segunda-feira, 20 de janeiro de 2020

Multiple Customer ship to address maintenance on Sales Order VA01 S/4 Hana 1709

In SAP there is a functionality available to maintain several ship to party customers in customer master. In case one needs to maintain several addresses of ship to Party for a single customer then this is also possible.
Our requirement is to maintain several addresses of a customer in ship to party addresses and we want a popup message to show all ship to addresses of sold to party and user has to decide which address should be chosen for its customers in partner function.
This requirement was achieved by implementing customer enhancement V09A0004 in CMOD and along with this implementing implicit enhancement on saving document in VA01.

  1. Sales order is created in reference of contract so we can take input from its contract number and fetch sold to party of the contract.
    1. GET PARAMETER ID para FIELD lv_vbeln.select single into wa_vbak from vbak where vbeln lv_vbeln.
      select single into wa_kna1 from kna1 where kunnr wa_vbakkunnr.
  2.  select all addresses maintained for a particular customer.
    1. select into table ops from adrc
    2.     where name1 wa_kna1name1.
  3. loop at ops.
  4. append all addresses to spoplist and then call FM POPUP_TO_DECIDE_LIST.
    1. CALL FUNCTION ‘POPUP_TO_DECIDE_LIST’
      EXPORTING  TITEL            ‘Possible entry for shipping address’(a01)
      TEXTLINE1        ‘By which criteria’(b01)
      TEXTLINE2        ‘should addresses’(b02)
      TEXTLINE3        ‘be selected?’(b03)
      MARK_MAX         1
      MARK_FLAG        ‘X’
      IMPORTING  ANSWER           ANTWORT
      TABLES     T_SPOPLI        SPOPLIST
      EXCEPTIONS TOO_MUCH_ANSWERS 1
      TOO_MUCH_MARKS   2.
  5. Export that address to memory:
  6. loop at spoplist where selflag ‘X’.*   spoplist-selflag = ”.
    flag ‘X’.
    SELECT SINGLE INTO wa_adrc FROM adrc
    WHERE street like spoplistvaroption.
    export wa_adrc wa_adrc to memory id ‘STRT’.
    endloop.
  7. Now while implementing implicit enhancement Save_document in MV45AFZZ
  8. read address from memory
    1. import wa_adrc wa_adrc from memory id ‘STRT’.
  9. move-corresponding wa_adrc to lv_adr_data.lv_adr_Datadate_from sydatum.
    lv_adr_datadate_to   ‘31129999’.
    lv_adr_datastreet wa_Adrcstreet.
  10. call FM ADDR_UPDATE and ADDR_MEMORY_SAVE.
    1. CALL FUNCTION ‘ADDR_UPDATE’
      EXPORTING
      ADDRESS_DATA               lv_adr_data
      *   ADDRESS_HANDLE             = lv_addr-addrnumber
      ADDRESS_NUMBER             lv_addraddrnumber
      *   DATE_FROM                  = ‘00010101’
      LANGUAGE                   SYLANGU
      *   NATION                     = ‘ ‘
      *   CHECK_EMPTY_ADDRESS        = ‘X’
      CHECK_ADDRESS              ‘ ‘
      *   CHECK_OTHER_VERSIONS       = ‘X’
      *   BLK_EXCPT                  =
      IMPORTING
      ADDRESS_DATA               lv_adr_data
      RETURNCODE                 lv_retcode
      DATA_HAS_CHANGED           cflag
      TABLES
      ERROR_TABLE                error_table
      EXCEPTIONS
      ADDRESS_NOT_EXIST          1
      PARAMETER_ERROR            2
      VERSION_NOT_EXIST          3
      INTERNAL_ERROR             4
      ADDRESS_BLOCKED            5
      OTHERS                     6
      .
      IF SYSUBRC <> 0.
      * Implement suitable error handling hereelse.
      CALL FUNCTION ‘ADDR_MEMORY_SAVE’
      EXPORTING
      execute_in_update_task space
      EXCEPTIONS
      address_number_missing 1
      person_number_missing 2
      internal_error 3
      database_error 4
      reference_missing 5
      OTHERS 6.
      ENDIF.
The ship to party address is automatically updated in system through this requirement..

Nenhum comentário:

Postar um comentário