DEFINE : ABAP Keyword a day
DEFINE
Basic form
DEFINE macro.
Effect
Defines a program component (macro) under the name macro . It must consist only of ABAP/4 statements and is expanded at compilation time.
A macro should always be concluded with the END-OF-DEFINITION statement.
In the definition, you can use &n to reference positional parameters (n = 0 .. 9). When the macro is called, &n is replaced by the n-th actual parameter.
Example
Define a macro called “++” for use in the program.
DEFINE ++.
ADD 1 TO &1.
END-OF-DEFINITION.
DATA: NUMBER TYPE I VALUE 1.
…
++ NUMBER.
Notes
* In general, it is better to use subroutines (FORM , FUNCTION ) rather than macros because subroutines – unlike macros – are supported by all the ABAP/4 Development Workbench tools (including debugging, runtime analysis, runtime error handling, …).
* You cannot nest macro definitions.
———————
ABAPer, mail: abap.community@gmail.com http://abaplearner.blogspot.com
If you like this post, you may as well like these too:
- ABAP Source Code: Three approaches to define data objects REPORT ZSOURCE0401.* 1. Elementary typesDATA: CUSTOMER_NAME_1(25) TYPE C, VENDOR_NAME_1(25) TYPE C. * 2. Reference to an existing fieldDATA: CUSTOMER_NAME_2(25) TYPE C, VENDOR_NAME_2 LIKE CUSTOMER_NAME_2. * 3. Reference to a non-elementary...
- ABAP Keyword a day : ADD ADD Variants: 1. ADD n TO m. 2. ADD n1 THEN n2 UNTIL nz GIVING m. [...]...
- ADD-CORRESPONDING : ABAP Keyword a day ADD-CORRESPONDING Basic form ADD-CORRESPONDING rec1 TO rec2. Effect Interprets rec1 and rec2 as field strings. If, for example, rec1 and rec2 are tables, executes the statement for their header...
- AT : ABAP Keyword a day AT Events in lists- AT LINE-SELECTION.- AT USER-COMMAND.- AT PFn.Events on selection screens- AT SELECTION-SCREEN.Control break with extracts- AT NEW f.- AT END OF f.- AT FIRST.- AT LAST.- AT...
- CNT : ABAP Keyword a day CNT Basic form… CNT(h) …EffectCNT(h) is not a statement, but a field which is automatically created and filled by the system if f is a sub-field of an extract dataset...
















Leave a Reply