Ansicht
Dokumentation

ABENMACRO_INCLUDE - MACRO INCLUDE

ABENMACRO_INCLUDE - MACRO INCLUDE

Vendor Master (General Section)   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.
SAP E-Book

Inserting Macros

macro $[p1 p2 ... $].

Effect

If a macro is listed as the first word in an ABAP statement instead of a valid ABAP keyword, then its content is included in the source code at this position.

To create a syntactically correct program, the included macro may only contain complete ABAP statements except for DEFINE and END-OF-DEFINITION, and program-initiating statements. These statements create a source code section that is included in the current source code. The statements of the macro are not bound to the limits of processing blocks.

Appropriate ABAP words or operands p1, p2, ... must be passed to all placeholders of the macro. The specified operands p1, p2, replace the placeholders literally, one after another. In addition to the content of the literals, the characters are converted to uppercase letters.

The ABAP Compiler searches for a macro specified in an ABAP program as follows:

  1. In the preceding source code of the same compilation unit.
  2. In the type pools that can be used by the program. Local macros of the program hide macros of the same name in type pools.
  3. In database table TRMAC Macros in type pools usually follow different naming conventions to those in TRMAC and therefore there should be no hidings.

A macro can insert other macros but not itself.

Only use macros in exceptional cases.

Note

In global classes, macros are defined and searched for in a dedicated include program.

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 literally replaced in the macros.

Macros






CPI1466 during Backup   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.

Length: 2654 Date: 20240425 Time: 072630     sap01-206 ( 47 ms )