SAP MACRO INCLUDE SAP Info












ARTICLE ( Version: 0019)

Standard SAP Help for MACRO ( Version: 0019)

Inserting Macros

Syntax
macro [p1 p2 ... ].


Effect
If a macro is specified instead of a valid
ABAP keyword, as the first word in an ABAP statement, its statements are included at this position in the source text. Suitable ABAP words or operands p1 p2 ... must be transferred to all of the macro's placeholders. The specified operands p1 p2 ... replace the placeholders sequentially.
The ABAP Compiler searches for a macro specified in a program,
first in the preceding source text of the same compilation unit and then in the type groups that are used for the program. Local macros of the program hide macros of the same name in type groups.
A macro can insert other macros but not itself.


Notes
  Before Release 7.0, EhP2, a specified macro that was not defined in the current program was only searched for in explicitly loaded type groups using the TYPE-POOLS statement. As of Release 7.0, EhP2, the search is made in all usable type groups.
  If the ABAP Compiler does not find a specified macro in the current program or in a type group, it searches in the TRMAC table. Macros in the TRMAC table usually follow different naming conventions to those in type groups and therefore nothing should be hidden.

Example
In this example, the two macros operation and output are
defined. output is nested in operation. operation is called three times with different parameters. Note how the placeholders <(> <)>1, <(> <)>2, ... are replaced in the macros. DATA: result TYPE i,
n1 TYPE i VALUE 5,
n2 TYPE i VALUE 6.

DEFINE operation.
result = <(> <)>1 <(> <)>2 <(> <)>3.
output <(> <)>1 <(> <)>2 <(> <)>3 result.
END-OF-DEFINITION.

DEFINE output.
write: / 'The result of <(> <)>1 <(> <)>2 <(> <)>3 is', <(> <)>4.
END-OF-DEFINITION.

operation 4 + 3.
operation 2 ** 7.
operation n2 - n1.

ARTICLE ( Version: 0020)

Standard SAP Help for MACRO ( Version: 0020)

Inserting Macros

Syntax
macro [p1 p2 ... ].


Effect
If a macro is specified instead of a valid
ABAP keyword, as the first word in an ABAP statement, its statements are included at this position in the source text. Suitable ABAP words or operands p1 p2 ... must be transferred to all of the macro's placeholders. The specified operands p1 p2 ... replace the placeholders sequentially.
The ABAP Compiler searches for a macro specified in a program,
first in the preceding source text of the same compilation unit and then in the type groups that are used for the program. Local macros of the program hide macros of the same name in type groups.
A macro can insert other macros but not itself.


Notes
  Before Release 7.0, EhP2, a specified macro that was not defined in the current program was only searched for in explicitly loaded type groups using the TYPE-POOLS statement. As of Release 7.0, EhP2, the search is made in all usable type groups.
  If the ABAP Compiler does not find a specified macro in the current program or in a type group, it searches in the TRMAC table. Macros in the TRMAC table usually follow different naming conventions to those in type groups and therefore nothing should be hidden.

Example
In this example, the two macros operation and output are
defined. output is nested in operation. operation is called three times with different parameters. Note how the placeholders <(> <)>1, <(> <)>2, ... are replaced in the macros. DATA: result TYPE i,
n1 TYPE i VALUE 5,
n2 TYPE i VALUE 6.

DEFINE operation.
result = <(> <)>1 <(> <)>2 <(> <)>3.
output <(> <)>1 <(> <)>2 <(> <)>3 result.
END-OF-DEFINITION.

DEFINE output.
write: / 'The result of <(> <)>1 <(> <)>2 <(> <)>3 is', <(> <)>4.
END-OF-DEFINITION.

operation 4 + 3.
operation 2 ** 7.
operation n2 - n1.

ARTICLE ( Version: 0021)

Standard SAP Help for MACRO ( Version: 0021)

Inserting Macros

Syntax
macro [p1 p2 ... ].


Effect
If a macro is executed instead of a valid
ABAP keyword, as the first word in an ABAP statement, its statements are included at this position in the source text. Suitable ABAP words or operands p1 p2 ... must be transferred to all of the macro's placeholders. The specified operands p1 p2 ... replace the placeholders sequentially.
The ABAP Compiler searches for a macro specified in a program,
first in the preceding source text of the same compilation unit and then in the type groups which are used for the program. Local macros of the program hide macros of the same name in type groups.
A macro can insert other macros but not itself.


Notes
  Previously, a specified macro not defined in the current program was only searched for in explicitly loaded type groups using the TYPE-POOLS statement. The search now covers all usable type groups.
  If the ABAP Compiler does not find a specified macro in the current program or in a type group, it searches in the TRMAC table. Macros in the TRMAC table usually follow different name conventions to those in type groups and therefore nothing should be hidden.

Example
In this example, the two macros operation and output are
defined. output is nested in operation. operation is called three times with different parameters. Note how the placeholders <(> <)>1, <(> <)>2, ... are replaced in the macros. DATA: result TYPE i,
n1 TYPE i VALUE 5,
n2 TYPE i VALUE 6.

DEFINE operation.
result = <(> <)>1 <(> <)>2 <(> <)>3.
output <(> <)>1 <(> <)>2 <(> <)>3 result.
END-OF-DEFINITION.

DEFINE output.
write: / 'The result of <(> <)>1 <(> <)>2 <(> <)>3 is', <(> <)>4.
END-OF-DEFINITION.

operation 4 + 3.
operation 2 ** 7.
operation n2 - n1.

ARTICLE ( Version: 0022)

Standard SAP Help for MACRO ( Version: 0022)

Inserting Macros

Syntax
macro [p1 p2 ... ].


Effect
If a macro is executed instead of a valid
ABAP keyword, as the first word in an ABAP statement, its statements are included at this position in the source text. Suitable ABAP words or operands p1 p2 ... must be transferred to all of the macro's placeholders. The specified operands p1 p2 ... replace the placeholders sequentially. The characters are converted to uppercase (except for the content of character literals).
The ABAP Compiler searches for a macro specified in a program,
first in the preceding source text of the same compilation unit and then in the type groups which are used for the program. Local macros of the program hide macros of the same name in type groups.
A macro can insert other macros but not itself.


Notes
  Previously, a specified macro not defined in the current program was only searched for in explicitly loaded type groups using the TYPE-POOLS statement. The search now covers all usable type groups.
  If the ABAP Compiler does not find a specified macro in the current program or in a type group, it searches in the TRMAC table. Macros in the TRMAC table usually follow different name conventions to those in type groups and therefore nothing should be hidden.

Example
In this example, the two macros operation and output are
defined. output is nested in operation. operation is called three times with different parameters. Note how the placeholders <(> <)>1, <(> <)>2, ... are replaced in the macros. DATA: result TYPE i,
n1 TYPE i VALUE 5,
n2 TYPE i VALUE 6.

DEFINE operation.
result = <(> <)>1 <(> <)>2 <(> <)>3.
output <(> <)>1 <(> <)>2 <(> <)>3 result.
END-OF-DEFINITION.

DEFINE output.
write: / 'The result of <(> <)>1 <(> <)>2 <(> <)>3 is', <(> <)>4.
END-OF-DEFINITION.

operation 4 + 3.
operation 2 ** 7.
operation n2 - n1.
Message text extract from SAP system. Copyright SAP SE.


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!