SAP Database

DEFINE : ABAP Keyword a day

Print This Post Email This Post Written by admin on Dec 10th, 2007 | Filed under: ABAP Keywords

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:

  1. 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 typeTYPES T_NAME(25)...
  2. CONTROLS: ABAP Keyword a day CONTROLSBasic formCONTROLS ctrl TYPE ctrl_type.EffectDefines a control.A control defines an ABAP/4 runtime object which displays data in a particular visual format, depending on the type. It offers the user standard...
  3. COMMIT: ABAP Keyword a day COMMITBasic formCOMMIT WORK.Addition... AND WAITEffectExecutes a database commit and thus closes a logical processing unit or Logical Unit of Work ( LUW ) (see also Transaction processing ). This means...
  4. CHECK : ABAP Keyword a day CHECKWithin loops and events- CHECK logexp.Special for reports with logical databases- CHECK sel.- CHECK SELECT-OPTIONS.CHECK - within loopsBasic formCHECK logexp.EffectCHECK evaluates the subsequent logical expression . If it is true,...
  5. ADD-CORRESPONDING : ABAP Keyword a day ADD-CORRESPONDINGBasic 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 lines. Searches...



Leave a Reply

  • Help Support CRY