2014 Jun 19 11:17 AM
Hi All
I have deep structure with one structure and one table type. i need to add data to that table type fields , so in data appending how to access table type.
HD_item has vbeln, posnr, matnr field.
how to access VBELN to append data....
Rgds
PP
2014 Jun 19 11:39 AM
Hi Pramod,
Please try to use below code for appending data in deep structure. This will be helpful for you.
Read table ztest_item_st into wa_item_st.
if wa_item_st is not initial.
loop at wa_item_st-HD_item into wa_hd_item.
add your code here.
endloop.
endif.
see the below example also.
loop at XMVERF_POS into lwa_mverf_pos.
loop at lwa_mverf_pos-einteil into lwa_einteil.
lwa_einteil-lmeng = <lwa_vbap>-bmeng.
lwa_einteil-vsmng = <lwa_vbap>-bmeng.
modify lwa_mverf_pos-einteil from lwa_einteil .
endloop.
modify XMVERF_POS from lwa_mverf_pos.
endloop.
Regards,
Prasenjit
2014 Jun 19 11:49 AM
HI Presenjit
In driver programe i want to append invoice line item vise data to HD_ITEM table type.
for that
HD_ITEM-vbeln = my_workarea-vbeln.
is this way correct???
2014 Jun 19 11:52 AM
As you know , Hd_item is internal table. first you can create work area for this internal table and put that intenal table in loop and assign your work area and modify your hd_item internal table like example code.
Regards,
Prasenjit
2014 Jun 19 12:27 PM
Hi Pramod,
Please write the following code to retrieve data from a deep structure.
FIELDSYMBOLS <LFS_ITEM> like line of ZTEST_ITEM_IT.
Loop at ZTEST_ITEM_ST-HD_ITEM assigning <LFS_ITEM>.
*write your own logic
Endloop.
2014 Jun 19 12:38 PM
Hi,
First fill your individual itables. Then append it in you structure.
DATA lt type table of ZTEST_ITEm_ST.
DATA ls type ZTEST_ITEm_ST.
DATA hd_DATA type ZTEST_HEAD.
DATA ls_data like line of hd_data.
DATA hd_item type ZTEST_item_tt.
DATA ls_item like line of hd_item.
ls_data-f1 = 'jj'.
ls_data-f2 = 'kk'.
append ls_data to hd_DATA .
ls_item-f1 = 'jj'.
ls_item-f2 = 'kk'.
append ls_item to hd_item .
move hd_item to ls-hd_item.
move hd_DATA to ls-hd_DATA.
append ls to lt.
Rgrds,
Krishna