‎2007 May 15 11:09 AM
hi experts,
i need to change loop with READ table.
Loop at vit_fil.
Loop at vit_tab where loc = vit_fil-loc AND
( matnr = vit_fil-mat OR matnr = ' ' ).
endloop.
if sy-subrc <> 0.
Delete vit_fil.
endif.
endloop.
thanks in advance.
Bijal
‎2007 May 15 11:17 AM
hi,
Check thsi code
Loop at vit_fil.
lv_tabix = sy-tabix.
clear vit_tab.
read table vit_tab with key loc = vit_fil-loc.
if sy-subrc ne 0.
if not ( vit_tab-matnr eq vit_fil-mat or vit_tab-matnr = ' ' ).
delete vit_fil index lv_tabix.
endif.
endif.
endloop.Regards
Sailaja.
‎2007 May 15 11:12 AM
Loop at vit_fil.
Read table vit_tab with key loc = vit_tab-loc
matnr = vit_tab-matnr.
if sy-subrc <> 0.
Delete vit_fil index sy-tabix..
endif.
endloop.
‎2007 May 15 11:15 AM
Loop at vit_fil.
read table vit_tab with key loc = vit_fil-loc matnr = vit_fil-mat binary search.
if sy-subrc ne 0.
read table vit_tab with key loc = vit_fil-loc matnr = ' ' binary search.
if sy-subrc <> 0.
Delete vit_fil.
endif.
endif.
endloop.
‎2007 May 15 11:16 AM
Hi,
Try this:
Loop at vit_fil.
read table vit_tab with key loc = vit_fil-loc
and matnr = vit_fil-mat OR matnr = ' ' .
if sy-subrc <> 0.
Delete vit_fil.
endif.
endloop.Jogdand M B
‎2007 May 15 11:17 AM
hi,
Check thsi code
Loop at vit_fil.
lv_tabix = sy-tabix.
clear vit_tab.
read table vit_tab with key loc = vit_fil-loc.
if sy-subrc ne 0.
if not ( vit_tab-matnr eq vit_fil-mat or vit_tab-matnr = ' ' ).
delete vit_fil index lv_tabix.
endif.
endif.
endloop.Regards
Sailaja.
‎2007 May 15 11:18 AM
Hi Bijal,
Read is used to retrieve the value from the internal table and DB taable..But read all the time will only retrieve one value at a time...
READ table INT_Table into Workarea index 2.
-->It will take the second values from the table...
If we want to retrieve a name means
READ table INT_Table into Workarea with key name = 'XXX'.
If there is more than one name we want to put in to loop which the first answer tells u..
REWARD if useful
‎2007 May 15 11:21 AM
hi,
in read statement u are not able to put logical operations.by default it peforms AND.
Loop at vit_fil.
read table vit_tab with key loc = vit_fil-loc
matnr = vit_fil-mat
matnr = ' ' .
if sy-subrc <> 0.
Delete vit_fil index sy-tabix.
endif.
endloop.
‎2007 May 15 11:24 AM
hi,
Loop at vit_fil .
read table vit_fil with key loc = vit_fil-loc.
if sy-subrc ne 0.
read table vit_tab with key matnr = vit_fil-matnr
if sy-subrc ne 0.
read table vit_tab with key matnr = ''.
if sy-subrc <> 0.
Delete vit_fil.
endif.
endif.
endif.
endloop.
Reward with points if helpful.
Message was edited by:
Vinutha YV
Message was edited by:
Vinutha YV
‎2007 May 15 11:41 AM
hi,
to make the whole thing faster do binary search on every read with key statement, e.g.:
<b>READ TABLE vit_fil WITH KEY loc = vit_fil-loc BINARY SEARCH.</b>
Remember to Sort vit_fil by loc before that:
<b>SORT vit_fil BY loc.</b>
Please reward points, if helpful!