Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

GET_FRAME_TITLE

Former Member
0 Kudos

Hi all,

can anyone explain me what does the following statement mean :

<b>INITIALIZATION.

GET_FRAME_TITLE: 2, 4, 8.</b>

you can find it in the sap standard program <b>RFKORD10</b>. Can anyone expain or guide me with documentation regarding this.

Regards,

Varun.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Varun,

This is a MACRO in ABAP terms. Double-click on GET_FRAME_TITLE and you will be taken to this syntax in the program.

DEFINE GET_FRAME_TITLE.

PERFORM GET_FRAME_TITLE(SAPDBBRF) USING &1 TEXT&1.

END-OF-DEFINITION.

DEFINE macro.

... &1 ... &9 ...

END-OF-DEFINITION.

Effect

The statement DEFINE defines a macro. Naming conventions apply to the name macro and you cannot use ABAP language elements. Between the statements DEFINE and END-OF-DEFINITION, you can use any number of complete ABAP statements, with the exception of DEFINE, END-OF-DEFINITION, and program-initiating statements. These statements constitute a section of source code that can be inserted into a program under the name macro. The definition of a macro is not restricted to the limits of processing blocks.

The validity of a macro is defined by its position in the source code. It can be inserted at any position after END-OF-DEFINITION. If another macro is defined with the same name, it overwrites the previous macro from its new position.

Within a macro, you can use up to nine placeholders &1 ... &9 instead of language elements and operands. These placeholders must be replaced by fixed words when the macro is inserted.

As well as in the source code of a program, you can also store macros in the database table TRMAC, where they can be used by any program. The system first searches in the current program for a macro, and then in the table TRMAC. Do not define your own macros in TRMAC. One example of a macro in TRMAC is break, which sets a breakpoint in the system field sy-uname, depending on the current user name.

In macros, you cannot set any breakpoints. In the ABAP Debugger, the statements of a macro cannot be performed in individual steps.

Macros must not include more than a few lines, and should be used sparingly, since it is very difficult to analyze macro errors. Instead of macros, use internal procedures or include programs.

Inserting Macros

macro [p1 p2 ... ].

If a previously defined macro is listed as the first word in an ABAP statement instead of a valid ABAP language element, then these statements are inserted in the source code at this position. Appropriate language elements or operands p1 p2 ... must be specified for all placeholders of the macro. p1 p2 ... replace the placeholders literally, one after the other.

Note

A macro can insert other macros, but not itself.

Example

In this example, a macro write_frame, which draws a frame around a placeholder &1 in a list, is defined and then implemented.

DATA: x TYPE i, y TYPE i, l TYPE i.

DEFINE write_frame.

x = sy-colno. y = sy-linno.

WRITE: '|' NO-GAP, &1 NO-GAP, '|' NO-GAP.

l = sy-colno - x.

y = y - 1. SKIP TO LINE y. POSITION x.

ULINE AT x(l).

y = y + 2. SKIP TO LINE y. POSITION x.

ULINE AT x(l).

y = y - 1. x = sy-colno. SKIP TO LINE y. POSITION x.

END-OF-DEFINITION.

SKIP.

write_frame 'In a frame!'.

2 REPLIES 2

Former Member
0 Kudos

Varun,

This is a MACRO in ABAP terms. Double-click on GET_FRAME_TITLE and you will be taken to this syntax in the program.

DEFINE GET_FRAME_TITLE.

PERFORM GET_FRAME_TITLE(SAPDBBRF) USING &1 TEXT&1.

END-OF-DEFINITION.

DEFINE macro.

... &1 ... &9 ...

END-OF-DEFINITION.

Effect

The statement DEFINE defines a macro. Naming conventions apply to the name macro and you cannot use ABAP language elements. Between the statements DEFINE and END-OF-DEFINITION, you can use any number of complete ABAP statements, with the exception of DEFINE, END-OF-DEFINITION, and program-initiating statements. These statements constitute a section of source code that can be inserted into a program under the name macro. The definition of a macro is not restricted to the limits of processing blocks.

The validity of a macro is defined by its position in the source code. It can be inserted at any position after END-OF-DEFINITION. If another macro is defined with the same name, it overwrites the previous macro from its new position.

Within a macro, you can use up to nine placeholders &1 ... &9 instead of language elements and operands. These placeholders must be replaced by fixed words when the macro is inserted.

As well as in the source code of a program, you can also store macros in the database table TRMAC, where they can be used by any program. The system first searches in the current program for a macro, and then in the table TRMAC. Do not define your own macros in TRMAC. One example of a macro in TRMAC is break, which sets a breakpoint in the system field sy-uname, depending on the current user name.

In macros, you cannot set any breakpoints. In the ABAP Debugger, the statements of a macro cannot be performed in individual steps.

Macros must not include more than a few lines, and should be used sparingly, since it is very difficult to analyze macro errors. Instead of macros, use internal procedures or include programs.

Inserting Macros

macro [p1 p2 ... ].

If a previously defined macro is listed as the first word in an ABAP statement instead of a valid ABAP language element, then these statements are inserted in the source code at this position. Appropriate language elements or operands p1 p2 ... must be specified for all placeholders of the macro. p1 p2 ... replace the placeholders literally, one after the other.

Note

A macro can insert other macros, but not itself.

Example

In this example, a macro write_frame, which draws a frame around a placeholder &1 in a list, is defined and then implemented.

DATA: x TYPE i, y TYPE i, l TYPE i.

DEFINE write_frame.

x = sy-colno. y = sy-linno.

WRITE: '|' NO-GAP, &1 NO-GAP, '|' NO-GAP.

l = sy-colno - x.

y = y - 1. SKIP TO LINE y. POSITION x.

ULINE AT x(l).

y = y + 2. SKIP TO LINE y. POSITION x.

ULINE AT x(l).

y = y - 1. x = sy-colno. SKIP TO LINE y. POSITION x.

END-OF-DEFINITION.

SKIP.

write_frame 'In a frame!'.

Former Member
0 Kudos

Hi varun,

GET_FRAME_TITLE is a macro used in the said program.

Double click on it to find what it does.

2 4 8 happens to be the parameters passed.

Regards,

Tanveer.

Please mark helpful answers.