2012 Apr 26 6:45 AM
Hello All,
I have the following code
types: BEGIN OF t_vbap,
vbeln TYPE vbap-vbeln,
posnr TYPE vbap-posnr,
uepos TYPE vbap-uepos,
END OF t_vbap.
DATA: lit_vbap TYPE TABLE OF t_vbap,
lwa_vbap TYPE t_vbap,
lfd_posnr TYPE vbap-posnr.
clear lfd_posnr.
lfd_posnr = gwa_item-posnr.
LOOP AT lit_vbap INTO lwa_vbap WHERE posnr EQ lfd_posnr.
IF lwa_vbap-uepos IS INITIAL.
EXIT.
ELSE.
lfd_posnr = lwa_vbap-uepos.
CLEAR: lwa_vbap.
ENDIF.
ENDLOOP.
The loop is executed only one time. When I change the value of lfd_posnr from UEPOS there is another entry in the table LIT_VBAP which satisfies my criteria.
Could you please help me find the problem with the code
Thanks,
Anju
Moderator message : Not enough re-search before posting, discussion locked.
Message was edited by: Vinod Kumar
2012 Apr 26 6:50 AM
Hi Anju,
Can you explain what report you are developing.What is gwa_item-posnr.What is the selection you are giving.
Regards,
Madhu.
2012 Apr 26 6:53 AM
Hi Madhu,
My requirement is to fetch the entry from VBAP where the value of UEPOS is initial for a particular sales order number and item.
Thanks,
Anju
2012 Apr 26 6:57 AM
Hi Anju,
See i think some one already answered.
Regards,
Madhu.
2012 Apr 26 6:52 AM
2012 Apr 26 6:52 AM
Hi,
the problem might be with leading zeroes of lfd_posnr and posnr.
can u check that
Thanks,
Ibrahim
2012 Apr 26 6:52 AM
Hi,
First of all you are using an unnecessary if condition inside the loop. You may do the follwing.
LOOP AT lit_vbap INTO lwa_vbap
WHERE posnr EQ lfd_posnr
AND uepose is not initial.
lfd_posnr = lwa_vbap-uepos.
ENDLOOP.
Hope it helps. Thank you.
Regards,
kartik
2012 Apr 26 7:10 AM
Hi,
In the current code, you are looping with where condition on lfd_posnr. and inside loop changing the variable lfd_posnr and expecting the loop to be continued for the new value.
but the loop statement will not work in this way.
Notes
Try to achive the requirement in some other alternative way. I hope wht ever karthik said will work for u.
Thanks,
Lakshmi