Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Coding buck..

Former Member
0 Kudos

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

3 REPLIES 3

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi,

Paste your code so that we can troubleshoot.

Regards

Karthik D

Former Member
0 Kudos

Hi,

Please display the code. So that the problem can be identified.

Thanks.