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 append data to Deep Structure

former_member203806
Participant
0 Kudos
4,787

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

5 REPLIES 5

Former Member
0 Kudos
419

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

0 Kudos
419

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???

0 Kudos
419

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

sunil_mani
Active Participant
0 Kudos
419

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.

krishnadhuriya
Explorer
0 Kudos
419

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