‎2010 Nov 03 1:47 AM
Hi All;
I am trying to write a test program to use this method. I almost have it working but I am getting an error message that I am missing critical partner functions. I have tried adding the Partner Functions to the Sales Data component but keep getting an error when attaching the "Functions" table to this component. Below is my sample program. It is based on other examples in this forms. Any ideas?
report zcreate_customer.
data: wa_header type cmds_ei_header,
wa_central_data type cmds_ei_vmd_central_data,
wa_central_datax type cmds_ei_vmd_central_data_xflag,
wa_address type bapiad1vl,
wa_addressx type bapiad1vlx,
wa_tax_ind_st type cmds_ei_tax_ind,
wa_tax_ind type cmds_ei_cmd_tax_ind,
wa_bankdetail_st type cvis_ei_cvi_bankdetail,
wa_bankdetail type cvis_ei_bankdetail,
wa_company_code_st type cmds_ei_company,
wa_company_code type cmds_ei_cmd_company,
wa_functions_st type cmds_ei_functions,
wa_functions_t type CMDS_EI_FUNCTIONS_T,
wa_functions type cmds_ei_cmd_functions,
wa_sales_data_st type cmds_ei_sales,
wa_sales_data type cmds_ei_cmd_sales,
wa_customer type cmds_ei_extern,
wa_customers type cmds_ei_main,
wa_correct type cmds_ei_main,
wa_defective type cmds_ei_main,
wa_mes_correct type cvis_message,
wa_mes_error type cvis_message.
constants: c_update type c value 'M',
c_insert type c value 'I'.
start-of-selection.
* A "customer" is made up of 4 Main Sections
* 1. HEADER
* 2. CENTRAL_DATA
* 3. COMPANY_DATA
* 4 SALES_DATA
free: wa_customer, wa_company_code_st, wa_customer.
wa_address-name = 'CUSTOMER NAME'.
wa_address-city = 'CITY'.
wa_address-postl_cod1 = '99999'.
wa_address-street = '1400 9TH ST W'.
wa_address-country = 'US'.
wa_address-langu = 'EN'.
wa_address-region = 'FL'.
wa_address-sort1 = 'SORT1'.
wa_address-sort2 = ''.
wa_address-taxjurcode = 'FL0000000'.
* wa_address-time_zone = 'UTC-6'.
* Assign address data directly
wa_customer-central_data-address-postal-data = wa_address.
wa_customer-central_data-address-postal-datax = wa_addressx.
* Account account group directly
wa_customer-central_data-central-data-ktokd = 'Z001'.
* wa_customer-central_data-central-datax-ktokd = 'X'.
wa_company_code_st-task = c_insert.
wa_company_code_st-data_key-bukrs = '1000'.
wa_company_code_st-data-zuawa = '009'.
wa_company_code_st-data-akont = '0000121000'.
wa_company_code_st-data-zwels = 'ACDETY'.
wa_company_code_st-data-zterm = 'Z000'.
wa_company_code_st-data-zgrup = '02'.
wa_company_code_st-data-xausz = '2'.
wa_company_code_st-data-xzver = 'X'.
append wa_company_code_st to wa_company_code-company.Continued...
Edited by: kishan P on Nov 3, 2010 8:13 AM
Edited by: kishan P on Nov 3, 2010 8:15 AM
‎2010 Nov 03 2:45 AM
Part II
wa_sales_data_st-task = c_insert.
wa_sales_data_st-data_key-vkorg = '1000'.
wa_sales_data_st-data_key-vtweg = '10'.
wa_sales_data_st-data_key-spart = '10'.
wa_sales_data_st-data-kalks = '1'.
wa_sales_data_st-data-inco1 = 'FOB'.
wa_sales_data_st-data-inco2 = 'Free on board'.
wa_sales_data_st-data-antlf = '9'.
wa_sales_data_st-data-kzazu = 'X'.
wa_sales_data_st-data-vsbed = '01'.
wa_sales_data_st-data-waers = 'USD'.
wa_sales_data_st-data-ktgrd = '01'.
wa_sales_data_st-data-zterm = 'Z000'.
* wa_sales_data_st-functions-functions-data_key-parvw = 'SP'.
wa_functions_st-data_key-parvw = 'SP'.
wa_functions_st-data_key-parza = '000'.
append wa_functions_st to wa_functions_t.
wa_functions_st-data_key-parvw = 'BP'.
wa_functions_st-data_key-parza = '000'.
append wa_functions_st to wa_functions_t.
wa_functions_st-data_key-parvw = 'PY'.
wa_functions_st-data_key-parza = '000'.
append wa_functions_st to wa_functions_t.
wa_functions_st-data_key-parvw = 'SH'.
wa_functions_st-data_key-parza = '000'.
append wa_functions_st to wa_functions_t.
* wa_functions = wa_functions_t.
* wa_sales_data_st-functions = wa_functions.
append wa_sales_data_st to wa_sales_data-sales.
wa_customer-header-object_instance-kunnr = ''.
wa_customer-header-object_task = c_insert.
wa_customer-company_data = wa_company_code.
wa_customer-sales_data = wa_sales_data.
append wa_customer to wa_customers-customers.
call method cmd_ei_api=>maintain_bapi
EXPORTING
iv_test_run = 'X'
iv_collect_messages = 'X'
is_master_data = wa_customers
IMPORTING
es_master_data_correct = wa_correct
es_message_correct = wa_mes_correct
es_master_data_defective = wa_defective
es_message_defective = wa_mes_error.
if wa_mes_error-is_error is initial.
commit work.
endif.
‎2010 Nov 03 2:37 PM
Hi All;
I finally figured it out.
This line
append wa_functions_st to wa_functions_t.
has to be append wa_functions_st to wa_functions-functions.
Note, there are still other issues with this code, but it is close to working.
‎2010 Nov 03 2:55 PM
Please note one thing while using this.
There will be field called CURRENT_STATE in some of the structures.
mark it as space if you are passing incomplete data and as X when you are passing complete data.
It once happened for me like i was just passsing the deletion indicator for vendor master , for example in XK02 there are some mandatory fields which were already aving value filled in it . when i passed X to CURRENT_STATE only with the deletion indicator as X . It deleted all the values i the mandatory fields.
Anyways this case was while using VMD_EI_API . Not sure how it is in CMD_EI_API
‎2010 Nov 03 8:33 PM
Hi All;
I now have this working. I had to replace the SD Partner Functions with their Germany code and not use their English code (i.e. use RE instead of BP).
I am however still having problems getting it to create a Business Partner in Collections Management when the customer is created via this class. When I create a customer using XD01, the Business Partner gets created in Collections Management automatically so I would have thought that the class should have done the same.
Any thoughts?
Also, what is the difference between cmd_ei_api=>maintain and cmd_ei_api=>maintain_bapi.
Thanks
Stephen
‎2021 Apr 21 5:11 PM
cmd_ei_api => maintain
The result output has no new customer number
cmd_ei_api=>maintain_bapi.
The result output has the new customer number。---es_vmds_ei_main
‎2013 Mar 21 7:01 AM