ABAPDATA_COMMON - DATA COMMON
General Material Data General Data in Customer MasterThis documentation is copyright by SAP AG.
DATA - COMMON PART
Obsolete Syntax
DATA BEGIN OF COMMON PART [name].
...
DATA ...
...
DATA END OF COMMON PART [name].
Effect
This variant of the statement DATA with the additions BEGIN OF COMMON PART and END OF COMMON PART defines a globalinterface work area, that can be used jointly by the programs of aprogram group. All data objects declared between these statements using DATA are part of thiscommon area.
The COMMON PART addition can only be used in the global declaration section of an ABAP program. Multiple commondataareas can be declared in a program, but they cannot be nested. Every common data area must be givena unique name using the name addition. You can only omit the name addition if there is just one common data area in a program.
In all programs of a program group that access the data of a common data area, this area must be declaredwith the same name and exactly the same structure, otherwise there is no guarantee that it will work correctly and non-handleable exceptions can be raised.
Notes
- The use of common data areas in otherwise independent programs can be very problematic, with regard to both the maintainability and the functions. Therefore, common data areas should no longer be used. The parameter interfaces ofprocedures are available for exchanging data between programs.
- Common data areas for various programs are generally declared in anincludeprogram that is embedded in all programs involved. However, multiple use of include programs is no longer recommended.
- For more information about issues related to interface work areas, see Program Groups in External Procedure Calls.
Example
In this example, a common data area struc is declared in the include program part. Byincorporating the include program, the three programs param, sum and dis have sharedaccess to the data area struc if they are part of a program group. The latter is accomplishedby loading the programs sum and disp into the program group of param using externalsubroutine calls. The subroutine display in the program disp outputs the input values to the program param and the result of the summation in the subroutine summing.
- * INCLUDE part.
DATA: BEGIN OF COMMON PART struc,
f1 TYPE i,
f2 TYPE i,
s TYPE i,
END OF COMMON PART struc.
PROGRAM param.
INCLUDE part.
PARAMETERS:
p1 TYPE i DEFAULT 20,
p2 TYPE i DEFAULT 90.
f1 = p1.
f2 = p2.
PERFORM summming IN PROGRAM sum.
PROGRAM sum.
INCLUDE part.
FORM summing.
s = f1 + f2.
PERFORM display IN PROGRAM disp.
ENDFORM.
PROGRAM disp.
INCLUDE part.
FORM display.
WRITE: / f1, f2, s.
ENDFORM.
General Material Data Addresses (Business Address Services)
This documentation is copyright by SAP AG.
Length: 4482 Date: 20120522 Time: 043337 triton ( 167 ms )






