How to define macro in ABAP/4
We can define macro by apply statement DEFINE ... END-OF-DEFINITION.
Example
Note: You can define parameters only 9 (&1 ... &9).
DATA: itab TYPE TABLE OF sflight WITH HEADER LINE.
RANGES: r_carrid FOR sflight-carrid.
DEFINE append_range.
&1-sign = &2.
&1-option = &3.
&1-low = &4.
append &1.
END-OF-DEFINITION.
INITIALIZATION.
append_range r_carrid ’I’ ’EQ’ ’AA’.
append_range r_carrid ’I’ ’EQ’ ’AB’.
START-OF-SELECTION.
SELECT * FROM sflight INTO TABLE itab
WHERE carrid in r_carrid.
IF SY-SUBRC = 0.
LOOP AT itab.
WRITE:/ itab-carrid, itab-connid, itab-fldate.
ENDLOOP.
ENDIF.
- thitima's blog
- 3178 reads
Post new comment