Posts

Showing posts from February, 2011

Parameters - Syntax & Examples (SAP ABAP Keyword).

Image
INTRODUCTION: - The PARAMETERS statement creates a single entry field on the selection screen. - The PARAMETERS command is very simple to use and a powerful means to create a user interface. - In layman terms, PARAMETERS statement is used to accept input from user. It is used when we want the user to enter data and depending upon what he/she enters, necessary action is to be taken. - It creates a variable in the program with the same name and the value placed in the field at run time by the user is also placed in the variable. SYNTAX: PARAMETERS <pname> EXTRAS where <pname> is the variable created which holds the the value entered by user at run time. and EXTRAS are the additional properties associated with the PARAMETERS statement, such as: TYPE type [DECIMALS dec ] LIKE fld OBLIGATORY NO-DISPLAY VISIBLE LENGTH vlen AS CHECKBOX [USER-COMMAND fcode ] RADIOBUTTON GROUP group  [USER-COMMAND fcode ] AS LISTBOX VISIBLE LENGTH vlen  [USER-COMMA

SAP ABAP - Basics - Theory, Examples & Necessary Screenshots.

- ELEMENTARY DATA TYPES - Initial Values, Syntax & Properties. - FIELD SYMBOLS - Introduction, Syntax & Examples. - PARAMETERS - Introduction, Syntax & Examples. - SELECT-OPTIONS - Introduction, Syntax & Examples. - SELECTION-SCREEN - Introduction, Syntax & Examples. - SSCRFIELDS - The Screen Fields Table. Your suggestions and comments are welcome in this section. Please mail all your contributions to administrator@abapmadeeasy.com We request you to mention your Name, Designation, Experience & Organization you are working for. Your posts will be verified and posted in this site with your name.

Select Options - Syntax & Examples (SAP ABAP Keyword)

Image
INTRODUCTION: - The SELECT-OPTIONS statement creates selection criteria for a particular database field. The existence of the statement in the code causes the selection screen to display at the beginning of the report execution. It creates a line on the selection screen where the user can enter selection criteria for that field. - Basically SELECT-OPTIONS statement determines the user interface for any report program. SYNTAX: SELECT-OPTIONS <sel> FOR <f>                                   [DEFAULT <g> [TO <h>]  [OPTION <op>] SIGN <s>]                                   [MEMORY ID <pid>]                                   [LOWER CASE]                                   [OBLIGATORY]                                   [NO-DISPLAY]                                   [MODIF ID <key>]                                   [NO-EXTENSION]                                   [NO INTERVALS]                                   [NO DATABASE SE

Field Symbols - Syntax & Sample Program (SAP ABAP Keyword).

- In SAP, A field symbol can point to any data object. - Field symbols can be created without any attributes or with a type specification . If a field symbol is created without attributes, it takes on the attributes of the field to which it is assigned. If a field symbol is assigned a type specification, the system verifies that the types of the field and field symbol are compatible. - To declare a field symbol in SAP ABAP, use the statement FIELD-SYMBOLS <FS>  [ <type> | STRUCTURE <S>  DEFAULT <WA> ]. Angle brackets (<>) are part of the syntax, which basically allows to distinguish the field symbols from the normal fields in the programs. - The <type>  addition is used to specify the type of a field symbol. If there is no type specification it means the field symbol adopts all of the attributes of the data object. TYPE ANY - Field symbol adopts all of the attributes of the data object. TYPE C, N, P, or X - The field symbols point

SAP ABAP - Elementary Data Types, Initial Values, Syntax & Properties.

In ABAP, we have 8 elementary data types to declare data types: CHARACTER TEXT(C): - Lenght: 1 - 65535. - Default Length: 1. - Initial Value: Blank. - Default Values for the character based data types has to be a text enclosed in single quotes. - Character fields (Type C) are l eft-justified and can be truncated or filled with blanks from the right. - Character fields can also be used as alphanumeric fields. Example: DATA: option TYPE c. DATA: name(30). DATA: subject(20) TYPE c. DATA: title(10) VALUE 'Mr.'. DATA: name(30) TYPE c VALUE 'Sachin Tendulkar '. DATA: name TYPE char30. " This statement will allow name variable to hold upto 30 characters. NUMERIC TEXT (N): - Length: 1 - 65535. - Default Length: 1. - Initial Value: '0....0'. - Numeric text variables hold unsigned positive integers. - This data type should be used for numeric fields t hat will not be calculated like Roll number , Employee number. - We can

SAP ABAP - Sample Programs, Tips & Tricks On SAP Script/Smart Forms.

INDEX - SAPSCRIPTS / SMARTFORMS: - Convert Smartform To PDF Document & Mail It To The Concerned As An Attachment. - Downloading Graphics From Any SAPSCRIPTS. SMARTFORMS Interview Questions With Answers: 1.  What Are Smart Forms In SAP System? 2. W hat Are The Differences Between SAP Scripts & Smartforms? 3.  How Many Main Windows Can We Have In A Smartform? 4.  Is It Mandatory To Have A Main Window In Smartforms? 5.  What Are The Types Of Windows Available In Smartforms? 6.  Explain The Significance Of Main Window? 7.  Explain The Significance Of Secondary Window? 8.  Explain The Significance Of Copies Window? 9.   Explain The Significance Of Final Window? 10.  What Is The Difference Between Tables & Template Node? 11.  How To Insert Or Upload Graphics In Smartforms? 12.  Can You Force A Page Break Within Table Loop In Smart Forms? If Yes, How? 13.  How Do You Create & Maintain Font Style & Font Size Used In Smartforms In SAP? 14.  Why SAP Script

SAP ABAP - Sample Programs, Tips & Tricks On Report Programming.

INDEX - REPORT PROGRAMMING: - Finding User Exits, Badi's & Enhancements For Any Transaction Or Program. - Upload Excel Sheet Data Into Internal Table Using FM ALSM_EXCEL_TO_INTERNAL_TABLE. - Uploading Large Data From Excel Sheet To Internal Table Using FM ALSM_EXCEL_TO_INTERNAL_TABLE - BDC To Create Condition Types & Amount For Tcode MEK1. - Type Conversion ( Char To Curr Type). - Type Conversion ( Curr To Char Type). - Send an excel sheet to the concerned person in an email format via SAP System. - Upload the financial documents from a legacy system (excel file) into SAP using transaction code FB01. - Edit / Create Customer Specific Message / Text On Login Screen Via SE61. - MM - Determine Shelf Life Of Materials. - Function Module To Verify Valid E-Mail Address. - Setting Default Values In Selection Screen. - Programming On Buttons In A Screen. - Create A Screen With Two TABSTRIPS For A Report Program. - On Using HOTSPOT Keyword In A Report

SAP ABAP - Sample Programs, Tips & Tricks On ALV Grid/List Display.

INDEX -ALV - Dynamic ALV Grid/List Display. - ALV Tree Display. - Colors In ALV Grid Display. - Making ALV Grid Fields Editable. - Display Average Value In ALV Report. Your suggestions and comments are welcome in this section. Please mail all your contributions to administrator@abapmadeeasy.com We request you to mention your Name, Designation, Experience & Organization you are working for. Your posts will be verified and posted in this site with your name.

SAP ABAP - Sample Program To Demonstrate Tabstrips & Subscreens In Selection Screen.

Image
This sample report program explains the use of tabstrips and subscreen in main selection screen. *& Use of TabStrip and SubScreen explained *& ---- The report shows the material on one tab *& and plant on one tab.Pressing the execute button will show *& the description of the material or plant as the case is. *& TEXT-002 = Material Number *& TEXT-003 = Plant Number. REPORT zjal_tabstrip_selscr NO STANDARD PAGE HEADING LINE-SIZE 80 LINE-COUNT 60. TABLES : sscrfields. DATA activetab(6) TYPE c . DATA: mat_des TYPE makt-maktx, pl_des TYPE t001w-name1 . SELECTION-SCREEN BEGIN OF SCREEN 001 AS SUBSCREEN NO INTERVALS . SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-002 NO INTERVALS. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 14(18) text-002 FOR FIELD matnr. PARAMETERS matnr TYPE mara-matnr. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN END OF BLOCK block1. SELECTION-SCREEN END OF SCREEN 001. SELECTION-SCREEN BEGI

SAP ABAP - Simple Program to generate PDF from ABAP List Output.

Image
This is a sample report program to generate PDF File From ABAP List Output. REPORT zjal_list_to_pdf NO STANDARD PAGE HEADING. * PF-status containing a PDF button in the report Output to generate  PDF form SET PF-STATUS 'Z_PDF'. * TABLE DECLARATIONS TABLES: mara, marc, makt. * INTERNAL TABLE DECLARATIONS DATA: BEGIN OF ts_mara OCCURS 0, matnr LIKE mara-matnr, mtart LIKE mara-mtart, matkl LIKE mara-matkl, lvorm LIKE mara-lvorm, werks LIKE marc-werks, maktx LIKE makt-maktx, END OF ts_mara. * SELECTION SCREEN PARAMETERS SELECTION-SCREEN BEGIN OF BLOCK b1. SELECT-OPTIONS: s_matnr FOR mara-matnr OBLIGATORY, s_werks FOR marc-werks OBLIGATORY. SELECTION-SCREEN END OF BLOCK b1. TOP-OF-PAGE. WRITE: 40 'Generating PDF from List Output' COLOR 1 INTENSIFIED ON . SKIP 1. WRITE: /1 'Date :', sy-datum, /1 'User ID :', sy-uname, /1(112) sy-uline. START-OF-SELECTION. PERFORM get_mara. PERFORM display_mara. AT USE

SAP ABAP - Sample Program On Downloading Graphics From Any SAPSCRIPTS.

This program downloads graphics present in SAPSCRIPT to the system. REPORT ztest_graphic_download. DATA : l_bytecount TYPE i, l_tdbtype LIKE stxbitmaps-tdbtype, l_content TYPE STANDARD TABLE OF bapiconten INITIAL SIZE 0. DATA: graphic_size TYPE i. DATA: BEGIN OF graphic_table OCCURS 0, line(255) TYPE x, END OF graphic_table. CALL FUNCTION 'SAPSCRIPT_GET_GRAPHIC_BDS' EXPORTING i_object = 'GRAPHICS' i_name = 'ZWM_INDICATOR_BIG' i_id = 'BMAP' i_btype = 'BMON' IMPORTING e_bytecount = l_bytecount TABLES content = l_content EXCEPTIONS not_found = 1 bds_get_failed = 2 bds_no_content = 3 OTHERS = 4. CALL FUNCTION 'SAPSCRIPT_CONVERT_BITMAP' EXPORTING old_format = 'BDS' new_format = 'BMP' bitmap_file_bytecount_in = l_bytecount IMPORTING bitmap_file_bytecount = graphic_size TABLES bds_bitmap_file

SAP ABAP - Sample Program To Fetch Company Code Of All The Vendors.

This sample program can be used to fetch company codes of all the vendors . REPORT ztest_comp_code_of_vendor. DATA:BEGIN OF fieldnames OCCURS 0, field(75), END OF fieldnames. DATA: BEGIN OF it_final OCCURS 0, altkn TYPE altkn, lifnr TYPE lifnr, bukrs TYPE bukrs, name1 TYPE name1_gp, name2 TYPE name2_gp, END OF it_final. DATA: BEGIN OF it_lfa1 OCCURS 0, lifnr TYPE lifnr, name1 TYPE name1_gp, name2 TYPE name2_gp, END OF it_lfa1. DATA: BEGIN OF it_lfb1 OCCURS 0, lifnr TYPE lifnr, bukrs TYPE bukrs, altkn TYPE altkn, END OF it_lfb1. DATA:file TYPE string. DATA: vendor TYPE lifnr. SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001. PARAMETER : pfname LIKE rlgrap-filename OBLIGATORY. SELECTION-SCREEN : END OF BLOCK b1. AT SELECTION-SCREEN ON VALUE-REQUEST FOR pfname. CALL FUNCTION 'KD_GET_FILENAME_ON_F4' EXPORTING static = 'X' CHANGING file_name = pfname. START-OF-SELECTION. SELECT lifnr name1 name2 INTO TABLE it_

SAP ABAP - Sample Report Program On WRITE, COLOR, HOTSPOT Keywords.

Image
REPORT ztest_events_list_report. START-OF-SELECTION. WRITE 'Click me!' COLOR = 5 HOTSPOT . AT LINE-SELECTION. WRITE: / 'You Just Clicked Me', sy-listi, / 'You are on list', sy-lsind. IF sy-lsind < 2. SKIP. WRITE: 'More ...' COLOR = 3 HOTSPOT . ELSE. SKIP. WRITE: 'THAT''s THE END' COLOR = 1. ENDIF. OUTPUT: On Clicking “More…” MORE PROGRAMS ON REPORT PROGRAMMING: - Type Conversion ( Char To Curr Type). - Type Conversion ( Curr To Char Type). - Setting Default Values In Selection Screen. - Programming On Buttons In A Screen. - Create A Screen With Two TABSTRIPS For A Report Program. - ...Back To Index On Report Programming. Your suggestions and comments are welcome in this section. Please mail all your contributions to administrator@abapmadeeasy.com We request you to mention your Name, Designation, Experience & Organization you are working for. Your posts will be verified and

SAP ABAP - Sample Program On Creating A Screen With Two TABSTRIPS For A Report Program.

Image
This sample program creates a screen with two tabstrips . One tab TAB1 accepts two numbers, where as the other tab TAB2 displays the sum of two numbers accepted on TAB1. SAMPLE PROGRAM: REPORT ztest_screen_tabstrip. DATA: number1 TYPE i, number2 TYPE i, n1 TYPE i, n2 TYPE i, ok_code TYPE sy-ucomm, result TYPE i. CONTROLS tabstrip TYPE TABSTRIP . CALL SCREEN 100. CALL SCREEN 110. CALL SCREEN 130. *&---------------------------------------------------------------------* *& Module STATUS_0100 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE status_0100 OUTPUT. SET PF-STATUS 'STATUS_0100'. ENDMODULE. " STATUS_0100 OUTPUT *&---------------------------------------------------------------------* *& Module USER_COMMAND_0100 INPUT *&------------------------------------------

SAP ABAP - Sample Program On How To Program On Buttons In A Screen.

Image
This is a sample program on screen painter showing how to program on buttons in a screen. REPORT ztest_screen_paint_program. TABLES: mara. DATA: matnr TYPE mara-matnr, ersda TYPE mara-ersda, ernam TYPE mara-ernam, mtart TYPE mara-mtart, matkl TYPE mara-matkl, display TYPE c, save TYPE c, delete TYPE c, clear TYPE c, exit TYPE c, ok_code TYPE sy-ucomm. CALL SCREEN 9000. *&---------------------------------------------------------------------* *& Module STATUS_9000 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE status_9000 OUTPUT. SET PF-STATUS 'STATUS_9000'. SET TITLEBAR 'TITLE_9000'. ok_code = sy-ucomm . CASE ok_code. WHEN 'BACK'. LEAVE PROGRAM. WHEN 'EXIT'. LEAVE PROGRAM. WHEN 'CANCEL'. LEAVE TO SCREEN 0. WHEN 'CLEAR'. CLEAR mara. WHEN 'DISPLAY