‎2007 Mar 29 12:12 PM
Hi i have 2 internal tables
itab OCCURS 0 ,
posnv LIKE vbfa-posnv,
vbeln LIKE vbfa-vbeln,
vbtyp_n LIKE vbfa-vbtyp_n,
vbelv LIKE vbfa-vbelv,
flag TYPE i,
END OF itab.
and
itab1 OCCURS 0,
vbelv LIKE vbfa-vbelv,
flag TYPE i,
END OF itab1.
they are declared according to the fields in the table vbfa
and i want to set the itab1-flag to 1 if there's a situation when a record in itab contains the following values
itab - vbelv = itab1-vbelv
and
itab-vbtyp_n='M'
so i have used the following code
LOOP AT itab.
LOOP AT itab1.
IF itab-vbelv = itab1-vbelv AND itab-vbtyp_n = 'M'.
itab1-flag = 1.
ENDIF.
ENDLOOP.
ENDLOOP.
but its not working. Please help me
‎2007 Mar 29 12:19 PM
Hi,
loop at itab1.
lv_tabix = sy-tabix.
read table itab with key vbelv = itab1-vbelv
vbtyp_n = 'M' .
if sy-subrc = 0.
itab1-flag = 1.
modify itab1 index lv_tabix.
endif.
endloop.
Regards,
Ravi
‎2007 Mar 29 12:19 PM
Hi,
loop at itab1.
lv_tabix = sy-tabix.
read table itab with key vbelv = itab1-vbelv
vbtyp_n = 'M' .
if sy-subrc = 0.
itab1-flag = 1.
modify itab1 index lv_tabix.
endif.
endloop.
Regards,
Ravi
‎2007 Mar 29 12:23 PM
Hi,
You need to modify the code as follows:
LOOP AT itab.
LOOP AT itab1 where vbelv = itab-vbelv and itab-vbtyp_n = 'M'.
if sy-subrc eq 0.
itab1-flag = 1.
modify itab1 transporting flag.
clear itab1.
ENDIF.
ENDLOOP.
clear: itab.
ENDLOOP.
‎2007 Mar 29 12:24 PM
Hi Musarrat,
You have done it but in the opposite way try this
LOOP AT itab1.
LOOP AT itab.
IF itab-vbelv = itab1-vbelv AND itab-vbtyp_n = 'M'.
itab1-flag = 1.
ENDIF.
ENDLOOP.
ENDLOOP.
I think this will do, try this.
If this really worked then dont forget to award the points.
Thanks and regards
Vipin Das
‎2007 Mar 29 12:25 PM
LOOP AT itab assigning <wa>.
LOOP AT itab1 assigning <wa1>.
IF <wa>-vbelv = <wa1>-vbelv AND <wa>-vbtyp_n = 'M'.
<wa1>-flag = 1.
ENDIF.
ENDLOOP.
ENDLOOP.
‎2007 Mar 29 12:34 PM
Hi,
you have to change the loop as shown here........
loop at itab1.
loop at itab where vbeln = itab1-vbeln.
IF itab-vbelv = itab1-vbelv AND itab-vbtyp_n = 'M'.
itab1-flag = 1.
ENDIF.
endloop
MODIFY ITAB1 TRANSPORTING FLAG.
endloop.
Thanks and Regards,
Kunjal Patel
‎2007 Mar 29 12:44 PM
hi musarrat,
try out this,
loop at itab1.
read table itab wit key vbelv
if itab-vbelv = itab1-vbelv and itab-vbelv = 'M'.
itab1-flag = 1.
endif.
endloop