Skip to Content
0
Former Member
Aug 30, 2006 at 05:38 AM

BAPI_ACC_GL_POSTING_POST

831 Views

Hi,

I used the Bapi 'BAPI_ACC_GL_POSTING_POST'... with the following program...that I found here on SDN

&----


*& Report ZNAM_BAPI_TEST

*&----


REPORT ZNAM_BAPI_TEST .

TABLES: bapiache08, bapiacgl08,bapiaccr08, bapiret2.

DATA: t_bapiache08 LIKE TABLE OF bapiache08 WITH HEADER LINE,

t_bapiacgl08 LIKE TABLE OF bapiacgl08 WITH HEADER LINE,

t_bapiaccr08 LIKE TABLE OF bapiaccr08 WITH HEADER LINE,

t_bapiret2 LIKE TABLE OF bapiret2 WITH HEADER LINE,

ct_bapiret2 LIKE TABLE OF bapiret2 WITH HEADER LINE.

t_bapiache08-obj_type = 'BKPFF'. "BKPFF

t_bapiache08-obj_key = '000000001810052006'.

t_bapiache08-obj_sys = 'ID1CLNT800'. "T09CLNT800

t_bapiache08-username = 'NJAYAWAN'.

t_bapiache08-header_txt = 'DOCUMENT POSTING'.

t_bapiache08-comp_code = '1005'.

t_bapiache08-fisc_year = '2006'.

t_bapiache08-doc_date = '20060829'.

t_bapiache08-pstng_date = '20060829'.

t_bapiache08-fis_period = '08'.

t_bapiache08-doc_type = 'SA'.

t_bapiache08-compo_acc = 'FI'. "GL

APPEND t_bapiache08.

t_bapiacgl08-itemno_acc = '0000000001'.

t_bapiacgl08-gl_account = '220000'.

t_bapiacgl08-comp_code = '1005'.

t_bapiacgl08-pstng_date = '20060829'.

t_bapiacgl08-doc_type = 'SA'.

t_bapiacgl08-fisc_year = '2006'.

t_bapiacgl08-fis_period = '08'.

t_bapiacgl08-stat_con = 'X'.

t_bapiacgl08-vendor_no = '1920'. "ACCOUNTING NO.FOR VENDOR/CREDITOR.

t_bapiacgl08-item_text = 'LINE ITEM TEXT BY VIN'.

APPEND t_bapiacgl08.

t_bapiaccr08-itemno_acc = '0000000001'.

t_bapiaccr08-currency_iso = 'EUR'.

t_bapiaccr08-amt_doccur = '2000'.

APPEND t_bapiaccr08.

CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'

EXPORTING

documentheader = t_bapiache08

  • IMPORTING

  • OBJ_TYPE =

  • OBJ_KEY =

  • OBJ_SYS =

TABLES

accountgl = t_bapiacgl08

currencyamount = t_bapiaccr08

return = t_bapiret2

  • EXTENSION1 =

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = ' '

IMPORTING

return = ct_bapiret2.

LOOP AT t_bapiret2.

WRITE :/ t_bapiret2-type, t_bapiret2-id, t_bapiret2-number,

t_bapiret2-message,t_bapiret2-parameter,

t_bapiret2-row, t_bapiret2-field, t_bapiret2-system.

ENDLOOP.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = ' '

IMPORTING

return = ct_bapiret2.

LOOP AT ct_bapiret2.

WRITE :/ ct_bapiret2-type, ct_bapiret2-id, ct_bapiret2-number,

ct_bapiret2-message,ct_bapiret2-log_no, ct_bapiret2-parameter,

ct_bapiret2-row, ct_bapiret2-field, ct_bapiret2-system.

ENDLOOP.

*&----


The output received was :

S RW 605

Document posted successfully: BKPFF 000000001810052006 ID1CLNT800

*&----


But there was no document created in BKPF or BSEG table.. Please ignore the use of 'BAPI_TRANSACTION_COMMIT' 2 times. It was done to check various possiblities.. Please advise.