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 we can send data to a line type of field in a deep structure?

Former Member
0 Kudos

Hi ,

      I got an object in the in badi extension  .In that I have to retrieve the serial id from objk table and assign that serial id to the line type SAPPLSEF_SERIAL_ID  of table type SAPPLSEF_SERIAL_ID_TT in the field  SERIAL_ID  of  the structure SAPPLSEF_DLV_ITEM_INF and this structure is a line type of a SAPPLSEF_DLV_ITEM_INF of table type SAPPLSEF_DELIVERY_ITEM_INF_TAB for the filed ITEM in the structure SAPPLSEF_DLV_INF

Thanks ,

Venkat.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Just create a internal table of the same table type assigned to the field, you can do it as deep as you need. It would be something like this:

DATA:
ls_structure TYPE SAPPLSEF_DLV_INF,

lt_item TYPE SAPPLSEF_DELIVERY_ITEM_INF_TAB,

lt_obj TYPE SAPPLSEF_SERIAL_ID_TT.

<FIELD-SYMBOLS>:

<s_item> TYPE SAPPLSEF_DLV_ITEM_INF,

<s_obj> TYPE SAPPLSEF_SERIAL_ID.

lt_item = ls_structure-item.

LOOP AT lt_item ASSIGNING <s_item>.

lt_obj = <s_item>-SERIAL_ID.

LOOP AT lt_obj ASSIGNING <s_obj>.

<s_obj>-xxx = 'XXXX'.

ENDLOOP.

ENDLOOP.



@Eitan was faster, when I wrote I didn't see his reply.

Message was edited by: Felipe Simionatto

5 REPLIES 5

former_member205763
Active Contributor
0 Kudos

your structure relationship seems confusing. can you show the structure/hierarchy of deep structure.

in general you can access table and use assigning to assign your line type to a fieldsymbol and add data to your fs.

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

In order to traverse deep structures (Nested tables etc.)

Nested loops are the tools to be used.

As a sample:

See:

In program y_r_eitan_test_26_02 FORM get_info_of_request there is such a loop.

FIELD-SYMBOLS: <st_systems> TYPE LINE OF ctslg_systems .

FIELD-SYMBOLS: <st_steps>   TYPE LINE OF ctslg_steps .

FIELD-SYMBOLS: <st_actions> TYPE LINE OF ctslg_actions .

LOOP AT st_cofile-systems[] ASSIGNING <st_systems> .

  LOOP AT <st_systems>-steps[] ASSIGNING <st_steps> .

 

   LOOP AT <st_steps>-actions[] ASSIGNING <st_actions> .

     ENDLOOP .

    ENDLOOP .

  ENDLOOP .

IMHO you need to do something similar.

Read about the use of FIELD-SYMBOLS . You can update a row without using "MODIFY" .

Regards.

Former Member
0 Kudos

Just create a internal table of the same table type assigned to the field, you can do it as deep as you need. It would be something like this:

DATA:
ls_structure TYPE SAPPLSEF_DLV_INF,

lt_item TYPE SAPPLSEF_DELIVERY_ITEM_INF_TAB,

lt_obj TYPE SAPPLSEF_SERIAL_ID_TT.

<FIELD-SYMBOLS>:

<s_item> TYPE SAPPLSEF_DLV_ITEM_INF,

<s_obj> TYPE SAPPLSEF_SERIAL_ID.

lt_item = ls_structure-item.

LOOP AT lt_item ASSIGNING <s_item>.

lt_obj = <s_item>-SERIAL_ID.

LOOP AT lt_obj ASSIGNING <s_obj>.

<s_obj>-xxx = 'XXXX'.

ENDLOOP.

ENDLOOP.



@Eitan was faster, when I wrote I didn't see his reply.

Message was edited by: Felipe Simionatto

0 Kudos

Hi,

When you do:

lt_item = ls_structure-item.

lt_obj = <s_item>-SERIAL_ID.

IMHO you create a copy.

Regards.

0 Kudos

You are absolutely right, it would not update the fields properly without a modify, better to use fieldsymbols for every declaration.

Regards,

Felipe