Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error 'BAPI_ACC_DOCUMENT_POST' ,

Former Member
0 Likes
1,260

When test the attached program, and Use 'BAPI_ACC_DOCUMENT_POST' function module the result table show ''Document are posted, without document number".

The field it_hdr-obj_type = 'BKPFB', exist in a TTYP table.

REPORT zpba_pc MESSAGE-ID m3.

***

DATA: obj_type LIKE bapiache09-obj_type,

obj_key LIKE bapiache09-obj_key,

obj_sys LIKE bapiache09-obj_sys.

DATA: it_hdr LIKE bapiache09,

it_gl LIKE bapiacgl09 OCCURS 0 WITH HEADER LINE,

it_curr LIKE bapiaccr09 OCCURS 0 WITH HEADER LINE,

it_criteria LIKE bapiackec9 OCCURS 0 WITH HEADER LINE,

it_extension LIKE bapiacextc OCCURS 0 WITH HEADER LINE,

t_result LIKE bapiret2 OCCURS 0 WITH HEADER LINE.

DATA: ls_zzz TYPE STANDARD TABLE OF yyy_accit WITH HEADER LINE.

DATA: it_ext2 LIKE bapiparex OCCURS 0 WITH HEADER LINE.

PARAMETER: hkont_1(10) DEFAULT '1440131001',

hkont_2(10) DEFAULT '1440131001',

ceco_1(10),

ceco_2(10),

cebe_1(10) DEFAULT 'VE9002',

cebe_2(10).

  • Header Data

it_hdr-obj_type = 'BKPFB'.

it_hdr-obj_key = '$'.

SELECT SINGLE logsys INTO it_hdr-obj_sys FROM t000 WHERE mandt EQ sy-mandt.

it_hdr-bus_act = 'RFBU'.

it_hdr-comp_code = 'VEVS'.

it_hdr-fisc_year = '2008'.

it_hdr-fis_period = '02'.

it_hdr-doc_date = '20080228'.

it_hdr-pstng_date = '20080228'.

it_hdr-doc_type = 'SA'.

it_hdr-header_txt = 'TEXTO CAB'.

it_hdr-username = 'VEJMACIAS'.

it_hdr-compo_acc = 'FI'.

it_hdr-ref_doc_no_long = 'REFERENCIA'.

  • First Item

  • Account number

it_gl-itemno_acc = '1'.

it_gl-gl_account = hkont_1.

it_gl-item_text = 'PRUEBA TEXTO 1'.

it_gl-costcenter = ceco_1.

it_gl-profit_ctr = cebe_1.

APPEND it_gl. CLEAR it_gl.

  • Second Item

  • Account number

it_gl-itemno_acc = '2'.

it_gl-gl_account = hkont_2.

it_gl-item_text = 'PRUEBA TEXTO 2'.

it_gl-profit_ctr = cebe_2.

APPEND it_gl.

  • Set amount

it_curr-itemno_acc = '1'.

it_curr-currency = 'VEF'.

it_curr-amt_doccur = '100'.

APPEND it_curr.

it_curr-itemno_acc = '2'.

it_curr-currency = 'VEF'.

it_curr-amt_doccur = '-100'.

APPEND it_curr.

BREAK-POINT.

  • check posting

CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'

EXPORTING

documentheader = it_hdr

TABLES

accountgl = it_gl

currencyamount = it_curr.

return = t_result.

LOOP AT t_result WHERE ( type = 'E' OR type = 'A' ).

EXIT.

ENDLOOP.

REFRESH t_result.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = it_hdr

IMPORTING

obj_type = obj_type

obj_key = obj_key

obj_sys = obj_sys

TABLES

accountgl = it_gl

currencyamount = it_curr

criteria = it_criteria

extension2 = it_ext2

return = t_result.

*

BREAK-POINT.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

COMMIT WORK AND WAIT.

WRITE: obj_key.

What are we do, to solve the problem?.

Regards.

Piero Cimule.

2 REPLIES 2
Read only

Former Member
0 Likes
688

Hello:

Do not fill this fields because the system it generates them

it_hdr-obj_type = 'BKPFB'.

it_hdr-obj_key = '$'.

SELECT SINGLE logsys INTO it_hdr-obj_sys FROM t000 WHERE mandt EQ sy-mandt

and Try again.

Regards

Roberto

Read only

0 Likes
688

Hello Roberto:

When I blank the fields:

it_hdr-obj_type.

it_hdr-obj_key.

it_hdr-obj_sys.

And it_hdr-compo_acc = 'FI', The document 0100000016 are created. When I check FB03 ->accounting documents, doesn't exist.

When I change hdr-compo_acc = 'GL', this message appear:

"Combination of company code VEVS transaction RFBU not assigned to a ledger".

Do you have other idea?.

Regards,

Piero Cimule.

Edited by: Piero Cimule on Mar 14, 2008 9:52 PM