Search code examples
abapsap-erp

User Exit or BAdI for VA01 partners tab


After creating a Grant from the GMGRANT transaction code, after pressing on "Change Status", a Sales Order is automatically created. Currently in the Partner Function tab, all partner types are filled with the "Sold-to-party" partner.

I need that 'Bill to party' and 'Payer' be taken from a 'Sponsor'. I tried to find a BAdI or an User Exit without success. Can you help me with these issue?

IMG1

IMG2


Solution

  • You can use USEREXIT_SAVE_DOCUMENT_PREPARE exit for overriding partners before order creation, it resides in MV45AFZZ include. You can write something like this:

    IF sy-tcode = 'GMGRANT'.
      LOOP AT XVBPA.
        IF XVBPA-PARVW = 'RG' " filling payer
          XVBPA-VBELN = SPONSOR-KUNNR1.
        ENDIF.
        IF XVBPA-PARVW = 'RE' " filling bill-to
          XVBPA-VBELN = SPONSOR-KUNNR2.
        ENDIF.
        MODIFY XVBPA.
      ENDLOOP.
    ENDIF.
    

    If the restriction by GMGRANT transaction doesn't work, you can play with sy-uсomm command value, after changing the status it should hold some specific value.