07-12-2007 10:47 AM
hi
while creating an RFC function module, can we use the nested structures . what is the use of using nested structures?
07-12-2007 10:55 AM
Hi
You can use the nested structures in RFC/any fun module creation depending on your requirement.
see the doc on Deep/Nested Internal tables/structures
structures containing internal tables as components or
Internal table containing Structure as components are called Deep Internal table.
Please check this link for reading a deep structure.
Example:
TYPES: BEGIN OF TYPE_DEEP,
MATNR TYPE MATNR,
T_MARC TYPE MARC OCCURS 0,
END OF TYPE_DEEP.
DATA: T_DEEP TYPE STANDARD TABLE OF TYPE_DEEP.
DATA: WA_DEEP TYPE TYPE_DEEP.
DATA: T_MARC TYPE TABLE OF MARC.
DATA: S_MARC TYPE MARC.
Populating data.
WA_DEEP-MATNR = 'TEST'.
S_MARC-MATNR = 'TEST'.
S_MARC-WERKS = '9090'.
APPEND S_MARC TO T_MARC.
Append second level internal table.
WA_DEEP-T_MARC[] = T_MARC[].
Append.
APPEND WA_DEEP TO T_DEEP.
Process the internal table.
LOOP AT T_DEEP INTO WA_DEEP.
WRITE: / WA_DEEP-MATNR.
PROCESS the second level internal table.
LOOP AT WA_DEEP-T_MARC INTO S_MARC.
WRITE: S_MARC-WERKS.
ENDLOOP.
ENDLOOP.
<b>Reward points for useful Answers</b>
Regards
Anji