以编程方式更改付款冻结(MIRO)

时间:2018-09-05 11:44:12

标签: sap abap netweaver

是否可以通过BAPI,FM或代码更改付款冻结?

Payment Block

2 个答案:

答案 0 :(得分:5)

使用BAdi INVOICE_UPDATE来更改此方法,方法为CHANGE_BEFORE_UPDATE

实施示例is here

要通过BAPI更改付款冻结,请使用BAPI_ACC_PYMNTBLK_UPDATE_POST

FM通话示例:

DATA:
it_return   TYPE STANDARD TABLE OF BAPIRET2,"tables param
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 EQ 0.
  "Everything OK"
ENDIF.

答案 1 :(得分:4)

我一直使用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.