Skip to Content
Author's profile photo Hock Lin Wong

BAPI_ACC_DOCUMENT_POST for posting F-47

For the F-47 posting, it only post to 1 line item whereby BAPI “BAPI_ACC_DOCUMENT_POST” have to post in 2 lines for balance the account. Here are the steps to do posting F-47 (Down Payment Request) via BAPI and BTE with 1 line item:

1) Create a new function group using transaction code SE80.

2) Copy the standard function module of BTE “SAMPLE_INTERFACE_RWBAPI01” to a Z Function module, say “ZSAMPLE_INTERFACE_RWBAPI01”

3) Goto transaction code FIBF to create the BTE for process “RWBAPI01”.

    Refer the link at Configuration session – Business Transaction Event – RWBAPI01 – For Accounting Document Interface – ABAP Development – SCN Wiki

4) Before call the BAPI “BAPI_ACC_DOCUMENT_POST”, prepare the table for extension1 as below:

  DEFINE mac_assign_extension.

    clear lv_string.

    concatenate &1 &2

       into lv_string.

    concatenate &3 lv_string

           into &3

      separated by ‘;’.

  END-OF-DEFINITION.

*-> prepare extension

    CONCATENATE ‘0001’ ls_accountpayable-itemno_acc

           INTO ls_extension1-field1.   ” 0001 => running number for different purpose to triggering BTE “RWBAPI01”

    CONCATENATE ‘BSTAT’ ‘S’  INTO ls_extension1-field2.

    mac_assign_extension ‘BSCHL’ ’39’ ls_extension1-field2.

    mac_assign_extension ‘UMSKZ’ ‘F’ ls_extension1-field2.

    mac_assign_extension ‘ZUMSK’ ‘Z’ ls_extension1-field2.

    mac_assign_extension ‘SHKZG’ ‘H’ ls_extension1-field2.

    APPEND ls_extension1 TO lt_extension1.

5) In the function module “ZSAMPLE_INTERFACE_RWBAPI01”, read the table extension1 and populate the field into table IT_ACCIT.

  TYPES : BEGIN OF ty_extension,

            field TYPE char50,

          END OF ty_extension.

  TYPES : tty_extension TYPE STANDARD TABLE OF ty_extension.

  DATA : ls_extension TYPE bapiacextc,

         ws_extension TYPE ty_extension,

         lt_extension TYPE tty_extension,

         lv_tabix     TYPE sytabix,

         lv_len       TYPE i.

  DATA : lv_bstat TYPE char01,

         lv_bschl TYPE char01,

         lv_umskz TYPE char01,

         lv_zumsk TYPE char01,

         lv_shkzg TYPE char01.

  DEFINE mac_assign_value.

    clear lv_len.

    if &4 is initial.

      find first occurrence of &1 in &2 match length lv_len.

      if sy-subrc = 0.

        &3 = &2+lv_len.

        &4 = ‘X’.

      endif.

    endif.

  END-OF-DEFINITION.

  LOOP AT extension INTO ls_extension.

    CASE ls_extension-field1(4).

      WHEN ‘0001’.  “For down payment request

        MOVE ‘RFST’ TO document_header-glvor.

        READ TABLE it_accit WITH KEY posnr = ls_extension-field1+4(10).

        IF sy-subrc = 0.

          lv_tabix = sy-tabix.

          SPLIT ls_extension-field2 AT ‘;’

           INTO TABLE lt_extension

             IN CHARACTER MODE.

          LOOP AT lt_extension INTO ws_extension.

            mac_assign_value ‘BSTAT’ ws_extension-field it_accit-bstat lv_bstat.

            mac_assign_value ‘BSCHL’ ws_extension-field it_accit-bschl lv_bschl.

            mac_assign_value ‘UMSKZ’ ws_extension-field it_accit-umskz lv_umskz.

            mac_assign_value ‘ZUMSK’ ws_extension-field it_accit-zumsk lv_zumsk.

            mac_assign_value ‘SHKZG’ ws_extension-field it_accit-shkzg lv_shkzg.

          ENDLOOP.

          MODIFY it_accit INDEX lv_tabix.

        ENDIF.

      WHEN OTHERS.

    ENDCASE.

  ENDLOOP.

=====================================================================================================

Another option to post noted items using BADI: F-47 Downpayment Request Using BAPI_ACC_DOCUMENT_POST

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Muhammad Syafiq Izzuddin bin Bahrin
      Muhammad Syafiq Izzuddin bin Bahrin

      Hi, experts, i just followed this steps and tweaked the value 'Z' in mac_assign_extension ‘ZUMSK’ ‘Z’ ls_extension1-field2 to the value required for Special GL Indicator. Functional consultant also need to make sure the config is set up. And it's working! thanks