BAPI Extension for BAPI_ACC_GL_POSTING_POST
By Alka Khambra, Hitachi
Had a requirement to post GL documents via BAP I function module: BAPI_ACC_GL_POSTING_POST,
using the 5 custom fields which are added to BSEG table
Custom field in the Tcode FB01 are Project ID, Channel, State, Reinsurer Code and Product as:
Custom fields in BSEG table are highlighted below:
In BAPI "BAPI_ACC_GL_POSTING_POST" need to add EXTENSION1 for BAPI extension.
Building structure BAPIEXTC, BAPIEXT, BAPIEXTA which will act as the container for the 5 custom fields
Can use the following code for filling the values in the EXTENSION1 :
DATA : it_extension TYPE TABLE OF bapiextc,
wa_extension TYPE bapiextc.
Filling extension table
wa_extension-field1(03) = lw_item-itemno_acc+7(3).
wa_extension-field1+03(04) = w_post-zzproj.
wa_extension-field1+07(04) = w_post-zzstate.
wa_extension-field1+11(06) = w_post-zzrecode.
wa_extension-field1+17(04) = w_post-zzprod.
wa_extension-field1+21(04) = w_post-zzchennel.
wa_extension-field1+25(04) = w_post-ldgrp.
APPEND wa_extension TO it_extension.
CLEAR: lw_item,wa_extension.
Calling the BAPI 'BAPI_ACC_GL_POSTING_POST' and passing it_extension to extension1.
CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
EXPORTING
documentheader = wa_head
IMPORTING
obj_type = obj_type
obj_key = obj_key
obj_sys = obj_sys
TABLES
accountgl = i_item
currencyamount = i_amnt
return = i_return
extension1 = it_extension.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.