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: 

how to populate structure inside a structure in FM output

Former Member
0 Kudos

Hi Experts,

I want to populate a structure inside a structure in output of a function module.

Currently I have defined a table type inside a line item i have defined an include structure. But when you append it with values it is not forming the sub-structure in the output. I doubt if this approach is correct for the output requirement or not.

Please suggest how to get this done or provide some sample standard function module which I can refer for this in SAP CRM/ISU.

4 REPLIES 4

former_member192854
Active Participant
0 Kudos

Hi Dharmaraj, by any change you have some coding with this problem? I think it's do-able but I can't give you a solid approach with a more concreet example. Best, Sander

nabheetscn
Active Contributor
0 Kudos

Hi

What exactly are you trying to achieving using deep structures concept please provide the details. For example how to populate it check DOC parameter type in exporting of function module ME_READ_PO_FOR_PRINTING

Nabheet

Former Member
0 Kudos

Hi,

Let structure_one_name be the main structure and structure_two_name be the structure inside the structure_one_name and Field1 be one of the field of it.

Structure_one_name-Structure_two_name-Field1 = Value.

Hope this works.

Regards.

former_member184569
Active Contributor
0 Kudos

Hi Dharmaraj,

When you include a structure in a table type, using include, you don't create a hierarchical structure, all the fields will be in the same hierarchical level. All the fields in the structure would be included in the table just as if they were directly included.

To access it, you just access with the table type and field, the structure name is not there.

eg table is ztable, and you include structure struct having field fldA, fldB, and fldC.

now to access fldA, fldb or fldC, you dont access as ztable-struct-fldA, but directly as ztable-fldA.

Here a structure addr2_comm is included.

You access the fields in it just like country field. All the fields in the include are added, just as if they were directly added, not as any sub structure.

ztest-state, ztest-tel_number.

Similar is the way when you declare a type in ABAP program.


TYPES: BEGIN OF typ1,
           mandt TYPE mandt,
           land1 TYPE land1.
           include structure addr2_comm.
types:    END OF typ1.


TYPES: BEGIN OF typ2,
           mandt TYPE mandt,
           land1 TYPE land1,
          addr2_com like addr2_comm,
     END OF typ2.

     data : it1 type table of typ1 WITH HEADER LINE, it2 type table of typ2 WITH HEADER LINE.


FOr the first type of table, the structure will not form any heirarchy, you can access the firelds in addr2_comm direcltly.

eg it1-tel_number.


However, for the second type, when you are declaring a structure inside table type using like addition (or type addition), we will have to access it specify the structure name also. eg it2-addr2_comm-tel_number.


Hope that makes it clear.