Use of Exit 'EXIT_SAPLV09A_004' or smod 'V09A0004'
We have a scenario whereby a user may need to change the sold-to party on a sales order. However, the sales order already has a manually entered and modified partner on it of type 'ZT'. As you likely know, when you change the sold-to partner on a sales document you redetermine all the partners and the manually entered partner goes away. We would like to always keep the 'ZT' partner. The configuration is complete in VOPA for this partner such that user exits V09A0004 and V09A0003 are triggered when they are active. User exit V09A0003 does not have the table output that I would need to keep the manual entries, but V09A0004 does. So, I've put the very simple code below into the exit and it works great...however, the sales document has the original customer master address on it and not the one I just read from ADRC. I have to believe that it is possible for me to affect the address of the partner irrespective of what is on the customer master because these fields are provided for me...why else would stras, name1, city1 and etc be on the frt_determinated_partners table? I've searched for a flag or something, but to no avail...any input would be greatly appreciated.
No...I have not tried the mv45af** exits yet. I was hoping to do this in the enhancement for partner determination provided.
TYPES: BEGIN OF ty_adrc.
INCLUDE STRUCTURE adrc.
TYPES: END OF ty_adrc.
DATA: para TYPE tpara-paramid VALUE 'AUN',
lv_vbeln TYPE vbeln,
lv_kunnr TYPE kunnr,
lv_adrnr TYPE adrnr,
lt_adrc TYPE TABLE OF ty_adrc,
wa_adrc LIKE LINE OF lt_adrc,
wa_sdpartner_enhanced_kupav TYPE sdpartner_enhanced_kupav.
GET PARAMETER ID para FIELD lv_vbeln.
SELECT SINGLE adrnr kunnr INTO (lv_adrnr, lv_kunnr) FROM vbpa
WHERE vbeln = lv_vbeln
AND parvw = 'ZT'.
IF sy-subrc = 0.
SELECT SINGLE * INTO wa_adrc FROM adrc
WHERE addrnumber = lv_adrnr.
IF sy-subrc = 0.
wa_sdpartner_enhanced_kupav-defpa = 'X'.
wa_sdpartner_enhanced_kupav-kunnr = lv_kunnr.
wa_sdpartner_enhanced_kupav-vkorg = fif_vkorg.
wa_sdpartner_enhanced_kupav-vtweg = fif_vtweg.
wa_sdpartner_enhanced_kupav-spart = fif_spart.
wa_sdpartner_enhanced_kupav-parvw = 'ZT'.
wa_sdpartner_enhanced_kupav-parza = '000'.
wa_sdpartner_enhanced_kupav-kunn2 = lv_kunnr.
wa_sdpartner_enhanced_kupav-adrnr = lv_adrnr.
wa_sdpartner_enhanced_kupav-name1 = wa_adrc-name1.
wa_sdpartner_enhanced_kupav-name2 = wa_adrc-name2.
wa_sdpartner_enhanced_kupav-ort01 = wa_adrc-city1.
wa_sdpartner_enhanced_kupav-pstlz = wa_adrc-post_code1.
wa_sdpartner_enhanced_kupav-regio = wa_adrc-region.
wa_sdpartner_enhanced_kupav-spras = wa_adrc-langu.
wa_sdpartner_enhanced_kupav-telf1 = wa_adrc-tel_number.
wa_sdpartner_enhanced_kupav-stras = wa_adrc-street.
wa_sdpartner_enhanced_kupav-land1 = wa_adrc-country.
wa_sdpartner_enhanced_kupav-ktokd = 'Z002'.
wa_sdpartner_enhanced_kupav-address_type = '1'.
MOVE-CORRESPONDING wa_adrc TO wa_sdpartner_enhanced_kupav.
APPEND wa_sdpartner_enhanced_kupav TO frt_determinated_partners.