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: 

usage of "Common part"

Former Member
0 Kudos

Hello All,

I need to declare a internal table with header line in a common part area ( Begin of common part), so that it can be used by more than one program of a program group.

The table structure is :

DATA : BEGIN OF i_msg OCCURS 0,

aenam LIKE zvs21-aenam,

langu LIKE zvs21-langu,

vbeln LIKE zvs21-vbeln.

INCLUDE STRUCTURE message.

DATA : END OF i_msg.

Kindly let me know how can i go abt this ?

Thanks in advance,

Sharat

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

you can also use include program to declare internal

table

include zcommon.

DATA : BEGIN OF i_msg OCCURS 0,

aenam LIKE zvs21-aenam,

langu LIKE zvs21-langu,

vbeln LIKE zvs21-vbeln.

INCLUDE STRUCTURE message.

DATA : END OF i_msg.

report ztest.

include zcommon.

or

Variant 5 DATA: BEGIN OF COMMON PART c,

.....

END OF COMMON PART.

Effect Defines one or more common data areas in programs linked by

external PERFORM calls. If only one common data area exists,

you can omit the name c. There may be just one unnamed COMMON

area or one or more named COMMON areas. You assign named COMMON

areas to each other by name. The structure of data areas must

always be the same for both the calling and the called program

(otherwise, the program terminates with an error message at

runtime).

You must specify the name of a common data area as a direct

value, i.e. without quotation marks.

Notes - The table work areas are always in the common data area.

- In general, you define the area created as COMMON with a

common INCLUDE STRUCTURE. Occasionally, you use a INCLUDE

report which contains precisely the definition of the COMMON

PART.

- Field symbols cannot belong to a common data area, even if

the FIELD-SYMBOLS statement lies between DATA BEGIN OF

COMMON PART and DATA END OF COMMON PART.

Regards

amole

2 REPLIES 2

Former Member
0 Kudos

Add the following to both programs:

DATA: BEGIN OF COMMON PART.
DATA: BEGIN OF i_msg OCCURS 0,
        aenam LIKE zvs21-aenam,
        langu LIKE zvs21-langu,
        vbeln LIKE zvs21-vbeln.
        INCLUDE STRUCTURE message.
DATA: END OF i_msg.
DATA: END OF COMMON PART.

Rob

Former Member
0 Kudos

Hi,

you can also use include program to declare internal

table

include zcommon.

DATA : BEGIN OF i_msg OCCURS 0,

aenam LIKE zvs21-aenam,

langu LIKE zvs21-langu,

vbeln LIKE zvs21-vbeln.

INCLUDE STRUCTURE message.

DATA : END OF i_msg.

report ztest.

include zcommon.

or

Variant 5 DATA: BEGIN OF COMMON PART c,

.....

END OF COMMON PART.

Effect Defines one or more common data areas in programs linked by

external PERFORM calls. If only one common data area exists,

you can omit the name c. There may be just one unnamed COMMON

area or one or more named COMMON areas. You assign named COMMON

areas to each other by name. The structure of data areas must

always be the same for both the calling and the called program

(otherwise, the program terminates with an error message at

runtime).

You must specify the name of a common data area as a direct

value, i.e. without quotation marks.

Notes - The table work areas are always in the common data area.

- In general, you define the area created as COMMON with a

common INCLUDE STRUCTURE. Occasionally, you use a INCLUDE

report which contains precisely the definition of the COMMON

PART.

- Field symbols cannot belong to a common data area, even if

the FIELD-SYMBOLS statement lies between DATA BEGIN OF

COMMON PART and DATA END OF COMMON PART.

Regards

amole