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: 

update communication details in BP transaction

Former Member
0 Kudos
1,819

Dear friends ,

Please give me your suggessions or code if available ,for updating standard address and communication details like telephone ,fax, mobile numbers to BP transaction using the BAPI bapi_bupa_address_change.Presently the BAPI is returning error like data to be uploaded is not found in target place.Which all are the mandatory entries for this bapi while uploading communication details?

REGARDS ,

PARVATHY

4 REPLIES 4

former_member555112
Active Contributor
0 Kudos
297

Hi,

I had faced a similar problem. I had updated the communication details individually as follows:

First telephone using BUPA_ADDRESS_CHANGE,

then fax again calling BUPA_ADDRESS_CHANGE

then telex again calling BUPA_ADDRESS_CHANGE and so on.

Example


----


  • COMMUNICATION DETAILS ADD/CHANGE

----


  • add or change telephone details

IF y_wa_supplier-telf1 NE y_k_nodata OR

y_wa_supplier-telf2 NE y_k_nodata OR

y_wa_supplier-mob_number NE y_k_nodata.

IF y_wa_supplier-land1 NE y_k_nodata.

PERFORM y_f_telephone USING y_wa_supplier

y_li_tel_ex

CHANGING y_li_tel

y_li_tel_x.

  • Update telephone fo the customer.

CALL FUNCTION 'BUPA_ADDRESS_CHANGE'

EXPORTING

iv_partner = y_wa_supplier-supplier_id

iv_partner_guid = y_lv_guid

TABLES

it_adtel = y_li_tel

it_adtel_x = y_li_tel_x

et_return = y_li_return.

READ TABLE y_li_return

INTO y_lwa_return

WITH KEY type = y_k_e.

IF sy-subrc EQ 0.

MOVE y_k_x TO y_lv_errflg.

LOOP AT y_li_return INTO y_lwa_return

WHERE type = y_k_e.

MOVE : y_wa_supplier TO y_wa_supplier_msg,

y_lwa_return-message TO y_wa_supplier_msg-message.

APPEND y_wa_supplier_msg TO y_i_supplier_msg.

CLEAR : y_lwa_return.

ENDLOOP.

REFRESH y_li_return.

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

DELETE y_i_supplier INDEX y_lv_indx.

CLEAR : y_lv_errflg.

CONTINUE.

ELSE.

REFRESH y_li_return.

ENDIF.

ELSE.

  • THe country should be compulsorly specified incase communication

  • data is to be changed

MOVE y_k_x TO y_lv_errflg.

MOVE : y_wa_supplier TO y_wa_supplier_msg.

CONCATENATE text-x01 text-x02

INTO y_wa_supplier_msg-message.

APPEND y_wa_supplier_msg TO y_i_supplier_msg.

CLEAR : y_lwa_return.

REFRESH y_li_return.

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

DELETE y_i_supplier INDEX y_lv_indx.

CLEAR : y_lv_errflg.

CONTINUE.

ENDIF.

ENDIF.

----


  • add or change fax details

----


IF y_wa_supplier-telfx NE y_k_nodata.

IF y_wa_supplier-land1 NE y_k_nodata.

PERFORM y_f_fax USING y_wa_supplier

y_li_fax_ex

CHANGING y_li_fax

y_li_fax_x.

  • Update fax details fo the customer.

CALL FUNCTION 'BUPA_ADDRESS_CHANGE'

EXPORTING

iv_partner = y_wa_supplier-supplier_id

iv_partner_guid = y_lv_guid

TABLES

it_adfax = y_li_fax

it_adfax_x = y_li_fax_x

et_return = y_li_return.

READ TABLE y_li_return

INTO y_lwa_return

WITH KEY type = y_k_e.

IF sy-subrc EQ 0.

MOVE y_k_x TO y_lv_errflg.

LOOP AT y_li_return INTO y_lwa_return

WHERE type = y_k_e.

MOVE : y_wa_supplier TO y_wa_supplier_msg,

y_lwa_return-message TO y_wa_supplier_msg-message.

APPEND y_wa_supplier_msg TO y_i_supplier_msg.

CLEAR : y_lwa_return.

ENDLOOP.

REFRESH y_li_return.

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

DELETE y_i_supplier INDEX y_lv_indx.

CLEAR : y_lv_errflg.

CONTINUE.

ELSE.

REFRESH y_li_return.

ENDIF.

ELSE.

  • THe country should be compulsorly specified incase communication

  • data is to be changed

MOVE y_k_x TO y_lv_errflg.

MOVE : y_wa_supplier TO y_wa_supplier_msg.

CONCATENATE text-x01 text-x02

INTO y_wa_supplier_msg-message.

APPEND y_wa_supplier_msg TO y_i_supplier_msg.

CLEAR : y_lwa_return.

REFRESH y_li_return.

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

DELETE y_i_supplier INDEX y_lv_indx.

CLEAR : y_lv_errflg.

CONTINUE.

ENDIF.

ENDIF.


Please read the documentation on the BAPI very carefully.

The sequence of records is very important for every kind of communication details i.e.

To add or change telphone number

telephone numbers whihc are to be changed should be added first and

then the oners which are to be inserted

Regards,

Ankur Parab

Edited by: Ankur Parab on May 25, 2009 4:40 PM

Edited by: Ankur Parab on May 25, 2009 4:41 PM

former_member555112
Active Contributor
0 Kudos
297

Hi,

contd.

Please read the documentation on the BAPI very carefully. The sequence of records is very important for every kind of communication details i.e. To add or change telphone number telephone numbers whihc are to be changed should be added first and then the oners which are to be inserted

Teh perform is as follows:-


FORM y_f_telephone  USING
                          y_lwa_supplier  TYPE y_t_supplier1
                          y_li_tel_ex     TYPE y_tt_bapiadtel
                  CHANGING
                          y_li_tel        TYPE y_tt_bapiadtel
                          y_li_tel_x      TYPE y_tt_bapiadtelx.


  DATA: y_lwa_adtel     TYPE bapiadtel,
        y_lwa_adtel_ex  TYPE bapiadtel,
        y_lwa_adtel_x   TYPE bapiadtelx.


  DATA : y_li_insert_tel   TYPE STANDARD TABLE OF bapiadtel,
         y_li_insert_tel_x TYPE STANDARD TABLE OF bapiadtelx,
         y_li_update_tel   TYPE STANDARD TABLE OF bapiadtel,
         y_li_update_tel_x TYPE STANDARD TABLE OF bapiadtelx.


  DATA : y_lv_chng      TYPE flag,
         y_lv_updateind TYPE ad_updflag .


  DATA : y_li_tel_int TYPE STANDARD TABLE OF y_t_con_no,
         y_li_mob_int TYPE STANDARD TABLE OF y_t_con_no.


  DATA : y_lwa_tel_int TYPE y_t_con_no,
         y_lwa_mob_int TYPE y_t_con_no.



  REFRESH :  y_li_tel,  y_li_tel_x.


  LOOP AT y_li_tel_ex INTO y_lwa_adtel_ex
  WHERE country  = y_lwa_supplier-land1
  AND   r_3_user NE y_k_3.

    MOVE: y_lwa_adtel_ex-country    TO y_lwa_tel_int-country,
          y_lwa_adtel_ex-consnumber TO y_lwa_tel_int-consnumber,
          sy-tabix                  TO y_lwa_tel_int-pos.
    APPEND y_lwa_tel_int TO y_li_tel_int.

  ENDLOOP.

  SORT y_li_tel_int BY consnumber pos.

  LOOP AT y_li_tel_ex INTO y_lwa_adtel_ex
  WHERE country  = y_lwa_supplier-land1
  AND   r_3_user = y_k_3 .

    MOVE: y_lwa_adtel_ex-country    TO y_lwa_mob_int-country,
          y_lwa_adtel_ex-consnumber TO y_lwa_mob_int-consnumber,
          sy-tabix                  TO y_lwa_mob_int-pos.
    APPEND y_lwa_mob_int TO y_li_mob_int.

  ENDLOOP.

  SORT y_li_mob_int BY consnumber pos.




*----------------------------------------------------------------*
*Change or insert the first telephonenumber
*----------------------------------------------------------------*


  READ TABLE y_li_tel_int INTO y_lwa_tel_int
  INDEX 1.

  IF sy-subrc EQ 0.

* 1st telephone number already exists and should be updated

    IF NOT y_lwa_supplier-telf1 EQ y_k_nodata.

      y_lv_updateind = y_k_u.


      MOVE : y_lwa_supplier-land1     TO y_lwa_adtel-country,
             y_lwa_supplier-telf1     TO y_lwa_adtel-telephone,
             y_k_1                    TO y_lwa_adtel-r_3_user,
             y_lwa_tel_int-consnumber TO y_lwa_adtel-consnumber.

      APPEND y_lwa_adtel   TO y_li_update_tel.


      MOVE:   y_k_x                TO y_lwa_adtel_x-country,
              y_k_x                TO y_lwa_adtel_x-telephone,
              y_k_x                TO y_lwa_adtel_x-r_3_user,
              y_lv_updateind       TO y_lwa_adtel_x-updateflag.

      APPEND y_lwa_adtel_x TO y_li_update_tel_x .

    ENDIF.



  ELSE.
* 1st telephone number does not exist and should be inserted

    y_lv_updateind = y_k_i.
    IF NOT y_lwa_supplier-telf1 EQ y_k_nodata.

      MOVE : y_lwa_supplier-land1     TO y_lwa_adtel-country,
             y_lwa_supplier-telf1     TO y_lwa_adtel-telephone,
             y_k_1                    TO y_lwa_adtel-r_3_user.

      APPEND y_lwa_adtel   TO y_li_insert_tel.


      MOVE:   y_k_x                TO y_lwa_adtel_x-country,
              y_k_x                TO y_lwa_adtel_x-telephone,
              y_k_x                TO y_lwa_adtel_x-r_3_user,
              y_lv_updateind       TO y_lwa_adtel_x-updateflag.

      APPEND y_lwa_adtel_x TO y_li_insert_tel_x.

    ENDIF.

  ENDIF.



*----------------------------------------------------------------*
*Change or insert the second telephonenumber
*----------------------------------------------------------------*

  IF NOT y_lwa_supplier-telf2 EQ y_k_nodata.

    READ TABLE y_li_tel_int INTO y_lwa_tel_int
    INDEX 2.

    IF sy-subrc EQ 0.

* 2nd telephone number already exists and should be updated



      y_lv_updateind = y_k_u.


      MOVE : y_lwa_supplier-land1     TO y_lwa_adtel-country,
             y_lwa_supplier-telf2     TO y_lwa_adtel-telephone,
             y_k_1                    TO y_lwa_adtel-r_3_user,
             y_lwa_tel_int-consnumber TO y_lwa_adtel-consnumber.

      APPEND y_lwa_adtel   TO  y_li_update_tel.


      MOVE:   y_k_x                TO y_lwa_adtel_x-country,
              y_k_x                TO y_lwa_adtel_x-telephone,
              y_k_x                TO y_lwa_adtel_x-r_3_user,
              y_lv_updateind       TO y_lwa_adtel_x-updateflag.

      APPEND y_lwa_adtel_x TO  y_li_update_tel_x.





    ELSE.
* 1st telephone number does not exist and should be inserted

      y_lv_updateind = y_k_i.


      MOVE : y_lwa_supplier-land1     TO y_lwa_adtel-country,
             y_lwa_supplier-telf2     TO y_lwa_adtel-telephone,
             y_k_1                    TO y_lwa_adtel-r_3_user.

      APPEND y_lwa_adtel   TO  y_li_insert_tel.


      MOVE:   y_k_x                TO y_lwa_adtel_x-country,
              y_k_x                TO y_lwa_adtel_x-telephone,
              y_k_x                TO y_lwa_adtel_x-r_3_user,
              y_lv_updateind       TO y_lwa_adtel_x-updateflag.

      APPEND y_lwa_adtel_x TO  y_li_insert_tel_x.



    ENDIF.

  ENDIF.
*----------------------------------------------------------------*
*Change or insert the mobile number
*----------------------------------------------------------------*
  IF NOT y_lwa_supplier-mob_number EQ y_k_nodata.

    READ TABLE y_li_mob_int INTO y_lwa_mob_int
    INDEX 1.

    IF sy-subrc EQ 0.

* Mobile number already exists and should be updated



      y_lv_updateind = y_k_u.


      MOVE : y_lwa_supplier-land1      TO y_lwa_adtel-country,
             y_lwa_supplier-mob_number TO y_lwa_adtel-telephone,
             y_k_3                     TO y_lwa_adtel-r_3_user,
             y_lwa_mob_int-consnumber  TO y_lwa_adtel-consnumber.

      APPEND y_lwa_adtel   TO  y_li_update_tel.


      MOVE:   y_k_x                TO y_lwa_adtel_x-country,
              y_k_x                TO y_lwa_adtel_x-telephone,
              y_k_x                TO y_lwa_adtel_x-r_3_user,
              y_lv_updateind       TO y_lwa_adtel_x-updateflag.

      APPEND y_lwa_adtel_x TO  y_li_update_tel_x.





    ELSE.
* mobile number does not exist and should be inserted

      y_lv_updateind = y_k_i.


      MOVE : y_lwa_supplier-land1      TO y_lwa_adtel-country,
             y_lwa_supplier-mob_number TO y_lwa_adtel-telephone,
             y_k_3                     TO y_lwa_adtel-r_3_user.

      APPEND y_lwa_adtel   TO  y_li_insert_tel.


      MOVE:   y_k_x                TO y_lwa_adtel_x-country,
              y_k_x                TO y_lwa_adtel_x-telephone,
              y_k_x                TO y_lwa_adtel_x-r_3_user,
              y_lv_updateind       TO y_lwa_adtel_x-updateflag.

      APPEND y_lwa_adtel_x TO  y_li_insert_tel_x.



    ENDIF.
  ENDIF.

  IF NOT  y_li_update_tel[] IS INITIAL.
    APPEND LINES OF y_li_update_tel   TO y_li_tel.
    APPEND LINES OF y_li_update_tel_x TO y_li_tel_x.
  ENDIF.

  IF NOT   y_li_insert_tel[] IS INITIAL.
    APPEND LINES OF y_li_insert_tel   TO y_li_tel.
    APPEND LINES OF y_li_insert_tel_x TO y_li_tel_x.
  ENDIF.

ENDFORM.                    " y_f_telephone
*&---------------------------------------------------------------------*
*&      Form  y_f_fax
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->Y_LI_FAX  text
*      -->Y_LI_FAX_X  text
*      -->Y_LWA_SUPPLIER  text
*----------------------------------------------------------------------*
FORM y_f_fax  USING    y_lwa_supplier TYPE  y_t_supplier1
                       y_li_fax_ex    TYPE  y_tt_bapiadfax
              CHANGING y_li_fax       TYPE  y_tt_bapiadfax
                       y_li_fax_x     TYPE  y_tt_bapiadfaxx.


  DATA: y_lwa_adfax     TYPE bapiadfax,
        y_lwa_adfax_ex  TYPE bapiadfax,
        y_lwa_adfaxx    TYPE bapiadfaxx.

  DATA : y_lv_chng      TYPE flag,
         y_lv_updateind TYPE ad_updflag .


  REFRESH : y_li_fax_x, y_li_fax.


  READ TABLE y_li_fax_ex INTO y_lwa_adfax_ex
  WITH KEY country = y_lwa_supplier-land1.
  IF sy-subrc EQ 0.
* update fax number
    MOVE y_k_u TO y_lv_updateind.

    MOVE : y_lwa_supplier-telfx      TO y_lwa_adfax-fax,
           y_lwa_supplier-land1      TO y_lwa_adfax-country,
           y_lwa_adfax_ex-consnumber TO y_lwa_adfax-consnumber.

    APPEND y_lwa_adfax  TO y_li_fax.

    MOVE : y_k_x                TO y_lwa_adfaxx-fax,
           y_k_x                TO y_lwa_adfaxx-country,
           y_k_x                TO y_lwa_adfaxx-consnumber,
           y_lv_updateind       TO y_lwa_adfaxx-updateflag.

    APPEND y_lwa_adfaxx TO y_li_fax_x.


  ELSE.
*insert fax number
    MOVE y_k_i TO y_lv_updateind.

    MOVE : y_lwa_supplier-telfx      TO y_lwa_adfax-fax,
           y_lwa_supplier-land1      TO y_lwa_adfax-country.

    APPEND y_lwa_adfax  TO y_li_fax.

    MOVE : y_k_x                TO y_lwa_adfaxx-fax,
           y_k_x                TO y_lwa_adfaxx-country,
           y_lv_updateind       TO y_lwa_adfaxx-updateflag.

    APPEND y_lwa_adfaxx TO y_li_fax_x.


  ENDIF.




ENDFORM.                    " y_f_fax

Regards,

Ankur Parab

tarangini_katta
Active Contributor
0 Kudos
297

former_member555112
Active Contributor
0 Kudos
297

Hi,

I am sorry but I am unable to convert the text into a code format although i have used the

.

Regards,

Ankur Parab