Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

customer IDOC

Former Member
0 Likes
1,739

If SAP has some customer record and If again i am sending the same record ,

How would SAP react in that case.

would it look and match each and every field of customer with existing customer and throws an exception?

or would it add new line in table and give it a unique SAP customer number ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,684

Hi,

It all depends on which IDOC you are using and how that IDOC works.

There are multiple possibilities here.

1. If customer does not exit, then IDOC will definitely update the records

2. If customer already exist, then IDOC might not update anything

3. If customer already exist, then it check whether any change in the data. If there is a change then it modifies the data.

Let me know which IDOC you are using and how you are are processing this IDOC so i can give you exact answer.

Let me know if you have any other question.

Regards,

RS

If SAP has some customer record and If again i am sending the same record ,

How would SAP react in that case.

would it look and match each and every field of customer with existing customer and throws an exception?

or would it add new line in table and give it a unique SAP customer number ?

12 REPLIES 12
Read only

Former Member
0 Likes
1,684

It will match the primary key of the table. If the record does exists, it will modify otherwise it will insert.

Thanks,

SKJ

Read only

0 Likes
1,684

thanks for you response,

How could i find out which all fields in DEBMAS06 are mandatory fields?

Read only

0 Likes
1,684

Hi,

You can not say which fields are mandatory. You can check which segments are mandatory. Go to transaction WE60 and dispaly the IDOC tree. Here with each segments it show if segment is mandatory and what is the min / man allowed segments for this type.

To find which fields are mandatory you have two options.

- Use transaction <b>WE19</b> ( test tool for idoc processing ). Enter basic type DEBMAS06. Here populate the fields which you thing are mandatory and process inbound idoc. This way you have to trial and error to find out mandatory / required fields for your purpose.

- the second options you have is, <b>generate outbound customer idoc</b> for one customer. See what fields are being populated. Fill up same fields in inbound idocs.

Let me know if you have any question.

Regards,

RS

Read only

0 Likes
1,684

Question is not for mandatory field,

but question is

which are primary field in DEBMAS06 which SAP would see to find out whether record already exist in SAP or not

Read only

0 Likes
1,684

Obviously, it has to be KUNNR customer number.

Thanks,

SKJ

Read only

0 Likes
1,684

Thanks SKJ ...

so it means whenever i enter new record, SAP would add that in SAP irrespective of new record has everything same , only thing which new record would not be having would be SAP customer number as its entering first time into SAP.

Read only

Former Member
0 Likes
1,685

Hi,

It all depends on which IDOC you are using and how that IDOC works.

There are multiple possibilities here.

1. If customer does not exit, then IDOC will definitely update the records

2. If customer already exist, then IDOC might not update anything

3. If customer already exist, then it check whether any change in the data. If there is a change then it modifies the data.

Let me know which IDOC you are using and how you are are processing this IDOC so i can give you exact answer.

Let me know if you have any other question.

Regards,

RS

Read only

0 Likes
1,684

I am using DEBMAS06 IDoc and scenario is :

SAP would get data from 2 source and it could be possible that <b>source A</b> send <b>customerData1</b> to SAP and

later on <b>source B</b> would again send <b>customerData1.</b>

Would SAP insert this Customer ?

Which fields of DEBMAS06 idoc SAP would compare to check whether customer exist or not?

Read only

0 Likes
1,684

Hi,

The FM to upload custom master is IDOC_INPUT_DEBITOR. This FM inturn call a FM ERP_IDOC_INPUT_DEBITOR. I checked and found out that, the checking of customer already exist or not done with very first segment E1KNA1M. This is the program flow

FM <b>IDOC_INPUT_DEBITOR</b> --> FM <b>ERP_IDOC_INPUT_DEBITOR</b> --> PERFORM <b>FILL_APPL_STRUCTURES</b> ( include <b>LVV02F3N</b> ) --> Here on the <b>line item '349'</b> the code is line this.

*     E1KNA1M
      WHEN c_segnam_e1kna1m.
        PERFORM init_bkn00(rfbidei0) USING bkn00.

        SELECT SINGLE * FROM kna1 WHERE kunnr = h_kunnr.
        IF sy-subrc = 0.
          h_ktokd     = kna1-ktokd.
          bkn00-ktokd = kna1-ktokd.
          bkn00-tcode = 'XD02'.
        ELSE.
          bkn00-tcode = 'XD01'.
        ENDIF.

You can see here that if customer already exit then the trnasaction called is XD02. It also explains that down the line in program flow, it will do BDC to update the customer master record.

Let me know if you have any question.

Regards,

RS

Read only

0 Likes
1,684

thanks RS for your reponse,

So do you think , we could add some more field to check for data consistency in SAP ?

I mean apart from KUNNAR field of IDOC which indicates SAP Customer number, could i add some more field in FM to check whether record should enter into SAP as new customer or not???

Read only

0 Likes
1,684

The above code says that, if you are passing existing KUNNR the SAP would call XD02 - customer change.

If not, it will insert a new record by calling XD01.

Bottom line is we must pass the mandatory fields which SAP needs to insert a record. And these mandatory fields are ultimately primary keys.

Note: KUNNRs are auto generated or need to be entered by the user depending upon the config settings (External or Internal Number Range)

Hope this solves your problem.

Thanks,

SKJ

Read only

0 Likes
1,684

Hi,

I do not think you can add anything at this place and i do not suggest to modify standard SAP code too. There might be other checking also in this program flow down the line but you will have to go through the code to see if there is any.

The only user-exit available for this IDOC ( inbound ) is <b>EXIT_SAPLVV02_001</b> in enhancement <b>VSV00001</b>.

Let me know if you have any other question.

Regards,

RS