2023 Sep 12 6:09 AM
Hi,
Does anyone know which user-exit to use if we want to add partner functions that gets triggered at item level of VA01/VA02 (every time we add/change a new line item)?
We have used USEREXIT_SAVE_DOCUMENT_PREPARE but this only gets triggered after we click on save.
Thank you.
Regards,
2023 Sep 12 9:48 AM
Did you
2023 Sep 12 9:48 AM
Did you
2023 Sep 13 2:07 AM
Hi Raymond, I've added my code in USEREXIT_MOVE_FIELD_TO_VBAP and it's getting triggered for every line item. I'm updating XVBPA, in debugger the added partner function and its value is there. But when I check the partners tab, the added partner function is there but it has no value (only 0). I've also created a watchpoint in XVBPA[] but my added values are still there, it's just that it's not getting displayed in Partners tab. What other tables must be updated to reflect the added partner function's value?
2023 Sep 13 7:44 AM
Update: The partner function and its value are reflecting once I click on save button. But if it's not saved, the partner function is there but with blank value.
Not yet saved:
Once saved:
2023 Sep 13 8:56 AM
Have you filled in XVBPA-UPDKZ with I for insert?
2023 Sep 13 9:26 AM
TYPES: BEGIN OF lty_data,
bukrs TYPE bukrs,
prsdt TYPE prsdt,
tvbap TYPE STANDARD TABLE OF vbapvb WITH DEFAULT KEY,
tvbpa TYPE STANDARD TABLE OF vbpavb WITH DEFAULT KEY,
END OF lty_data,
BEGIN OF lty_vbpa,
tvbpa TYPE STANDARD TABLE OF vbpavb WITH DEFAULT KEY,
END OF lty_vbpa .
*Data declarations
DATA: ls_data TYPE lty_data,
ls_vbpa TYPE lty_vbpa.
*Get needed data from memory
ls_data-bukrs = vbak-bukrs_vf.
ls_data-prsdt = vbkd-prsdt.
ls_data-tvbpa = xvbpa[].
READ TABLE ls_data-tvbap WITH KEY posnr = vbap-posnr TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
DATA(lv_index) = sy-tabix.
MODIFY ls_data-tvbap FROM vbap INDEX lv_index.
ELSE.
APPEND vbap TO ls_data-tvbap.
ENDIF.
*Get partner function (Retrieve partner function details)
CALL METHOD /ebos/so_cl_o2vmapping=>get_partner(
EXPORTING
is_data = ls_data
RECEIVING
rs_vbpa = ls_vbpa ).
*ChecK if data is available and do not proceed if empty
IF ls_vbpa IS NOT INITIAL.
*Add data to partner function table
APPEND LINES OF ls_vbpa-tvbpa TO xvbpa.
ENDIF.
CLEAR ls_vbpa.
2023 Sep 13 9:27 AM
Yes, I have set it to UPDKZ to 'I'.
These are the fields I am filling from XVBPA this is inside another method, I'm passing the value of LIFNR, since the partner I am adding is a supplier/vendor:
* Provide the necessary data
ls_xvbpa-mandt = sy-mandt.
ls_xvbpa-vbeln = iv_vbeln.
ls_xvbpa-posnr = iv_posnr.
ls_xvbpa-parvw = iv_parvw.
ls_xvbpa-lifnr = lv_lifnr.
ls_xvbpa-adrnr = lv_adrnr.
ls_xvbpa-land1 = lv_land1.
ls_xvbpa-adrda = lc_adrda.
ls_xvbpa-updkz = lc_insert.
* Append to the list of partner function
APPEND ls_xvbpa TO cs_vbpa-tvbpa.
2023 Sep 13 10:14 AM
This has been solved, I just needed to pass the value of 'LI' to xvbpa-nrart for it to determine that the partner function I added was a LIFNR/VENDOR