‎2006 May 11 4:17 PM
Hi All,
I have got a small problem. im creating a sales order using a bapi and doing some process with the return orders thats already created. if the order created consists of duplicate line items i have to add the quantity of the duplicate material numbers and make it look in a single line. im using BAPI_SALESORDER_CHANGE for doing that. how can i do that. any suggestions plz.
Thanks & Regards,
Kiran.
‎2006 May 11 4:24 PM
Hi Kiran,
Before calling the BAPI check the Item table for the existance of the line item. If it exists, then pick that Qty and line item number and add the new Quantity now you got the line item with the new qty. Now call the BAPI with your new values.
Thanks
Govin.
‎2006 May 11 4:24 PM
Hi Kiran,
Before calling the BAPI check the Item table for the existance of the line item. If it exists, then pick that Qty and line item number and add the new Quantity now you got the line item with the new qty. Now call the BAPI with your new values.
Thanks
Govin.
‎2006 May 11 4:26 PM
could me plz let me know how i can do that. any logic or syntax for example ...
‎2006 May 11 4:31 PM
Hi,
Select * from VBAP where vbeln eq s_vbeln and
MATNR eq s_matnr.
if sy-subrc eq 0.
Then update your item data internal table Qty with the above qty and POSNR with the above posnr.
Now you got the POSNR and New qty of the line Item.
Continue with the existing process.
‎2006 May 11 4:34 PM
Hi,
One more addition to sreeni answer....along with line item vbap table data and you should pass the header data also from the vbak table...
Thanks,
Sony
‎2006 May 11 4:36 PM
ive got 3 lines in the lines internal table. im getting 3 line where in
1st line item is matl m1 quantity 1
2nd line item is matl m2 quantity 2
3rd line item is matl m1 quantity 1
how can i do the processing then....
‎2006 May 11 4:42 PM
Hi Kiran,
Now you have to replace new qty with the old qty then pass that internal table to the bapi structure....
then call the bapi_*_change FM...
‎2006 May 11 4:44 PM
Hi Kiran,
Use the "COLLECT" statement to count the Qty and delete the duplicate records in Internal table.
Thanks
‎2006 May 11 4:45 PM
HI Kiran.
YOu have to use the following logic.
First sort your internal table based on the material number.
sort itab by matnr.
loop at itab.
at new matnr.
collect itab into itab_new.
endat.
endloop.
Regards,
Ravi
‎2006 May 11 4:45 PM
if you want to make it single record with the duplicate records...
what you have to do is loop that internal table with the distinct command and add all the qty values with the temporary parameter...
‎2006 May 11 4:53 PM