05-29-2009 5:18 AM
Hi Guru's,
I have 2 internal tables ALV_LTB AND IT_BOM.
IN ALV_LTB i have the data like
stlal I stlnr I stlst I datuv I............
03 I 40 I - I 02.04.2008
02 I 60 I - I 03.04.2008
IN IT_BOM i have the data like this
stlal I stlnr I stlst I datuv
03 I 40 I 02 I 02.04.2008
02 I 60 I 01 I 03.04.2008
i want to modify the internal table ALV_LTB like beloow
stlal I stlnr I stlst I datuv
03 I 40 I 02 I 02.04.2008
02 I 60 I 01 I 03.04.2008
can any one help me how to do this...
Thanks & Best Regards,
Praveen.
05-29-2009 5:29 AM
loop at alv_tb into wa_alv.
read table it_bom into wa_bom with key stlal = wa_alv-stlal. "Read the corresponding entry
wa_alv-stlst = wa_bom-stlst.
modify alv_tb from wa_alv transporting stlst. "modify the alv table
endloop.
05-29-2009 5:25 AM
Hi You can use MOVE-CORRESPONDING..
MOVE-CORRESPONDING alv_tab TO it_bom.
Hope this helps...
05-29-2009 5:27 AM
Hi,
Try this......
LOOP AT IT_BOM.
LOOP AT ALV_LTB WHERE stlal = IT_BOM-stlal AND stlnr = IT_BOM-stlnr.
ALV_LTB-stlst = IT_BOM-stlst.
MODIFY ALV_LTB.
ENDLOOP.
ENDLOOP.
05-29-2009 5:28 AM
hi,
you may try the following approach:
loop at it_ltb into wa_ltb.
g_tabix = sy-tabix.
read table it_bom into wa_bom with key stlal = wa_ltb-stlal.
wa_ltb-stlst = wa_bom-stlst.
modify it_ltb from wa_ltb transporting stlst index g_tabix.
clear wa_ltb.
clear wa_bom.
clear g_tabix.
endloop.
best regards,
Prinan
05-29-2009 5:29 AM
loop at alv_tb into wa_alv.
read table it_bom into wa_bom with key stlal = wa_alv-stlal. "Read the corresponding entry
wa_alv-stlst = wa_bom-stlst.
modify alv_tb from wa_alv transporting stlst. "modify the alv table
endloop.
05-29-2009 5:31 AM
hi praveen,
as far as i understand u want to modify the stlst value in the ALV_LTB table... right?
so..
loop at alv_ltb into ls_alv_ltb. "ls_alv_ltv is work area for alv_ltb.
clear ls_IT_BOM.
*reading the same row of IT_BOM.
read table IT_BOM into ls_IT_BOM with key stlal = ls_alv_ltb-stlal stlnr = ls_alv_ltb-stlnr.
if sy-subrc = 0.
ls_alv_ltb-stlst = ls_IT_BOM-stlst.
*modifying alv_ltb from the value we got from IT_BOM
modify alv_tlb from ls_alv_ltb.
endif.
clear : ls_alv_ltb.
endloop.
i hope this helps...
05-29-2009 5:38 AM
Hello
LOOP AT ALV_LTB.
READ TABLE IT_BOM WITH KEY STLAL = ALV_LTB-STLAL
STLNR = ALV_LTB-STLNR.
IF SY-SUBRC = 0.
ALV_LTB-STLST = IT_BOM-STLST.
MODIFY ALV_LTB INDEX SY-TABIX.
ENDIF.
ENDLOOP.
05-29-2009 6:19 AM
Hi,
If you use FIELD SYMBOLS, it will also improve the performance.
Declare a field symbol of type similar to that of ALV_LTB so that we can avoid MODIFY statement which will improve performance.
LOOP AT ALV_LTB ASSIGNING <FS_LTB>.
READ TABLE IT_BOM WITH KEY STLAL = <FS_LTB>-STLAL
STLNR = <FS_LTB>-STLNR.
IF SY-SUBRC = 0.
<FS_LTB>-STLST = IT_BOM-STLST.
ENDIF.
ENDLOOP.
UNASSIGN <FS_LTB>.
Thanks,
Harimanjesh AN