Skip to Content
0
Former Member
Sep 11, 2007 at 11:50 AM

problem using READ statement in loop.

27 Views

Hi,

i have few read statements within loop ...endloop as shown:

LOOP AT t_pbim INTO wa_pbim.

READ TABLE t_zpp_material

INTO wa_zpp_material

WITH KEY smatn_new = wa_pbim-matnr.

wa_final-product = wa_zpp_material-product.

wa_final-smatn_old = wa_zpp_material-smatn_old .

wa_final-smatn_new = wa_zpp_material-smatn_new .

wa_final-plant = wa_zpp_material-plant.

wa_final-zdate1 = wa_zpp_material-zdate1.

READ TABLE t_pbed

INTO wa_pbed

WITH KEY bdzei = wa_pbim-bdzei .

wa_final-perxx = wa_pbed-perxx.

READ TABLE t_mdbs

INTO wa_mdbs

WITH KEY matnr = wa_pbim-matnr.

wa_final-val = wa_mdbs-val.

wa_final-meins = wa_mdbs-meins.

append wa_final to t_final.

endloop.

The second read statement finds one matching records with the key value given.but as it is in the loop,that single entry is duplicated in t_final.

please mention how to resolve the issue.