Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

User-exit to Add partner functions in Partners tab of VA01/VA02 that gets triggered at item level

kmdarunday
Explorer
0 Kudos
2,321

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,

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
2,212

Did you

  • Try to use an exit triggered at item level such as USEREXIT_MOVE_FIELD_TO_VBAP.
  • Before coding, look for Partner Determination Procedure with functionals?
7 REPLIES 7

raymond_giuseppi
Active Contributor
2,213

Did you

  • Try to use an exit triggered at item level such as USEREXIT_MOVE_FIELD_TO_VBAP.
  • Before coding, look for Partner Determination Procedure with functionals?

0 Kudos
2,212

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?

0 Kudos
2,212

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:

0 Kudos
2,212

Have you filled in XVBPA-UPDKZ with I for insert?

0 Kudos
2,212
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.

0 Kudos
2,212

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.

2,212

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