Parking a Document in FI using BAPI

本文介绍如何通过Business API (BAPI)实现财务文件的停放功能。由于直接停放API不存在,文章采用记账BAPI 'BAPI_ACC_GL_POSTING_POST'来完成。详细步骤包括设置记账凭证的头信息及明细项,利用扩展字段标记凭证为停放状态,并通过调用BAPI实现停放。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

In FI Module, Sometimes we need to park a document instead of Posting. Through BDC, direct input method we can do this. But in this post, I am explaining the Parking using BAPI.

There is no Direct BAPI for parking the FI Document. So using the Document posting BAPI, ‘BAPI_ACC_GL_POSTING_POST’ we can achieve this easily.

        Header-username = sy-uname.
        Header-comp code = '1000'.
        Header-fisc_year = sy-datum+0(4).
        Header-doc_date = sy-datum.
        Header-pstng_date = sy-datum.
        Header-fis_period = sy-datum+4(2).
        Header-doc_type = 'SA'.

        accountgl-itemno_acc = '1'.
        accountgl-gl_account = '0000115510' .
        accountgl-comp_code = '1000'.
        accountgl-pstng_date = sy-datum.
        accountgl-doc_type = 'SA'.
        accountgl-fisc_year = sy-datum+0(4).
        accountgl-fis_period = sy-datum+4(2).
        APPEND accountgl.
        CLEAR accountgl.

        loc_cnt = 1.
        loc_cnt  = loc_cnt + 1.
        accountgl-itemno_acc = loc_cnt.
        accountgl-gl_account = '0000601900' .
        accountgl-comp_code = '1000'.
        accountgl-pstng_date = sy-datum.
        accountgl-doc_type = 'SA'.
        accountgl-fisc_year = sy-datum+0(4).
        accountgl-fis_period = sy-datum+4(2).
        accountgl-costcenter = ‘13100’.
        APPEND accountgl.
        CLEAR accountgl.

       currencyamount-itemno_acc = ‘1’.
        currencyamount-currency  = 'USD'.
        currencyamount-amt_doccur = loc_amt. ( For  Debit / ‘S’)
        APPEND currencyamount.

        CLEAR currencyamount.

       currencyamount-itemno_acc = ‘2’.
        currencyamount-currency  = 'USD'.
        currencyamount-amt_doccur =  ( -1 ) * ( loc_amt ).  ( For credit /‘H’)
        APPEND currencyamount.

      CLEAR currencyamount.  

        extension1-field1 =  'BAPI-PARK'.
        extension1-field2 =   '1'.
        APPEND extension1.

     CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
          EXPORTING
            documentheader       = header
         IMPORTING
            obj_key              =    obj_key
          TABLES
            accountgl            = accountgl
            currencyamount       = currencyamount
            return               = return
            extension1           = extension1

 CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait = 'X'.

Implement Customer Exit (CMOD) ACBAPI01, with Include Program ZXACCU15 of Component EXIT_SAPLACC4_001.

READ TABLE extension INDEX 1.

IF sy-subrc = 0 AND extension-field1 = 'BAPI-PARK'. ( to confirm for our parking, because it should not work for all the BAPI posting by the standards.)

 MOVE 2 TO t_acchd-status_new. " Park Document

Endif.

To check the parked Document, go to table BKPF and we can check the Document status as ‘V’.

We can check the parked document in FBV0.

One more important thing after implementing all the above steps, if you are trying to post a parked document which is created by the above process, you may be getting some error. We have to follow steps of the OSS notes (Note 1020574) to avoid that error.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值