Thursday, August 14, 2008

SAP ABAP Important Keywords :
The following list displays some of the important Keywords in ABAP
NoKeywordDescription
1AT END OF … ENDATControl group end in LOOP
2AT Fg … ENDATProcessing specific to record type in LOOP
3AT FIRST … ENDATExecute processing block within a LOOP before processing single lines
4AT LAST … ENDATExecute processing block within a Loop after processing single lines
5AT NEW … ENDATControl group end during LOOP
6CALLCall processing (Program, function module, screen)
7CHECKSelection condition, leave loops and subroutines
8CONTINUEExit current loop pass within a DO, WHILE, LOOP or SELECT loop
9DO … ENDDOLoop processing
10EXEC SQL … ENDEXECExecute a Native SQL Statement
11EXITLeave loops or subroutines
12FORM … ENDFORMDefinition of a subroutine
13IF … ELSE … ENDIFConditional processing
14LEAVELeave program processing, go to a transaction, list (or) menu
15LOOP … ENDLOOPLoop on a table (or) extract dataset
16MODULE … ENDMODULEDefinition of a dialog module
17ON CHANGE OF … ENDONProcessing on field change
18PERFORM … USINGCall a subroutine
19SELECT … ENDSELECTRead database tables
20STOPEnd selection
21WHILE … ENDWHILELoop processing

Wednesday, August 13, 2008

SAP ABAP Function Module to Wrap Long Text

The following function module can be used to wrap long text in ABAP.

SAP ABAP Function Module to Wrap Text

RKD_WORD_WRAP

Find the code below to test the above Function Module.

Import Parameters:

TEXTLINE
DELIMITER
OUTPUTLEN

OutPut Parameters:

OUT_LINE1
OUT_LINE2
OUT_LINE3

Code Sample:

REPORT ZEX_WORDWRAP.

Data: d_text(110),
d_text1(110),
d_text2(110),
d_text3(110),
d_text4(110),
d_oline1(110),
d_oline2(110),
d_oline3(110).

Data: Begin of int_text occurs 0,
o_lines(100),
End of int_text.

Move: 'THIS IS SAP MM DESCRIPTION WHICH NEEDS TO BE WRAPPED' to d_text1,
'IN TO SEVERAL LINES AS IT IS TOOL LONG FOR ONE LINE.' to d_text2.

Concatenate d_text1 d_text2 INTO d_text.

CALL FUNCTION 'RKD_WORD_WRAP'
EXPORTING
TEXTLINE = d_text
DELIMITER = ' '
OUTPUTLEN = 35
IMPORTING
OUT_LINE1 = d_oline1
OUT_LINE2 = d_oline2
OUT_LINE3 = d_oline3
TABLES
OUT_LINES = int_text
EXCEPTIONS
OUTPUTLEN_TOO_LARGE = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

loop at int_text.
write: int_text-o_lines.
endloop.

_______________________________________________________