Hi All,
I am working on a BAPI "BAPI_ACC_DOCUMENT_POST" and for this I have created a program and wrote the following code:
DATA: WA_DOCUMENT_HEADER LIKE BAPIACHE09, LW_ACCOUNTGL LIKE BAPIACGL09 OCCURS 0 WITH HEADER LINE, LW_CURRENCYAMOUNT LIKE BAPIACCR09 OCCURS 0 WITH HEADER LINE, COMPANYCODEID LIKE BAPI0002_2-COMP_CODE, POSTING_DATE LIKE BAPI0002_4-POSTING_DATE, EFISCAL_YEAR LIKE BAPI0002_4-FISCAL_YEAR, EFISCAL_PERIOD LIKE BAPI0002_4-FISCAL_PERIOD, RETURN LIKE BAPIRETURN1, T_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE. DATA: C_RFBU(04) VALUE 'RFBU', L_POSTING_SUCCESS_MESSAGE TYPE SYMSGNO. *POSTING_DATE = Sy-DATUM. COMPANYCODEID = C_BUKRS. WA_DOCUMENT_HEADER-BUS_ACT = C_RFBU. WA_DOCUMENT_HEADER-USERNAME = SY-UNAME. WA_DOCUMENT_HEADER-HEADER_TXT = 'test posting'. WA_DOCUMENT_HEADER-COMP_CODE = 'XX'. WA_DOCUMENT_HEADER-DOC_DATE = SY-DATUM. WA_DOCUMENT_HEADER-PSTNG_DATE = SY-DATUM. WA_DOCUMENT_HEADER-FISC_YEAR = '2010'. WA_DOCUMENT_HEADER-FIS_PERIOD = '1'. WA_DOCUMENT_HEADER-DOC_TYPE = 'JE'. LW_ACCOUNTGL-ITEMNO_ACC = '1'. LW_ACCOUNTGL-GL_ACCOUNT = '500000'. LW_ACCOUNTGL-FUNC_AREA = '5'. LW_ACCOUNTGL-FUND = 'ZZ00002'. LW_ACCOUNTGL-COSTCENTER = '991023456'. LW_ACCOUNTGL-BUS_AREA = 'U'. APPEND LW_ACCOUNTGL. LW_CURRENCYAMOUNT-ITEMNO_ACC = '1'. LW_CURRENCYAMOUNT-CURRENCY = 'USD'. LW_CURRENCYAMOUNT-AMT_DOCCUR = '100'. APPEND LW_CURRENCYAMOUNT. CLEAR LW_CURRENCYAMOUNT. CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST' EXPORTING DOCUMENTHEADER = WA_DOCUMENT_HEADER TABLES ACCOUNTGL = LW_ACCOUNTGL CURRENCYAMOUNT = LW_CURRENCYAMOUNT * EXTENSION1 = RETURN = T_RETURN.
Edited by: rajatg on Mar 31, 2010 10:01 PM