Application Development and Automation 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: 
Read only

difficulty

Former Member
0 Likes
402

what is the difference between the following two syntax:

1] TYPES vbap_type TYPE vbap .

and

2] INCLUDE STRUCTURE vbap .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
378

Dear Abaper Learner,

TYPES itabtype {TYPE tabkind OF linetype|

LIKE tabkind OF lineobj}

[WITH [UNIQUE|NON-UNIQUE] keydef] [INITIAL SIZE n].

Defines the type itabtype for an internal table without header line in a program with table type tabkind and line type linetype (if you use a TYPE reference) or the type of the referred object lineobj (if you use a LIKE reference). Internal tables without a header line consist of any number of table lines, each of which has the structure defined by the line type.

INCLUDE STRUCTURE s.

This statement can only be used within a structure definition with the additions BEGIN OF and END OF to the statements TYPES, DATA, CLASS-DATA, CONSTANTS, and STATICS. It transfers all components of the structure s at the specified point into the current structure definition. s must be a structure of the same program or a flat structure in the ABAP Dictionary. The latter is only possible outside classes.

Note

You should no longer use the INCLUDE STRUCTURE statement simply to define structures whose type is created with reference to existing structures. Use the constructions below instead. You should only use INCLUDE STRUCTURE with the AS additions that allow you to perform offset/length addressing on structures.

A data definition:

DATA BEGIN OF rec.

INCLUDE STRUCTURE s.

DATA END OF rec.

should be replaced with:

DATA rec LIKE s.

Even if the structure rec to be defined contains additional components, instead of:

DATA: BEGIN OF rec,

... .

INCLUDE STRUCTURE s.

DATA: ...

END OF rec.

you should use

DATA: BEGIN OF rec,

...

rec LIKE s,

...

END OF rec.

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

Regards,

Abir

************************************

  • Don't forget to award Points *

2 REPLIES 2
Read only

Former Member
0 Likes
378

1] TYPES vbap_type TYPE vbap .

vbap_type is a structure of type vbap . vbap_type does not have any element other then vbap.

2] INCLUDE STRUCTURE vbap .

In side the custom structure, there is a structure type vbap . custom structure can have additional elements other then vbap .

ie. types : begin of itab

sno(10),

include structure vbap,

end of itab .

types

Read only

Former Member
0 Likes
379

Dear Abaper Learner,

TYPES itabtype {TYPE tabkind OF linetype|

LIKE tabkind OF lineobj}

[WITH [UNIQUE|NON-UNIQUE] keydef] [INITIAL SIZE n].

Defines the type itabtype for an internal table without header line in a program with table type tabkind and line type linetype (if you use a TYPE reference) or the type of the referred object lineobj (if you use a LIKE reference). Internal tables without a header line consist of any number of table lines, each of which has the structure defined by the line type.

INCLUDE STRUCTURE s.

This statement can only be used within a structure definition with the additions BEGIN OF and END OF to the statements TYPES, DATA, CLASS-DATA, CONSTANTS, and STATICS. It transfers all components of the structure s at the specified point into the current structure definition. s must be a structure of the same program or a flat structure in the ABAP Dictionary. The latter is only possible outside classes.

Note

You should no longer use the INCLUDE STRUCTURE statement simply to define structures whose type is created with reference to existing structures. Use the constructions below instead. You should only use INCLUDE STRUCTURE with the AS additions that allow you to perform offset/length addressing on structures.

A data definition:

DATA BEGIN OF rec.

INCLUDE STRUCTURE s.

DATA END OF rec.

should be replaced with:

DATA rec LIKE s.

Even if the structure rec to be defined contains additional components, instead of:

DATA: BEGIN OF rec,

... .

INCLUDE STRUCTURE s.

DATA: ...

END OF rec.

you should use

DATA: BEGIN OF rec,

...

rec LIKE s,

...

END OF rec.

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

Regards,

Abir

************************************

  • Don't forget to award Points *