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: 

Class CMD_EI_API does not extend customer

Former Member
0 Kudos
488

Hi All,

I have a requirement of extending an existing customer for a company code. For testing purpose I have hard coded some values in a program.

This program is running well without any errors in the class but does not extend the customer. When I try to run the program for the same customer again,

it says 'customer is already created in the company code'. When I am going to XD03, system gives message that customer is not created for the company code. I am providing code for reference. Kindly suggest if any changes are to be made.

DATA: WA_CUSTOMERS1 TYPE CMDS_EI_EXTERN,
       IS_MASTER_DATA1 TYPE CMDS_EI_MAIN.
DATA : IT_COMPANY TYPE CMDS_EI_COMPANY_T.
DATA : WA_COMPANY LIKE LINE OF IT_COMPANY.
DATA : WA_MASTER_DATA_CORRET TYPE CMDS_EI_MAIN,
        WA_MESSAGE_CORRECT TYPE CVIS_MESSAGE,
        WA_MASTR_DATA_DEFECTIVE TYPE CMDS_EI_MAIN,
        WA_MSG_DEFECTIVE TYPE CVIS_MESSAGE,
        wa_central type CMDS_EI_CENTRAL_DATA.

CLEAR : WA_COMPANY, WA_CUSTOMERS1, is_master_data1.
wa_customers1-header-object_instance-kunnr = '100197'.    "customer number
wa_customers1-header-object_task = 'I'.

wa_company-TASK = 'I'.
WA_COMPANY-DATA_KEY-BUKRS = 'PS02'.
WA_COMPANY-DATA-AKONT = '0000140000'.
WA_COMPANY-DATAX-AKONT = 'X'.

*WA_CUSTOMERS1-HEADER-OBJECT_TASK = 'M'.
wa_CUSTOMERS1-CENTRAL_DATA-central-data-ktokd = 'ZSRS'.
WA_CUSTOMERS1-CENTRAL_DATA-centrAl-DATAX-KTOKD = 'X'.
WA_CUSTOMERS1-CENTRAL_DATA-ADDRESS-POSTAL-DATA-NAME = 'Rajesh Chaudhari'.
wa_customers1-central_data-address-postal-datax-name = 'X'.
WA_CUSTOMERS1-CENTRAL_DATA-ADDRESS-POSTAL-DATA-SORT1 = 'CHAUDHARI'.
WA_CUSTOMERS1-CENTRAL_DATA-ADDRESS-POSTAL-DATAX-SORT1 = 'X'.
WA_CUSTOMERS1-CENTRAL_DATA-ADDRESS-POSTAL-DATA-CITY = 'Cincinnati'.
WA_CUSTOMERS1-CENTRAL_DATA-ADDRESS-POSTAL-DATAX-CITY = 'X'.
WA_CUSTOMERS1-CENTRAL_DATA-ADDRESS-POSTAL-DATA-LANGU = 'EN'.
WA_CUSTOMERS1-CENTRAL_DATA-ADDRESS-POSTAL-DATAX-LANGU = 'X'.
WA_CUSTOMERS1-CENTRAL_DATA-ADDRESS-POSTAL-DATA-COUNTRY = 'US'.
WA_CUSTOMERS1-CENTRAL_DATA-ADDRESS-POSTAL-DATAX-COUNTRY = 'X'.

APPEND WA_COMPANY TO WA_CUSTOMERS1-COMPANY_DATA-COMPANY.
APPEND WA_CUSTOMERS1 TO IS_MASTER_DATA1-CUSTOMERS.

CALL METHOD CMD_EI_API=>MAINTAIN_BAPI
   EXPORTING
     IV_TEST_RUN              = SPACE
     IV_COLLECT_MESSAGES      = SPACE
     IS_MASTER_DATA           = IS_MASTER_DATA1
   IMPORTING
     ES_MASTER_DATA_CORRECT   = WA_MASTER_DATA_CORRET
     ES_MESSAGE_CORRECT       = WA_MESSAGE_CORRECT
     ES_MASTER_DATA_DEFECTIVE = WA_MASTR_DATA_DEFECTIVE
     ES_MESSAGE_DEFECTIVE     = WA_MSG_DEFECTIVE
     .

COMMIT WORK. ( I have tried using BAPI_TRANSACTION_COMMIT also)

3 REPLIES 3

Former Member
0 Kudos
78

Did you try COMMIT WORK and WAIT.

kesavadas_thekkillath
Active Contributor
0 Kudos
78

Conversion exits ( add leading zero to the customer no )

Former Member
0 Kudos
78

Please can you let me know what was the solution for this issue. We are also having similar problem.