Sap-Abap Class Notes
Sap-Abap Class Notes
Sap-Abap Class Notes
SAP-ABAP
SAP ADVANTAGES:
SAP can support any database at the back end.
Platform independent.
Supports multiple languages.
Faster b/w networks.
Can support any database in the backend.
Transaction failure is very less comparing 2 other erp packages
(0.03%).
SAP landscape:
Development server (functional).
Quality server( testing).
Production server (end-user uses the system).
Role of ABAPer:
Screen creation.
Table creation.
Data migration.
Reporting.
Redirecting SAP data from d-base to o/p devices.(scripts & forms).
3. DATABASE CONNECTIVITY
- OPEN SQL - It receives each user's request in open SQL format
(INSERT, UPDATE, DELETE, MODIFY) and converts them in native SQL
format (Database used at the back end).
REPOSITORY OBJECTS
EXECUTABLE PROGRAMS
INCLUDE PROGRAMS
MODULE POOL PROGRAMS
MESSAGE CLASSES
SUBROUTINE POOLS
FUNCTION GROUPS
CLASS POOLS
TABLES
VIEWS
DATA TYPES
DOMAINS
TYPE GROUPS
SEARCH HELPS
LOCK OBJECTS
Enter 'SE21' Tcode in Command Prompt area of SAP EAsy Access Screen ->
Press Enter -> Opens Package Builder Screen -> Select Package Radiobutton
-> Specify Package Name starting with Z or Y -> Click on Create pushbutton
-> Opens an interface -> Enter Short Description for your package -> Select
Software Component as HOME -> Click on Save -> OPens another interface
to assign request number -> Click on CREATE REQUEST -> Opens interface
-> Enter short description -> Click on Continue -> A Request number is
4
created and assigned for your package -> Click on Continue -> A package is
created -> Save -> Come back.
CREATING PROGRAMS IN SAP EDITOR:
SE38 is the Tcode used to open ABAP editor, where we create source code.
SE38 -> Opens ABAP Editor Initial screen -> Specify program name starting
with Z or Y -> Select Source Code radio button -> Click on Create
pushbutton -> Opens another interface -> Enter short description for
program -> Select Program type as Executable Program -> Click on Save ->
Specify Package Name -> Assign request number -> Click on continue ->
Opens ABAP Editor page.
ACTIVATION:
This concept is used to make the current object to be accessible by other
objects within the same client or different client or vice versa.
Eg. code:
DATA A TYPE I.
A = 100.
WRITE A.
5
eg. code:
TYPE statement is used to assign data type for the variable declared.
VALUE statement is used to assign initial value for the variable.
6
ABAP GUI
ABAP screens can be created using the following two statements:
1. PARAMETERS
2. SELETION-SCREEN
eg. code
parameters : b(10).
Initialization.
lb1 = 'PRINT'.
lb2 = 'enter A value'.
lb3 = 'enter B value'.
at SELECTION-SCREEN.
7
case sy-ucomm.
when 'PB1'.
LEAVE TO LIST-PROCESSING.
write :/ a, b .
endcase.
4. SELECTION-SCREEN POSITION.
This statement is used to specify the position of input fields. There are two
attributes for specifying position using this statement. They are:
POS_LOW
POS_HIGH
EG.
eg.
initialization.
t1 = 'SELECT CHECKBOXES AND RADIOBUTTONS'.
T2 = 'PARAMETERS'.
at selection-screen.
case sy-ucomm.
WHEN 'PB1'.
CALL SCREEN 200.
ENDCASE.
SYNTAX:
INITIALIZATION.
AT SELECTION-SCREEN.
START-OF-SELECTION.
9
TOP-OF-PAGE.
END-OF-PAGE.
END-OF-SELECTION.
EG. CODE
INITIALIZATION.
LB1 = 'PRINT A'.
AT SELECTION-SCREEN.
CASE SY-UCOMM.
WHEN 'PB1'.
LEAVE TO LIST-PROCESSING.
WRITE :/ A, B.
ENDCASE.
After executing the program, use 'BACK' statement in the command prompt
of LPS to come back to the selection-screen and then come back to the
program.
EG. CODE 2
INITIALIZATION.
LB1 = 'PRINT A'.
lb2 = 'EXIT'.
AT SELECTION-SCREEN.
CASE SY-UCOMM.
WHEN 'PB1'.
LEAVE TO LIST-PROCESSING.
WRITE :/ A, B.
WHEN 'PB2'.
LEAVE PROGRAM.
ENDCASE.
8. SELECTION-SCREEN SKIP.
9. SELECTION-SCREEN ULINE.
10. SELECT-OPTIONS.
EG. CODE:
TABLES MARA.
SELECT-OPTIONS STALIN FOR MARA-MTART.
SELECT * FROM MARA WHERE MTART IN STALIN.
WRITE :/ MARA-MTART.
ENDSELECT.
LOW
HIGH
SIGN
OPTION
The pushbuttons declared in the header part of the screen are referred to as
FUNCTION KEYS. A user can be allowed to create only 5 function keys.
SYNTAX:
TABLES SSCRFIELDS.
INITIALIZATION.
SSCRFIELDS-FUNCTXT_01 = 'STALIN'.
SSCRFIELDS-FUNCTXT_02 = 'JEGAN'.
SSCRFIELDS-FUNCTXT_03 = 'SYED'.
SSCRFIELDS-FUNCTXT_04 = 'DEEPA'.
SSCRFIELDS-FUNCTXT_05 = 'KARTHIK'.
AT SELECTION-SCREEN.
CASE SY-UCOMM.
WHEN 'FC02'.
CALL TRANSACTION 'SE80'.
12
WHEN 'FC01'.
CALL TRANSACTION 'SE11'.
WHEN 'FC03'.
CALL TRANSACTION 'SE37'.
WHEN 'FC04'.
CALL TRANSACTION 'SE38'.
WHEN 'FC05'.
LEAVE PROGRAM.
ENDCASE.
When we create function keys, SAP automatically generates name for each
function key. The name of first function key is 'FC01' , the second one is
'FC02', etc.
So the name range for function keys start from FC01 - FC05.
INITIALIZATION.
LB1 = 'ENTER A VALUE'.
LB2 = 'ENTER B VALUE'.
LB3 = 'DISPLAY'.
LB4 = 'EXIT'.
LB5 = 'CALL NEXT'.
AT SELECTION-SCREEN.
CASE SY-UCOMM.
WHEN 'PB1'.
LEAVE TO LIST-PROCESSING.
WRITE : A, B.
IF CH1 = 'X'.
LEAVE TO LIST-PROCESSING.
WRITE 'FIRST CHECKBOX IS SELECTED'.
ENDIF.
IF CH2 = 'X'.
WRITE :/ 'SECOND CHECKBOX IS SELECTED'.
ENDIF.
IF CH3 = 'X'.
WRITE :/ 'THIRD CHECKBOX IS SELECTED'.
ENDIF.
IF RB1 = 'X'.
WRITE :/ 'FIRST RADIOBUTTON'.
14
WHEN 'PB2'.
LEAVE PROGRAM.
WHEN 'PB3'.
CALL SELECTION-SCREEN 200.
ENDCASE.
EN - LIBRARY HELP
15
DATA DICTIONARY
Data dictionary objects are:
TABLES
VIEWS
DATA ELEMENTS
DOMAINS
SEARCH HELP
LOCK OBJECT
TYPE GROUP
SE11 is the Tcode used to access and create data dictionary objects.
CREATING A TABLE:
1. built-in type.
2. using data elements and domains.
SE11 -> select DATABASE TABLE radiobutton -> Specify table name starting
with Z or Y -> Enter short description.
Table creation involves specifying delivery class, maintenance, data class and
size.
Maintenance:
Technical Settings:
Size Category - Specifies initial size for the table inside the database.
SINGLE BUFFERING - Whenever a table is created with this option and when
the user tries to access records from the database table, a buffer is created
in AS for only a single record.
Use the following code to access records from the existing database table:
tables zstudtable.
select * from zstudtable.
write :/ zstudtable-studid, zstudtable-studname, zstudtable-studmarks.
endselect.
Here, TABLES statement will create a temporary table memory area in AS.
DOMAIN : This data dictionary object is used to assign data type and length
for a field to be created in a table.
SE11 -> Select Domain radiobutton -> Specify name of the domain starting
with Z or Y -> Create -> Enter short description -> Select data type ->
Enter length -> Save -> Activate.
SE11 -> Select Data Type radiobutton -> Specify name of the data element
starting with Z or Y -> Create -> Enter short description -> Select 'Domain'
radiobutton -> Specify name of the domain you created previously -> Press
Enter -> Save -> Activate -> Come back.
Enter field name -> Select the checkbox of initial field to declare it as a
primary key -> Specify data element name -> Press Enter.
18
VIEWS:
SE11 -> Select 'VIEW' radiobutton -> Specify view name starting with Z or Y
-> Create -> Select as 'DATABASE VIEW' -> Click on Copy -> Enter short
description -> Specify name of the tables from which you want to fetch
records -> Click on Relationships pushbutton -> Opens an interface ->
Select the condition based on primary key relationship -> Click on Copy -> A
join condition is created -> Click on 'View Fields' tab button -> Click on Table
fields pushbutton -> Opens an interface with specified table names -> Click
on first table -> Click on Choose -> Select required fields -> Click on Copy
-> Do the same thing for choosing fields from second table -> Save ->
Activate -> Discard the warning message.
To implement the view created, use SE38 editor and write the following
code:
TABLES ZMYVIEW1.
TABLE TYPES:
TRANSPARENT TABLES:
These type of tables have one to one relationship with the underlying
database table. The structure of this table will be in the form of rows and
columns.
POOLED TABLE:
Several pooled tables in data dictionary are stored under one table pool in
the database.
CLUSTER TABLE:
Several cluster tables in data dictionary are stored under one table cluster in
the database.
The difference between pooled table and cluster table is in the form of
storage of datas.
Several pooled table records are stored in one table pool in the database in
continuous format using a row separator.
Whereas in the case of table cluster, the records are stored in continuous
format without any row separator.
CLIENT-DEPENDENT TABLE
CLIENT-INDEPENDENT TABLE.
GENERIC BUFFERING
20
FULLY BUFFERED.
TYPE GROUP:
Type group is a data dictionary object used to store user-defined data types
and constants.
SE11 -> Select Type group radiobutton -> Specify type group name starting
with Z or Y -> Click on Create -> Enter short description -> Continue ->
Opens Type Group interface -> Write the following code inside editor:
TYPE-POOL YMYTY .
END OF YMYTY_STALIN.
User-defined data types can be made globally accessed if saved under a type
group.
MESSAGE CLASSES:
The created messages can be called from programs using the statement
'MESSAGE'.
SYNTAX:
MESSAGE <type_of_message><message id>(message_class).
TYPES OF MESSAGES:
S - Status message.
I - Information message.
E - Error message.
W - Warning message.
A - Abort message.
T - Terminate message.
22
You can create up to 1000 messages in a single message class. The message
id ranges from 0 - 999.
at selection-screen.
case sy-ucomm.
when 'PB1'.
MESSAGE T000(ZMYMESSAGE).
ENDCASE.
VARIANTS:
This concept is used to create default values for the input fields. Variants are
helpful for the SAP end users and data entry operators.
Save -> Activate -> Come back -> Click on Variants radiobutton -> Click on
Change -> Opens Variants Initial Screen -> Specify name of the variant
starting with Z or Y -> Click on Create -> Opens an interface with the input
fields -> Click on Attributes pushbutton from Application toolbar -> Enter
short description for variant -> Save -> Enter variant values in the input
fields -> Save again -> Come back -> Come back -> Click on Source code
radiobutton -> Click on change -> Execute the program -> You will see 'Get
Variant' pushbutton option in the application toolbar -> Click on pushbutton
to get variant values.
23
INTERNAL TABLES
Internal table is a user-defined temporary work area to store the database
table records.
If you want to make any changes to the table records, make the changes in
internal table and then update the records back into the database table.
syntax:
1 kb = 1024 bytes
DEFINING A STRUCTURE:
eg.
WA-NAME = 'PRAVIN'.
WA-COURSE = 'SQLSERVER'.
WA-NAME = 'DEEPA'.
WA-COURSE = 'ORACLE'.
WA-NAME = 'SYED'.
WA-COURSE = 'ABAP'.
A structure can hold only one record. To make the structure hold more than
one record, declare an internal table.
eg. code
name(10),
course(10),
end of itab.
itab-name = 'karthik'.
itab-course = 'abap'.
append itab.
itab-name = 'pravin'.
itab-course = 'sql'.
append itab.
loop at itab.
write :/ itab-name, itab-course.
endloop.
In the above code, when executed, an internal table in the name of ITAB is
created without header line.
APPEND statement is used to insert the values into body area of the
internal table even if the record already exists.
COLLECT statement is also used to insert the values into body area of the
internal table, but will check for index value. If the record already exists, it
wont insert the same value.
To view a single line from body area of internal table, use READ statement.
A structure can hold only record by default. To allocate extra memory space
for a structure to hold more values, use the statement OCCURS 0. Using this
statement, an internal table structure is created with 8 KB memory of body
area without header line.
eg.
To create an internal table with HEADER LINE, use 'WITH HEADER LINE'
statement.
eg.
DATA DEEPA LIKE <database table name> OCCURS 0 WITH HEADER LINE.
Now, an internal table is created with header line and body area.
HEADER LINE :
BODY AREA :
This is a storage area for holding records fetched from database table.
READ - Used to view or write out a single record we specify using index
value from the internal table body area.
Eg. code to insert user-defined values into database table using internal
table structure:
27
ITAB1-MATNR = 'MATNUMBER01'.
ITAB1-MBRSH = 'P'.
ITAB1-MTART = 'COUP'.
ITAB1-MEINS = 'KG'.
APPEND ITAB1.
ITAB1-MATNR = 'MATNUMBER02'.
ITAB1-MBRSH = 'P'.
ITAB1-MTART = 'COUP'.
ITAB1-MEINS = 'KG'.
APPEND ITAB1.
ITAB1-MATNR = 'MATNUMBER03'.
ITAB1-MBRSH = 'P'.
ITAB1-MTART = 'COUP'.
ITAB1-MEINS = 'KG'.
APPEND ITAB1.
LOOP AT ITAB1.
IF SY-SUBRC = 0.
MESSAGE S005(ZMSG).
ENDLOOP.
eg.
This type of internal table performs the search for a record in the body area
using LINEAR SEARCH TECHNIQUE.
SYNTAX:
.
WITH DEFAULT/NON-UNIQUE KEY
WITH HEADER LINE
INITIAL SIZE <size>
eg. code
29
DATA ITAB LIKE STANDARD TABLE OF MARA WITH NON-UNIQUE KEY MTART
WITH HEADER LINE INITIAL SIZE 0.
SELECT * FROM MARA INTO TABLE ITAB.
LOOP AT ITAB.
WRITE :/ ITAB-MATNR, ITAB-MBRSH, ITAB-MTART, ITAB-MEINS.
ENDLOOP.
If we try to read a single value from the above internal table body area, a
linear search will be performed. Whereas, for normal internal table, the
default search is binary search.
This internal table will hold the records from the database table in a sorted
manner.
SYNTAX:
Eg.
DATA ITAB LIKE SORTED TABLE OF MARA WITH NON-UNIQUE KEY MBRSH
WITH HEADER LINE INITIAL SIZE 0.
SYNTAX:
This internal table is not assigned any index value. The retrieval of records
from internal body area is based on key field or a row.
Eg. code
DATA ITAB LIKE HASHED TABLE OF MARA WITH UNIQUE KEY MTART WITH
HEADER
LINE INITIAL SIZE 0.
SELECT * FROM MARA INTO TABLE ITAB.
LOOP AT ITAB.
WRITE :/ ITAB-MATNR, ITAB-MBRSH, ITAB-MTART, ITAB-MEINS.
ENDLOOP.
For this type of internal table, we have to specify only the primary key for a
retrieval function.
Eg. code
LOOP AT ITAB.
WRITE :/ SY-TABIX, ITAB-KUNNR, ITAB-LAND1, ITAB-NAME1, ITAB-ORT01.
ENDLOOP.
31
SYNTAX:
example code:
LOOP AT ITAB.
WRITE :/ sy-tabix, ITAB-KUNNR, ITAB-LAND1, ITAB-NAME1, ITAB-ORT01.
ENDLOOP.
SUBROUTINES
Subroutines are used to call a piece of code frequently within the program or
externally from other program.
LOCAL SUBROUTINES:
The subroutine is called locally from the same program using PERFORM
statement.
PERFORM STALIN.
FORM STALIN.
DO 5 TIMES.
WRITE :/ 'WELCOME TO ABAP'.
ENDDO.
ENDFORM.
REPORT ZSUBROUTINES2 .
PERFORM STALIN.
FORM STALIN.
DO 5 TIMES.
WRITE :/ 'WELCOME TO ABAP'.
ENDDO.
ENDFORM.
REPORT ZSUBROUTINES1.
PERFORM STALIN(ZSUBROUTINES2).
PASS BY REFERENCE:
PASS BY VALUE:
X = 'AMERICA'.
Y = '100'.
WRITE :/ X , Y.
ENDFORM.
LOOP AT ITAB.
WRITE :/ ITAB-KUNNR, ITAB-NAME1, ITAB-LAND1, ITAB-ORT01.
ENDLOOP.
ENDFORM.
35
Reports
Fetching required data from the database and redirecting to the output
devices or displaying the data in LPS screen as per client's requirements is
the concept behind report generation.
TYPES OF REPORTS:
1. GRAPHICAL REPORTS
2. ALV REPORTS (ABAP LIST VIEWER).
3. GROUP REPORTS
4. INTERACTIVE REPORTS
5. CLASSICAL REPORTS (FORMATTED & UN FORMATTED).
INITIALIZATION.
AT SELECTION-SCREEN.
START-OF-SELECTION.
TOP-OF-PAGE.
END-OF-PAGE.
END OF SELECTION.
INITIALIZATION.
AT USER-COMMAND.
START-OF-SELECTION.
TOP-OF-PAGE.
TOP-OF-PAGE DURING LINE SELECTION.
END OF PAGE.
END OF SELECTION.
Classical report.
tables: spfli.
include <list>.
start-of-selection.
loop at it.
write:/ it-carrid, it-connid, it-cityfrom, it-cityto , it-fltime input on.
endloop.
top-of-page.
end-of-page.
GRAPHICAL REPORTS:
These type of reports are used display the database table in a graphical
format either in two-dimensional or three-dimensional format.
GRAPH_2D
GRAPH_3D
COMPNAME(20),
COMPSALES TYPE I,
END OF ITAB.
ITAB-COMPNAME = 'MRF'.
ITAB-COMPSALES = '2000000'.
APPEND ITAB.
ITAB-COMPNAME = 'SANMAR'.
ITAB-COMPSALES = '7000000'.
APPEND ITAB.
ITAB-COMPNAME = 'EICHER'.
ITAB-COMPSALES = '3500000'.
APPEND ITAB.
REUSE_ALV_GRID_DISPLAY
REUSE_ALV_LIST_DISPLAY
eg. code:
GROUP REPORTS:
These reports are also called as CLASSICAL REPORTS which is divided into:
eg. code:
LOOP AT BASKAR.
WRITE:/(70) SY-ULINE.
ENDLOOP.
top-of-page.
*WRITE :/40(50) 'THIS IS HEADER AREA FOR THE REPORT' COLOR 4
CENTERED.
39
END-OF-PAGE.
WRITE :/40(50) 'THIS IS FOOTER AREA FOR THE REPORT' COLOR 7
CENTERED.
WRITE :/ 'CURRENT PAGE NUMBER IS', SY-PAGNO COLOR 6.
ALV REPORTS:
ALV stands for ABAP List Viewer. Using ALV reports, we can generate the list
in LIST and GRID formats. The function modules used for ALV reports are:
1. REUSE_ALV_LIST_DISPLAY
2. REUSE_ALV_GRID_DISPLAY
Eg. Code:
GROUP REPORTS:
1. ON CHANGE OF
ENDON.
40
2. AT FIRST.
ENDAT.
3. AT LAST.
ENDAT.
4. AT NEW.
ENDAT.
5. AT END OF.
ENDAT.
ON CHANGE OF-ENDON:
This processing block gets executed whenever there is a change in the field
name of internal table.
eg. code:
LOOP AT ITAB.
ON CHANGE OF ITAB-LAND1.
SKIP 1.
WRITE :/ 'CUSTOMER MASTER DETAILS FOR' COLOR 4, ITAB-LAND1 COLOR
4.
SKIP 1.
ENDON.
WRITE :/ ITAB-KUNNR, ITAB-NAME1, ITAB-LAND1, ITAB-ORT01.
ENDLOOP.
TOP-OF-PAGE.
WRITE :/40(40) 'THIS IS CUSTOMER MASTER DATA' COLOR 5.
AT FIRST-ENDAT:
This processing block gets triggered at the first pass of internal table loop.
eg. code:
LOOP AT ITAB.
AT FIRST.
WRITE :/ 'THIS IS CUSTOMER MASTER DATA'.
SKIP 1.
ENDAT.
WRITE :/ ITAB-KUNNR, ITAB-NAME1, ITAB-LAND1, ITAB-ORT01.
ENDLOOP.
TOP-OF-PAGE.
WRITE :/40(40) 'THIS IS CUSTOMER MASTER DATA' COLOR 5.
AT LAST - ENDAT:
This processing block gets executed at the last pass of the internal table
loop.
eg. code:
AT NEW-ENDAT:
Whenever we use this control break statement, make use of only the
required fields in the internal table.
LOOP AT ITAB.
42
AT NEW GJAHR.
SKIP 1.
WRITE :/ 'SALES DONE IN THE FISCAL YEAR', ITAB-GJAHR.
SKIP 1.
ENDAT.
WRITE :/ ITAB-GJAHR, ITAB-UM01U.
ENDLOOP.
AT END OF-ENDAT.
This processing block gets executed at the end of each field inside the
internal table.
eg. code:
LOOP AT ITAB.
AT END OF GJAHR.
SUM.
WRITE :/ 'TOTAL SALES DONE IN THE FISCAL YEAR', ITAB-UM01U.
SKIP 1.
ENDAT.
INTERACTIVE REPORTS:
The list index assigned for the primary list is 0. The list index assigned for
the first secondary list is 1. The secondary list index ranges from 1-20.
Eg. code:
DATA FLDNAME(30).
DATA ITAB LIKE KNA1 OCCURS 0 WITH HEADER LINE.
SELECT * FROM KNA1 INTO TABLE ITAB.
LOOP AT ITAB.
WRITE :/ ITAB-KUNNR, ITAB-NAME1, ITAB-LAND1, ITAB-ORT01.
ENDLOOP.
AT LINE-SELECTION.
GET CURSOR FIELD FLDNAME.
IF FLDNAME = 'ITAB-KUNNR'.
WRITE :/ 'THE CURRENT LIST INDEX IS', SY-LSIND.
SKIP 1.
WRITE :/ SY-LISEL.
ENDIF.
GET CURSOR FIELD statement is used to specify the cursor position on the
list.
STRING FUNCTIONS:
SPLIT - This function is used to split the given string value based an any
separator and save in separate string variables.
eg. code:
DATA STR(30) VALUE 'SAP IS AN ERP'.
DATA: S1(5), S2(5), S3(5), S4(5).
SPLIT STR AT ' ' INTO S1 S2 S3 S4.
44
SEARCH - This string function is used to search for the specified value in a
given string.
eg. code:
eg. code:
DATA STR(30).
DATA: S1(5) VALUE 'INDIA', S2(5) VALUE 'IS', S3(5) VALUE 'GREAT'.
CONCATENATE S1 S2 S3 INTO STR SEPARATED BY ' '.
WRITE :/ STR.
SHIFT - This string function is used to move the string to the specified
position (LEFT, RIGHT, CIRCULAR) based on the number of places specified.
eg. code:
TRANSLATE - This string function is used to change the case of the given
string value.
45
eg. code:
CONDENSE - This string function is used to remove the blank spaces in the
given string.
eg. code:
REPLACE - This string function is used to replace the given string with
specified string value.
eg. code:
STRLEN - This string function is used to identify the length of the given
string.
Eg. code:
OVERLAY
FIND
46
Navigations:
SE36 -> specify logical database name starting with Z or y -> create ->
enter a short description -> save under a pack -> specify root node name
-> enter short description for root node -> enter the database table name
-> click on create ->opens an interface with root node -> select node ->
click on selection push button from application toolbar -> click on yes to
generate from structure ->click on no to search help -> select two
checkboxes for field selections and free selections -> click on transfer ->
opens an include file -> specify range variable as follows….
save -> activte -> come back -> select node ->click on source code
pushbutton from application toolbar ->click on yes to generate program from
structure and selections ->opens two include file -> double click on the
header file -> declare an internal table as follows…
tables kna1.
Data itab like kna1 occurs 0 with header line.
Save ->activate -> comeback ->double click on Nxxx (sys routine file)
->double click on the node kna1 include file -> write the following code
between the FORM and ENDFORM .
Loop at itab.
Write :/ itab-kunnr,itab-name1,itab-land1,itab-ort01.
Endloop.
Put statement is used to fetch records from the specified database table and
insert into node created from that table in the logical database.
Nodes kna1. (Creates link b/w node and LDB and invoke pgm)
EVENTS IN MPP:
SE80 -> Select Program from drop-down list -> Specify program name
starting with SAPMZ or SAPMY -> Press Enter -> Click on Yes to create
object -> Create Top Include File by clicking on Continue icon in pop-up
screens -> Save under a package -> Assign a request number -> MPP
program with specified name is created with Top include File.
To create screen, Right click on program name -> Select Create -> Screen
-> Opens Screen Description page -> Enter short description for screen ->
Select screen type as NORMAL -> Click on LAYOUT pushbutton from
application toolbar -> Opens Screen Painter -> Drag and drop two input
fields from toolbar -> Likewise, create two pushbuttons -> Double click on
each component -> Opens Attributes box -> Specify attributes for each
screen component -> For pushbutton, specify FCT code -> Save the screen
-> Click on Flowlogic pushbutton from application toolbar -> Opens Flow
logic editor to create event functionalities for screen components ->
Decomment PAI module -> Double click on PAI module name -> Click on Yes
to create PAI module object -> Opens PAI module -> Specify the following
code within module-endmodule statements:
49
CASE SY-UCOMM.
WHEN 'DISPLAY'.
LEAVE TO LIST-PROCESSING.
WRITE :/ IO1, IO2.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
-> Save.
Now double click on 'Includes' Folder (TOP INCLUDE FILE) -> Declare
variables for input fields as follows:
Now To create Transaction Code, right click on Main Program Name ->
Create -> Transaction -> Opens an interface -> Enter Tcode name starting
with Z or Y -> Enter short description -> Continue -> Opens interface ->
Enter Main program name and Screen number to be called first -> Save
under a package -> Assign a request number.
Activate all the objects of MPP program by right clicking on Main program
Name -> Click on Activate -> Raises 'Objects Activated' message.
To execute the MPP program, specify Tcode name in the Command Prompt
area -> Press Enter.
EVENTS IN MPP:
PROCESS AFTER INPUT - This event gets triggered after some user's action
in the screen (for eg, after clicking pushbutton, subsequent event
functionalities).
50
Using screen painter, design a screen consisting of four input fields for client,
username, password and language as we have in login screen of SAP.
Assign the first two input fields to one group called GR1, the third input field
to a group GR2.
PROGRAM SAPMYSCREENVALID.
DATA : IO1(3), IO2(8), IO3(8), IO4(2).
DATA A TYPE I.
In Flow logic editor, decomment PAI MODULE, double click on module name,
and inside the module, write the following code:
case sy-ucomm.
WHEN 'LOGIN'.
CALL TRANSACTION 'SE38'.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
In PBO module, write the following code to assign default input field
attributes:
IF A = 0.
MESSAGE S010(ZMSG).
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'GR1'.
SCREEN-REQUIRED = '1'.
ENDIF.
IF SCREEN-GROUP1 = 'GR2'.
SCREEN-INVISIBLE = '1'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
A = 1.
ENDIF.
endmodule. " STATUS_0200 OUTPUT
Using screen painter, design a screen consisting of four input fields for client,
username, password and language as we have in login screen of SAP.
Assign the first two input fields to one group called GR1, the third input field
to a group GR2.
PROGRAM SAPMYSCREENVALID.
DATA : IO1(3), IO2(8), IO3(8), IO4(2).
DATA A TYPE I.
In Flow logic editor, decomment PAI MODULE, double click on module name,
and inside the module, write the following code:
52
case sy-ucomm.
WHEN 'LOGIN'.
CALL TRANSACTION 'SE38'.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
In PBO module, write the following code to assign default input field
attributes:
IF A = 0.
MESSAGE S010(ZMSG).
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'GR1'.
SCREEN-REQUIRED = '1'.
ENDIF.
IF SCREEN-GROUP1 = 'GR2'.
SCREEN-INVISIBLE = '1'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
A = 1.
ENDIF.
endmodule. " STATUS_0200 OUTPUT
Menu Painter
Eg. code:
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'SAMPATH3'.
LEAVE PROGRAM.
WHEN 'SUBMENU11'.
CALL TRANSACTION 'SE38'.
WHEN 'SUBMENU12'.
CALL TRANSACTION 'SE37'.
ENDCASE.
Navigations:
1. Create MPP program.
2. In Top Include File, declare the following structure:
CASE SY-UCOMM.
WHEN 'INSERT'.
INSERT INTO KNA1 VALUES SHABANA.
IF SY-SUBRC = 0.
MESSAGE S003(ZSHABMSG).
ELSEIF SY-SUBRC = 4.
MESSAGE E004(ZSHABMSG).
ENDIF.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
Here, the records can be viewed in rows and columns format separated by
horizontal and vertical lines.
SYNTAX:
SCREEN NUMBER should be specified to make the system know where the
table control was physically created.
Create MPP program -> In TOP INCLUDE FILE, write the following code:
Create a Normal screen (123) -> Drag and drop TABLE CONTROL component
from application toolbar -> Specify its name in attributes box -> Specify title
if necessary -> Select HORIZONTAL and VERTICAL SEPARATORS checkbox
-> If needed, select COLUMN and ROW selection radiobuttons -> Click on
Dictionary/Program Fields from Appn. Toolbar -> Specify internal table name
specified in top include file -> Click on 'GET FROM PROGRAM' pushbutton ->
Choose required fields -> Click on continue -> Place the fields in table
control component -> Add labels for each fields -> Create two pushbuttons
(FETCH, EXIT) -> Save -> Flow Logic.
CASE SY-UCOMM.
WHEN 'FETCH'.
SELECT * FROM KNA1 INTO TABLE ITAB.
TABCTRL-LINES = SY-DBCNT.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
TABSTRIP CONTROLS:
Using normal screen, we can add only 40 components to the screen. To add
more than 40 components, make use of tabstrip control. You can specify any
number of tab fields for a tabstrip control and create subscreen for each tab
field created.
57
Create an MPP program -> Create a screen -> Drag and drop tabstrip
control from toolbar -> Specify name for the tabstrip created (KARTHIK) ->
Specify required number of tab fields (2) -> Drag and drop subscreen area
for each tab field -> Name the subscreen areas (SUB1, SUB2) -> Specify
attributes for each tab field (NAME, TEXT, FCTCODE, REF_FIELD) -> Create
two pushbuttons (DISPLAY, EXIT) Save the screen painter -> Click on Flow
logic editor.
Now create two subscreens (10, 20) for each tab field subscreen areas.
Create required screen components for each subscreen (input fields namely
IO1, IO2, IO3, IO4) -> Save -> Come back to Flow logic editor.
In the FLOW LOGIC EDITOR, Specify following code for PBO and PAI
modules:
CASE SY-UCOMM.
WHEN 'DISPLAY'.
LEAVE TO LIST-PROCESSING.
WRITE :/ IO1, IO2, IO3, IO4, IO5.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'TAB1'.
SCREEN = '10'.
KARTHIK-ACTIVETAB = 'TAB1'.
WHEN 'TAB2'.
SCREEN = '20'.
KARTHIK-ACTIVETAB = 'TAB2'.
ENDCASE.
Create Tcode -> Activate all components -> Execute the program.
LIST OF VALUES:
This concept is used to provide drop-down facility for the input fields created
using screen painter. Here, a type group called VRM is used in which we have
following structure and internal table:
TABLE CONTROL:
This component is used to view the internal table records in MPP screen.
To make modification, create one more internal table for the same dbtable
structure used in top include file. To move first internal table records to the
newly created one, create a separate module to specify a statement for this
purpose b/w LOOP-ENDLOOP in PAI.
eg.
eg.
WHEN 'MODIFY'.
LOOP AT ITAB1.
MODIFY KNA1 FROM ITAB1.
IF SY-SUBRC = 0.
MESSAGE S006(ZSHABMSG).
ELSEIF SY-SUBRC = 4.
MESSAGE E004(ZSHABMSG).
60
ENDIF.
ENDLOOP.
ENDCASE.
61
The above three methods require source code to perform data migration.
There are predefined tools available to perform data migration with only
minimal source code. They are:
Advantages:
Using this method, we can perform bulk data transfer.
No manual intervention is required for direct input method.
Data migration time is very less.
Disadvantages:
Since no manual intervention is required, we cannot correct the error
record during runtime.
This method can be used only during SAP implementation, not for
support projects.
Eg. code:
FILETYPE = 'ASC'
TABLES
DATA_TAB = ITAB.
LOOP AT ITAB.
SPLIT ITAB-STR AT ' ' INTO ITAB1-KUNNR ITAB1-NAME1 ITAB1-ORT01
ITAB1-LAND1.
APPEND ITAB1.
ENDLOOP.
LOOP AT ITAB1.
INSERT INTO KNA1 VALUES ITAB1.
IF SY-SUBRC = 0.
WRITE :/ 'RECORDS ARE INSERTED INTO KNA1'.
ELSEIF SY-SUBRC = 4.
WRITE :/ 'RECORDS ALREADY EXISTS'.
ENDIF.
ENDLOOP.
This concept deals with data migration from legacy system database into
SAP database. Whenever a company moves into SAP from legacy system,
BDC is used to populate the new SAP database with their old required
records.
Methods in BDC:
1. DIRECT INPUT METHOD - Using this method, records from the flat file
are uploaded first into an internal table created for the flat file structure.
Using a string function (SPLIT functionality), the records are splitted based
on the separators and then inserted into a new internal table which is
created for a table where the datas are to be inserted.
eg. code:
LOOP AT ITAB.
SPLIT ITAB-STR AT ' ' INTO ITAB1-KUNNR ITAB1-NAME1 ITAB1-LAND1
ITAB1-ORT01.
APPEND ITAB1.
ENDLOOP.
LOOP AT ITAB1.
INSERT INTO KNA1 VALUES ITAB1.
IF SY-SUBRC = 0.
WRITE :/ 'RECORDS ARE INSERTED'.
ELSEIF SY-SUBRC = 4.
WRITE :/ 'RECORDS ALREADY EXIST'.
ENDIF.
ENDLOOP.
In the above program, 'UPLOAD' function module is used to fetch the flat file
records and then insert into internal table created for flat file structure
(ITAB).
CODE:
LOOP AT ITAB.
SPLIT ITAB-STR AT ',' INTO ITAB1-KUNNR ITAB1-NAME1 ITAB1-ORT01
ITAB1-LAND1.
APPEND ITAB1.
ENDLOOP.
LOOP AT ITAB1.
ENDLOOP.
LOOP AT KTAB.
WRITE :/ KTAB-TCODE, KTAB-DYNAME, KTAB-DYNUMB, KTAB-MSGTYP,
KTAB-MSGNR, SY-SUBRC.
ENDLOOP.
CLEAR JTAB.
REFRESH JTAB.
JTAB-PROGRAM = PROGNAME.
JTAB-DYNPRO = SCRNUM.
JTAB-DYNBEGIN = 'X'.
APPEND JTAB.
ENDFORM.
65
CLEAR JTAB.
JTAB-FNAM = FLDNAME.
JTAB-FVAL = FLDVAL.
APPEND JTAB.
Since we cannot modify the error record using direct input method, we go
for call transaction method. Here, we create a screen to populate error
records in input fields and from the screen, we can modify the error records
and then insert into database table.
LOOP AT ITAB.
ENDLOOP.
LOOP AT ITAB1.
ENDLOOP.
CLEAR JTAB.
REFRESH JTAB.
JTAB-PROGRAM = PROGNAME.
JTAB-DYNPRO = SCRNUM.
JTAB-DYNBEGIN = 'X'.
APPEND JTAB.
ENDFORM.
CLEAR JTAB.
JTAB-FNAM = FLDNAME.
JTAB-FVAL = FLDVALUE.
APPEND JTAB.
67
ENDFORM.
BDCDATA is a structure used to populate the internal table records into the
screen fields. The BDCDATA structure has following components:
PROGRAM - Holds the name of MPP program where the screen is created.
DYNPRO - Holds the screen number where the internal fields to be
populated.
DYNBEGIN - Used to initiate the screen when the program is executed.
The default value to be specified is 'X'.
FNAM - Specifies input field name in the screen where the data is to be
populated.
FVAL - Specifies from which internal table field, the data should be passed
to the screen field.
SYNTAX:
UPDATE: This is used to specify the update task of records in the database
table. The types of update tasks are:
A - Asynchronous update
S - Synchronous update
L - Local update
LOOP AT ITAB.
SPLIT ITAB-STR AT ',' INTO ITAB1-KUNNR ITAB1-NAME1 ITAB1-ORT01
ITAB1-LAND1.
APPEND ITAB1.
ENDLOOP.
LOOP AT ITAB1.
PERFORM PROGINFO USING 'SAPMYCALLTRANSACTION' '400'.
ENDLOOP.
ENDFORM.
ENDFORM.
SYNTAX:
Tcode is the name of the transaction code which contains screen to display
error records.
bdcdata_itab is an internal table which is created for BDCDATA structure.
mode specifies the type of mode for processing. There are three types as
follows:
A - Foreground processing
E - Errors only
N - Background processing
Syntax:
DATA KTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
Since Direct Input and Call Transaction methods cannot be used for support
projects due to the database availability and networking constraints, SAP
suggests to use Session Method for data migration in support projects.
Eg. code:
LOOP AT ITAB.
ITAB1-LAND1.
APPEND ITAB1.
ENDLOOP.
LOOP AT ITAB1.
ENDLOOP.
CLEAR JTAB.
REFRESH JTAB.
JTAB-PROGRAM = PROGNAME.
JTAB-DYNPRO = SCRNUM.
JTAB-DYNBEGIN = 'X'.
APPEND JTAB.
ENDFORM.
CLEAR JTAB.
JTAB-FNAM = FLDNAME.
JTAB-FVAL = FLDVALUE.
APPEND JTAB.
ENDFORM.
SM35 -> Select the session -> click on PROCESS pushbutton from appn.
toolbar -> Opens an interface -> Select DISPLAY ERRORS ONLY radiobutton
-> Process -> Opens the user-defined screen -> Modify and Insert the
records -> Finally opens a message -> Click on Session Overview
pushbutton -> Comes back to SM35 screen -> Select the session -> Click on
Log Pushbutton from appn. toolbar -> To view the detailed log, select
session from here -> Click Analyze Log pushbutton from appn. toolbar ->
Opens an interface -> Click on Log Created on...date... tab button -> We
can view the detailed log of transaction.
SM36 -> Click on Own Jobs pushbutton from appn. toolbar -> Select session
from the list -> Click on Job Log pushbutton from appn. toolbar -> Gives you
detailed log of background processing.
73
select the radiobutton -> Click on Execute from Application toolbar -> Opens
Another Interface -> Click0 on Pushbutton Recording Overviews , to create a
new recording Object -> Opens LPS -> Select the data from screen -> Click
on Create Recording from application toolbar -> Name the recording Object (
zrec1 ) -> Enter description ( any ) -> Click on continue -> Specify Tcode
( mm01 ) -> Accept the SAMPLE data -> Save the Record -> by default sap
displays list of fields information where data is accepted in the form "JTAB"
Internal table data -> Move this fields into Recording Object fields by clicking
on "Default all" pushbutton from application toolbar -> save the Entries ->
Come back -> come back -> Change mode of the screen into Change mode
-> Select the radiobutton called as Batch Input Recording -> Name the
recording Object ( ZREC1 ) -> Save the Entries -> Come back .
Select -> Execute from Application -> Opens an interface -> Change the
mode into Change mode -> Click on Create Structure From Application
toolbar -> Name the Internal table ( ITAB1 ) -> Enter Description
( Database format internal table ) -> Click on Continue -> save the Entries
-> Come back.
In this step we are adding fields to the Internal table created in Second
step.
Select the radiobutton -> Click on Execute -> Opens an interface -> Change
Mode of the screen -> select the Internal table from the List -> Click on
Create field from application toolbar -> Name the Field ( MATNR ) -> Enter
Description (any) -> Set the Size ( 18) -> Specify Data type ( C ) -> Click
on Continue.
Using the same step add Other Fields
MBRSH ( Industry ) 1 (C)
MTART (Mat type) 4 (C)
MAKTX (Mat Desc) 40 (C)
MEINS (Mat measure) 3 (C)
-> save the Entries -> Come back.
select -> Execute -> Opens an interface -> Relation ship , by defult
generated by SAP -> Change mode of the screen -> save the Entries ->
Come back.
select -> Execute -> Change Mode of Screen -> Select the Field From List of
recording object -> Click on Source Field From Application toolbar ->
Displays the List of Internal table fields -> Double click on Proper Field. In
the same way map all Fields of Recording Object with All Fields of Internal
table -> Save the Entries -> Come back.
Select -> Execute -> Opens an interface -> Change Mode of Screen ->
select legacy data on PC -> Click on Create From Application toolbar ->
Name the File ( D:\730AM\matdata.txt ) -> Enter Description ( any ) ->
75
Sepecify Separator as "Comma" -> Click on Continue -> Save the Entries
-> Come back.
select -> Execute -> Change Mode of the screen -> Save the Entries ->
Come back.
Select -> Execute -> Opens an interface -> Click on Execute -> Sap
Generates a report as Flat file is converted into ".read" file with Number of
transactions -> Come back -> Come back.
Select ->Execute -> Open an Interface -> Click on Continue -> displays the
data in Internal table (itab1) -> Come back.
In this step Data will be converted into ".lsmw.conv" file to make data is
ready for populating into Session object.
select -> execute -> Execute -> Sap Generates a report as file is converted
into Conv -> Come back -> come back.
Select ->Execute -> Opens an interface -> Select the checkbox -> Click on
Execute -> Prompts a message.
select -> Execute -> Select session object name -> Click on Process -> Click
on continue -> SAP trasnfers all file data into R/3 applications.
BDC recording method is a SAP tool used to perform data migration. Using
this method, a recording object is created for any one of the predefined
screens (MM01, XK01, and XD01) the sample values entered in the screen
input fields are taken to create a BDCDATA structure. Based on the structure
created, the source code is automatically generated by the system.
In this method we cannot use user-defined screens to populate the
error records.
SHDB-> click on new recording push button from the application tool bar->
opens an interface->name the recording object->specify TCODE( mm01) for
which the recording is done(mm01) ->continue->opens specified screen
(mm01) ->enter sample values [ Material no, Material type, industry
sector(matnr,mtart,mbrsh) ->click on select view pushbutton from the
application tool bar->select basic data1 from interface->continue->opens
second screen-> enter description(maktx) and measurement(meins) -> click
on save -> opens an interface with BDCDATA structure filled with the sample
values -> save the recording -> comeback -> select the recording object ->
click on program pushbutton from the application tool bar -> opens an
interface -> enter the program name -> select transfer from recording radio
button -> continue -> enter a short description -> clickon source code push
button -> opens SE38 editor with auto generated code.
Start-of-selection.
Exporting
File name = ‘c:\mara.txt’
File type = ‘asc’
Tables
Data_tab = itab.
Loop at itab.
Endloop.
Loop at itab1.
Replace all the sample values for the fields with the internal table name.
itab1-matnr
itab1-mtart
itab1-mbrsh
itab1-meins
endloop.
Perform close_group.
SAPSCRIPTS
This is a tool used to redirect SAP data to output devices. SE71 is the Tcode
to create SAPScript.
1. BASIC SETTINGS.
2. ADMINISTRATIVE SETTINGS.
Types of Windows:
1. Main Window - This is a common window for all pages. This is a default
window.
2. Constant Window - This window is used to create footer space, header
space for a particular page.
3. Variable Window - This is a subwindow.
4. Graphical Window - This is an optional window, which is used to create
logos or some other graphics for the page.
SE71 -> Specify Form name starting with Z or Y (ZSHABFORM) -> Click on
Create -> Opens an interface -> Enter short description -> Click on
'Paragraph Format' from Appn. toolbar -> Specify Paragraph Name (P1)->
Press Enter -> Enter short description -> Click on 'Definitions' pushbutton
from application toolbar -> Specify Default Paragraph (P1) created -> Click
on Layout pushbutton from appn. toolbar -> Opens a layout with a default
window 'MAIN' -> Right click on Main Window -> Select 'Edit Text' -> Opens
a Line Editor -> Specify a statement -> Come back -> Save -> Activate the
form -> A SAPscript is created.
-> Save -> Activate -> Execute -> Opens an interface -> Specify output
device as LP01 -> Click on Print Preview (F8) pushbutton -> Executes the
form.
'WRITE_FORM' is used to specify the name of the text elements and window
types.
eg. &KARTHIK&.
To pass a value from the print program to the form, declare the variable as
follows in Print PRogram:
....OPEN_FORM
...
....CLOSE_FORM
In the line editor, specify the table field arguments enclosed by '&' symbol as
follows:
/E ELEMENT
TABLES KNA1.
/E ELEMENT
&ITAB-KUNNR& &ITAB-NAME1& &ITAB-LAND1&
LOOP AT ITAB.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ELEMENT'
WINDOW = 'MAIN'.
ENDLOOP.
Create a .bmp file and save it in a directory -> Goto SE78 Tcode -> Double
click BMAP Bitmap images -> Click on Import icon from appn. toolbar ->
Opens an interface -> Specify the path of .bmp file from the OS -> Specify
the name for the image -> Select Color bitmap image radiobutton -> Click
on Continue -> Image is imported.
To add the imported image into the form, right click on the form layout ->
Select Create Graphic -> Opens an interface -> Select image from the form
directory -> Select Color bitmap image radiobutton -> Specify resolution as
100 -> Continue -> An image is added to the script.
To upload .TIFF files into the SAPscript directory, make use of a predefined
executable program called as RSTXLDMC.
In SE38 Tcode, specify the above name, click on execute pushbutton from
application toolbar -> Opens an interface -> Specify the file path ->
Execute.
Text Elements in the line editor are used to avoid data duplication.
82
SMARTFORMS
ADVANTAGES OF SMARTFORMS:
1. Smartforms does not require paragraph formats as a mandatory one.
2. Smartforms does not duplicate the data.
3. Smartforms are Client-independent and language-independent.
4. We can apply styles for the texts using Smartforms.
5. Print programs does not contain any function modules to call the form.
Global Settings:
1. Form Attributes - Holds the description about the smartform.
2. Form Interface - Holds the import and export parameters for the
smartforms.
3. Global Definitions - Used to declare variables for the smartform that can
be accessed by any component within the smartform.
SMARTFORMS -> Specify form name starting with Z or Y -> Click on Create
-> Opens an interface -> Enter short description -> Double click on Form
Interface -> Specify following parameter in IMPORT tab button:
STR TYPE C
-> Expand Pages and Windows -> By default, a Main Window is present ->
Right click on Main Window -> Create -> Text -> Opens Form Editor -> To
go to line editor, Click on 'Txt Editor' pushbutton on the upper left corner of
the form editor -> Specify the variable (&STR&) in the first line of line editor
-> Come back -> Save -> Activate -> Execute -> Opens Form Builder with
autogenerated function module for the smartform ('/1BCDWB/SF00000042')
-> Copy the function module generated.
To invoke the smartform from SE38 editor, Call the Function module and
paste the FM copied from smart form function builder screen as follows:
STR = NAME.
-> Save -> Activate -> Execute in the same way as Sapscript.
-> Double click on Global Definitions -> Specify the global variable as
follows:
-> Expand Pages and Windows -> Right click on Main Window -> Create ->
Table -> Click on Data tab button -> In the LOOP section, for the operand
fields, specify the following:
-> Right click on Main Area -> Create -> Table Line -> In the Line Type input
field, a line type called %LTYPE1 is automatically generated -> Select it.
To create internal table fields, right click on Text cell -> Create -> Text ->
Select General Attributes tab button -> Opens Form Editor -> Goto Line
editor by clicking on 'Txt Editor' pushbutton -> Specify the following in the
first line:
&ITAB1-MATNR&,,&ITAB1-MTART&,,&ITAB1-MBRSH&,,&ITAB1-MEINS&
-> Come back -> Save -> Activate -> Execute -> Copy the autogenerated
FM.