Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Unsolved BAPI_ACC_DOCUMENT_POST...problem!!!!

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....

Tags:
Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question