cancel
Showing results for 
Search instead for 
Did you mean: 

LSMW 0110 0000 RM07MMBL grouping rules

ILIAN_Grigorov
Contributor
0 Kudos

Hello

We try to make multiple documents with multiple lines in LSMW using 1 file and

Standard batch/direct input 0110 0000 RM07MMBL.

The problem is, the program is using field MTSNR by default to sort all the records in the file

so that it knows how to combine them, and which of them go together in one document.

How can we choose another filed?

In the context of https://scn.sap.com/thread/1931489

Perhaps Juergen Lins will know.

Thanks in advance

ILIAN

Accepted Solutions (0)

Answers (1)

Answers (1)

JL23
Active Contributor
0 Kudos

I don't really believe that SAP is sorting something on its own.

how is your source file defined?

ILIAN_Grigorov
Contributor
0 Kudos

We discovered that when we sort by column MTSNR, the system takes all lines that are the same and combines them in 1 document. We want to use field CNT for that or CHARG. It seems the system likes this field for some reason, perhaps it is connected with the header data.....

JL23
Active Contributor
0 Kudos

MTSNR is a external reference number. It might be logical to group all movements that share the same external reference number together, however it is certainly possible to control LSMW to do what you want.

Since you have just defined a single flat source structure SAP  is certainly processing the records in sequence like they are visible in the READ data.

You did not yet say how you want it to be. do you just want a single material document per line, or do you want it grouped by another field?

ILIAN_Grigorov
Contributor
0 Kudos

Thanks for the reply.

Like I said in the post "multiple documents with multiple lines " - I mean some of them have 1 line, others more than one 1 line.

And the LSMW project works, but it groups "one to many" header/items on MTSNR field, and I don't know why.

And how can I select another field.

JL23
Active Contributor
0 Kudos

Just tell me like you want it to be

JL23
Active Contributor
0 Kudos

Are you dealing with serial numbers?

ILIAN_Grigorov
Contributor
0 Kudos

I want to import multiple documents with multiple lines each, grouped by CHARG field.

So the system will decide which lines go together in a doc by CHARG field (not MTSNR).

I am using only one file.

Thanks.

ILIAN_Grigorov
Contributor
0 Kudos

No, I don't use that field SERNR.

JL23
Active Contributor
0 Kudos

the easiest way is to have the CHARG field on first position in your source file and the file sorted by this number.

then you make use of the command ON_CHANGE_TRANSFER_RECORD instead of TRANSFER_RECORD

I explained this appraoch in my blog

ILIAN_Grigorov
Contributor
0 Kudos

Many thanks for your time, and your answers Juergen.

Also thank you for all the efforts you put here on SDN, and all the information you provide in many different forms.

Unfortunately it appears that I cannot use your methods in my case, because the program itself (RM07MMBL) provides a single non hierarchical structure/dataset BMSEG. It does not matter what convertion rules I do in "Maintain Field Mapping and Conversion Rules" the program takes this dataset, and then decides how to do head/items on its internal logics. I debugged.

It considers several fields as header, and then upon change of any of them, makes a new document.

The easiest way for me is to use BKTXT with some suffix (i.e. CHARG) when I want new document generated. Anyway I learned a lot. Thanks again.

P.S.

if anybody is interested the fields for header are:

TCODE

BLDAT

BUDAT

BWART

XBLNR

FRBNR

BKTXT

WEVER

LDEST

MTSNR

XABLN

LIFNR