10-13-2008 7:56 PM
HI all,
data: i_vbap like vbap occurs 0 with header line,
i_vbfa like vbfa occurs 0 with header line.
parameters: p_vbeln like vbap-vbeln.
select vbeln
posnr
matnr
uepos
prodh
meins
from vbap
into corresponding fields of table i_vbap
where vbeln = p_vbeln.
select vbelv
posnv
rfmng
plmin
from vbfa
into corresponding fields of table i_vbfa
for all entries in i_vbap where vbelv = i_vbap-vbeln
and posnv = i_vbap-posnr.
write: 'VBELV',25 'RFMNG',31 'POSNV',40 'PLMIN'.
loop at i_vbfa.
write:/ i_vbfa-vbelv, i_vbfa-rfmng, i_vbfa-posnv, i_vbfa-plmin.
endloop.
If i run this program wilh any sales document.iam getting less than the entries which i have in VBFA table.
Example: for one sales order In VBFA iam having 20 entries. but when i run the above pgm iam getting only 7 records.
Can any body give me clear explanation..PLZ
10-13-2008 8:03 PM
Hi Sultabi,
You have not properly used the For All Entries statement.
Please make sure before doing For All Entries there should be 2 things u should keep in mind.
sort the internal table
and check the internal table is not initial
Let me rewrite your efficient code it will definatly work.
select vbeln
posnr
matnr
uepos
prodh
meins
from vbap
into corresponding fields of table i_vbap
where vbeln = p_vbeln.
sort table i_vbap by posnr. " you have missed this statment
if not i_vbap[] is initial. " you have missed this statment
select vbelv
posnv
rfmng
plmin
from vbfa
into corresponding fields of table i_vbfa
for all entries in i_vbap where vbelv = i_vbap-vbeln
and posnv = i_vbap-posnr.
endif.
write: 'VBELV',25 'RFMNG',31 'POSNV',40 'PLMIN'.
loop at i_vbfa.
write:/ i_vbfa-vbelv, i_vbfa-rfmng, i_vbfa-posnv, i_vbfa-plmin.
endloop.
Thanks,
Chidanand
10-14-2008 1:19 PM
HI Chidanand Chauhan,
The code which i have missed is just to sort the orders and just to check whether we are having entries in VBAP or not...?
Even though i pasted u r recomanded u r code. But no use.
Can you please run the code once and not down the entries and also check those entries in VBFA. u can understand very clear..
Can any body please tell me...
11-10-2008 2:33 PM
10-13-2008 8:43 PM
Hi Sultanbi,
try to use SORT and IF NOT i_vbap[] IS INITIAL statements.
You will get.
If you want u can use DELETE ADJACENT DUPLICATES FROM i_VBAP COMPARING VBELN POSNR.
Thanks,
surendra babu Vemula