Syntax for Include

INCLUDE prog

Basic form

INCLUDE prog.

Effect

Includes the program prog in the main program for syntax check and generation purposes. Include programs are used to divide very large programs into smaller more manageable units. They also allow you to create common program components.

Example

INCLUDE LSPRITOP.

The whole of an INCLUDE statement must appear on one line where it is the only statement allowed. The include program must consist of complete statements (and comments). You can use the service report RSINCL00 to generate reference lists for include programs.

INCLUDE STRUCTURE

Basic form

INCLUDE STRUCTURE rec.

Effect

When you define a structure rec (with DATA or TYPES ), this statement copies the components of the structured data type subRec to the structure rec . Since you can define nested data structures (i.e. structures with sub-structures) starting from Release 3.0, you should use INCLUDE STRUCTURE only if you want to introduce types in a program first and nested structures in a later step.


A data definition DATA: BEGIN OF rec.
INCLUDE STRUCTURE subRec.
DATA: END OF rec.

is equivalent to

DATA rec LIKE subRec.

You are recommended to use the second formulation. Even if the structure rec to be defined contains additional components, instead of

DATA: BEGIN OF rec,
...
INCLUDE STRUCTURE subRec.
DATA: ...
END OF rec.

you should use

DATA: BEGIN OF rec,
...
rec LIKE subRec,
...
END OF rec.

so that subRec can be referenced as a sub-structure of rec .

Although " INCLUDE STRUCTURE subRec. " breaks up the substructure subRec into its components, the alignment of subRec is retained. This means that padding fields may be inserted before the first and/or before the last component of subRec in rec .

INCLUDE TYPE

Basic form

INCLUDE TYPE subRec.

Effect

When you define a structure rec (with DATA or TYPES ), this statement copies the components of the structured data type subRec to the structure rec .

Since you can define nested data structures (i.e. structures with sub-structures) starting from Release 3.0, you should use INCLUDE TYPE only if you want to introduce types in a program first and nested structures in a later step.(78.8).


Work flow for MM PART 6
Work flow for MM PART 7

2 comments :

  1. Who would like to support donate to Japan?
    It's' very sad regarding what is happening in Japan, so help donate!
    Japan wants your own help!

    ReplyDelete
  2. Let me know the difference bt. Include structure and include type.
    Are both the same ?

    Pls. reply

    ReplyDelete