01-18-2008 8:29 AM
Hi,
How can i declare a structure that include all the fields of two table?? Please note that there some common fields in the two tables such as MANDT.
TYPES: BEGIN OF MY_STRUCT.
INCLUDE STRUCTURE TABLEA.
INCLUDE STRUCTURE TABLEB.
END OF MY_STRUCT.
Regards,
Kit
01-18-2008 8:47 AM
Hi Kit,
you may declare like this:
TYPES: BEGIN OF my_struct.
INCLUDE STRUCTURE tablea AS a RENAMING WITH SUFFIX a1.
INCLUDE STRUCTURE tableb AS b RENAMING WITH SUFFIX b1.
TYPES: END OF my_struct.
I hope this helps. Best regards,
Alvaro
01-18-2008 8:47 AM
Hi Kit,
you may declare like this:
TYPES: BEGIN OF my_struct.
INCLUDE STRUCTURE tablea AS a RENAMING WITH SUFFIX a1.
INCLUDE STRUCTURE tableb AS b RENAMING WITH SUFFIX b1.
TYPES: END OF my_struct.
I hope this helps. Best regards,
Alvaro
01-18-2008 8:52 AM
Hi Alvaro,
Thx for your reply.
Do i need to use the alias a and b to access the structure variable??
Regards,
Kit
01-18-2008 8:59 AM
Hi Kit,
if you declare (say) a variable with reference to this type:
DATA: l_mystruc TYPE my_struct.
...then you can access the individual fields by appending the suffix to the name of the field.
For example, if both tables have field MANDT, you may access L_MYSTRUC-MANDTA1 for the first table and L_MYSTRUC-MANDTB1 for the second table.
You may also access the whole structure of each table, by typing L_MYSTRUC-A or L_MYSTRUC-B.
I hope this helps. Best regards,
Alvaro