Skip to Content
avatar image
Former Member

ADDRESS PARTNER CHANGED in VA01

How can I change one of the information (ADDR1_DATA-NAME_CO) from Ship-to partner (PARWV = WE) when SAVE the order (VA01 or VA02)?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 11, 2017 at 03:03 PM

    The solution for me was:

    DATA: LW_OBJTYPE TYPE SWO_OBJTYP,
    LW_VBTYP TYPE VBTYP,
    LWA_ADDR1_WE TYPE ADDR1_DATA,
    LI_WARNING TYPE ADDR_ERROR_TAB,
    LI_ADDR_IN TYPE TABLE OF /BUP/AQ0SANFREQ,
    LWA_ADDR_IN TYPE /BUP/AQ0SANFREQ,
    LI_ADDR_OUT TYPE TABLE OF /BUP/AQ0SERGREQ,
    LWA_ADDR_OUT TYPE /BUP/AQ0SERGREQ,
    IWA_HEADER TYPE /WUE/SSF_DOC_HEADER,
    LW_KEY TYPE ADDR_REF-APPL_KEY,
    LW_HANDLE TYPE SZAD_FIELD-HANDLE.

    READ TABLE XVBPA WITH KEY PARVW = 'WE'.

    SELECT SINGLE * FROM ADRC
    INTO CORRESPONDING FIELDS OF LWA_ADDR1_WE
    WHERE ADDRNUMBER = XVBPA-ADRNR AND
    DATE_FROM = '00010101' AND
    NATION = ''.

    IF SY-SUBRC = 0.
    LWA_ADDR1_WE-NAME_CO = 'PACKAGE 123'. "THE FIELD THAT I NEEDED TO CHANGE
    ENDIF.

    CALL FUNCTION 'SD_OBJECT_TYPE_DETERMINE'
    EXPORTING
    I_DOCUMENT_TYPE = XVBAK-VBTYP
    IMPORTING
    E_BUSINESS_OBJECT = LW_OBJTYPE
    EXCEPTIONS
    OTHERS = 1.

    CALL FUNCTION 'SD_PARTNER_ADDRESS_SET'
    EXPORTING
    FIC_OBJECTTYPE = LW_OBJTYPE
    FIC_OBJECTKEY = ''
    FIF_PARVW = 'WE'
    FIF_POSNR = '000000'
    FIF_PARNR = KUWEV-KUNNR (Ship to party)
    FIF_ADDRESS_CHECK = ' '
    IMPORTING
    ET_WARNING = LI_WARNING
    CHANGING
    FIS_ADDRESS = LWA_ADDR1_WE
    EXCEPTIONS
    PARAMETER_INCOMPLETE = 1
    OBJECT_NOT_FOUND = 2
    PARTNER_NOT_FOUND = 3
    CHANGE_NOT_POSSIBLE = 4
    ADDRESS_NOT_OK = 5
    OTHERS = 6.

    IF SY-SUBRC <> 0.
    RETURN.
    ENDIF.

    PERFORM PARTNER_DATA_GET IN PROGRAM SAPMV45A.

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 04, 2017 at 03:27 PM
    -1

    Name usually comes from Master data . To change name you would need to update in XD02.

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 04, 2017 at 10:02 PM

    The ship-to address comes from the customer master and can be changed manually in the order. It shouldn't be manipulated by ABAP if that's what you are asking.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 05, 2017 at 06:16 AM

    Yes, I know where they come from, but you can change it (VBPA table) just for your sales order, not master data records.
    In my case, we need to enter a correct NAME_OC of it, according to a condition specific when SAVE the order.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 05, 2017 at 11:07 AM

    If you need to determine an address from a certain set of addresses, it would make sense of maintaing the possible ship-to parties (addresses) in advance and determine the right ship-to in the order (and not creating a new temporariy adress all the time during order processing).

    In case the address changes from order to order and there's no way to maintain the possible set of addresses (ship-to parties) in advance (?), you can save a new address number for the ship-to business partner in user exit MV45AFZZ / USEREXIT_SAVE_DOCUMENT_PREPARE provided the address (number) already exists in ARDC (you would need to create the address during the program run - there's a bapi for this purpose). I didn't try it, so you may face problems because of the database updates (adress and order).

    Other technical solution could be to simply use an event development for business object BUS2032. Once the "created" or "changed" events are triggered, you could update the business partner's data of the order with the corresponding bapi (BAPI_SALESORDER_CHANGE).

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      please´╝îhow to use the bapi of BAPI_SALESORDER_CHANGE to change the information of ship-to partner , i tried , but didn't work.

  • avatar image
    Former Member
    Apr 05, 2017 at 11:18 AM

    The problem is the run time of my change.

    Using this BAPI, I should have to wait for a sales order number to use.
    I want to change some internal tables during saving the order, like XVBADR and XVBPA in MV45AFZZ include but until now without success.

    Add comment
    10|10000 characters needed characters exceeded