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

Reverse Document after BAPI_ACC_DOCUMENT_POST using FB08

Former Member
0 Likes
1,716

Hello everybody, I'm using the BAPI_ACC_DOCUMENT_POST to post a document, but I can't reverse it using the transaction FB08, I get the following message "Not possible to reverse the document in financial accounting". I found in this forum something similar: but if I leave the OBJ_TYPE blank I get the following message "Required field OBJ_TYPE was not transferred in parameter DOCUMENTHEADER".

I've been reading and for what I see the only way is to use the BAPI_ACC_DOCUMENT_REV_POST, but that wont work for me I need to be able to reverse the document using the FB08. Is it possible? If it's so How can I post the document using the BAPI and be able to reverse it using the FB08 transaction?

Thank you.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,181

Hi!

I think the problem is with the field AWTYP. What value are you sending to the BAPI?

Yo should try to send "BKPF".

Hope it helps,

Esteban

5 REPLIES 5
Read only

ThomasZloch
Active Contributor
0 Likes
1,181

We're posting thousands of documents each day using this BAPI, and some get reversed by FB08 without problems (as I said in the quoted thread as well). Please post your BAPI call here and how you fill the relevant structures, especially the header data (please observe the 5000 character limit, or your post will become unreadable).

Thomas

Read only

Former Member
0 Likes
1,181

What does the long text of the error message say?

Rob

Read only

Former Member
0 Likes
1,182

Hi!

I think the problem is with the field AWTYP. What value are you sending to the BAPI?

Yo should try to send "BKPF".

Hope it helps,

Esteban

Read only

0 Likes
1,181

For information and maybe reference, in the header data I'm leaving the following fields blank:

OBJ_TYPE

OBJ_KEY

OBJ_SYS

and I fill BUS_ACT with "RFBU".

Works for me, might depend on specific circumstances though.

Thomas

Read only

Former Member
0 Likes
1,181

CONSTANTS: c_obj_type TYPE awtyp VALUE 'IDOC'.

CONSTANTS: c_obj_key TYPE awkey VALUE '$'.

CONSTANTS: c_bus_act TYPE glvor VALUE 'RFBU'.

CONSTANTS: c_doc_type TYPE blart VALUE 'GV'.

CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'

IMPORTING

own_logical_system = v_obj_sys.

w_hdr-obj_type = c_obj_type.

w_hdr-obj_sys = v_obj_sys.

w_hdr-bus_act = c_bus_act.

w_hdr-username = sy-uname.

w_hdr-header_txt = w_gv-header_txt.

w_hdr-comp_code = w_gv-comp_code.

w_hdr-doc_date = sy-datum.

w_hdr-pstng_date = sy-datum.

w_hdr-trans_date = w_gv-pstng_date.

w_hdr-fisc_year = w_hdr-pstng_date(04).

w_hdr-fis_period = w_hdr-pstng_date+04(02).

w_hdr-doc_type = c_doc_type.

w_hdr-ref_doc_no = w_gv-ref_doc_no.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = w_hdr

IMPORTING

obj_type = v_typ

obj_key = v_key

obj_sys = v_sys

TABLES

accountgl = i_agl

accounttax = i_tax

currencyamount = i_cur

return = i_ret.