10-26-2012 11:21 AM
Hi,
I need to create new customers with LSMW IDoc from text file(s). I'm using standart DEBMAS (DEBMAS07, DEBM). Tricky part starts where one customer can have multiple company codes (info in child segment/2nd file).
At the moment (judging from we19) I'm stuck after place where customer is created using parent segment and first child segment, then next customer (same) creation is started with next company code (child segment data), but the parent data are not filled any more.
Maybe I have formed input files wrong, or what I'm doing wrong? My guess is I should somehow tell the program to use parent segment data for each segment, but how?
Used data:
Source Fields
CUSTOMER structure for customers
DUMMY C(010) linking field
KTOKD N(004) Number or something
NAME1 C(020) Could be name
SORT1 C(010) Sort?
CITY1 C(015) City
COUNTRY C(003) Country code
CUSTOMER_KNB1 Part of customer data
DUMMY C(010) linking field
BUKRS C(004) Company Code
AKONT C(010) Reconciliation acct
My input files look like this:
Parent segment data file
DUMMY KTOKD Name1 SORT1 CITY1 COUNTRY
1 0004 Name1 Search t test Riga LV
2 0004 Name2 Search t test Riga LV
Child segment file
DUMMY BUKRS AKONT
1 LV77 231000
1 MARA 230000
1 MARC 230000
2 MARA 230000
2 MARC 230000
P.S. It is something close to problem described in http://scn.sap.com/thread/2067417#10767533 but I didn't get it there, I'm a bit new to SAP.
10-26-2012 12:02 PM
the source file like shown should be able to get what you want.
At the moment (judging from we19) I'm stuck after place where customer is created using parent segment and first child segment, then next customer (same) creation is started with next company code (child segment data), but the parent data are not filled any more.
what you do in WE19 is certainly not correct.
the segments maintained should be in this sequence:
e1kna1m dummy1
e1knb1m bukrs LV77
e1knb1m bukrs MARA
e1knb1m bukrs MARC
e1kna1m dummy 2
e1knb1m bukrs MARA
e1knb1m bukrs MARC
Best you forget WE19 for the moment and start doing it in LSMW, based on your source file LSMW will usually get it into the right format automatically.
10-26-2012 12:14 PM
Thanks for quick response.
Using LSMW at "Start IDOC Processing" step, I have 2 IDocs with error "Fill all required fields SAPMF02D 0111 ADDR1_DATA-NAME1", so I think, as described previously, program created first customer with company code MARA and then tried to create one with MARC, but the parent segment data are not filled (like name, that error is about).
And both IDocs looks to be created correctly, one with 2 child elements (BUKRS), second with 3. And the fields looks correctly filled in Idoc.
EDIT:
Checked the we19 again, it is always after 1st customer/company code is created and it moves to next one.
Maybe the problem is that child segment is used both at start (BUKRS) and in the end (AKONT) of each creation.. or something?
10-26-2012 12:35 PM
does your IDOC in WE19 look like this one?
of course you have to fill all mandatory fields like the address fields,
a customer wihtout address does not make any sense, dont you think so?
10-26-2012 1:11 PM
Well this is more like a training task, so atm I'm filling all the mandatory fields (the one needed to create customer in XD01), its all the ones in data files + langu field (constant EN).
My IDoc with error in we19 looks like this:
EDIT:
More info:
IDoc
LSZMLCUST (well the thing in upper right corner in IDoc screenshot)
Partner ZMLCUST: Logical system, User. One Inbound Message Type: DEBMAS (with process code DEBM)
10-26-2012 2:03 PM
Can you show the content of data segment e1kna1m
in general you have to know that ADRC segment will not be created with DEBMAS Idoc,
you have to have a second IDOC for ADRMAS to create the central addresses.
10-29-2012 7:31 AM
Well this is the segment, I thought its a standart:
So, you are saying that I should create 2 IDocs? I'm not sure I get the idea, because this Idoc kind of makes everything for 1 company code, or to handle customers with multiple companies, its impossible to do it with just 1 Idoc?
EDIT:
In case if this was what you were asking:
10-29-2012 8:50 AM
nowadays SAP uses central adress managment, earlier the adress was just stored in general data tables for customer and vendors.
E.g .When you do manual maintenance of a customer in XD01/Xd02 then you see the central adress screen, The data is stored redundand in ADRC and KNA1 tables.
But central adress management has more lines for name and street as the table KNA1 has.
When you create vendors or customer with IDOC, then only the adress in table LFA1 or KNA1 is updated.
But this are only the old tables, , the full adress needs to be stored in table ADRC, for this you need to use ADRMAS
For more see OSS note 306275 and 384462
10-30-2012 11:32 AM
So, I looked around and read some info about that all, but it seems that this is not the problem. If I use just 1 company code for 1 customer, all gets done, no info is missing. My problem is that with more than one company code, program is not using the parent data, well the other company codes are not created. E1KNA1M is a standart SAP structure with 1 to n relation, it should work in this case (so I have been told).
Maybe there are some workaround or something? Like using function module to find out what will be customer number for new customer and then use it somehow for each E1KNB1M segment ( don't know how, since it don't have a field with customer nr, it is in parent segemnt).
10-30-2012 11:44 AM
there is certainly no wrokaround necessary, I do it already for many year, to create one customer with several company codes and several sales organizations in one IDOC. I did it this morning, and you can see the proof from the screen shot I gave you earlier.
you have to get move specific where exactly you get what error.
10-30-2012 11:56 AM
In "Start IDoc processing" step I get 2 IDocs with error 51: "Fill all required fields SAPMF02D 0111 ADDR1_DATA-NAME1". In we19 I get that it happens in spot where customer and 1st company code is created and program attempts to create next company code, but it is not using the parent data anymore, so all the fields other than ones in the child segment with company code, is empty.
EDITx2:
Btw, it looks like parent segment E1KNA1M in IDoc after error is empty. Erm.. That is in we19 if I look at it.... in LSMW if I look at it, the data segment for E1KNA1M is filled with data...
10-30-2012 12:53 PM
it sounds like a bug.
Check OSS using SAPMF02D 0111
there are many notes, if you do not find any suitable then open a message yourself to SAP