cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Method CMD_EI_API MAINTAIN does not commit

Former Member
0 Likes
2,574

Hi gurus,

I tried to use the method MAINTAIN in the class CMD_EI_API to create a new customer, I tried both from transaction se24 and from a report to call it. No error message and a new customer number generated but when a look for it in transaction XD03 I get the error message: Customer 10002 has not been created.

Any help will be appreciate

Leo

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Just COMMIT WORK yourself after the call to the method, it should work.

Also check the error tables for any messages.

Former Member
0 Likes

It works, thank you very much

Answers (1)

Answers (1)

0 Likes

Hello,

Could you please help me on how to use this class for both customer creation and update? A sample code would be of great help.

Thanks.

Former Member
0 Likes

Hi Padmini..

U got any idea about commit.. I also facing same problem.. HOw commit work after calling method.

Regards

Prabu

dkle
Participant
0 Likes

Hi ABAPers,

this is my example code for updating two KNVV-fields of a single customer.

As you might notice, one of the fields is a ZZ-field, which requires to do some additional

work to get it updated (Refer to my post at [;).

Regards

Daniel Klein


    DATA  is_master_data  TYPE cmds_ei_main.
    DATA: es_master_data  TYPE cmds_ei_main.
    DATA: es_error        TYPE cvis_message.
    DATA: wa_customers    TYPE cmds_ei_extern.
    DATA: lt_sales        TYPE cmds_ei_sales_t.
    DATA: wa_sales        LIKE LINE OF lt_sales.

* Check obligatory fields for KNVV
    CHECK gp_vkorg IS NOT INITIAL AND gp_vtweg IS NOT INITIAL
      AND gp_spart IS NOT INITIAL.
* Control parameters
      wa_customers-header-object_instance-kunnr = '0006206900'.    "customer number
      wa_customers-header-object_task = 'U'.                       "update customer
      APPEND wa_customers TO is_master_data-customers.
* Read customer
      cmd_ei_api_extract=>get_data( EXPORTING is_master_data = is_master_data
                                    IMPORTING es_master_data = es_master_data ).
* Change the read-data 
      CLEAR is_master_data.
      is_master_data = es_master_data.
      READ TABLE is_master_data-customers INDEX 1 INTO wa_customers.
      DELETE is_master_data-customers INDEX 1.
      lt_sales = wa_customers-sales_data-sales.
      READ TABLE lt_sales WITH KEY  data_key-vkorg = gp_vkorg
                                    data_key-vtweg = gp_vtweg
                                    data_key-spart = gp_spart
                                    INTO wa_sales .
      wa_sales-data-kvgr1 = 'BB'.                       "new field value
      wa_sales-datax-kvgr1 = abap_true.                 "flag: change this field
      wa_sales-data-zzbemerkung = 'MAINTAIN-Bemerkung'. "new field value
      wa_sales-datax-zzbemerkung = abap_true.           "flag: change this field
      wa_sales-task = 'U'.                              "Maintaining-mode: update

      CLEAR wa_customers-sales_data-sales.
      APPEND wa_sales TO wa_customers-sales_data-sales.
      APPEND wa_customers TO is_master_data-customers.

* Testing update on customer
      cmd_ei_api=>maintain( EXPORTING is_master_data = is_master_data
                            IMPORTING es_error = es_error ).
      IF es_error-is_error IS INITIAL.
*  No errors? Commit work
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait = abap_true.
      ELSE.
        CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
      ENDIF.

Edited by: D. Klein [GER] on Nov 18, 2011 3:16 PM + Rollback

dhinesh_thirugnanam
Contributor
0 Likes

Hi Daniel,

I am this class(CMD_EI_API)method(MAINTAIN_DIRECT_INPUT) to create a customer

I am getting this error when I pass all the mandatory data "Customer 600205: Mandatory partner role is missing for sales area GVR GV GV".

I have posted this as a new issue(http://scn.sap.com/thread/3218239).As you have dealt with this class.

Kindly suggest me.