2007 Sep 03 1:26 PM
Hi experts
I am facing the following problem, my requirement is,
i have internal table containing sales order, line item, shipped qty,mov type(601,602).
I want to say weather the order is closed or open line item wise.
so i need to compare the shipped qty and order qty.
regarding shipped qty i need to do calculation that 601 ship qty - 602 ship qty in a particular line item(considering reverse document), then only move to comparing order qty.
Can you please give me suggestions how to solve this problem.
Thanks in advance.
Regards
rajaram
2007 Sep 03 1:40 PM
Hi,
as i already suggested, use COLLECT..
Now i wil show u how it will work..
tab1
12345 00010 50 601
12345 00010 60 601
12345 00010 120 602
12345 00010 20 601
LOOP AT tab1.
pass data to tab2..
COLLECt tab2.
ENDLOOP.
tab2
12345 00010 130 601
12345 00010 120 602
SORT tab2 BY field1 field2 field4.
LOOP AT tab2.
READ TABLE tab2 INTO e_tab2 WITH KEY so# = tab2-so#
item# = tab2-item#
movtp = 602.
if sy-subrc eq 0.
DELETE tab2 INDEX sy-tabix.
ENDIF.
tab2-shipqty = tab2-shipqty - e_tab2-shipqty.
MODIFY tab2.
ENDLOOP.
tab2
12345 00010 10 601
At last you can check which records do not have ship qty = 0, and display them as open items..
Thanks and Best Regards,
Vikas Bittera.
2007 Sep 03 1:43 PM
2007 Sep 03 1:46 PM
Hey,
I have written the 100% logic with 80% of the code, you just to fit it in your program.. nothing to explain here.. see the table values i have shown.. how they are changing..
It will work!!!
Thanks and Best Regards,
Vikas Bittera.
2007 Sep 03 1:54 PM
2007 Sep 03 2:02 PM
Sure, i will wait for the result..
Thanks and Best Regards,
Vikas Bittera.
2007 Sep 03 2:17 PM
READ TABLE tab2 INTO e_tab2 WITH KEY so# = tab2-so#
item# = tab2-item#
movtp = 602.
what it means, tell me clearly.
2007 Sep 03 2:21 PM
Hi,
Here we are looping at table tab2.. we will find the corresponding mov type 602 record for the current mov type 601 record..
We just have to compare the qty.. so i will read the same table itab2 with full key values of the current record..
12345 00010 is the key of my current record and it has miv type 601..
So, i will get the 2nd record with move type 602 into the structure e_tab2.. this structure has the same fields as table tab2.
Now once i get this record, i can do the comparison from e_tab2, so i do not need this record any more and i will delete it...
Thanks and Regards,
Vikas Bittera.