Search code examples
abapbapisap-erp

Change Payment Block programmatically in MIRO tcode?


Is it possible to change the payment block via a BAPI, FM or code?

Payment Block


Solution

  • I've always used FI_DOCUMENT_CHANGE. Check out this example.

    Hope it helps.

      " VARIABLES
      DATA: LT_ACCCHG TYPE TABLE OF ACCCHG.
      DATA: LS_ACCCHG TYPE ACCCHG.
    
      DATA: LV_AWTYP  TYPE AWTYP.
      DATA: LV_AWSYS  TYPE AWSYS.
      DATA: LV_AWREF  TYPE AWREF.
      DATA: LV_AWORG  TYPE AWORG.
      DATA: LV_LIFNR  TYPE LIFNR.
    
      " Fill variables here 
      " Can be found in tables BKPF AND BSIK
    
      " SET VALUES FOR NEW PAYMENT BLOCK
      " P = Payment request, A = Blocked for payment
      " Check T008 for more Payment Block values
      LS_ACCCHG-FDNAME = 'ZLSPR'. "Payment Block
      LS_ACCCHG-NEWVAL = 'P'.    
      APPEND LS_ACCCHG TO LT_ACCCHG.
    
      " CHANGE PAYMENT BLOCK
      CALL FUNCTION 'FI_DOCUMENT_CHANGE'
        EXPORTING
          I_AWTYP              = LV_AWTYP
          I_AWREF              = LV_AWREF
          I_AWORG              = LV_AWORG
          I_AWSYS              = LV_AWSYS
          I_LIFNR              = LV_LIFNR
        TABLES
          T_ACCCHG             = LT_ACCCHG.