Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Not able to update the Vendor communication details using maintain_bapi

HI,

I need small information.

I would like to update the Vendor master Details Like Street and Communication Details. So, i choose. Maintain_bapi. Below is my code.

I can able to update the Vendor Address Details like Street1, Street2 other things, But i am not able to update the communication details.

I put the break point at error_message. But It is not return any thing , Message text also not showing.

Any has faced this type of problem. Can u please share your experience.

DATA:VENDOR_OK TYPE VMDS_EI_MAIN,

VENDOR_ERR TYPE VMDS_EI_MAIN,

VENDOR_OK_MESSAGE TYPE CVIS_MESSAGE,

VENDOR_ERR_MESSAGE TYPE CVIS_MESSAGE.

DATA:LS_PHONE_MAIN TYPE CVIS_EI_CVI_PHONE,

LS_PHONE TYPE CVIS_EI_PHONE_STR,

LT_PHONE TYPE CVIS_EI_PHONE_T.

DATA:  LT_VENDORS            TYPE VMDS_EI_EXTERN_T,

           LS_VENDORS            TYPE VMDS_EI_EXTERN,

           LS_ADDRESS            TYPE CVIS_EI_ADDRESS1,

*           LS_COMM              TYPE CVIS_EI_PHONE_STR,

*           LS_TEL            TYPE CVIS_EI_PHONE_STR,

*           LS_TEL_T          TYPE CVIS_EI_PHONE_T,

            LS_TEL TYPE CVIS_EI_PHONE_STR,

*

*          ls_purchasing      TYPE vmds_ei_purchasing,

*          lt_purch_func      TYPE vmds_ei_functions_t,

*

           GS_VMDS_EXTERN    TYPE VMDS_EI_MAIN.

LS_VENDORS-HEADER-OBJECT_INSTANCE-LIFNR = '0030000005'.               "Pass the Vendor Number to be updt

LS_VENDORS-HEADER-OBJECT_TASK = 'U'.                                "Represents update

* *   SET THE NAME

LS_ADDRESS-POSTAL-DATA-NAME        = 'Test1'.                      "Name of the Vendor

LS_ADDRESS-POSTAL-DATA-STREET      = 'Flat 106, 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       = 'TEST T'.

LS_ADDRESS-POSTAL-DATA-STR_SUPPL1  = 'STR_SUPL1'.

LS_ADDRESS-POSTAL-DATA-STR_SUPPL2  = 'STR_SUPPL2'.

LS_ADDRESS-POSTAL-DATA-STR_SUPPL3  = 'STR_SUPPL3'.

LS_ADDRESS-POSTAL-DATA-CITY  = 'HYDERABAD'.

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

LS_ADDRESS-POSTAL-DATAX-STR_SUPPL1 = 'X'.

LS_ADDRESS-POSTAL-DATAX-STR_SUPPL2 = 'X'.

LS_ADDRESS-POSTAL-DATAX-STR_SUPPL3 = 'X'.

LS_ADDRESS-POSTAL-DATAX-CITY = '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.

""For telephone.

LS_PHONE-CONTACT-TASK = 'U'.

LS_PHONE-CONTACT-DATA-TELEPHONE = '69792'.

*  LS_PHONE-CONTACT-DATA-COUNTRY = 'IN'.

*  LS_PHONE-CONTACT-DATA-STD_NO = 'X'.

*  LS_PHONE-CONTACT-DATA-R_3_USER = '1'.

*  LS_PHONE-CONTACT-DATA-HOME_FLAG = 'X'.

*  LS_PHONE-CONTACT-DATA-CALLER_NO  = '69792'.

*  LS_PHONE-CONTACT-DATA-CONSNUMBER = '001'.

*  LS_PHONE-CONTACT-DATAX-COUNTRY = 'X'.

LS_PHONE-CONTACT-DATAX-TELEPHONE = 'X'.

*  LS_PHONE-CONTACT-DATAX-STD_NO = 'X'.

*  LS_PHONE-CONTACT-DATAX-R_3_USER = 'X'.

*  LS_PHONE-CONTACT-DATAX-HOME_FLAG = 'X'.

*  LS_PHONE-CONTACT-DATAX-CALLER_NO  = 'X'.

*  LS_PHONE-CONTACT-DATAX-CONSNUMBER = 'X'.

*  LS_VENDORS-CENTRAL_DATA-PHONE = LS_PHONE.

*LS_CUSTOMERS-CENTRAL_DATA-ADDRESS-COMMUNICATION-PHONE = LS_PHONE_MAIN .

*LS_VENDORS-CENTRAL_DATA-CONTACT-CONTACTS = LS_PHONE.

*LS_VENDORS-CENTRAL_DATA-ADDRESS = LS_ADDRESS.

APPEND LS_PHONE TO LT_PHONE.

*LS_VENDORS-CENTRAL_DATA-ADDRESS-PHONE = LS_TEL.

*LS_COMM-

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   = VENDOR_OK

    ES_MESSAGE_CORRECT       = VENDOR_OK_MESSAGE

    ES_MASTER_DATA_DEFECTIVE = VENDOR_ERR

    ES_MESSAGE_DEFECTIVE     = VENDOR_ERR_MESSAGE.

IF VENDOR_ERR_MESSAGE-IS_ERROR IS INITIAL.

  COMMIT WORK.

ENDIF.

Not what you were looking for? View more on this topic or Ask a question