cancel
Showing results for 
Search instead for 
Did you mean: 

Create Customer SD_CUSTOMER_MAINTAIN_ALL or CMD_EI_API

Former Member
0 Kudos

Hi,

I'm trying to create a function that makes it possible to create customers like in XD01.

I read in the forum that the function module SD_CUSTOMER_MAINTAIN_ALL shouldn't be used for that.

Is that correct?

I read also that I should use the Class CMD_EI_API with method MAINTAIN_BAPI. But when I try to create a customer I get the error: Mandatory partner role is missing for sales area 0003 01 05

Does anybody knwo what I'm missing in here?

Best regards,

Dennis

Accepted Solutions (1)

Accepted Solutions (1)

former_member191735
Active Contributor
0 Kudos

>

> Hi,

>

> I'm trying to create a function that makes it possible to create customers like in XD01.

> I read in the forum that the function module SD_CUSTOMER_MAINTAIN_ALL shouldn't be used for that.

> Is that correct?

>

> I read also that I should use the Class CMD_EI_API with method MAINTAIN_BAPI. But when I try to create a customer I get the error: Mandatory partner role is missing for sales area 0003 01 05

I think, you need to pass partner functions. You can see them in XD02 (with any existing customerS) with sales area data under sales area - partner functions.

You can also use the following bapi BAPI_CUSTOMER_CREATEFROMDATA to create customers online.

If it is a mass creation, you can go for LSMW.

Former Member
0 Kudos

Hi,

thanks for the reply. I found the mandantory partner functions and tried to add them.

but I got now some other errors regarding invalid partners.

I think the settings getting picked up by T770D regarding to the Account Group.

But it is weird that I also get errors now with some "Requiered" Date Fields that can be left blank in XD01.

The BAPI "BAPI_CUSTOMER_CREATEFROMDATA" doesn't support me with enough input I have to add and SD_CUSTOMER_MAINTAIN_ALL does not do any checks at all. But as CMD_EI_API causes a lot of trouble I might still go for the bapi and do reimplement the important checks myself.

Or is there any better way to create the customers. The endpurpose is a small Web Dynpro application with just a few of the feilds from XD01.

Regards,

Dennis

former_member191735
Active Contributor
0 Kudos

>

> Hi,

>

> thanks for the reply. I found the mandantory partner functions and tried to add them.

> but I got now some other errors regarding invalid partners.

> I think the settings getting picked up by T770D regarding to the Account Group.

>

> But it is weird that I also get errors now with some "Requiered" Date Fields that can be left blank in XD01.

>

> The BAPI "BAPI_CUSTOMER_CREATEFROMDATA" doesn't support me with enough input I have to add and SD_CUSTOMER_MAINTAIN_ALL does not do any checks at all. But as CMD_EI_API causes a lot of trouble I might still go for the bapi and do reimplement the important checks myself.

>

> Or is there any better way to create the customers. The endpurpose is a small Web Dynpro application with just a few of the feilds from XD01.

Customer creation is always a pain in the neck when it comes to do that in background. You need to pass all the required fields to BAPI .

Let me tell you about the checks.... you can implement the BADI to do checks for you instead of doing on your own.

Yes, you need to pass the account group like is it one time cusotmer or there are some entries in table T077D (KNA1-KTOKD).

Let me know if you need any further help on this.

madhu_vadlamani
Active Contributor
0 Kudos

Hi Sampath,

I want to create a bapi for customer creation. I want to access from external system . By seeing this mail i think you worked on this class. can you give me some idea how to work with this calla CMD_EI_API . Is is useful to create a customer.

Regards,

Madhu

Former Member
0 Kudos

You can create a customer using this class. You can get an example of how to properly fill the structures by using the extract class. I found the example code on how to call the extract class on SDN. Basically fill in your existing customer, and use the get_data method of class cmd_ei_api_extract.

Once you have your imported data, you can view the format of the input parameters that will be used to create the customers.

Through cmd_ei_api methods bapi_maintain or maintain

  • set the instance object to the donor account

ls_instance-kunnr = account. "KNA1-kunnr

ls_head-object_instance = ls_instance_don.

ls_head-object_task = lc_obj_task.

ls_cust-header = ls_head_don.

APPEND ls_cust TO lt_custs.

ls_e_main-customers = lt_custs.

CALL METHOD cmd_ei_api_extract=>get_data

EXPORTING

is_master_data = ls_e_main

IMPORTING

es_master_data = ls_i_main.

  • es_error = gf_open_error. "pe_error.

kesavadas_thekkillath
Active Contributor
0 Kudos

SD_CUSTOMER_MAINTAIN_ALL is used in standard programs also, You can also use it at your own risk.

Check it is used in BAPI_CUSTOMER_CREATEFROMDATA

Former Member
0 Kudos

Yes you are right SD_CUSTOMER_MAINTAIN_ALL is used in standard. But for a very precise purpose.

The maintenance of consumer. And this should only be true from the transaction itself.

There exists other cases, one of the oldest one is the BAPI_CUSTOMER_CREATEFROMDATA1. But is is exclusively reserved for SAP Online store.

Despite the fact CMD_EI_API is quite difficult to use, it has the main benefit that is it supported if being triggered directly.

For the maintenance of customers, there is NO BAPI and NO direct function module.

There are some functions modules like the one above where the name is looking nice. But these should not be used.

The only valid solutions are :

  • Below ECC 2005 (6.00), the only solution was batch input and DEBMAS idocs. See note 384462

  • Starting with ECC 2005 (6.00) and above: a synchronisation tool has been introduce. See class CMD_EI_API and VMD_EI_API

Hope this helps

BR

Alain

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi...to me the function works to fill the I_KNA1 structure with the fields KUNNR & KTOKD in case that the Customer was created.

Regards

former_member189545
Participant
0 Kudos

Hi Dennis,

please read the following note regarding SD_CUSTOMER_MAINTAIN_ALL:

1826993 - Function SD_CUSTOMER_MAINTAIN_ALL behaviour

If you use the Class CMD_EI_API you have to provide to CMD_EI_API the partner function you want to
store.
In your case, you have provided no partner function in the input
complex structure.

In clear, your report has to provide the partner functions you want to
maintain.
In order to easily find which are the mandatory partner functions
for an account group, you may look at class cmd_ei_api_check, method
get_mand_partner_functions.
This method can't be used directly, but at least it will provides you
with a code sample.

I hope I could help you to solve this issue:-)

Best regards,

Zsuzsanna

Former Member
0 Kudos

Hello,

when I try to use this method CMD_EI_API=>maintain_bapi to create a new customer master data, the system doesn't trigger the customer user exit EXIT_SAPMF02D_001.

Do you have any suggestions?

Thank you

Best regards

former_member189545
Participant
0 Kudos

Hi Dennis,

You have to provide to CMD_EI_API the partner function you want to store.
In your case, you might have not provided partner function in the input complex structure.

In clear, your report has to provide the partner functions you want to maintain.
In order to easily find which are the mandatory partner functions
for an account group, you may look at class cmd_ei_api_check, method
get_mand_partner_functions.
This method can't be used directly, but at least it will provides you
with a code sample.

I hope I could help you further.

Best regards,

Zsuzsanna

dhinesh_thirugnanam
Active Participant
0 Kudos

Hi Dennis

Its related to the Querry posted earlier by you about " Mandatory partner role is missing for sales area 0003 01 05 .I tried the note implementing it but I got an error message,stating system is already configured with advanced config (SAPKH60504).

Kindly let me know is there any solution to overcome the mandatory partner issue or am I missing anything.I have also posted it as a new issue(http://scn.sap.com/thread/3218239)

Thankyou,

Dhinesh