09-18-2014 7:29 PM
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.
09-18-2014 8:17 PM
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
09-18-2014 7:36 PM
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.
09-18-2014 8:01 PM
Hi,
In order to traverse deep structures (Nested tables etc.)
Nested loops are the tools to be used.
As a sample:
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.
09-18-2014 8:17 PM
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
09-18-2014 8:40 PM
Hi,
When you do:
lt_item = ls_structure-item.
lt_obj = <s_item>-SERIAL_ID.
IMHO you create a copy.
Regards.
09-18-2014 8:49 PM
You are absolutely right, it would not update the fields properly without a modify, better to use fieldsymbols for every declaration.
Regards,
Felipe