cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion - Doc with multiple line items - LSMW

former_member1330001
Participant
0 Kudos

Hi Friends,

I have got a flat file that holds all the open sales orders from a legacy system. I need to upload these data into R/3. If i use LSMW it creates a separate sales order for each line item of a single sales order. That is i am unable to get all the line items for a sales order.How to go about it?.

Quick replies would be rewarded.

Regards,

Tamilarasan.

Accepted Solutions (1)

Accepted Solutions (1)

former_member214131
Active Contributor
0 Kudos

Hello,

First of all, I assume that you have NOT created a recording. Either DI/BI, BAPI or IDoc method is applied.

You need <b>two files</b> in this case.

The First one will have Header Details. The second one will have Item details.

You need Key fields linking both the files.

The files are then mapped to corresponding structures.

Please read thro' the LSMW online documentation which explains in detail.

If you are creating a document by recording, you may have to adopt slightly different approach. The creation of the document with first line item in first step. this is done in CREATE mode. In the second step you add the line items in CHANGE mode.

Hope this helps you.

Best Regards

  • Christian, there are 2 files to be supplied to LSMW in the above solution. But I tried to explain that data in both the files have to be linked with a common key field ( usually document number ).Hope I have not confused you.

First File: (HEAD)

1000014 20050706

1000015 20050707

Second File: (LINE)

1000014 00010 5334667 15 ST 23,15 EUR

1000014 00020 5334669 20 ST 15,89 EUR

1000015 00010 5334661 30 ST 50,15 EUR

1000015 00030 5334669 20 ST 15,89 EUR

Message was edited by: Murugesh Arcot

Answers (1)

Answers (1)

christian_wohlfahrt
Active Contributor
0 Kudos

Hi,

you have to define two different structures:

one for header fields

one for line fields.

First field is an identifier for the type, all lines following the header will be included in the same order.

In source field definition, attribute of a field, you can maintain 'identifying field content' -> that's the link.

Your second structure has to be subsequent (below) the header - otherwise the internal loops are on the wrong level.

Regards,

Christian

former_member1330001
Participant
0 Kudos

Hi Christian,

Sorry i couldn't get your point. Could you please elaborate on your reply?.

Regards,

Tamilarasan.

christian_wohlfahrt
Active Contributor
0 Kudos

Hi,

of course. We were talking of two approaches, here is a simple one (with one input file):

1) Source structure definition

I define several structures (head level / line level)

ART_HEAD Article E1BPE1MATHEAD

5 ART_SITE Logistic view source E1BPE1MARCRT

ART_MBEW Article Valuation E1BPE1MBEWRT

(Sorry, can't see correctly the copy, but art_site is below art_head and can contain several sites for one article)

2) Maintain source fields

Group your fields into header and line values. In both strucutes one identifier is needed:

ART_HEAD Article E1BPE1MATHEAD

IDENT C(010) Structure Identifier 1

Identifing Field Content: HEAD

HEAD_MATERIAL C(018) Article number

Assign all needed fields, double click on field IDENT, you will see attribute 'Identifying field content'.

3) Maintain Structure relations

Header fields of BAPI (or whatever method you use) your head-structure has to be assigned, line (tables) input has to be assigned to line-structure.

4) Field mapping: quite normal

5) Import file example (tabulator separated text file):

HEAD 1000014 20050706 OR

LINE 5334667 15 ST 23,15 EUR

LINE 5334669 20 ST 15,89 EUR

HEAD ....

LINE ....

LINE ....

LINE .... and so one

So no field names, just the field values according to your source field definition. Don't ask me, how to create such a text file, I managed it somehow with some formulas. Visual basic might help better.

Please ask for me details if necessary.

The other option of Murugesh uses three files instead: header values, line values, link values. Looks like some online information will tell how to use them in LSMW.

Regards,

Christian

former_member1330001
Participant
0 Kudos

Hi Christian,

What is this Article,Logistic view source and Article Valuation all about?. Suppose we are getting everything in one file can we transfer the line item details to a separate file and have all the header details in one file?. Assume they are new sales orders to be created and therefore there'll be no sales order numbers to identify or link between records.

From your reply i infer that we have to manually add HEAD for each Header info and LINE for each line item info. How could that be done?.

Thanks in advance.

Regards,

Tamilarasan.

Message was edited by: Tamilarasan Lakshmanan

christian_wohlfahrt
Active Contributor
0 Kudos

Hi Tamilarasan!

I had only an article creation with multiple lines - so this was my source for examples. This has nothing to do with your problem, just general look-alike was important.

But even from the look-alike was nothing left...

Nevertheless: obviously my names confused you - but no further questions of structure/field definition are left?

Since you have (naturally) no keys, one-file approach might be easier.

Because you need a variable number of positions per sales order, you need an identification (just from pure logic, not LSMW).

In case you would receive IDOCs, header segment and line segment would also be named -> could be used in LSMW.

As long as you don't build your file manually, it should be easy for a programmer, to add a 'HEAD' or 'LINE' depending for each line.

... mmh - you really think about manual maintenance?

- Open your data in excel

- Add one column (in the beginning)

- Add a formula 'if (length(b1)<10 then "HEAD" else "LINE"'

Instead of testing the length of a column, you might find an other way to identify your lines, but should be pretty easy. Sorry - I don't have English Excel at hand, but you will find corresponding function.

Regards,

Christian

Former Member
0 Kudos

Hi chris,

I used Lsmw batch recording with one input file for sales order data. since i want to load multiple material for a sales document,i have used two recording one for creation and one for change document and in change mode i am loading the materials.but when i run the batch input session only the second recording(change document is executed).but i need the create document recording to be executed before this.hope i am clear.

cheers,

sanjay.s