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.
- 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.
- 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_vbak–kunnr.
- GET PARAMETER ID para FIELD lv_vbeln.select single * into wa_vbak from vbak where vbeln = lv_vbeln.
- select all addresses maintained for a particular customer.
- select * into table ops from adrc
- where name1 = wa_kna1–name1.
- loop at ops.
- append all addresses to spoplist and then call FM POPUP_TO_DECIDE_LIST.
- 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.
- CALL FUNCTION ‘POPUP_TO_DECIDE_LIST’
- Export that address to memory:
- loop at spoplist where selflag = ‘X’.* spoplist-selflag = ”.
flag = ‘X’.SELECT SINGLE * INTO wa_adrc FROM adrcWHERE street like spoplist–varoption.export wa_adrc = wa_adrc to memory id ‘STRT’.endloop. - Now while implementing implicit enhancement Save_document in MV45AFZZ
- read address from memory
- import wa_adrc = wa_adrc from memory id ‘STRT’.
- move-corresponding wa_adrc to lv_adr_data.lv_adr_Data–date_from = sy–datum.
lv_adr_data–date_to = ‘31129999’.lv_adr_data–street = wa_Adrc–street. - call FM ADDR_UPDATE and ADDR_MEMORY_SAVE.
- CALL FUNCTION ‘ADDR_UPDATE’
EXPORTING
ADDRESS_DATA = lv_adr_data
* ADDRESS_HANDLE = lv_addr-addrnumber
ADDRESS_NUMBER = lv_addr–addrnumber
* DATE_FROM = ‘00010101’
LANGUAGE = SY–LANGU
* 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 SY–SUBRC <> 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.
- CALL FUNCTION ‘ADDR_UPDATE’
The ship to party address is automatically updated in system through this requirement..
Nenhum comentário:
Postar um comentário