Documente Academic
Documente Profesional
Documente Cultură
ABAP Commands
ABAP Training ABAP Commands 2
Move Statements
MOVE f TO g.
MOVE c1 TO c2 PERCENTAGE n.
Move-corresponding itab1 to itab2.
ABAP Training ABAP Commands 4
WRITE f TO g[+off][(len)].
DO’S.
DON’TS.
Translate STATMENTS
Example :
DATA letters(3) TYPE C.
Replace Statements
REPLACE f ...WITH g
...INTO h.
Example :
Data field(10).
Move ‘XYZAB' to field.
Concatenate Statements
Additions :
……….. Separated by h .
Example :
DATA: ONE(10) VALUE 'john',
TWO(3) VALUE 'F.',
THREE(10) VALUE 'Kennedy',
NAME(20).
Concatenate one two three into name separated by space.
ABAP Training ABAP Commands 10
Condense Statements
CONDENSE c.
Additions :
…… No-gaps.
Example :
DATA: BEGIN OF NAME,
TITLE(8) VALUE ' dr.',
FIRST_NAME(10) VALUE 'Michael',
SURNAME(10) VALUE 'Hofmann',
END OF NAME.
Condense name no-gaps.
Output :
Dr.MichaelHofmann
ABAP Training ABAP Commands 11
Split Statements
Contd …
Shift Statements
SHIFT c.
SHIFT c BY n PLACES.
SHIFT c UP TO c1.
SHIFT c LEFT DELETING LEADING c1.
SHIFT c RIGHT DELETING TRAILING c1.
ABAP Training ABAP Commands 15
Contd …
Variants :
Shift c by n places
Example :
Data: alpha1(10) type c value
'ABCDEFGHIJ',
alpha2 type string,
five type i value 5.
Alpha2 = alpha1.
Shift alpha1 by five places.
Shift alpha2 right by 2 places.
ABAP Training ABAP Commands 17
Contd …
Other variants :
SHIFT c LEFT DELETING LEADING c1.
SHIFT c RIGHT DELETING TRAILING c1
ABAP Training ABAP Commands 18
EQ / “ = “ GE / “ >= “ LE / “ <= “
Useful Keywords
Initial
If w_var1 is initial.
…..
ENDIF.
Space
Data : w_var1 type c.
If w_var1 is space.
…..
ENDIF.
ABAP Training ABAP Commands 22
WRITE : ‘ TEST1’.
WRITE : ‘ TEST1’.
ELSEIF VAR1 EQ VAR2.
ELSE. WRITE : ‘ TEST2’.
WRITE : ‘ TEST3’.
ENDIF.
ENDIF.
ABAP Training ABAP Commands 23
Loop at screen
ABAP Training ABAP Commands 24
Continue Statements
Continue
Effect :
CONTINUE terminates the current loop pass, return the processing to
the beginning of the loop and starts the next loop pass, if there is one
Example :
Do 100 times.
If SY-index >= 10 and SY-index <= 20.
Continue.
ENDIF.
...
Enddo.
ABAP Training ABAP Commands 25
Exit Statements
Exit :
Effect :
Within a loop structure:
terminates loop processing (DO, WHILE, LOOP, SELECT).
Within subroutines and other modularization units (but not in a loop
structure):
leaves the subroutine or modularization unit (FORM, MODULE,
FUNCTION, TOP-OF-PAGE, END-OF-PAGE).
More Looping
IF SY-INDEX = 10.
ENDWHILE.
EXIT.
ENDIF.
DATABASE Commands
Update
Modify
Delete
Insert
Select
ABAP Training ABAP Commands 28
UPDATE dbtab. Or
UPDATE *dbtab. Or
UPDATE (dbtabname) ... .
[GROUP BY Fields1]
[HAVING Cond2]
[ORDER BY Fields2].
ABAP Training ABAP Commands 33
Inner join :
We only get the records of the cross-product for which there is
an entry in all tables used in the view.
Outer join :
Records are also selected for which there is no entry in some of
the tables used in the view.
ABAP Training ABAP Commands 35
Contd ...
Select ESLL~ktext1 ESLL~MENGE ESLL~MEINS ESLL~NETWR
Into table i_ESLL
From ESLH outer join ESLH
On ( ESLH~PACKNO = ESLL~PACKNO )
Where ESLH~HPACKNO EQ
GS_XEKPO-PACKNO
AND ESLH~DEL EQ c_space
AND ESLL~DEL EQ c_space
AND ESLL~PACKAGE EQ c_space.
ABAP Training ABAP Commands 37
Join Conditions
ABAP Training ABAP Commands 38
Write Output