Two ways. Assume table dbtab has a field called f1.
TYPES: BEGIN OF MYTYPE, dbtab TYPE dbtab, myf1, myf2, END OF MYTYPE. DATA: myvar TYPE MYTYPE. ... WRITE: myvar-dbtab-f1, myvar-myf1.
or
TYPES: BEGIN OF MYTYPE. INCLUDE STRUCTURE dbtab. TYPES: myf1, myf2, END OF MYTYPE. DATA: myvar TYPE MYTYPE. ... WRITE: myvar-f1, myvar-f2.
Personally I dislike the syntax of the second since it requires a break in the chaining (that is a second TYPES statement). It is possible that nowadays INCLUDE STRUCTURE xxx should be INCLUDE TYPE xxx - haven't tried for a while but you should get the idea.
It is also clearer (IMO) with the first approach what the data represents, plus you don't have to worry about field-names conflicting - that is, it wouldn't matter if dbtab also had a field called myf1.
Scott
Add a comment