Skip to Content

Regarding LSMW PO upload

Oct 05, 2017 at 12:10 PM


avatar image

Dear SAP world

My query is using BAPI option with IDOC I am creating Purchase order where I have used external number range for PO. in additiion to that PO will contains multiple line item with account assignment P or Q with WBS element per line item also I am having three or multiple condition types and three or multiple condition rates per line item meaning

PO number -4100000000

Pur Org - XXXX you can use your own

Pur Group - XXX you can use your own

Company Code - XXXX you can use your own

your reference

Our reference

line iem 00010

account assignment category P

Material number 13/1001

Qty 1000


Order price unit EA

Price per unit 1

Price 120

Currency INR

Plant - XXXX you can use your own

Storage location - XXXX you can use your own

requisitioner say any number you can use

agreement number - XXXXXXXXXX

Agreement line item number - XXXXX

WBS element - DB- CNB1-13-51-01-01 fourth level WBS from Cj20N

GR receipt yes

GR non valuated - Yes\

Invoice receipt - yes

Tax code - XX you can use your own

condition 1 - surcharge

condition 1 rateor value - 2 %

condition 2 - discount

condition 2 rate or value -3 %

condition 3 - discount

condition 3 rate or value -3%

then line item 20 and line item 30 with same data

I want to upload this much data using BAPI/ IDOC with Po external number range I was able to create PO with multple line item using this LSMW BAPI/IDOC option but the issue here is multiple conditions are not appearing in line item 10 20 30 and price is getting copied incorrectly for line item 20 and 30

in addition to that we wanted to copy deleted items from PO as it is in next system

meaning PO 4100000000 has line 10 20 30 40 out of which line item 40 is deleted now in backend table LOEKZ fields gets updated for line item 40

if we do this manually meaning if we create a PO manually by ME21N with line item 10 20 30 & 40 and at the same time if we put deletion indicator at line item 40 , PO gets created but line item 40 still appears with deleted sign. we wanted to have exactly the same case to be happened through LSMW PO upload.

Right now if I put X in LOEKZ fied in my template LSMW ignores that line item and PO gets created with line item 10 20 & 30 only

Can any one help me please

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Jürgen L
Oct 06, 2017 at 12:40 PM

The BAPI's are developed to support day by day business cases. Migration of data is an extraordinary event.

LSMW is just a toolbox to describe source and target, to create relations and mapping and finally to generate a load program that makes use of all kind of long existing features like the BAPI.

It is not at all logical to create a new PO with deleted items. From a logical sequence you have to create something before you can delete it, or you just leave it away as it is not needed.

see KBA 2006419 - BAPI_PO_CREATE1 does not create items with deletion indicator set (DELETE_IND = 'L')

Show 4 Share
10 |10000 characters needed characters left characters exceeded


Hope you are doing good... I checked your reply logically it is correct keeping manufacturing business process. However the area I am working is a project based industry where PO editing for modification of items from that PO is happeneing at higher side since it is project procurement again it was happening in legacy system. when we are trying to migrate the date from legacy to SAP client informed that he would like to see that deleted data in PO hence we are trying to find a way to do this. If you see I have mentioned that not only deleted items are required as it is in Purchase Order but it shall accomodate multiple conditions records as well which we can enter manually in PO item tab condition here we do have mainly two conditions apart from PBXX those are ZABV & ZBLW.

these are basically copy of Surcharge and discounts. all our purchase orders are getting created by grouping material falling under material group in other words material group wise PO's. where this surcharge and discounts are individual related to material group ... we have around 10000 PO's and each PO has approx 300 line item in it which are already there in legacy system. so each line item may have multilple condition records at the same time may have deletion inndicator at any item number

Now i guess you can imagine why I am looking for that type of LSMW which can copy data from legacy system to SAP.

Please let me know incase any information is needed.. awaiting reply from your side as we are really looking for LSMW creation

Thanks & Regards

Mandar Sathe

Mandar Shashikant Sathe

see this sentence from me again "From a logical sequence you have to create something before you can delete it"

So why are you not just doing it that way, create your POs as if they have no deletion indicator, and in a subsequent LSMW you delete those items that should have a deletion indicator.

Many times you can't have everything in a single object, so you have to split it.



Thanks for reply. we had pointed out the same thing to client but the point here is the activity become twice. meaning I have 10 Po's approx 300 line items in each PO

PO1 - say 300 line item created now as per legacy system line itm 30 ,120 ,270 ,320 ,330 are not reuired

PO2 say 450 line item are created where as per legacy system line item 70, 80 110 160 210 not required and so on so with the approach you mentioned the activity become twice i.e. first we will have to create two files right... if we are same page let me inform you that approach was discussed earlier here but got rejected straight away by client as well as management :D :D hence I am looking for one single LSMW which will address both my points for multiple conditions as well as deletion indicator. I was looking to award some point as your answers are helpful how can I do that how ever I am looking for some precise solution hence cant accept them pardon me for that

Anyways would request you to check my other query also submitted for catalogue today

Thanks & Regards

Mandar Sathe

Mandar Shashikant Sathe

Can you (and your decision makers) really afford to search a full month for an answer and potentially hold up a migration project? I did already 200 migrations this year and it is not over yet and the year has just 230 work days, I could not wait a month to hope that someone might have a solution for something that is not possible in SAP standard.

I can't really imagine what you mean by 2 files and what is so difficult to have them if they are needed.

From your input so far I imagine that you very much know what items have a deletion indicator.

So just copy this file, take the original and remove all deletion indicators and load it as if all items were valid.

Then take the copy and filter just those with the deletion indicator and remove the rest, you can even remove all fields except purchase order number and items number and just create a small simple LSMW to set a deletion indicator to all PO items in SAP that are in this file. I consider this as a 1 hour task for developing the LSMW and to do a test. The final run time may be much longer depending how many thousand POs you have to migrate.