i have 5 internal table it_vbrk, it_vbrp, it_vbak,it_vbap, it_lips and it_kna1 ..( the select-options was likp-erdat and likp-vbeln)
based on that i have done select 'for all entries' on it_likp into it_likp have selected 3 flds from likp, 7 flds from lips. now using
for all entries on
it_lips i have selected 5 flds from vbrp into it_vbrp. based on for all entries on it_lips i have selected 5 flds from vbap.
now i have to populate my final internal table it_final.
****************************************************************************************************************
types: begin of it_final, "this is my internal table flds arranged according to the list output vbeln type vbap-vbeln, posnr type vbap-posnr, erdat type vbak-erdat, kunnr type likp-kunnr, name1 type kna1-name1, aufnr type vbak-aufnr, matnr typr vbap-matnr, arktx type vbap-arktx, kwmeng type vbap-kwmeng, vrkme type vbap-vrkme, vbeln1 type lips-vbeln, posnr 1type lips-posnr, lfimg type lips-lfimg, vrkme type lips-vrkme, vbeln2 type vbrp-vbeln, posnr2 type vbrp-posnr, fklmg type vbrp-fklmg, vrkme1 type vbrp-vrkme, end of it_final. now plz tell me how to populate this internal table? which is the right method : (1) looping at it_likp into wa_likp. "based on the likp-vbeln i am fetching the flds from lips. read table it_lips into wa_lips where vbeln = wa_likp-vbeln. it_final-vbeln1 = wa_lips-vbeln. it_final-posnr1 = wa_lips-posnr. it_final-fklmg = wa_lips-fkimg. it_final-vrkme1 = wa_lips-vrkme. append it_final. endloop. loop at it_final. read table it_vbrp where vgbel = it_final-vbeln. it_final-vbeln2 = wa_vbrp-vbeln. ........... modify it_final index sy-tabix transporting vbeln2.... similarly fetch the records from vbap, lips etc. (2 )another method. loop at it_likp into wa_likp. read table it_lips into wa_lips where vbeln = wa_likp-vbeln. read table it_vbrp into wa_vbrp where vgbel = wa_likp-vbeln. read table it_vbap into wa_vbap where vbeln = wa_lips-vgbel. [ps: i am selecting vgbel and vgpos from lips and vbrp but not populating into it_final as it is not reqd.] it_final-vbeln = wa_vbap-vbeln. it_final-posnr = wa_vbap-posnr. it_final-matnr = wa_vbap-matnr. it_final-vbeln1 = wa_lips-vbeln. it_final-posnr1 = wa_lips-posnr. it_final-lfimg = wa_lips-lfimg. it_final-vbeln2 = wa_vbrp-vbeln. it_final-posnr3 = wa_vbrp-posnr. it_final-fklmg = wa_vbrp-fklmg. ........ ......... append it_final. clear it_final. endloop.
*************************************************************************************************************
now plz suggest which one is a better method to follow and why? suggest me some tips to select which table to use loop first and how? where shud i use read table? plz site some codes as an example.
elaborate answers will be highly appreciated.