Application Development 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: 

user exit for XD01 (Customer Creation)

tharaka_fernando
Contributor
0 Kudos

Hi All Gurus,

I need to extract some data (kunnr, name1, name2, telephone, mobile etc from KNA1, KNVV, KNBK tables) when user is creating a new customer. I have used the user exit SAPMF02D - EXIT_SAPMF02D_001 for the requirement.

I am getting all the required data except KUNNR. It is always blank, and according to my guessing it is because yet the KUNNR is not created.

Is there any other alternative or user exit for this scenario?

Thank you all in advance,

7 REPLIES 7

eduardo_hinojosa
Active Contributor
0 Kudos

Hi

Use the function module NUMBER_GET_INFO to know the last customer. Add 1 to know the next number. Take into account the SAP Note 141497 - Consulting: Buffering of number ranges to avoid problems of skipped numbers.

It's an idea that I hope it helps you

Regards

Eduardo

Former Member
0 Kudos

Implement BADI CUSTOMER_ADD_DATA and put all your code in SAVE_DATA method, the customer number that is about to be created will come in parameter I_KUNNR.

I just verified this in debug, that the customer number that is about to be created in XD01 comes in the SAVE_DATA method. The SAVE_DATA method can be used to update custom tables. Just ensure that you don't write COMMIT anywhere, the SAP standard will take care that all your custom table updates are saved along with the customer save.

kesavadas_thekkillath
Active Contributor
0 Kudos

Did you check the methods available in badi CUSTOMER_ADD_DATA . I see the methods MODIFY_ACCOUNT_NUMBER & CHECK_ACCOUNT_NUMBER and some others holding this value.

0 Kudos

Thank you all for the reply,

I tried using badi - CUSTOMER_ADD_DATA mehtod - SAVE_DATA.In here I get only the KUNNR value but not others.

How can I geet it ?

Can I import other method values (ex : CHECK_ALL_DATA method values) into SAVE_DATA ?

Thanks

marcin_milczynski
Contributor
0 Kudos

Hi,

You can use Business Transaction Event (BTE) 00001320 CUSTOMER MASTER DATA: Save for this purpose. You need to assign custom function module to the event in transactuion FIBF. The event is called after the insert/update on DB table is triggered, so the customer number is always available already.

Regards,

Marcin

This was a very useful post Marcin!
For those who need detailed steps for BTE regarding customer master data:
  1. Transaction FIBF
  2. Environment -> Infosystem P/S
  3. Find event code using google (debitors are 00001320)
  4. Click "Sample Function Module" and copy it to your FM (e.g. Z_CUSTOMER_UPDATED)
  5. Back in FIBF choose menu Settings -> Products -> ...of a customer and create one (check "Active"). Go back to FIBF
  6. Settings -> P/S Modules -> of a customer and assign your event + product + FM
  7. Now you can implement your FM

You can use this FM to track changes to customer master data and e.g. feed the information into interfacing systems.

0 Kudos

: we noticed that although the KUNNR of new customers is available, changes to contact persons address data (ADR3, ADR6) is not available when this BTE is called. With 00001321 you even get KNVK tables but telephone and email data ismissing and there is no way to SELECT the new telephone or email address.