Skip to Content

want to change the sold to party telephone and email

hello expert

i want to change the ship to party street,city,postal code and in sold to party change is only telephone number and email id through BAPI_SALESORDER_CHANGE bapi both changes are made but problem is when i change ship to party street, city postal code that same changes also reflect in sold to party which i don't want, i want only telephone number and email id change in sold to party below i mentioned my code

thanks in advance....

REPORT ZDEV_VA01_CHANGE.

tables: BAPISDH1,
         BAPISDH1X,
         BAPISDITM,
         BAPISDITMX,
         BAPIPARNR,
         BAPIPARNRC,
         BAPISCHDL,
         BAPISCHDLX,
         BAPIADDR1.

DATA: LS_HEAD TYPE BAPISDH1,
       LT_HEAD TYPE TABLE OF BAPISDH1,

       LS_HEADX TYPE BAPISDH1X,
       LT_HEADX TYPE TABLE OF BAPISDH1,
       VB LIKE BAPIVBELN-VBELN,

       LS_ITEM TYPE BAPISDITM,
       LT_ITEM TYPE TABLE OF BAPISDITM,

       LS_ITEMX TYPE BAPISDITMX,
       LT_ITEMX TYPE TABLE OF BAPISDITMX,

       LS_SCHDX TYPE BAPISCHDLX,
       LT_SCHDX TYPE TABLE OF BAPISCHDLX,


       LS_PARNR TYPE BAPIPARNR,
       LT_PARNR TYPE TABLE OF BAPIPARNR,

       LS_PARNRC TYPE BAPIPARNRC,
       LT_PARNRC TYPE TABLE OF BAPIPARNRC,

       LS_SCHD TYPE BAPISCHDL,
       LT_SCHD TYPE TABLE OF BAPISCHDL,


       LS_ADDR TYPE BAPIADDR1,
       LT_ADDR TYPE TABLE OF BAPIADDR1,

       LT_BAPIRET2 TYPE TABLE OF BAPIRET2 WITH HEADER LINE.


    START-OF-SELECTION.

      LS_HEAD-SALES_ORG    = 'PRIM'.
      LS_HEAD-DISTR_CHAN   = 'PR'.
      LS_HEAD-DIVISION     = '01'.
     APPEND LS_HEAD TO LT_HEAD.

      LS_HEADX-UPDATEFLAG  = 'U'.
*
*    LS_ITEM-ITM_NUMBER    = '000010'.
*    LS_ITEM-MATERIAL       = '000000000000000015'.
*    LS_ITEM-REASON_REJ      = '60'.
*    APPEND LS_ITEM TO LT_ITEM.
*
*    LS_ITEMX-ITM_NUMBER = 'X'.
*    LS_ITEMX-MATERIAL    = 'X'.
*    LS_ITEMX-REASON_REJ  =  'X'.
*    APPEND LS_ITEMX TO LT_ITEMX.
*
*    LS_SCHD-ITM_NUMBER  = '000010'.
*    LS_SCHD-REQ_QTY     = '20'.
*    LS_SCHD-SCHED_LINE  = '0001'.
*    APPEND LS_SCHD TO LT_SCHD.
*
*    LS_SCHDX-UPDATEFLAG = 'U'.
*    LS_SCHDX-ITM_NUMBER = 'X'.
*    LS_SCHDX-REQ_QTY    = 'X'.
*    LS_SCHDX-SCHED_LINE = 'X'.
*    APPEND LS_SCHDX TO LT_SCHDX.


     LS_PARNRC-DOCUMENT    = '0000101162'.
     LS_PARNRC-UPDATEFLAG  = 'U'.
     LS_PARNRC-PARTN_ROLE  = 'WE'.

     LS_PARNRC-P_NUMB_OLD  = '0000100005'.
     LS_PARNRC-P_NUMB_NEW  = '0000100005'.
     LS_PARNRC-ADDR_LINK   = '0000000003'.
     APPEND LS_PARNRC TO LT_PARNRC.

     LS_ADDR-ADDR_NO     = '0000000003'.
     LS_ADDR-STREET      = 'NARAYAN PETH LAXMI ROAD'.
     LS_ADDR-CITY        = 'PUNE'.
     LS_ADDR-POSTL_COD1  = '411401'.
     LS_ADDR-COUNTRY     = 'IN'.
     LS_ADDR-LANGU       = 'E'.

     APPEND LS_ADDR TO LT_ADDR.

     LS_PARNRC-DOCUMENT    = '0000101162'.
     LS_PARNRC-UPDATEFLAG  = 'U'.
     LS_PARNRC-PARTN_ROLE  = 'AG'.

     LS_PARNRC-P_NUMB_OLD  = '0000100005'.
     LS_PARNRC-P_NUMB_NEW  = '0000100005'.
     LS_PARNRC-ADDR_LINK   = '0000000002'.
     APPEND LS_PARNRC TO LT_PARNRC.

      LS_ADDR-ADDR_NO     = '0000000002'.
      LS_ADDR-E_MAIL      = 'kotalwar.nilesh@gmail.com'.
      LS_ADDR-TEL1_NUMBR  = '8275473215'.
      LS_ADDR-COUNTRY     = 'IN'.
      LS_ADDR-LANGU       = 'E'.
     APPEND LS_ADDR TO LT_ADDR.


    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        SALESDOCUMENT               = '0000101162'
*      ORDER_HEADER_IN             = LS_HEAD
        ORDER_HEADER_INX            = LS_HEADX
*      SIMULATION                  =
*      BEHAVE_WHEN_ERROR           = ' '
*      INT_NUMBER_ASSIGNMENT       = ' '
*      LOGIC_SWITCH                =
*      NO_STATUS_BUF_INIT          = ' '
      TABLES
        RETURN                      = LT_BAPIRET2[]
       ORDER_ITEM_IN               =  LT_ITEM[]
       ORDER_ITEM_INX              = LT_ITEMX[]
       PARTNERS                    = LT_PARNR[]
       PARTNERCHANGES              = LT_PARNRC[]
       PARTNERADDRESSES            = LT_ADDR[]
*      ORDER_CFGS_REF              =
*      ORDER_CFGS_INST             =
*      ORDER_CFGS_PART_OF          =
*      ORDER_CFGS_VALUE            =
*      ORDER_CFGS_BLOB             =
*      ORDER_CFGS_VK               =
*      ORDER_CFGS_REFINST          =
       SCHEDULE_LINES              = LT_SCHD[]
       SCHEDULE_LINESX             = LT_SCHDX[]
*      ORDER_TEXT                  =
*      ORDER_KEYS                  =
*      CONDITIONS_IN               =
*      CONDITIONS_INX              =
*      EXTENSIONIN                 =
*      EXTENSIONEX                 =
              .


     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*     EXPORTING
*       WAIT          =
*     IMPORTING
*       RETURN        =
               .

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 27, 2015 at 09:09 AM

    Hi,

        

         Don't pass the P_NUMB_OLD ,P_NUMB_NEW twice.

           LS_PARNRC-DOCUMENT    = '0000101162'.
         LS_PARNRC-UPDATEFLAG  = 'U'.
         LS_PARNRC-PARTN_ROLE  = 'WE'.

         LS_PARNRC-P_NUMB_OLD  = '0000100005'.
         LS_PARNRC-P_NUMB_NEW  = '0000100005'.
         LS_PARNRC-ADDR_LINK   = '0000000003'.
         APPEND LS_PARNRC TO LT_PARNRC.

         LS_ADDR-ADDR_NO     = '0000000003'.
         LS_ADDR-STREET      = 'NARAYAN PETH LAXMI ROAD'.
         LS_ADDR-CITY        = 'PUNE'.
         LS_ADDR-POSTL_COD1  = '411401'.
         LS_ADDR-COUNTRY     = 'IN'.
         LS_ADDR-LANGU       = 'E'.

         APPEND LS_ADDR TO LT_ADDR.

         LS_PARNRC-DOCUMENT    = '0000101162'.
         LS_PARNRC-UPDATEFLAG  = 'U'.
         LS_PARNRC-PARTN_ROLE  = 'AG'.

        LS_PARNRC-P_NUMB_OLD  = '0000100005'.
         LS_PARNRC-P_NUMB_NEW  = '0000100005'.
         LS_PARNRC-ADDR_LINK   = '0000000002'.
         APPEND LS_PARNRC TO LT_PARNRC.

          LS_ADDR-ADDR_NO     = '0000000002'.
          LS_ADDR-E_MAIL      = 'kotalwar.nilesh@gmail.com'.
          LS_ADDR-TEL1_NUMBR  = '8275473215'.
          LS_ADDR-COUNTRY     = 'IN'.
          LS_ADDR-LANGU       = 'E'.
         APPEND LS_ADDR TO LT_ADDR.



    remove those two lines



    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Nilesh kotalwar

      Hi Nilesh

      BP Data is not stored against Transactional Data, only the reference to that Business Partner.

      So what you're doing here is changing the BP Data for that Business Partner across the whole system.

      It also looked like you're not indicating which address type you're actually wanting to change. You're just indicating to update the address which is most likely picking up the Default (XXDEFAULT).

      Regards

      Arden

  • avatar image
    Former Member
    Oct 27, 2015 at 07:34 AM

    Hi,

    Try

    DATA:  wa_adsmtp TYPE bapiadsmtp,

            ls_addr_use TYPE bapibus1006_addressusage,

            wa_adtel TYPE bapiadtel,

            wa_adfax TYPE bapiadfax,

            lt_adtel TYPE STANDARD TABLE OF bapiadtel,

            lt_adsmtp TYPE TABLE OF bapiadsmtp,

            lt_adsmtp_x TYPE TABLE OF bapiadsmtx,

            wa_adsmtp_x TYPE bapiadsmtx,

            lt_adfax TYPE TABLE OF bapiadfax,

            lt_adfax_x TYPE TABLE OF bapiadfaxx,

            wa_adfax_x TYPE bapiadfaxx,

            ls_adfax TYPE bapiadfax,

            lt_adtel_x TYPE TABLE OF bapiadtelx,

            ls_adtel_x TYPE bapiadtelx,

            lt_return TYPE TABLE OF bapiret2.

    ""Default landline number

    wa_adtel-telephone = '12345678'.

    wa_adtel-extension = '011'.

    wa_adtel-r_3_user = '1'.

    APPEND wa_adtel TO lt_adtel.

    ""Default mobile number

    wa_adtel-telephone = '9999988888'.

    wa_adtel-r_3_user = '3'.

    APPEND wa_adtel TO lt_adtel.

    wa_adsmtp-e_mail = 'test@sap.com'.

    APPEND wa_adsmtp TO lt_adsmtp.

    wa_adfax-fax = '1111122222'.

    APPEND wa_adfax TO lt_adfax.

    ls_adtel_x-telephone = 'X'.

    APPEND ls_adtel_x TO lt_adtel_x.

    wa_adfax_x-fax = 'X'.

    APPEND wa_adfax_x TO lt_adfax_x.

    wa_adsmtp_x-e_mail = 'X'.

    APPEND wa_adsmtp_x TO lt_adsmtp_x.

    CALL FUNCTION 'BAPI_BUPA_ADDRESS_CHANGE'

       EXPORTING

         businesspartner = lv_partner_no

       TABLES

         bapiadtel       = lt_adtel

         bapiadfax       = lt_adfax

         bapiadsmtp      = lt_adsmtp

         bapiadtel_x     = lt_adtel_x

         bapiadfax_x     = lt_adfax_x

         bapiadsmt_x     = lt_adsmtp_x

         return          = lt_return.

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

       EXPORTING

         wait = 'X'

    *  IMPORTING

    *   return = ls_return

       .

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 01, 2016 at 04:20 PM

    Hallo,

    the componet P_numb_new can be 3 type: KUNNR, LIFNR or PERNR,

    Could you tell me, how could we tell the different?

    thanks a lot

    Add comment
    10|10000 characters needed characters exceeded