Application Development 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: 

Unsolved BAPI_ACC_DOCUMENT_POST...problem!!!!

Former Member
0 Kudos

Hi gurus,

I am posting this problem of mine for the third time, but I have got any reply to my previous postings, I don't know wheter the my problem is too difficult or its not an appropriate one to ask. Can someone pleaase reply this time to my problem so that I can proceed into my development, I will really appreciate your efforts.

I am working on an interface where I need to post an accounting document using

f-43 and for this I have identified this bapi 'BAPI_ACC_DOCUMENT_POST', and I have written the following code. everything is working properly but the only problem is, the posting keys I am using are 31 and 40 but when I run my program and look into the document created, it shows me the posting keys as 40 and 50 instead of 31 and 40, can you please tell me how to get rid of this thing .

v_semfile = p_ifname.

refresh it_input_file.

call function 'WS_UPLOAD'

EXPORTING

filename = v_semfile

filetype = 'DAT'

TABLES

data_tab = it_input

EXCEPTIONS

conversion_error = 1

file_open_error = 2

file_read_error = 3

invalid_type = 4

no_batch = 5

unknown_error = 6

invalid_table_width = 7

gui_refuse_filetransfer = 8

customer_error = 9

others = 10.

move:

'RFBU' to documentheader-bus_act,

it_input-doc_date2 to documentheader-doc_date,

it_input-pos_date2 to documentheader-pstng_date,

it_inputdoc_type to documentheader-doc_type,

it_inputbukrs to documentheader-comp_code,

it_input-pos_per to documentheader-fis_period,

it_input-fis_year to documentheader-fisc_year,

it_input-reference to documentheader-ref_doc_no,

it_input-h_text to documentheader-header_txt,

syst-uname to documentheader-username.

if it_input_file-pos_key eq 31.

move:

v_count to glaccount-ITEMNO_ACC,

it_input-glaccount to glaccount-gl_account,

it_input-kostl to glaccount-COSTCENTER,

it_input-prctr to glaccount-PROFIT_CTR,

it_input-bus_area to glaccount-bus_area,

it_input-item_text to glaccount-ITEM_TEXT,

it_input-assignment to glaccount-ALLOC_NMBR.

append glaccount.

move:

v_count to currencyamount-ITEMNO_ACC,

it_input-currency to currencyamount-CURRENCY,

it_input-amount to currencyamount-AMT_DOCCUR .

append currencyamount.

clear: glaccount, currencyamount.

else.

move: v_count to glaccount-ITEMNO_ACC,

it_input-glaccount to glaccount-gl_account,

it_input-kostl to glaccount-COSTCENTER,

it_input-prctr to glaccount-PROFIT_CTR,

it_input-bus_area to glaccount-bus_area,

it_input-item_text to glaccount-ITEM_TEXT,

it_input-assignment to glaccount-ALLOC_NMBR.

append glaccount.

move:

v_count to currencyamount-ITEMNO_ACC,

it_input-currency to currencyamount-CURRENCY.

currencyamount-AMT_DOCCUR = it_input-amount * -1.

append currencyamount.

clear: glaccount, currencyamount.

endif.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

DOCUMENTHEADER = documentheader

IMPORTING

OBJ_TYPE = obj_type

OBJ_KEY = obj_key

OBJ_SYS = obj_sys

TABLES

ACCOUNTGL = glaccount

ACCOUNTPAYABLE = ap

CURRENCYAMOUNT = currencyamount

RETURN = return.

read table return with key type = 'S'.

if syst-subrc eq 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

IMPORTING

RETURN = return2.

*****************************************************

Thanks

Rajeev....

4 REPLIES 4

JozsefSzikszai
Active Contributor
0 Kudos

hi Rajeev,

which TABLES parameter do you use? Seems like you use ACCOUNTGL (for both items), pls. use ACCOUNTPAYABLE for the vendor item and ACCOUNTGL for the G/L item.

You can try to use BAPI_ACC_INVOICE_RECEIPT_POST as well, which is specificly for vendor posting.

hope this helps

0 Kudos

Thanks for the reply Eric,

yes I was doing that mistake but when I tried to rectify it, I am getting the following error<b>....."Account 611100 in company code 1000 is not a reconciliation account".</b> but this is the a/c no. that I have been assigned by the functional folks. so can you please guide me through.

Rajeev.....

0 Kudos

Rajeev,

for the vendor line you have to add a vendor number and not a G/L account number (SAP will know the G/L behind the vendor and will take care about that). If posting key 31 was specified that is a vendor posting and you need a vendor number for that, so you should go back to functional guys and ask them what kind of posting they want in fact.

Some info about posting keys:

01-09 and 11-19 : customer

21-29 and 31-39 : vendor

40 and 50 : G/L

Come back if you still have questions!

ec

0 Kudos

Hey Eric ....thr problem is resolved now.....thnks for your hepl!!!!

Rajeev