在 MIRO tcode 中以编程方式更改付款块?

Change Payment Block programmatically in MIRO tcode?

是否可以通过 BAPI、FM 或代码更改支付块?

使用 BAdi INVOICE_UPDATE 来改变这个,方法 CHANGE_BEFORE_UPDATE。 实施示例 is here.

要通过 BAPI 更改支付区块,请使用 BAPI_ACC_PYMNTBLK_UPDATE_POST,调用方法如下:

DATA: it_return TYPE STANDARD TABLE OF bapiret2,
      wa_return LIKE LINE OF it_return .

DATA ld_referenceinv TYPE bapiacpmblk.

MOVE it_bkfp-awkey TO ld_referenceinv-obj_key.
MOVE it_bkfp-awtyp TO ld_referenceinv-obj_type.
MOVE it_bkfp-awsys TO ld_referenceinv-obj_sys.
MOVE it_bkfp-bukrs TO ld_referenceinv-comp_code.

CALL FUNCTION 'BAPI_ACC_PYMNTBLK_UPDATE_POST'
  EXPORTING
    referenceinv =   ld_referenceinv
  TABLES
    return       =   it_return .  

IF sy-subrc = 0.
  " Everything OK
ENDIF.

我一直用FI_DOCUMENT_CHANGE。看看这个例子。

希望对您有所帮助。

  " 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.