2008 Nov 12 7:07 AM
Hi Experts,
I have requirements in my program that...
In one case there is sales order and sales order Item number ..
for each sales order item, there is one production order..
In another case for one sales order item number, there are more than one production orders...
I want to display the production orders with respect to sales order item number correctly....
In my coding i used FOR ALL ENTRIES for the production orders with respect to sales order item with the table AUFK...and later i read the internal table with READ statement..But problem occurs when there is more than one production order for the same sales order number and item number..
I am unable to retrieve it in coding..
Please help me out..
Thanks in advance...
Regards,
Viju
2008 Nov 12 7:41 AM
Hi,
just check when yor are using FOR ALL ENTRIES form AUFK you are also selecting Sales order number and Sales Order Item number from AUFK , it shud be like
select AUFNR
KDAUF
KDPOS
from AUFK
inot table i_aufk
for all entries in i_vbap
where kdauf = i_vbap-vbeln
and kdpos = posnr.
secondly, by using the READ statement you will get only one entry ie the first entry which it finds for that Sales Order Item Number, so you would have to LOOP.
type: begin of t_aufnr,
aufnr type aufk-aufnr,
end of t_aufnr.
data: g_kdpos type aufk-kdpos,
i_aufnr type standard table of t_aufnr.
loop at i_aufk into wa_aufk.
if g_kdpos is initial. " For the 1st rec
g_kdpos = wa_aufk-kdpos.
else.
if g_kdpos = wa_aufk-kdpos.
move wa_aufk-aufnr to wa_aufnr-aufnr.
append wa_aufnr to i_aufnr.
else.
refresh i_aufnr.
endif.
endif.
endloop.
2008 Nov 12 7:45 AM
Hi,
Paste your code so that we can troubleshoot.
Regards
Karthik D
2008 Nov 12 7:48 AM
Hi,
Please display the code. So that the problem can be identified.
Thanks.