SAP for Retail Discussions
Join conversations about personalization, omnichannel strategies, and operational excellence in retail using SAP for Retail software.
cancel
Showing results for 
Search instead for 
Did you mean: 

LSMW using DEBMAS06: How to repeat a segment and its child segment

Former Member
0 Kudos

Hi everyone,

I developped an LSMW to upload customers using DEBMAS06.

I've an issue because I have to create a customer and extend him to others sales organization but I don't know how to repeat a segment with its child segment. I used "transfer_record" on E1KNVVM and E1KNVIM but i have this:

E1KNVVM

E1KNVVM - E1KNVIM

                  - E1KNVIM

I want

E1KNVVM - E1KNVIM

E1KNVVM - E1KNVIM

Can you tell me if i can create and extend a customer in the same Idoc. If not, have you an idea about create a customer with one line of my source file and extend him with an other knowing you don't know what's your customer KUNNR before create him.

Scuse me for my english, I'm french and I don't speak very well.

Regards,

Lionel

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Resolve by myself.

View solution in original post

10 REPLIES 10

Former Member
0 Kudos

First of all, when you are maintaining the field mapping, go to the menu ->extras -> Hide and display Field/codes. If you display "Processing time", you should be able to see at the end of every structure an _end_of_record_ field.

Modify the code to:

transfer_record

** Start of insertion **

E1KNVVM-VKORG = ...  "your new sales order

E1KNVVM-VTWEG = ...  "your new channel

E1KNVVM-SPART = ....  "your new division

E1KNVVM-any_field = ... "your new values

transfer_record.

** End of insertion **

Be careful if you're mapping the child structure E1KNVIM otherwise there will be a sintax problem in the IDoc. In that case, you should do this insertion at the end of E1KNVIM.

If you want to learn more about LSMW, go to http://service.sap.com/lsmw -> Media Center

0 Kudos

Hi Ivan,

I've this:

I did what you say:

If I put "transfer_record" under E1KNVV segment:

And the result is :

E1KNVVM- nothing

E1KNVVM- E1KNVIM

                 - E1KNVIM

When I put "transfer_record" under the child segment:

The result is:

I try to have :

E1KNVVM- E1KNVIM

E1KNVVM- E1KNVIM

I have to put E1KNVIM for each E1KNVVM segments.

Former Member
0 Kudos

Hi,

This is the structure that I want:

Please, someone can help me, it's very urgent...

Regards,

Lionel

0 Kudos

You almost got it.

transfer_record is a macro that will insert a new segment in the IDoc.

You are calling twice it after the segment E1KNVIM has been populated, then you get two E1KNVIM segements in your IDoc.

You want that macro to populate E1KNVIM and then a new E1KNVVM, then change the global fields g_edidd_segnam, segnum and psgnum accordingly.

Exactly as what I see in the 4th picture you have attached... in the begin of record. Did you spot it?

0 Kudos

I did that yesterday:

But when I look my Idoc, this is the result:

...

0 Kudos

1. Set the fields _BEGIN_OF_RECORD_ and _END_OF_RECORD_ in segment E1KNVVM back to default settings.

2. Set the fields _BEGIN_OF_RECORD_ in segment E1KNVIM back to default settings.

3. Change the code in _END_OF_RECORD_ in segment E1KNVIM to this:

transfer_record. "It will create a E1KNVIM segment for the 1st sales area.

** insert **

g_edidd_segnam = 'E2KNVVM007'.

g_edidd_segnum = '0005'.

g_edidd_psgnum = '000001'.

g_edidd_hlevel    = '02'.

E1KNVVM-VKORG = new_vkorg

E1KNVVM-VTWEG = new_vtweg

E1KNVVM-SPART = new_spart

transfer_record "it will create a E1KNVVM segment for the 2nd sale area.

g_edidd_segnam = 'E2KNVIM'.

g_edidd_segnum = '0008'

g_edidd_psgnum = '000005'

g_edidd_hlevel =    '03'

E1KNVIM-any_field = new_field "if something needs to be changed

transfer_record "it will create a E1KNVIM

Bye!

0 Kudos

I did what you said and litlle more, at the end of E1KNVIM, I put this code:

transfer_record.

g_edidd_segnam = 'E2KNVVM007'.

g_edidd_segnum = '0005'.

g_edidd_psgnum = '000001'.

g_edidd_hlevel = '02'.

E1KNVVM-MSGFN = DEBMAS2-MSGFN.

E1KNVVM-VKORG = DEBMAS2-VKORG2.

E1KNVVM-VTWEG = DEBMAS2-VTWEG2.

E1KNVVM-SPART = DEBMAS2-SPART2.

E1KNVVM-KALKS = '1'.

E1KNVVM-KONDA = '02'.

E1KNVVM-VSBED = '01'.

E1KNVVM-WAERS = DEBMAS2-WAERS.

E1KNVVM-ZTERM = '0001'.

transfer_record.

g_edidd_segnam = 'E2KNVIM'.

g_edidd_segnum = '0008'.

g_edidd_psgnum = '000005'.

g_edidd_hlevel = '04'.

E1KNVIM-MSGFN = DEBMAS2-MSGFN.

E1KNVIM-ALAND = 'FR'.

E1KNVIM-TATYP = 'MWST'.

E1KNVIM-TAXKD = '1'.

transfer_record.

It creates a new E1KNVVM segment but with an E1KNVIM structure and records...

Here is the result:

0 Kudos

I forgot :

  g_record = '....'.

before :

  g_edidd_segnam = '....'.

So now it's working but I've a new issue, with one E1KNVVM segment, my idoc is ok but with two, I've the status 51 with this message : All fields required : SAPMF02D 0111 ADDR1_DATA-NAME1

Can you help me on this please ?

Former Member
0 Kudos

Resolve by myself.

0 Kudos

Wow! Congratulations!