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: 

unable to vendor master record update using class vmd_ei_api

Former Member
0 Kudos
3,252

Hi All,

    I'm able to create vendor master record using class VMD_EI_API and method MAINTAIN_BAPI but not able to update vendor master record using same  class .

Can anybody please suggest what is the process to update vendor master record using this class VMD_EI_API ?

1 ACCEPTED SOLUTION

former_member212005
Active Contributor
0 Kudos
450

Alok:

Where are you finding the difficulty?

MAINTAIN_BAPI can be used for updating Vendor as well. Just tried it and it works well.

Below are sample codes for updating address of Vendor:

{Code}

DATA:  lt_vendors            TYPE vmds_ei_extern_t,

           ls_vendors            TYPE vmds_ei_extern,

           ls_address            TYPE cvis_ei_address1,

            gs_vmds_extern    TYPE vmds_ei_main.

     ls_vendors-header-object_instance-lifnr = p_lifnr.               "Pass the Vendor Number to be updt

     ls_vendors-header-object_task = 'U'.                                "Represents update

*   Set the Name

     ls_address-postal-data-name        = 'Test'.                      "Name of the Vendor

     ls_address-postal-data-street      = 'Flat 105, ABS Road'.

     ls_address-postal-data-postl_cod1  = '400062'.

     ls_address-postal-data-region      = '13'.

     ls_address-postal-data-country     = 'IN'.

     ls_address-postal-data-sort1       = gv_name.

     ls_address-postal-data-langu       = sy-langu.

*   For all the fields where value was provided, set the flag value also to be 'X'

     ls_address-postal-datax-name       = 'X'.

     ls_address-postal-datax-street     = 'X'.

     ls_address-postal-datax-postl_cod1 = 'X'.

     ls_address-postal-datax-region     = 'X'.

     ls_address-postal-datax-sort1      = 'X'.

     ls_address-postal-datax-country    = 'X'.

     ls_address-postal-datax-langu      = 'X'.

*    Represents that we are updating address of the Vendor

     ls_address-task                    = 'U'.

*   Set the Address for the Vendor

     ls_vendors-central_data-address = ls_address.

     APPEND ls_vendors TO lt_vendors.

*   Set the Final Vendor Data based on which it has to be updated

*   Note if multiple vendors are to be updated...please maintain multiple entries in LT_VENDORS

    gs_vmds_extern-vendors = lt_vendors[].

*   Initialize all the data

     vmd_ei_api=>initialize( ).

*   Call the Method for updation of Vendor.

     CALL METHOD vmd_ei_api=>maintain_bapi

       EXPORTING

         is_master_data           = gs_vmds_extern

       IMPORTING

         es_master_data_correct   = gs_vmds_succ

         es_message_correct       = gs_succ_messages

         es_master_data_defective = gs_vmds_error

         es_message_defective     = gs_err_messages.

     IF gs_err_messages-is_error IS INITIAL.

       COMMIT WORK.

     ENDIF.

{code}

Let me know as to what error are you receiving!

8 REPLIES 8

former_member213275
Contributor
0 Kudos
450

Hi Alok,

Please look at the code for creation of vendor using class VMD_EI_API

http://scn.sap.com/docs/DOC-42312

Please close the thread if it is helpful/answered.

Srikanth.

0 Kudos
450

This message was moderated.

former_member212005
Active Contributor
0 Kudos
451

Alok:

Where are you finding the difficulty?

MAINTAIN_BAPI can be used for updating Vendor as well. Just tried it and it works well.

Below are sample codes for updating address of Vendor:

{Code}

DATA:  lt_vendors            TYPE vmds_ei_extern_t,

           ls_vendors            TYPE vmds_ei_extern,

           ls_address            TYPE cvis_ei_address1,

            gs_vmds_extern    TYPE vmds_ei_main.

     ls_vendors-header-object_instance-lifnr = p_lifnr.               "Pass the Vendor Number to be updt

     ls_vendors-header-object_task = 'U'.                                "Represents update

*   Set the Name

     ls_address-postal-data-name        = 'Test'.                      "Name of the Vendor

     ls_address-postal-data-street      = 'Flat 105, ABS Road'.

     ls_address-postal-data-postl_cod1  = '400062'.

     ls_address-postal-data-region      = '13'.

     ls_address-postal-data-country     = 'IN'.

     ls_address-postal-data-sort1       = gv_name.

     ls_address-postal-data-langu       = sy-langu.

*   For all the fields where value was provided, set the flag value also to be 'X'

     ls_address-postal-datax-name       = 'X'.

     ls_address-postal-datax-street     = 'X'.

     ls_address-postal-datax-postl_cod1 = 'X'.

     ls_address-postal-datax-region     = 'X'.

     ls_address-postal-datax-sort1      = 'X'.

     ls_address-postal-datax-country    = 'X'.

     ls_address-postal-datax-langu      = 'X'.

*    Represents that we are updating address of the Vendor

     ls_address-task                    = 'U'.

*   Set the Address for the Vendor

     ls_vendors-central_data-address = ls_address.

     APPEND ls_vendors TO lt_vendors.

*   Set the Final Vendor Data based on which it has to be updated

*   Note if multiple vendors are to be updated...please maintain multiple entries in LT_VENDORS

    gs_vmds_extern-vendors = lt_vendors[].

*   Initialize all the data

     vmd_ei_api=>initialize( ).

*   Call the Method for updation of Vendor.

     CALL METHOD vmd_ei_api=>maintain_bapi

       EXPORTING

         is_master_data           = gs_vmds_extern

       IMPORTING

         es_master_data_correct   = gs_vmds_succ

         es_message_correct       = gs_succ_messages

         es_master_data_defective = gs_vmds_error

         es_message_defective     = gs_err_messages.

     IF gs_err_messages-is_error IS INITIAL.

       COMMIT WORK.

     ENDIF.

{code}

Let me know as to what error are you receiving!

0 Kudos
450

Thanks Vineesh!

Now I'm also able to update vendor master data with the help of your code as I was not setting flag value 'X' in datax fields.

Once again thank you very much..

Regards,

Alok

JeetOP
Participant
0 Kudos
450

Hi iam getting error 'address number or address handle missing' while creating conatct person detail using vmd_ei_api... please suggest which fields should be pass.

0 Kudos
450

Abhijeet:

Did you check the link below?

The below set of codes are to be checked....

*   Set Contact Person

    REFRESH: lt_contacts[].

    CLEAR ls_contacts.

    ls_contacts-task = 'I'.                                                         "Represents Creation of Contact person

    ls_contacts-address_type_3-task = 'I'.                               "Represents Creation of Address for CP

*   Specify how many Contact Person numbers are to be obtained

*   This will simply provide us a contact person number

*   NOTE: If the note 1749700 is present in the system, then the contact person number can be left empty

    CALL FUNCTION 'BAPI_PARTNEREMPLOYEE_GETINTNUM'

      EXPORTING

        quantity  = '1'

      IMPORTING

        contactid = lv_contactid.

    ls_contacts-data_key-parnr = lv_contactid.                          "Contact Person Number

*   Set the Name for Contact person

    ls_contacts-address_type_3-postal-data-fullname   = 'John Doe'.

    ls_contacts-address_type_3-postal-data-firstname  = 'John'.

    ls_contacts-address_type_3-postal-data-lastname  = 'Doe'.

    APPEND ls_contacts TO lt_contacts.

JeetOP
Participant
0 Kudos
450


Hi, i check the link also but the issuse is record iare.

1. if im using maintain_bapi for creation of contact person as per ur above code its executing but value is not populating in knvk table or vendor ' screen in xk02 tcode.

2. if im using maintain _bapi for editing contact person ie. first im using bdc to create contact person of vendor with mandatory field (name, last name, department& p.function)

second adding communication details such as telephone fax or email(by using address_type3 structure) its showing error:'Address Number or Address handle missing'. But the thing is im passing adrnr in address->postal(structure ) of vendor.

so kindly suggest wer is the error?

0 Kudos
450

have you solve with this?