Skip to Content
0
Former Member
Nov 15, 2011 at 04:27 PM

Create customer date trough class cmd_ei_api - error in test run

670 Views

Hi all,

I try to use class cmd_ei_api to create customer. It works fine but one thing is strange.

When I pass data with test run and customer is in a group with internal nummering system icrease number every time when i run program. Customer is not created ( that is good) but the assigned nummer is lost.

I tried to use method maintain_bapi and maintain.Problem occurs every time.

Do you have the same problem? Do you know solution of this problem?

regards,

JG

SAMPLE CODE:

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'.

PARAMETERS: p_test type c as CHECKBOX DEFAULT 'X'.

start-of-selection.

free: wa_customer, wa_company_code_st, wa_customer.

wa_address-name = 'CUSTOMER NAME'.

wa_address-city = 'CITY'.

wa_address-postl_cod1 = '28-500'.

wa_address-street = '1400 9TH ST W'.

wa_address-country = 'PL'.

wa_address-langu = 'L'.

  • wa_address-region = 'FL'.

wa_address-sort1 = 'SORT1'.

wa_address-sort2 = 'Sort2'.

  • Assign address data directly

wa_customer-central_data-address-postal-data = wa_address.

wa_addressx-name = 'X'.

wa_addressx-city = 'X'.

wa_addressx-postl_cod1 = 'X'.

wa_addressx-street = 'X'.

wa_addressx-country = 'X'.

wa_addressx-langu = 'X'.

wa_addressx-region = 'X'.

wa_addressx-sort1 = 'X'.

wa_addressx-sort2 = 'X'.

wa_customer-central_data-address-postal-datax = wa_addressx.

wa_customer-central_data-central-data-ktokd = 'OKRA'.

wa_customer-central_data-central-data-STCD1 = '8291004247'.

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 = '0000201100'.

append wa_company_code_st to wa_company_code-company.

append wa_customer to wa_customers-customers.

call method cmd_ei_api=>maintain_bapi

EXPORTING

iv_test_run = p_test

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 and p_test is INITIAL.

commit work AND WAIT.

else.

ROLLBACK work.

endif.