Currency in BAPI_ACC_DOCUMENT_POST
Hi All,
I want to pass local as well as foreign currency in BAPI_ACC_DOCUMENT_POST.
The requirement is such that i should not use exchange Rate. What would be the solution for the same?
Would be obliged if someone could guide me in right direction....
When you mentioned local and foreign currencies, if I make some assumptions:
Local(USD) - Curr Type = '10'
Foreign(AUD) - Either Doc curr(Curr type ='00') or Group Curr(Curr type ='30')
You can do something like this:
CURR_TYPE = '10'.
CURRENCY = 'USD'.
AMT_DOCCUR = '-10.00'.
CURR_TYPE = '10'.
CURRENCY = 'USD'.
AMT_DOCCUR = '10.00'.
CURR_TYPE = '00'.
CURRENCY = 'AUD'.
AMT_DOCCUR = '-26.33'.
CURR_TYPE = '00'.
CURRENCY = 'AUD'.
AMT_DOCCUR = '26.33'.
On BSEG, there are different fields to store Local, doc curr and other currencies.
Let me know if that helped.
Ram Dindi.
Similar Messages
-
BAPI - BAPI_ACC_DOCUMENT_POST Error due to Currency table.
Hi Guys ,
I am facing an error while posting documents using BAPI_ACC_DOCUMENT_POST. The error occurs is in the tables parameters "currencyamount" .I am appending Amt in document currency, Amt in Local currency, Amount in 2nd Currency and Amount in 3rd Currency using Currency type (CURR_TYP) 00,10,30 and 60 respectively for every line item. All these 4 currency fields might have different values.The error in the "return" parameter says "Balance in currencies".
Can anyone suggest an appropriate way to pass all the above 4 currency fields to the same line item ?
Thanks,
Venkat.Hi VG,
while using this bapi...the total amount or net amount should be zero.
Thru Txn we assign posting key ..and system autiomatically take the sign on the basiss of Posting key..but in this bapi we dont have posting key field....so we have to give the amount with the sign...and total of all the line items should be zero ...
Thnx
RK -
Hi All,
We are facing error FI/CO interface: Balance in transaction currency from BAPI BAPI_ACC_DOCUMENT_POST.
This error we are getting only in case of passing tax data.
Can anyone help me on this.
Below is the code :
*fill header
gd_documentheader-username = sy-uname.
gd_documentheader-header_txt = 'Test'.
gd_documentheader-comp_code = p_ccode. "SQ
gd_documentheader-doc_date = sy-datum.
gd_documentheader-pstng_date = sy-datum.
gd_documentheader-doc_type = 'KR'.
gd_documentheader-ref_doc_no = p_xblnr. "SQ
*gd_documentheader-bus_act = 'RMWE'.
city = p_city.
state = p_state.
zipcode = p_zip.
*get tax juridisction code
IF NOT ( city IS INITIAL ) AND
NOT ( state IS INITIAL ) AND
NOT ( zipcode IS INITIAL ).
SELECT SINGLE rfcdest INTO ttxd-rfcdest FROM ttxd
WHERE kalsm = 'TAXUSX'.
CLEAR x_com_jur.
REFRESH t_com_jur.
x_com_jur-city = city.
x_com_jur-state = state.
IF zipcode+5(4) EQ space.
zipcode+5(4) = '0000'.
ENDIF.
CONCATENATE zipcode+0(5) '-' zipcode+5(4)
INTO x_com_jur-zipcode.
x_com_jur-country = 'US'.
CALL FUNCTION 'RFC_DETERMINE_JURISDICTION'
DESTINATION ttxd-rfcdest
EXPORTING
location_data = x_com_jur
IMPORTING
location_err = x_com_err
TABLES
location_results = t_com_jur.
IF sy-subrc = 0.
READ TABLE t_com_jur INTO x_com_jur INDEX 1.
it_accountgl-taxjurcode = x_com_jur-txjcd.
ENDIF.
ENDIF.
*fill AP (line 1) - vendor related data
SELECT SINGLE zterm FROM lfb1 INTO p_zterm WHERE lifnr = p_lifnr.
it_accountpayable-itemno_acc = 1.
it_accountpayable-tax_code = p_txcd.
it_accountpayable-pmnttrms = p_zterm. "SQ
it_accountpayable-vendor_no = p_lifnr. "SQ
*it_accountpayable-item_text = 'S2P Testing in UDR1'. - SQ
it_accountpayable-pymt_meth = p_pmet. "- SQ
APPEND it_accountpayable.
*fill GL (line 2)
it_accountgl-itemno_acc = 2.
*item_text - sq
IF p_asset IS NOT INITIAL.
TABLES : anlz,
anla.
SELECT SINGLE * FROM anlz WHERE anln1 = p_asset.
SELECT SINGLE * FROM anla WHERE anln1 = p_asset.
*concatenate '00' anla-KTOGR into it_accountgl-gl_account .
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = anla-ktogr
IMPORTING
output = it_accountgl-gl_account.
it_accountgl-asset_no = p_asset.
it_accountgl-sub_number = '0000'.
it_accountgl-cs_trans_t = '105'.
it_accountgl-acct_type = 'A'.
ELSE.
it_accountgl-gl_account = p_gl.
it_accountgl-costcenter = p_cc.
it_accountgl-wbs_element = p_posid.
ENDIF.
it_accountgl-comp_code = p_ccode.
it_accountgl-tax_code = p_txcd. "SQ
it_accountgl-pstng_date = sy-datum.
it_accountgl-fisc_year = sy-datum(4).
APPEND it_accountgl.
CLEAR it_currencyamount.
*fill currency ammounts for lines 1 & 2
it_currencyamount-currency = p_waers. "SQ
it_currencyamount-itemno_acc = 1.
*it_currencyamount-amt_base = -1.
it_currencyamount-amt_doccur = - 116. "p_totamt.
it_currencyamount-CURRENCY_ISO = 'USD'.
it_currencyamount-tax_amt = - 16.
APPEND it_currencyamount.
CLEAR it_currencyamount.
it_currencyamount-itemno_acc = 2.
it_currencyamount-currency = p_waers. "SQ
it_currencyamount-amt_doccur = 100.
it_currencyamount-CURRENCY_ISO = 'USD'.
*it_currencyamount-amt_base = 100.
*it_currencyamount-TAX_AMT = -10.
APPEND it_currencyamount.
*tax data
it_accounttax-itemno_acc = 3.
it_accounttax-tax_code = p_txcd.
it_accounttax-gl_account = '0023110000'.
*it_accounttax-gl_account = p_gl.
it_accounttax-TAXJURCODE = x_com_jur-txjcd.
it_accounttax-acct_key = 'NVV'.
it_accounttax-cond_key = 'XP2I'.
**it_accounttax-direct_tax = 'X'.
APPEND it_accounttax.
CLEAR it_currencyamount.
it_currencyamount-itemno_acc = 3.
it_currencyamount-currency = p_waers. "SQ
it_currencyamount-amt_doccur = 16.
it_currencyamount-CURRENCY_ISO = 'USD'.
it_currencyamount-amt_base = 100.
it_currencyamount-TAX_AMT = - 16 .
APPEND it_currencyamount.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = gd_documentheader
IMPORTING
obj_key = wa_obj_key
TABLES
accountgl = it_accountgl
* ACCOUNTRECEIVABLE =
accountpayable = it_accountpayable
accounttax = it_accounttax
currencyamount = it_currencyamount
* CRITERIA =
* VALUEFIELD =
* EXTENSION1 =
return = it_return
COMMIT WORK.
Regards,
PriyaranjanHi,
Reason 1:
An revenue-recognition-relevant item has several active conditions whose values cancel themselves so that a net item value of 0 results. The conditions have both the same revenue account (SAKN1) and the same clearing account (SAKN2).
For these conditions, the system writes a line with value 0 into the temporary FI/CO interface (internal tables: CACCIT, CACCCR). If table VBREVK does not contain control lines for this line, no further processing occurs and the line remains in the temporary FI/CO interface. Then the system reads this line for the creation of the next billing item which conatins a net value and generates a posting line with value 0. As a result, there is a balance in the FI/CO interface, and the billing document cannot be transferred.
Reason 2:
The billing document contains at least one item with an item category for which there is a setting stipulating that the values of this item should not be transferred to the header total of the document.
That is, in the maintenance of the item categories, this item category has the characteristic 'X' or 'Y' in 'Statistical value' field.
Reason 3:
Case: Billing document contains items without pricing conditions.
Then, on release to accounting, error RW022 occurs.
regards,
Saju.S -
Currency value in BAPI_ACC_DOCUMENT_POST
Hi All;
in order to post payments i use BAPI_ACC_DOCUMENT_POST. There are many payment lines (posting key 40) and one vendor line (posting key 31). i have filled in tables header, account_gl, accounts_payable and currency-amount accordingly. When i run the function it issues an error stating 'use another currency other than ..'. I have tried with different currencies but the error keeps coming. I pass the currency value in account payable and currency amount tables. how can i sole this problem, is it smt. with FI customising?
Thx
aliHi,
here is my code:
clear header.
header-comp_code = '1100'.
header-username = sy-uname.
header-bus_act = 'RFBU'.
header-pstng_date = budat."kyt_tarih.
header-doc_date = bldat."g_tarih.
header-doc_type = 'SA'.
append header.
clear vendor.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lifnr
IMPORTING
output = lifnr.
vendor-vendor_no = lifnr.
vendor-comp_code = '1100'.
vendor-itemno_acc = sayac.
vendor-tax_code = mwskz.
vendor-pymt_amt = 0 - toplam.
vendor-pymt_cur = waers."'TRY'.
vendor-pymt_cur_iso = waers.
append vendor.
clear tax.
tax-itemno_acc = sayac.
tax-gl_account = zco_benzin_match-hkont.
tax-tax_code = mwskz.
append tax.
clear amount.
amount-itemno_acc = sayac.
amount-currency = waers. "'TRY'.
amount-currency_iso = waers.
amount-curr_type = '00'.
amount-amt_doccur = 0 - toplam.
amount-amt_base = 0 - toplam.
append amount.
loop at itab.
sayac = sy-tabix.
clear accountgl.
clear tax.
clear amount.
clear zco_benzin_match.
if itab-kostl co numbers.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = itab-kostl
IMPORTING
output = itab-kostl.
endif.
select single * from zco_benzin_match where kostl = itab-kostl.
accountgl-itemno_acc = sayac.
accountgl-comp_code = '1100'.
accountgl-pstng_date = budat."kyt_tarih.
accountgl-doc_type = 'SA'.
accountgl-gl_account = zco_benzin_match-hkont.
accountgl-vendor_no = lifnr.
accountgl-tax_code = mwskz.
accountgl-orderid = itab-plaka.
accountgl-item_text = itab-tip.
append accountgl.
tax-itemno_acc = sayac.
tax-gl_account = zco_benzin_match-hkont.
tax-tax_code = mwskz.
append tax.
it_accounttax-acct_key = 'VST'.
clear amount.
amount-itemno_acc = sayac.
amount-currency = waers. "'TRY'.
amount-currency_iso = waers.
amount-curr_type = '00'.
amount-amt_doccur = itab-wrbtr.
amount-amt_base = itab-wrbtr.
append amount.
if not zco_benzin_match-hkont is initial.
move itab-wrbtr to tutar.
translate tutar using '.,'.
endif.
endloop.
if not test is initial.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
EXPORTING
DOCUMENTHEADER = header
CUSTOMERCPD =
CONTRACTHEADER =
TABLES
ACCOUNTGL = accountgl
ACCOUNTRECEIVABLE =
ACCOUNTPAYABLE = vendor
ACCOUNTTAX = tax
CURRENCYAMOUNT = amount
CRITERIA =
VALUEFIELD =
EXTENSION1 =
RETURN = messages
PAYMENTCARD =
CONTRACTITEM =
EXTENSION2 =
REALESTATE =
ACCOUNTWT =
else.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
DOCUMENTHEADER = header
CUSTOMERCPD =
CONTRACTHEADER =
TABLES
ACCOUNTGL = accountgl
ACCOUNTRECEIVABLE =
ACCOUNTPAYABLE = vendor
ACCOUNTTAX = tax
CURRENCYAMOUNT = amount
CRITERIA =
VALUEFIELD =
EXTENSION1 =
RETURN = messages
PAYMENTCARD =
CONTRACTITEM =
EXTENSION2 =
REALESTATE =
ACCOUNTWT =
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = messages.
endif.
Thx .
Ali. -
Balance in local currency error in BAPI_ACC_DOCUMENT_POST
Hi,
When I call BAPI_ACC_DOCUMENT_POST, I take below error from bapi return message,
the code related filling bapi header,item and currency also is below.Is tehere any body can help me to solve my problem.
Thanks,
form fill_header .
"Header
t_doc_header-comp_code = 'NETS'.
t_doc_header-header_txt = 'CS stok'.
t_doc_header-fisc_year = gv_year.
t_doc_header-fis_period = gv_month.
t_doc_header-doc_date = sy-datum. "?
t_doc_header-pstng_date = sy-datum. "?
t_doc_header-bus_act = 'RFBU'.
t_doc_header-username = sy-uname.
t_doc_header-doc_type = 'SA'.
append t_doc_header.
t_doc_header-ac_doc_no = ''.
t_doc_header-acc_principle = ''.
t_doc_header-neg_postng = ''.
endform. " fill_header
form fill_item using p_no .
"item
t_accountgl_item-ac_doc_no = ''. "Accounting Document Number
t_accountgl_item-doc_type = ''. "Document type
t_accountgl_item-comp_code = 'NETS'. "Company Code
t_accountgl_item-plant = '1300'. "Plant
t_accountgl_item-fisc_year = gv_year. "Fiscal Year
t_accountgl_item-fis_period = gv_month. "Fiscal month
if p_no = '1'.
t_accountgl_item-itemno_acc = '1'.
t_accountgl_item-gl_account = '1522000111'.
t_accountgl_item-item_text = 'CS Vuk Item-1'.
t_accountgl_item-pstng_date = gv_last_day.
append t_accountgl_item.
elseif p_no ='2'.
t_accountgl_item-itemno_acc = '2'. "Accounting Document Line Item Number
t_accountgl_item-gl_account = '6220000111'. "General Ledger Account
t_accountgl_item-item_text = 'CS Vuk Item-2'.
t_accountgl_item-pstng_date = gv_first_day_for_next_month.
append t_accountgl_item.
endif.
endform. " fill_item_1
form fill_currency using p_no p_fark .
data: miktar1 type ckmlcr-salk3,
miktar2 type ckmlcr-salk3.
"currency
t_currencyamount-exch_rate = ''. "Exchange rate
t_currencyamount-curr_type = '10'. "Currency type and valuation view
t_currencyamount-currency = 'TRY'.
miktar1 = p_fark.
miktar2 = - p_fark.
if p_no = '1'.
t_currencyamount-itemno_acc = 1.
t_currencyamount-amt_doccur = miktar1. "Amount in document currency
append t_currencyamount.
t_currencyamount-itemno_acc = 2.
t_currencyamount-amt_doccur = miktar2.
append t_currencyamount.
elseif p_no = '2'.
t_currencyamount-itemno_acc = 1.
t_currencyamount-amt_doccur = miktar2.
append t_currencyamount.
t_currencyamount-itemno_acc = 2.
t_currencyamount-amt_doccur = miktar1.
append t_currencyamount.
endif.
append t_currencyamount.
endform. " fill_currency
form call_bapi_post .
call function 'BAPI_ACC_DOCUMENT_POST'
exporting
documentheader = t_doc_header
importing
obj_type = gv_obj_type
obj_key = gv_obj_key
obj_sys = gv_obj_sys
tables
accountgl = t_accountgl_item
ACCOUNTRECEIVABLE =
ACCOUNTPAYABLE =
ACCOUNTTAX =
currencyamount = t_currencyamount
CRITERIA =
VALUEFIELD =
EXTENSION1 =
return = t_return.
gs_doc = gv_obj_key.
perform check_error tables t_return.
perform call_bapi_trans.
endform. " execute_bapicheck below code....
FUNCTION ZF_BAPI_ACC_GL_POSTING.
""Local interface:
*" IMPORTING
*" VALUE(SIMULATE) TYPE CHAR1 OPTIONAL
*" VALUE(FILEPATH) LIKE RLGRAP-FILENAME OPTIONAL
*" TABLES
*" DATA_RECORD STRUCTURE ZFGL_ACCOUNT_POSTING
*" RETURN STRUCTURE BAPIRET2
This is a common function module is to simulate & post a GL document
using input file. If file got more than 999 items for the combination
of company code, Currency & accounting base, the function module will
post first 998 Items of the above combination & balances the GL
document with 999 item having GL account 0000299998. First line item
of the subsequent document would be similar to 999th item of the
previous *document.
Read all input records into an internal table.
clear: IT_DATA,
IT_DATA[],
w_simulate,
flg_err,
IT_US_DATA,
RETURN,
RETURN[],
it_return,
it_return[],
IT_US_DATA[].
w_simulate = simulate.
w_filepath = filepath.
DATA: L_index LIKE SY-TABIX,
L_NEWBS LIKE RF05A-NEWBS.
loop at DATA_RECORD.
move-corresponding data_record to it_data.
move : data_record-SAKNR to it_data-newKO,
data_record-MWSKZ to it_data-VAL2.
Function module to convert NEWKO
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = IT_DATA-NEWKO
IMPORTING
OUTPUT = IT_DATA-NEWKO.
Function module to convert KOSTL
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = IT_DATA-KOSTL
IMPORTING
OUTPUT = IT_DATA-KOSTL.
append it_data.
clear it_data.
endloop.
If no data is passed in an input table
if it_data[] is initial.
PERFORM UPLOAD_DATA.
IF SY-SUBRC = 0 .
PERFORM INSERT_IT_DATA.
ENDIF.
endif.
The below logic written for US payroll. As the US Payroll file is not
standard file and do not have the credit and debit amount balanced.
The logic below would take care the debit/credit amount balances
read table it_data index 1.
if it_data-zzdatsrc = '3311'.
loop at it_data.
if it_data-newbs = '40'.
L_NEWBS = '50'.
PERFORM CREATE_GL_ITEMS USING L_NEWBS
v_gen
IT_DATA-BUKRS.
CLEAR L_NEWBS.
else.
L_NEWBS = '40'.
PERFORM CREATE_GL_ITEMS USING L_NEWBS
v_gen
IT_DATA-BUKRS.
CLEAR L_NEWBS.
endif.
endloop.
The below logic written for P-card. As the US P-Card file is not
standard file and do not have the credit and debit amount balanced,
the logic below would take care the debit/credit amount balances
elseif it_data-zzdatsrc = '3312'.
sort it_data by BUKRS
WAERS
ZZACCBAS
seq_num
NEWKO.
loop at it_data.
if it_data-newbs = '40'.
IT_US_DATA-WRBTR = IT_US_DATA-WRBTR + IT_DATA-WRBTR.
else.
IT_US_DATA-WRBTR = IT_US_DATA-WRBTR - IT_DATA-WRBTR.
endif.
at end of NEWKO.
if it_us_data-wrbtr = 0.
clear: it_us_data,
L_NEWBS.
continue.
elseif it_us_data-wrbtr > 0.
L_NEWBS = '40'.
else.
L_NEWBS = '50'.
endif.
move-corresponding it_data to it_us_data.
clear: it_us_data-newko,
it_us_data-newbs,
it_us_data-kostl,
IT_us_data-sgtxt,
it_us_data-wrbtr.
MOVE: v_pcard_ac TO IT_US_DATA-NEWKO,
L_NEWBS TO IT_US_DATA-NEWBS,
IT_DATA-WRBTR to IT_US_DATA-WRBTR,
'3312' TO IT_US_DATA-ZZDATSRC,
'GGA' TO IT_US_DATA-ZZACCBAS.
append it_us_data.
clear: it_us_data,
L_NEWBS.
endat.
endloop.
LOOP AT IT_US_DATA.
MOVE-CORRESPONDING IT_US_DATA TO IT_DATA.
APPEND IT_DATA.
CLEAR IT_DATA.
ENDLOOP.
endif.
Populate Sequence number
loop at it_data.
it_data-seq_num = sy-tabix.
modify it_data index sy-tabix transporting seq_num.
endloop.
Sort table
sort it_data by bukrs waers budat zzACCBAS seq_num.
Populate reconciliation account for 999th record
v_rec_account = '0000299998'.
Process input data
loop at it_data.
L_INDEX = SY-TABIX.
Populate document heade for every combination of
company code & currency code
At new ZZACCBAS.
READ TABLE IT_DATA INDEX L_INDEX.
CLEAR: it_documentheader[],
it_documentheader,
it_accountgl[],
it_accountgl,
it_currencyamount[],
it_currencyamount,
W_COUNT,
W_TL_AMNT,
w_seq,
flg_eod.
perform populate_header.
endat.
W_COUNT = W_COUNT + 1.
IF IT_DATA-NEWBS = '40'.
W_TL_AMNT = W_TL_AMNT - IT_DATA-WRBTR.
ELSEIF IT_DATA-NEWBS = '50'.
W_TL_AMNT = W_TL_AMNT + IT_DATA-WRBTR.
ENDIF.
perform populate_items.
if flg_err = 'X'.
exit.
endif.
AT END OF ZZACCBAS.
Call BAPI to check input data.
perform call_posting_bapi.
loop at it_return where type = 'S' or type = 'E' or type ='A'.
move-corresponding it_return to return.
append return.
clear return.
endloop.
flg_EOD = 'X'.
CLEAR: W_TL_AMNT,
W_COUNT,
it_documentheader[],
it_documentheader,
it_accountgl[],
it_accountgl,
it_currencyamount[],
it_currencyamount.
ENDAT.
*Creating the reconcillation record
if flg_EOD <> 'X'.
IF W_COUNT EQ 998.
IF W_TL_AMNT <> 0.
W_COUNT = W_COUNT + 1.
IF W_TL_AMNT LT 0.
IT_DATA-NEWBS = '50'.
it_data-newko = v_rec_account.
W_WRBTR = ABS( W_TL_AMNT ).
IT_DATA-WRBTR = W_WRBTR.
flg_fi = 'X'.
w_seq = w_seq + 1 .
perform populate_items.
if flg_err = 'X'.
exit.
endif.
perform call_posting_bapi.
loop at it_return where type = 'S' or type = 'E' or type ='A'.
move-corresponding it_return to return.
append return.
clear return.
endloop.
cleAR:it_accountgl[],
it_accountgl,
it_currencyamount[],
it_currencyamount.
W_COUNT = 1.
IT_DATA-NEWBS = '40'.
it_data-newko = v_rec_account.
W_WRBTR = ABS( W_TL_AMNT ).
IT_DATA-WRBTR = W_WRBTR.
flg_fi = 'X'.
perform populate_items.
if flg_err = 'X'.
exit.
endif.
ELSE.
IT_DATA-NEWBS = '40'.
it_data-newko = v_rec_account.
W_WRBTR = ABS( W_TL_AMNT ).
IT_DATA-WRBTR = W_WRBTR.
flg_fi = 'X'.
perform populate_items.
if flg_err = 'X'.
exit.
endif.
perform call_posting_bapi.
loop at it_return where type = 'S' or type = 'E' or type ='A'.
move-corresponding it_return to return.
append return.
clear return.
endloop.
cleAR:it_accountgl[],
it_accountgl,
it_currencyamount[],
it_currencyamount.
W_COUNT = 1.
IT_DATA-NEWBS = '50'.
it_data-newko = v_rec_account.
W_WRBTR = ABS( W_TL_AMNT ).
IT_DATA-WRBTR = W_WRBTR.
flg_fi = 'X'.
perform populate_items.
if flg_err = 'X'.
exit.
endif.
ENDIF.
endif.
endif.
endif.
endloop.
IF FLG_ERR = 'X'.
loop at it_return where type = 'E' or type ='A'.
move-corresponding it_return to return.
append return.
clear return.
endloop.
ENDIF.
ENDFUNCTION. -
Where to enter Due Date and group currency amount in BAPI_ACC_DOCUMENT_POST
Hi,
I have some fields in a flat file . I need to post a document by F-04. Can anyone let me know where to enter the fields 'Due Date' and 'Group Currency Amount' for the line items?
Thanks in advance..
GC.Hi,
I have some fields in a flat file . I need to post a document by F-04. Can anyone let me know where to enter the fields 'Due Date' and 'Group Currency Amount' for the line items?
Thanks in advance..
GC. -
Error when using functions BAPI_ACC_DOCUMENT_POST
Hello,
When I used BAPI_ACC_DOCUMENT_POST function, the message: Document posted successfully appears, but really not documens are created, and the FI number range are modified.
See the example code:
*& Report ZPBA_PC *
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,
t_result LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
Header Data
it_hdr-obj_type = 'BKPFF'.
it_hdr-obj_key = '$'.
it_hdr-obj_sys = 'LA122D'.
it_hdr-bus_act = 'RFBU'.
it_hdr-comp_code = 'VEZS'.
it_hdr-fisc_year = '2004'.
it_hdr-fis_period = '12'.
it_hdr-doc_date = '20041218'..
it_hdr-pstng_date = '20041218'.
it_hdr-doc_type = 'ZI'.
it_hdr-header_txt = 'TEXTO CAB'.
it_hdr-username = sy-uname.
it_hdr-compo_acc = 'GL'.
it_hdr-ref_doc_no_long = 'REFERENCIA'.
First Item
Account number
it_gl-itemno_acc = '1'.
it_gl-gl_account = '0014401001'.
it_gl-item_text = 'PRUEBA TEXTO 1'.
it_gl-profit_ctr = 'VE2020'.
APPEND it_gl.
Second Item
Account number
it_gl-itemno_acc = '2'.
it_gl-gl_account = '0014401001'.
it_gl-item_text = 'PRUEBA TEXTO 2'.
it_gl-profit_ctr = 'VE2020'.
APPEND it_gl.
Set amount
it_curr-itemno_acc = '1'.
it_curr-currency = 'VEB'.
it_curr-amt_doccur = '10'.
APPEND it_curr.
it_curr-itemno_acc = '2'.
it_curr-currency = 'VEB'.
it_curr-amt_doccur = '-10'.
APPEND it_curr.
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.
if sy-subrc ne 0.
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
return = t_result.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
COMMIT WORK.
WRITE: obj_key.
endif.
I appreciated your help to solve that error.
Regards,
Piero Cimule.
<b></b>Hi,
Please check the changes :
*& Report ZPBA_PC *
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,
<b>l_flag type c.</b>
DATA: it_hdr LIKE bapiache09,
it_gl LIKE bapiacgl09 OCCURS 0 WITH HEADER LINE,
it_curr LIKE bapiaccr09 OCCURS 0 WITH HEADER LINE,
t_result LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
Header Data
it_hdr-obj_type = 'BKPFF'.
it_hdr-obj_key = '$'.
it_hdr-obj_sys = 'LA122D'.
it_hdr-bus_act = 'RFBU'.
it_hdr-comp_code = 'VEZS'.
it_hdr-fisc_year = '2004'.
it_hdr-fis_period = '12'.
it_hdr-doc_date = '20041218'..
it_hdr-pstng_date = '20041218'.
it_hdr-doc_type = 'ZI'.
it_hdr-header_txt = 'TEXTO CAB'.
it_hdr-username = sy-uname.
it_hdr-compo_acc = 'GL'.
it_hdr-ref_doc_no_long = 'REFERENCIA'.
First Item
Account number
it_gl-itemno_acc = '1'.
it_gl-gl_account = '0014401001'.
it_gl-item_text = 'PRUEBA TEXTO 1'.
it_gl-profit_ctr = 'VE2020'.
APPEND it_gl.
Second Item
Account number
it_gl-itemno_acc = '2'.
it_gl-gl_account = '0014401001'.
it_gl-item_text = 'PRUEBA TEXTO 2'.
it_gl-profit_ctr = 'VE2020'.
APPEND it_gl.
Set amount
it_curr-itemno_acc = '1'.
it_curr-currency = 'VEB'.
it_curr-amt_doccur = '10'.
APPEND it_curr.
it_curr-itemno_acc = '2'.
it_curr-currency = 'VEB'.
it_curr-amt_doccur = '-10'.
APPEND it_curr.
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' ).
<b>l_flag = 'X'.</b>
EXIT.
ENDLOOP.
<b>if l_flag is initial.</b>
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
return = t_result.
<b>Clear l_flag.
LOOP AT t_result WHERE ( type = 'E' OR type = 'A' ).
l_flag = 'X'.
EXIT.
ENDLOOP.</b><b>if l_flag is initial.</b>
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
<b>COMMIT WORK AND WAIT.</b>
<b>endif.</b>
WRITE: obj_key.
endif.
Best regards,
Prashant -
Error when using BAPI_ACC_DOCUMENT_POST...
[code]
Hello Experts,
Iam using the said BAPI for the first time and I am not sure if I filled up the
fields correctly. What I want to do is to post multiple debit entries(40) and a
special G/L entry for vendor(posting key 39). I also need to generate the tax and
withholding tax. So my entries will be like:
40 -->amount = 1,120(This value has a VAT included which is 12% or 120)
39 -->amount = 1,120(Special G/L for vendor)
For these 2 entries below, they must be generated automatically.
40 -->amount = 120(Tax)
50 -->amount = 20(This is the EWT or withholding tax)
Below is my code:
wa_documentheader-obj_type = 'BKPFF'.
CONCATENATE sy-sysid sy-mandt INTO wa_documentheader-obj_sys.
wa_documentheader-obj_key = '$'.
wa_documentheader-username = sy-uname.
wa_documentheader-comp_code = '1000'.
wa_documentheader-bus_act = 'RFBU'.
wa_documentheader-header_txt = 'AVH Testing...'.
wa_documentheader-fisc_year = '2007'.
wa_documentheader-doc_date = sy-datum.
wa_documentheader-pstng_date = sy-datum.
wa_documentheader-fis_period = '11'.
wa_documentheader-doc_type = 'S3'.
CLEAR wa_accountpayable.
wa_accountpayable-itemno_acc = 1.
wa_accountpayable-vendor_no = '2000000058'.
wa_accountpayable-sp_gl_ind = 'V'.
wa_accountpayable-tax_code = 'DI'.
APPEND wa_accountpayable TO it_accountpayable.
CLEAR: wa_accountgl.
wa_accountgl-itemno_acc = 2.
wa_accountgl-gl_account = '0060000061'.
wa_accountgl-item_text = 'Aris' .
wa_accountgl-DE_CRE_IND = 'S'.
wa_accountgl-tax_code = 'DI'.
wa_accountgl-comp_code = '1000'.
wa_accountgl-fisc_year = '2007'.
wa_accountgl-fis_period = '11'.
wa_accountgl-pstng_date = sy-datum.
wa_accountgl-doc_type = 'S3'.
INSERT wa_accountgl INTO TABLE it_accountgl.
CLEAR wa_accounttax.
wa_accounttax-itemno_acc = 3.
wa_accounttax-tax_code = 'DI'.
wa_accounttax-gl_account = '0010018291'.
wa_accounttax-acct_key = 'VST'.
APPEND wa_accounttax TO it_accounttax.
CLEAR: wa_currency.
wa_currency-itemno_acc = 1.
wa_currency-currency = 'PHP'.
wa_currency-curr_type = '00'.
wa_currency-amt_doccur = 1120.
wa_currency-amt_base = 1000.
wa_currency-exch_rate = 1.
APPEND wa_currency TO it_currency.
CLEAR: wa_currency.
wa_currency-itemno_acc = 2.
wa_currency-currency = 'PHP'.
wa_currency-curr_type = '00'.
wa_currency-amt_doccur = 1120.
wa_currency-amt_base = 1000.
wa_currency-exch_rate = 1.
APPEND wa_currency TO it_currency.
CLEAR: wa_currency.
wa_currency-itemno_acc = 3.
wa_currency-currency = 'PHP'.
wa_currency-curr_type = '00'.
wa_currency-amt_doccur = 120.
wa_currency-amt_base = 120.
wa_currency-exch_rate = 1.
APPEND wa_currency TO it_currency.
Post
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = wa_documentheader
IMPORTING
obj_type = obj_type
obj_key = obj_key
obj_sys = obj_sys
TABLES
accountgl = it_accountgl
currencyamount = it_currency
return = it_return.
LOOP AT it_return INTO wa_return.
WRITE : /1 wa_return-message.
ENDLOOP.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = wa_return3.
When I checked the return table there are 2 problems that says:
1. Error in document: BKPFF $ ED1CLNT140
2. Balance in transaction currency
Hope you can help me guys. Simple examples will be appreciated. Thank you and take care!
[/code]<u>you can check the code.</u>
IF NOT wa_data-lifnr IS INITIAL.
ADD 1 TO g_lino.
x_vendoritem-itemno_acc = g_lino.
x_vendoritem-vendor_no = wa_data-lifnr.
IF wa_data-newbk IS INITIAL.
x_vendoritem-comp_code = wa_data-bukrs.
ELSE.
x_vendoritem-comp_code = wa_data-newbk.
ENDIF.
x_vendoritem-comp_code = t001-bukrs.
x_vendoritem-item_text = wa_data-csgtxt.
x_vendoritem-pmnttrms = wa_data-pyterm.
x_vendoritem-bline_date = wa_data-bldate.
x_vendoritem-pymt_meth = wa_data-zlsch.
x_vendoritem-alloc_nmbr = wa_data-zuonr.
x_vendoritem-tax_code = wa_data-mwskz.
x_vendoritem-taxjurcode = wa_data-txjcd.
APPEND x_vendoritem TO it_vendoritem.
x_currencyamount-itemno_acc = g_lino.
x_currencyamount-curr_type = c_ct1.
x_currencyamount-currency = t001-waers.
x_currencyamount-amt_doccur = wa_data-cwrbtr.
APPEND x_currencyamount TO it_currencyamount.
x_currencyamount-curr_type = c_ct2.
APPEND x_currencyamount TO it_currencyamount.
IF t001-land1 = c_lnd.
x_currencyamount-curr_type = c_ct3.
APPEND x_currencyamount TO it_currencyamount.
ENDIF.
ENDIF.
IF NOT wa_data-dsaknr IS INITIAL.
CLEAR:
x_accountgl,
x_currencyamount,
x_vendoritem.
ADD 1 TO g_lino.
x_accountgl-itemno_acc = g_lino.
x_accountgl-doc_type = x_doc_hdr-doc_type.
IF wa_data-newbk IS INITIAL.
x_accountgl-comp_code = wa_data-bukrs.
ELSE.
x_accountgl-comp_code = wa_data-newbk.
ENDIF.
x_accountgl-gl_account = wa_data-dsaknr.
x_accountgl-costcenter = wa_data-dkostl.
x_accountgl-item_text = wa_data-dsgtxt.
x_accountgl-orderid = wa_data-daufnr.
x_accountgl-wbs_element = wa_data-dwbs.
x_accountgl-pstng_date = p_pdate.
x_accountgl-vendor_no = wa_data-lifnr .
x_accountgl-alloc_nmbr = wa_data-zuonr.
x_accountgl-tax_code = wa_data-mwskz.
x_accountgl-taxjurcode = wa_data-txjcd.
APPEND x_accountgl TO it_accountgl.
x_currencyamount-itemno_acc = g_lino.
x_currencyamount-curr_type = c_ct1.
x_currencyamount-currency = t001-waers.
x_currencyamount-amt_doccur = - wa_data-dwrbtr.
APPEND x_currencyamount TO it_currencyamount.
x_currencyamount-curr_type = c_ct2.
APPEND x_currencyamount TO it_currencyamount.
IF t001-land1 = c_lnd.
x_currencyamount-curr_type = c_ct3.
APPEND x_currencyamount TO it_currencyamount.
ENDIF.
ENDIF.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = x_doc_hdr
TABLES
accountgl = it_accountgl
accountpayable = it_vendoritem
currencyamount = it_currencyamount
return = it_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
Reward if helpful. -
Problem in G/L posting using BAPI_ACC_DOCUMENT_POST
Hi all,
I have one requirement in interface, using BAPI. Uploading the flat file USING BAPI (BAPI_ACC_DOCUMENT_POST)
my flat file is available given below.
sl.no
Document Date
Document Type
Company Code
Posting date
Period
Currency
Reference
Doc Header Text
Line Item 1
Account
Amount
Cost Centre
Profit Centre
Text
1
08/21/2014
SA
1000
08/21/2014
09
CUR
TEST
TEST
1
100
500.00
0001
Test
1
CUR
2
200
-500.00
0001
Test
2
08/21/2014
SA
1000
08/21/2014
09
CUR
TEST
TEST
1
100
500.00
0002
Test
2
CUR
2
200
-100.00
0002
Test
2
CUR
3
200
-100.00
0002
Test
2
CUR
4
200
-100.00
0002
Test
2
CUR
5
200
-100.00
0002
Test
2
CUR
6
200
-100.00
0002
Test
actually my requirement is , first time uploaded my data in ECC using BAPI (BAPI_ACC_DOCUMENT_POST). DOCUMENT no is created in BKPF table. again i've uploaded to same data using bapi.. again document no is created . but i don't need create document no in bkpf( when i'll upload 2nd time or more) in this case, i want to display error message 'this flat file already used'.
please give the solution fo this requirement. it's very urgent.Hi
The main parameters of BAPI BAPI_ACC_DOCUMENT_POST are:
- DOCUMENTHEADER (BAPIACHE09) to transfer the header data
- ACCOUNTGL (BAPIACGL09) to transfer the g/l item data
- ACCOUNTRECEIVABLE (BAPIACAR09) to transfer the customer item data
- ACCOUNTPAYABLE (BAPIACAP09) to transfer the vendor item data
So u need to use one of parameters above to transfer the header and item data, the amount data for every item have to be transfered by parameters CURRENCYAMOUNT
U should also considere the posting key is automatically set by BAPI, and it depends on the item type and the sign of amount:
- 40/50 for G/l
- 01/11 for customer
- 21/31 for vendor
1 40 617300 Mileage 0000310148 310148 27.20
2 40 617900 Entertainment Exp. 0000310148 V1 310148 177.26
3 40 144000 Input-VAT 20090925 V4 34.74
4 31 1019186 B.E.N. MR SAUVAT V1 239.20-
Lines 1/2 data move to ACCOUNTGL and CURRENCYAMOUNT
Line 4 data move to ACCOUNTPAYABLE and CURRENCYAMOUNT
The line 3 seems to be a TAX line, in this case u need to use ACCOUNTTAX and CURRENCYAMOUNT
The header data to be transfered to DOCUMENTHEADER
Max -
Error on bapi_acc_document_post
Hi experts,
when i executing this bapi_acc_document_post, am getting error " FI/CO interface: Line item entered several times" i mention code below so please give me suggestion.
*& Report ZSAMPLE
REPORT ZSAMPLE.
data: BEGIN OF WA_HEADER,
ID TYPE I,
KUNNR TYPE n LENGTH 10,
INV_DATE TYPE c LENGTH 10,
PST_DATE TYPE c LENGTH 10,
REF TYPE invfo-xblnr,
AMT_DOCCUR TYPE PA2010-BETRG,
TXT(40),
END OF WA_HEADER.
DATA : IT_HEADER like WA_HEADER OCCURS 0 WITH HEADER LINE.
data: BEGIN OF WA_ITEM,
ID TYPE I,
GL_ACCOUNT TYPE n LENGTH 10,
ITEM_TEXT TYPE BAPIACGL09-ITEM_TEXT,
BUS_AREA TYPE BAPIACGL09-BUS_AREA,
AMT_DOCCUR TYPE BAPIACCR09-AMT_DOCCUR,
KOSTL TYPE CSKT-KOSTL,
* VAT(2),
END OF WA_ITEM.
DATA : IT_ITEM like WA_ITEM OCCURS 0 WITH HEADER LINE.
* value of excel-cell
TYPES: ty_d_itabvalue TYPE alsmex_tabline-value,
* internal table containing the excel data
ty_t_itab TYPE alsmex_tabline OCCURS 0,
* line type of sender table
BEGIN OF ty_s_senderline,
line(4096) TYPE c,
END OF ty_s_senderline,
* sender table
ty_t_sender TYPE ty_s_senderline OCCURS 0.
CONSTANTS: gc_esc VALUE '"'.
DATA temp_row TYPE I.
DATA TEMP(4).
INCLUDE lalsmexf01.
DATA: it_data1 TYPE ty_t_itab.
DATA: it_data2 TYPE ty_t_itab.
DATA: it_data_wa LIKE LINE OF it_data1.
DATA: it_data_wa2 LIKE LINE OF it_data1.
* DATA DECLARATION
data: st_rw_s1 TYPE i VALUE '2'.
data: st_cl_s1 TYPE i VALUE '1'.
data: st_rw_s2 TYPE i VALUE '2'.
data: st_cl_s2 TYPE i VALUE '1'.
data: ed_rw_s1 TYPE i VALUE '3'.
data: ed_cl_s1 TYPE i VALUE '7'.
data: ed_rw_s2 TYPE i VALUE '5'.
data: ed_cl_s2 TYPE i VALUE '8'.
DATA: excel_tab TYPE ty_t_sender,
excel_tab1 TYPE ty_t_sender.
DATA: ld_separator TYPE c.
DATA: application TYPE ole2_object,
workbook TYPE ole2_object,
sheet TYPE ole2_object,
range TYPE ole2_object,
worksheet TYPE ole2_object.
DATA: h_cell TYPE ole2_object,
h_cell1 TYPE ole2_object.
DATA: ld_rc TYPE i.
TYPE-POOLS ole2.
*AT SELECTION-SCREEN.
PARAMETERS: filename LIKE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
PERFORM value_help.
sTART-OF-SELECTION.
* CASE sy-ucomm .
* WHEN 'ONLI'.
PERFORM execute.
PERFORM bapi.
* ENDCASE.
* MESSAGE DEFINATION
DEFINE m_message.
case sy-subrc.
when 0.
when 1.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
when others. raise upload_ole.
endcase.
END-OF-DEFINITION.
*& Form VALUE_HELP
* text
* --> p1 text
* <-- p2 text
FORM VALUE_HELP .
CALL FUNCTION 'DSVAS_DOC_WS_FILENAME_GET_50'
EXPORTING
def_filename = ' '
def_path = ' '
mask = ',*.*,*.*.'
mode = 'O'
title = ' '
IMPORTING
filename = filename
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " VALUE_HELP
*& Form EXECUTE
* text
* --> p1 text
* <-- p2 text
FORM EXECUTE .
* PARAMETER CHECK
IF st_rw_s1 > ed_rw_s1.
RAISE inconsistent_parameters.
ENDIF.
IF st_cl_s1 > ed_cl_s1.
RAISE inconsistent_parameters.
ENDIF.
IF st_rw_s2 > ed_rw_s2.
RAISE inconsistent_parameters.
ENDIF.
IF st_cl_s2 > ed_cl_s2.
RAISE inconsistent_parameters.
ENDIF.
CLASS cl_abap_char_utilities DEFINITION LOAD.
ld_separator = cl_abap_char_utilities=>horizontal_tab.
* OPENING EXCEL FILE
IF application-header = space OR application-handle = -1.
CREATE OBJECT application 'Excel.Application'.
m_message.
ENDIF.
CALL METHOD OF
application
'Workbooks' = workbook.
m_message.
CALL METHOD OF
application
'Workbooks' = workbook.
m_message.
CALL METHOD OF
workbook
'Open'
EXPORTING
#1 = filename.
m_message.
CALL METHOD OF
application
'Worksheets' = sheet
EXPORTING
#1 = 1.
m_message.
CALL METHOD OF
application
'Worksheets' = sheet
EXPORTING
#1 = 1.
m_message.
CALL METHOD OF
sheet
'Activate'.
m_message.
GET PROPERTY OF application 'ACTIVESHEET' = sheet.
m_message.
* MARKING OF WHOLE SPREADSHEET
CALL METHOD OF
sheet
'Cells' = h_cell
EXPORTING
#1 = st_rw_s1
#2 = st_cl_s1.
m_message.
CALL METHOD OF
sheet
'Cells' = h_cell1
EXPORTING
#1 = ed_rw_s1
#2 = ed_cl_s1.
m_message.
CALL METHOD OF
sheet
'RANGE' = range
EXPORTING
#1 = h_cell
#2 = h_cell1.
m_message.
CALL METHOD OF
range
'SELECT'.
m_message.
* Copy marked area (SHEET1) into Clippboard
CALL METHOD OF
range
'COPY'.
m_message.
* Read clipboard into ABAP
CALL METHOD cl_gui_frontend_services=>clipboard_import
IMPORTING
data = excel_tab
EXCEPTIONS
cntl_error = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE a037(alsmex).
ENDIF.
PERFORM separated_to_intern_convert TABLES excel_tab it_data1
USING ld_separator.
* Clear the clipboard
REFRESH excel_tab.
CALL METHOD cl_gui_frontend_services=>clipboard_export
IMPORTING
data = excel_tab
CHANGING
rc = ld_rc
EXCEPTIONS
cntl_error = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
* Working in Second Excel Work Sheet
CALL METHOD OF
application
'Worksheets' = sheet
EXPORTING
#1 = 2.
m_message.
CALL METHOD OF
sheet
'Activate'.
m_message.
GET PROPERTY OF application 'ACTIVESHEET' = sheet.
m_message.
* Mark Sheet2
CALL METHOD OF
sheet
'Cells' = h_cell
EXPORTING
#1 = st_rw_s2
#2 = st_cl_s2.
m_message.
CALL METHOD OF
sheet
'Cells' = h_cell1
EXPORTING
#1 = ed_rw_s2
#2 = ed_cl_s2.
m_message.
CALL METHOD OF
sheet
'RANGE' = range
EXPORTING
#1 = h_cell
#2 = h_cell1.
m_message.
CALL METHOD OF
range
'SELECT'.
m_message.
* Copy Marked Area (Sheet2) into Clippboard
CALL METHOD OF
range
'COPY'.
m_message.
* Read Clipboard into ABAP
CALL METHOD cl_gui_frontend_services=>clipboard_import
IMPORTING
data = excel_tab1
EXCEPTIONS
cntl_error = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE a037(alsmex).
ENDIF.
PERFORM separated_to_intern_convert TABLES excel_tab1 it_data2
USING ld_separator.
* Clear Clipboard
REFRESH excel_tab.
CALL METHOD cl_gui_frontend_services=>clipboard_export
IMPORTING
data = excel_tab1
CHANGING
rc = ld_rc
EXCEPTIONS
cntl_error = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4
* Leaving Application
CALL METHOD OF
application
'QUIT'.
m_message.
FREE OBJECT application.
m_message.
LOOP AT it_data1 INTO it_data_wa2.
IF temp_row ne it_data_wa2-ROW AND temp_row IS NOT INITIAL.
temp_row = it_data_wa2-ROW.
APPEND IT_HEADER.
ELSE.
temp_row = it_data_wa2-ROW.
ENDIF.
CASE it_data_wa2-COL.
WHEN '0001'.
IT_HEADER-ID = it_data_wa2-VALUE.
WHEN '0002'.
IT_HEADER-KUNNR = it_data_wa2-VALUE.
WHEN '0003'.
IT_HEADER-INV_DATE = it_data_wa2-value.
WHEN '0004'.
IT_HEADER-PST_DATE = it_data_wa2-VALUE.
WHEN '0005'.
IT_HEADER-REF = it_data_wa2-VALUE.
WHEN '0006'.
IT_HEADER-AMT_DOCCUR = it_data_wa2-VALUE.
WHEN '0007'.
IT_HEADER-TXT = it_data_wa2-VALUE.
ENDCASE.
ENDLOOP.
APPEND IT_HEADER.
CLEAR:temp_row.
LOOP AT it_data2 INTO it_data_wa ."WHERE ROW = it_data_wa2-ROW.
IF temp_row ne it_data_wa-ROW AND temp_row IS NOT INITIAL.
temp_row = it_data_wa-ROW.
APPEND IT_ITEM.
ELSEIF ( temp_row NE it_data_wa-ROW AND temp_row IS INITIAL ).
temp_row = it_data_wa-ROW.
* ELSE
ENDIF.
CASE it_data_wa-COL.
WHEN '0001'.
IT_ITEM-ID = it_data_wa-VALUE.
WHEN '0002'.
IT_ITEM-GL_ACCOUNT = it_data_wa-VALUE.
WHEN '0003'.
IT_ITEM-AMT_DOCCUR = it_data_wa-value.
WHEN '0004'.
IT_ITEM-ITEM_TEXT = it_data_wa-VALUE.
WHEN '0005'.
IT_ITEM-BUS_AREA = it_data_wa-VALUE.
WHEN '0006'.
IT_ITEM-KOSTL = it_data_wa-VALUE.
* WHEN '0007'.
* IT_ITEM-VAT = it_data_wa-VALUE.
ENDCASE.
ENDLOOP.
APPEND IT_ITEM.
ENDFORM. " EXECUTE
*ENDLOOP.
*& Form BAPI
* text
* --> p1 text
* <-- p2 text
FORM BAPI .
DATA: it_acc_gl LIKE bapiacgl09 OCCURS 0 WITH HEADER LINE,
it_acc_ap LIKE bapiacap09 OCCURS 0 WITH HEADER LINE,
it_acc_aR LIKE bapiacaR09 OCCURS 0 WITH HEADER LINE,
it_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
it_curr_amt LIKE bapiaccr09 OCCURS 0 WITH HEADER LINE,
it_doc_header LIKE bapiache09 OCCURS 0 WITH HEADER LINE,
it_acc_tax LIKE bapiactx09 OCCURS 0 WITH HEADER LINE,
obj_type LIKE bapiache09-obj_type,
obj_key LIKE bapiache09-obj_key,
obj_sys LIKE bapiache09-obj_sys,
pstng_date LIKE it_doc_header-pstng_date,
doc_date LIKE it_doc_header-doc_date,
loop_cnt TYPE i VALUE 0,
gv_vendor(10) TYPE c,
gv_gl_acc(10) TYPE c.
DATA conv_s_amt TYPE BETRG.
DATA cur_line TYPE P.
data item_no type POSNR_ACC.
data item_no1 type POSNR_ACC.
CLEAR: obj_type, obj_sys, obj_key, pstng_date, doc_date, gv_vendor, gv_gl_acc.
* CLEAR: it_doc_header,it_acc_gl,it_curr_amt,IT_ACC_AR,IT_RETURN.
LOOP AT it_HEADER INTO WA_HEADER .
REFRESH it_doc_header.
it_doc_header-bus_act = 'RFBU'.
it_doc_header-username = sy-uname.
* it_doc_header = WA_HEADER-KUNNR." Customer Number
it_doc_header-header_txt = WA_HEADER-TXT." bdc_source-col_h. " Invoice Text
it_doc_header-comp_code = 'JPOL'."bdc_source-col_a. " Company Code
CONCATENATE WA_HEADER-INV_DATE+6(4) WA_HEADER-INV_DATE+3(2) WA_HEADER-INV_DATE(2)
into it_doc_header-doc_date.
CONCATENATE WA_HEADER-pst_date+6(4) WA_HEADER-pst_date+3(2) WA_HEADER-pst_date(2)
into it_doc_header-pstng_date.
it_doc_header-doc_type = 'DR'. " Return Order...?
it_doc_header-fisc_year = '2013'. " Return Order...?
it_doc_header-fis_period = '02'. " Return Order...?
it_doc_header-ref_doc_no = '123'."bdc_source-col_d. " Invoice Number
APPEND it_doc_header.
REFRESH it_acc_aR.
it_acc_aR-itemno_acc = '1'. " Invoice Number
it_acc_aR-customer = WA_HEADER-KUNNR. " Customer Number
it_acc_aR-comp_code = 'JPOL'. " Company Code
it_acc_aR-item_text = WA_HEADER-txt. " Line Item Text
APPEND it_acc_aR.
* it_acc_aR-itemno_acc = '4'. " Invoice Number
* it_acc_aR-customer = WA_HEADER-KUNNR. " Customer Number
* it_acc_aR-comp_code = 'JPOL'. " Company Code
* it_acc_aR-item_text = WA_HEADER-txt. " Line Item Text
* APPEND it_acc_aR.
REFRESH it_acc_gl.
REFRESH IT_CURR_AMT.
* ITEM_NO = 1.
"GL Information details collected
CLEAR : ITEM_NO,item_no1.
LOOP AT it_ITEM INTO WA_ITEM where id = wa_header-ID.
ITEM_NO = ITEM_NO + 1.
it_acc_gl-itemno_acc = ITEM_NO.
it_acc_gl-gl_account = WA_ITEM-GL_ACCOUNT."gv_gl_acc. " GL Account
it_acc_gl-item_text = WA_ITEM-ITEM_TEXT. "bdc_source-col_o. " Line Item Text
it_acc_gl-doc_type = 'DR'. " Return Order...?
it_acc_gl-comp_code = 'JPOL'."bdc_source-col_a. " Company Code
it_acc_gl-bus_area = WA_ITEM-BUS_AREA."bdc_source-col_a. " Company Code
it_acc_gl-CUSTOMER = WA_HEADER-KUNNR.
conv_s_amt = WA_ITEM-AMT_DOCCUR."bdc_source-col_f. " Invoice Amount
IF conv_s_amt < 0.
it_acc_gl-de_cre_ind = 'H'. " H-Credit
conv_s_amt = - conv_s_amt.
ELSE.
it_acc_gl-de_cre_ind = 'S'. " S-Debit
ENDIF.
APPEND it_acc_gl.
ITEM_NO1 = ITEM_NO1 + 1.
it_curr_amt-itemno_acc = ITEM_NO1 . " Invoice Number
it_curr_amt-curr_type = '00'.
it_curr_amt-currency = 'INR'. " Currancy
it_curr_amt-amt_doccur = conv_s_amt . " Line Item Amount
APPEND it_curr_amt.
ITEM_NO1 = ITEM_NO1 + 1.
it_curr_amt-itemno_acc = ITEM_NO1 . " Invoice Number
it_curr_amt-curr_type = '00'.
it_curr_amt-currency = 'INR'. " Currancy
it_curr_amt-amt_doccur = conv_s_amt * -1. " Line Item Amount
APPEND it_curr_amt.
ENDLOOP.
REFRESH it_return.
"Customer Invoice
* Do the post to GL Account and AP
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = it_doc_header
IMPORTING
obj_type = obj_type
obj_key = obj_key
obj_sys = obj_sys
TABLES
accountgl = it_acc_gl
currencyamount = it_curr_amt
accountreceivable = it_acc_aR
return = it_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
* Check for any errors
WRITE : obj_key.
LOOP at IT_RETURN WHERE TYPE = 'E'.
WRITE : / 'Error :', IT_RETURN-MESSAGE .
endloop.
ENDLOOP.
ENDFORM. " BAPI
Result:Hi
Thank you for your help i did small modification i mention code below
REPORT ZCUS_INVOICE.
data: BEGIN OF WA_HEADER,
ID TYPE I,
KUNNR TYPE n LENGTH 10,
INV_DATE TYPE c LENGTH 10,
PST_DATE TYPE c LENGTH 10,
REF TYPE invfo-xblnr,
PRD_TEXT TYPE BAPIACGL09-ITEM_TEXT,
CMP_CODE TYPE BAPIACGL09-COMP_CODE,
AMT_DOCCUR TYPE PA2010-BETRG,
TXT(40),
END OF WA_HEADER.
DATA : IT_HEADER like WA_HEADER OCCURS 0 WITH HEADER LINE.
data: BEGIN OF WA_ITEM,
ID TYPE I,
GL_ACCOUNT TYPE n LENGTH 10,
ITEM_TEXT TYPE BAPIACGL09-ITEM_TEXT,
BUS_AREA TYPE BAPIACGL09-BUS_AREA,
AMT_DOCCUR TYPE BAPIACCR09-AMT_DOCCUR,
KOSTL TYPE CSKT-KOSTL,
* VAT(2),
END OF WA_ITEM.
DATA : IT_ITEM like WA_ITEM OCCURS 0 WITH HEADER LINE.
* value of excel-cell
TYPES: ty_d_itabvalue TYPE alsmex_tabline-value,
* internal table containing the excel data
ty_t_itab TYPE alsmex_tabline OCCURS 0,
* line type of sender table
BEGIN OF ty_s_senderline,
line(4096) TYPE c,
END OF ty_s_senderline,
* sender table
ty_t_sender TYPE ty_s_senderline OCCURS 0.
CONSTANTS: gc_esc VALUE '"'.
DATA temp_row TYPE I.
DATA TEMP(4).
INCLUDE lalsmexf01.
DATA: it_data1 TYPE ty_t_itab.
DATA: it_data2 TYPE ty_t_itab.
DATA: it_data_wa LIKE LINE OF it_data1.
DATA: it_data_wa2 LIKE LINE OF it_data1.
* DATA DECLARATION
data: st_rw_s1 TYPE i value '2'.
data: st_cl_s1 TYPE i value '1'.
data: st_rw_s2 TYPE i value '2'.
data: st_cl_s2 TYPE i value '1'.
data: ed_rw_s1 TYPE i value '50'.
data: ed_cl_s1 TYPE i value '9'.
data: ed_rw_s2 TYPE i value '50'.
data: ed_cl_s2 TYPE i value '6'.
DATA: excel_tab TYPE ty_t_sender,
excel_tab1 TYPE ty_t_sender.
DATA: ld_separator TYPE c.
DATA: application TYPE ole2_object,
workbook TYPE ole2_object,
sheet TYPE ole2_object,
range TYPE ole2_object,
worksheet TYPE ole2_object.
DATA: h_cell TYPE ole2_object,
h_cell1 TYPE ole2_object.
DATA: ld_rc TYPE i.
TYPE-POOLS ole2.
*AT SELECTION-SCREEN.
PARAMETERS: filename LIKE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
PERFORM value_help.
sTART-OF-SELECTION.
* CASE sy-ucomm .
* WHEN 'ONLI'.
PERFORM execute.
PERFORM bapi.
* ENDCASE.
* MESSAGE DEFINATION
DEFINE m_message.
case sy-subrc.
when 0.
when 1.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
when others. raise upload_ole.
endcase.
END-OF-DEFINITION.
*& Form VALUE_HELP
* text
* --> p1 text
* <-- p2 text
FORM VALUE_HELP .
CALL FUNCTION 'DSVAS_DOC_WS_FILENAME_GET_50'
EXPORTING
def_filename = ' '
def_path = ' '
mask = ',*.*,*.*.'
mode = 'O'
title = ' '
IMPORTING
filename = filename
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " VALUE_HELP
*& Form EXECUTE
* text
* --> p1 text
* <-- p2 text
FORM EXECUTE .
* PARAMETER CHECK
IF st_rw_s1 > ed_rw_s1.
RAISE inconsistent_parameters.
ENDIF.
IF st_cl_s1 > ed_cl_s1.
RAISE inconsistent_parameters.
ENDIF.
IF st_rw_s2 > ed_rw_s2.
RAISE inconsistent_parameters.
ENDIF.
IF st_cl_s2 > ed_cl_s2.
RAISE inconsistent_parameters.
ENDIF.
CLASS cl_abap_char_utilities DEFINITION LOAD.
ld_separator = cl_abap_char_utilities=>horizontal_tab.
* OPENING EXCEL FILE
IF application-header = space OR application-handle = -1.
CREATE OBJECT application 'Excel.Application'.
m_message.
ENDIF.
CALL METHOD OF
application
'Workbooks' = workbook.
m_message.
CALL METHOD OF
application
'Workbooks' = workbook.
m_message.
CALL METHOD OF
workbook
'Open'
EXPORTING
#1 = filename.
m_message.
CALL METHOD OF
application
'Worksheets' = sheet
EXPORTING
#1 = 1.
m_message.
CALL METHOD OF
application
'Worksheets' = sheet
EXPORTING
#1 = 1.
m_message.
CALL METHOD OF
sheet
'Activate'.
m_message.
GET PROPERTY OF application 'ACTIVESHEET' = sheet.
m_message.
* MARKING OF WHOLE SPREADSHEET
CALL METHOD OF
sheet
'Cells' = h_cell
EXPORTING
#1 = st_rw_s1
#2 = st_cl_s1.
m_message.
CALL METHOD OF
sheet
'Cells' = h_cell1
EXPORTING
#1 = ed_rw_s1
#2 = ed_cl_s1.
m_message.
CALL METHOD OF
sheet
'RANGE' = range
EXPORTING
#1 = h_cell
#2 = h_cell1.
m_message.
CALL METHOD OF
range
'SELECT'.
m_message.
* Copy marked area (SHEET1) into Clippboard
CALL METHOD OF
range
'COPY'.
m_message.
* Read clipboard into ABAP
CALL METHOD cl_gui_frontend_services=>clipboard_import
IMPORTING
data = excel_tab
EXCEPTIONS
cntl_error = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE a037(alsmex).
ENDIF.
PERFORM separated_to_intern_convert TABLES excel_tab it_data1
USING ld_separator.
* Clear the clipboard
REFRESH excel_tab.
CALL METHOD cl_gui_frontend_services=>clipboard_export
IMPORTING
data = excel_tab
CHANGING
rc = ld_rc
EXCEPTIONS
cntl_error = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
* Working in Second Excel Work Sheet
CALL METHOD OF
application
'Worksheets' = sheet
EXPORTING
#1 = 2.
m_message.
CALL METHOD OF
sheet
'Activate'.
m_message.
GET PROPERTY OF application 'ACTIVESHEET' = sheet.
m_message.
* Mark Sheet2
CALL METHOD OF
sheet
'Cells' = h_cell
EXPORTING
#1 = st_rw_s2
#2 -
Error getting while using BAPI "BAPI_ACC_DOCUMENT_POST" in the Web Dynpro
Hello Everyone,
I am trying to use BAPI_ACC_DOCUMENT_POST to post a docuemnt, for this I have created a web application and in that I have created one view. In the layout of the view I have developed three groups 1. document header 2.Currency 3. GL account. for user inputs and at the root node i have created a button and on the action f the button I am calling the BAPI but when i tested it I am getting the following error:
The following error text was processed in the system RS2 : Adapter error in INPUT_FIELD "GROUP_2_ITEMNO_ACC" of view "ZTEST_RAGI_INVOICE_POST.MAIN": Context binding of property VALUE cannot be resolved: Node MAIN.1.CURRENCYAMOUNT does not contain any elements .
Can you please help me in this.
Thanks,
Rajathelll rajat ,
The following error text was processed in the system RS2 : Adapter error in INPUT_FIELD "GROUP_2_ITEMNO_ACC" of view "ZTEST_RAGI_INVOICE_POST.MAIN": Context binding of property VALUE cannot be resolved: Node MAIN.1.CURRENCYAMOUNT does not contain any elements .
---> pass amount to that currency table.
regards
Prabhu -
Issue with posting G/L using the BAPI " BAPI_ACC_DOCUMENT_POST"
Hi all,
I am trying to create a G/L document using the BAPI "BAPI_ACC_DOCUMENT_POST". The Bapi is returning me a success message, but i am not able to see the document in BKPF/BSEG.
Can somebody please let me know if there is any customization that needs to be done to get the document number reflected in the corresponding tables after i execute this BAPI.
Here is the part of the code that i am using to fill the header structure:
docheader-obj_type = 'REACI'.
docheader-obj_key = 'TEST'.
docheader-obj_sys = 'ECSCLNT010'.
docheader-bus_act = 'RFBU'.
docheader-username = sy-uname.
docheader-header_txt = 'HDR TEXT'.
docheader-comp_code = 'SC01'.
docheader-doc_date = sy-datum.
docheader-pstng_date = sy-datum.
CASE wa_input_tmp-batch_type .
WHEN '0'.
docheader-doc_type = 'SA'.
WHEN '1'.
docheader-doc_type = 'RA'.
ENDCASE.
Any help is much appreciated.
Thanks in Advance,
SureshSee the below code :
I have tested program in my system :
*&---HEADER DECLARATION
DATA: HEADER TYPE BAPIACHE09. " HEADER DATA
INTERNAL TABLE DECLARATION
*&----G/L ACCOUNT ITEM
DATA: ACCOUNTGL TYPE STANDARD TABLE OF BAPIACGL09.
*&---CURRENCY ITEMS
DATA: CURRENCY_AMOUNT TYPE STANDARD TABLE OF BAPIACCR09.
*&----RETURN PARAMETER
DATA: RETURN TYPE STANDARD TABLE OF BAPIRET2 with header line.
WORK-AREA DECLARATION
*&----WORKAREA FOR G/L ACCOUNT ITEM
DATA: WA_ACCOUNTGL TYPE BAPIACGL09.
*&---WORKAREA FOR CURRENCY ITEMS
DATA: WA_CURRENCY_AMOUNT TYPE BAPIACCR09.
INITIALIZATION
HEADER-HEADER_TXT = 'TEST HEADER'.
HEADER-USERNAME = 'DEVELOPER'.
HEADER-COMP_CODE = '0002'.
HEADER-FISC_YEAR = '2007'.
HEADER-DOC_DATE = '20070502'.
HEADER-PSTNG_DATE = '20070502'.
HEADER-TRANS_DATE = '20070502'.
HEADER-DOC_TYPE = 'SA'.
HEADER-BUS_ACT = 'RFBU'.
WA_ACCOUNTGL-ITEMNO_ACC = '0000000010'.
WA_ACCOUNTGL-GL_ACCOUNT = '0000113020'.
WA_ACCOUNTGL-ITEM_TEXT = 'SO_DOC'.
WA_ACCOUNTGL-DE_CRE_IND = 'S'.
APPEND WA_ACCOUNTGL TO ACCOUNTGL.
CLEAR WA_ACCOUNTGL.
WA_ACCOUNTGL-ITEMNO_ACC = '0000000020'.
WA_ACCOUNTGL-GL_ACCOUNT = '0000113020'.
WA_ACCOUNTGL-ITEM_TEXT = 'SO_DOC'.
WA_ACCOUNTGL-DE_CRE_IND = 'H'.
APPEND WA_ACCOUNTGL TO ACCOUNTGL.
CLEAR WA_ACCOUNTGL.
WA_CURRENCY_AMOUNT-ITEMNO_ACC = '0000000010'.
WA_CURRENCY_AMOUNT-AMT_DOCCUR = '500'.
WA_CURRENCY_AMOUNT-CURRENCY = 'INR'.
APPEND WA_CURRENCY_AMOUNT TO CURRENCY_AMOUNT.
CLEAR WA_CURRENCY_AMOUNT.
WA_CURRENCY_AMOUNT-ITEMNO_ACC = '0000000020'.
WA_CURRENCY_AMOUNT-AMT_DOCCUR = '-500'.
WA_CURRENCY_AMOUNT-CURRENCY = 'INR'.
APPEND WA_CURRENCY_AMOUNT TO CURRENCY_AMOUNT.
CLEAR WA_CURRENCY_AMOUNT.
START-OF-SELECTION
START-OF-SELECTION.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = HEADER
CUSTOMERCPD =
CONTRACTHEADER =
IMPORTING
OBJ_TYPE =
OBJ_KEY =
OBJ_SYS =
tables
ACCOUNTGL = ACCOUNTGL
ACCOUNTRECEIVABLE =
ACCOUNTPAYABLE =
ACCOUNTTAX =
currencyamount = CURRENCY_AMOUNT
CRITERIA =
VALUEFIELD =
EXTENSION1 =
return = RETURN
PAYMENTCARD =
CONTRACTITEM =
EXTENSION2 =
REALESTATE =
IF return-type NA 'EA'.
call function 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
IMPORTING
RETURN = RETURN.
write:/ return-message.
else.
write:/ return-message.
ENDIF.
Reward Points if it is helpful
Thanks
Seshu -
BAPI_ACC_DOCUMENT_POST Giving an error while posting
Hi friends,
I wanted to post a Document using bapi BAPI_ACC_DOCUMENT_POST with tax data and jurisdiction code. Getting an error message " E RW 003 No currency information transferred into Accounting" though I have given the Currency info.
Below is the data that passed to the BAPI
<header> data
OBJ_TYPE BKPFF
OBJ_KEY $
OBJ_SYS T90CLNT810
BUS_ACT RFBU
USERNAME MNAGOORI
HEADER_TXT DOCU POST MD
COMP_CODE 3000
DOC_DATE 17.01.2007
PSTNG_DATE 17.01.2007
TRANS_DATE
FISC_YEAR 2007
FIS_PERIOD 01
DOC_TYPE WE
REF_DOC_NO
ACCOUNTGL TABLE DATA
ITEMNO_ACC 0000000001
GL_ACCOUNT 445000
ITEM_TEXT TEST FOR MD1
REF_KEY_3 40
ACCT_KEY
ACCT_TYPE S
COMP_CODE 3000
BUS_AREA 9900
ACCOUNTPAYABLE
ITEMNO_ACC 0000000002
VENDOR_NO 9999
GL_ACCOUNT 191100
REF_KEY_1
REF_KEY_2
REF_KEY_3 50
COMP_CODE 3000
BUS_AREA 9900
ITEM_TEXT TEST
AccountTax table
ITEMNO_ACC 0000000001
GL_ACCOUNT 445000
COND_KEY JP1I
ACCT_KEY NVV
TAX_CODE I1
TAX_RATE 6,000
TAX_DATE
TAXJURCODE PA0000000
ITEMNO_ACC 0000000002
GL_ACCOUNT 191100
COND_KEY JP1I
ACCT_KEY NVV
TAX_CODE I1
TAX_RATE 6,000
TAX_DATE
TAXJURCODE PA0000000
CurrencyAmount table
ITEMNO_ACC 0000000001
CURR_TYPE 00
CURRENCY USD
CURRENCY_ISO USD
AMT_DOCCUR 100,0000
EXCH_RATE
EXCH_RATE_V
AMT_BASE 100,0000
ITEMNO_ACC 0000000002
CURR_TYPE 00
CURRENCY USD
CURRENCY_ISO USD
AMT_DOCCUR 100,0000-
EXCH_RATE
EXCH_RATE_V
AMT_BASE 100,0000-
I could able to post without tax data.
I feel some of the feilds are missing the required data. Please any one could help me.
Thanks
MdHi Aaron,
I am testing the BAPI in SE37, the values are given below which I am trying to post.
[code]
****<header> data
OBJ_TYPE BKPFF
OBJ_KEY $
OBJ_SYS T90CLNT810
BUS_ACT RFBU
USERNAME MNuser
HEADER_TXT DOCU POST MD
COMP_CODE 3000
DOC_DATE 17.01.2007
PSTNG_DATE 17.01.2007
TRANS_DATE
FISC_YEAR 2007
FIS_PERIOD 01
DOC_TYPE WE
REF_DOC_NO
ACCOUNTGL TABLE DATA
ITEMNO_ACC 0000000001
GL_ACCOUNT 445000
ITEM_TEXT TEST FOR MD1
REF_KEY_3 40
ACCT_TYPE S
COMP_CODE 3000
BUS_AREA 9900
ACCOUNTPAYABLE
ITEMNO_ACC 0000000002
VENDOR_NO 9999
GL_ACCOUNT 191100
REF_KEY_1
REF_KEY_2
REF_KEY_3 50
COMP_CODE 3000
BUS_AREA 9900
ITEM_TEXT TEST
AccountTax table
ITEMNO_ACC 0000000001
GL_ACCOUNT 445000
COND_KEY JP1I
ACCT_KEY NVV
TAX_CODE I1
TAX_RATE 6,000
TAX_DATE
TAXJURCODE PA0000000
ITEMNO_ACC 0000000002
GL_ACCOUNT 191100
COND_KEY JP1I
ACCT_KEY NVV
TAX_CODE I1
TAX_RATE 6,000
TAX_DATE
TAXJURCODE PA0000000
CurrencyAmount table
ITEMNO_ACC 0000000001
CURR_TYPE 00
CURRENCY USD
CURRENCY_ISO USD
AMT_DOCCUR 100,0000
AMT_BASE 100,0000
ITEMNO_ACC 0000000002
CURR_TYPE 00
CURRENCY USD
CURRENCY_ISO USD
AMT_DOCCUR 100,0000-
AMT_BASE 100,0000-
[/code]
Thanks
Md -
Getting Error while posting through BAPI_ACC_DOCUMENT_POST
Hi Folks,
I could not post an GL account using the BAPI function module BAPI_ACC_DOCUMENT_POST . The code was,
wa_docheader-bus_act = 'RFBU'.
wa_docheader-username = 'CHARAN'.
wa_docheader-comp_code = '0147'.
wa_docheader-doc_date = '20101006'.
wa_docheader-pstng_date = '20101006'.
wa_docheader-DOC_TYPE = 'SA'.
*wa_docheader-REF_DOC_NO = 'UNASSIGNED'.
wa_glaccnt-itemno_acc = '0010'.
wa_glaccnt-gl_account = '0000100632'.
wa_glaccnt-item_text = 'POSTING TO GL'.
APPEND wa_glaccnt TO i_glaccnt.
wa_glaccnt-itemno_acc = '0020'.
wa_glaccnt-gl_account = '0000100634'.
wa_glaccnt-item_text = 'POSTING TO GL'.
APPEND wa_glaccnt TO i_glaccnt.
*wa_pyaccnt-itemno_acc = '0000100634'.
*wa_pyaccnt-gl_account = '0001234567'.
*APPEND wa_pyaccnt TO i_pyaccnt.
wa_curamt-itemno_acc = '0010'.
wa_curamt-currency = 'USD'.
wa_curamt-curr_type = '00'.
wa_curamt-amt_doccur = 200 .
APPEND wa_curamt TO i_curamt.
wa_curamt-itemno_acc = '0020'.
wa_curamt-currency = 'USD'.
wa_curamt-curr_type = '00'.
wa_curamt-amt_doccur = 200.
APPEND wa_curamt TO i_curamt.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = wa_docheader
CUSTOMERCPD =
CONTRACTHEADER =
IMPORTING
OBJ_TYPE =
OBJ_KEY =
OBJ_SYS =
TABLES
accountgl = i_glaccnt
ACCOUNTRECEIVABLE =
accountpayable = i_pyaccnt
ACCOUNTTAX =
currencyamount = i_curamt
CRITERIA =
VALUEFIELD =
EXTENSION1 =
return = i_ret
PAYMENTCARD =
CONTRACTITEM =
extension2 = i_ext2
REALESTATE =
ACCOUNTWT =
The Output error i'm getting is :
Error in document : BKPFF $ BH2CLNT200 400.00 USD
Balance in transaction currency.
Please help me in posting the Gl document successfully. Help will be rewarded.
Thanks in advance.Total amount of internal table I_CURAMT-AMT_DOCCURR should be zero (Credit & Debit).
Edit : See [Accounting Document Interface |http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=195726664] for reference.
Edited by: Vinod Kumar on Oct 8, 2010 1:04 PM -
Making Down Payment Request using BAPI_ACC_DOCUMENT_POST
Hi, all...
I faced a problem while I'm testing BAPI_ACC_DOCUMENT_POST to make down payment request(F-47), so I need some help.
I've found a BAPI_ACC_DOCUMENT_POST in down payment about this topic and followed its parameter settings except for currency settings.
In that posting, the accountpayable-pymt_cur and currencyamount-currency are set different currency.
While I set the two fields with same currency(USD). Belows are my source codes.
DOCUMENTHEADER-OBJ_TYPE = 'IDOC'.
DOCUMENTHEADER-OBJ_KEY = '$'.
DOCUMENTHEADER-OBJ_SYS = 'D10CLNT200'.
DOCUMENTHEADER-BUS_ACT = 'RFBU'.
DOCUMENTHEADER-USERNAME = SY-UNAME.
DOCUMENTHEADER-HEADER_TXT = 'DOWN PAYMENT REQUEST'.
DOCUMENTHEADER-COMP_CODE = '1000'.
DOCUMENTHEADER-DOC_DATE = '2006.09.01'.
DOCUMENTHEADER-PSTNG_DATE = '2006.09.01'.
DOCUMENTHEADER-DOC_TYPE = 'KG'.
ACCOUNTPAYABLE-ITEMNO_ACC = '0000000001'.
ACCOUNTPAYABLE-VENDOR_NO = '0002314908'.
ACCOUNTPAYABLE-GL_ACCOUNT = '0091120100'.
ACCOUNTPAYABLE-COMP_CODE = '1000'.
ACCOUNTPAYABLE-PYMT_METH = 'L'.
ACCOUNTPAYABLE-PMNT_BLOCK = 'A'.
ACCOUNTPAYABLE-BUSINESSPLACE = '1001'.
ACCOUNTPAYABLE-PYMT_CUR = 'USD'.
ACCOUNTPAYABLE-PYMT_AMT = '123,438.0000'.
ACCOUNTPAYABLE-SP_GL_IND = '2'.
ACCOUNTPAYABLE-TAX_CODE = 'RR'.
CURRENCYAMOUNT-ITEMNO_ACC = '0000000001'.
CURRENCYAMOUNT-CURRENCY = 'USD'.
CURRENCYAMOUNT-AMT_DOCCUR = '123,438.0000'.
But the function returns an error:
'Enter a payment currency different to USD'
But if I would set with different currencies, it returns an error:
'Balance in transaction currency'
If the ACCOUNTPAYABLE-PYMT_CUR and ACCOUNTPAYABLE-PYMT_AMT were remained empty, it returns
'Balance in transaction currency'
What should I do about this currency setting.
Someone please let me know about doing this right way.
Thank you.
Message was edited by: Jong-woon LeeHi,
Just in case you found this thread with the same problem.
At least in my case what was happening is that I wanted to leave the currency fields blank (the same currency as payment value) but I was filling in ACCOUNTPAYABLE-PYMT_AMT, so was receiving error telling me that currency fields could not be empty. And if I set them to the same as payment, I would receive a message telling me that currency must be different.
If you want to use only one currency you don't need to fill in these 3 fields:
ACCOUNTPAYABLE-PYMT_AMT
ACCOUNTPAYABLE-PYMT_CUR
ACCOUNTPAYABLE-PYMT_CUR_ISO
The same probably applies for the ACCOUNTRECEIVABLE table.
Cheers,
Erick
Ps.
Some extra text so you can find this thread by searching for error messages:
Required field CURRENCY was not transferred in parameter ACCOUNTPAYABLE
For the ISO code there is no unique SAP currency code for ALE
For the ISO code there is no unique SAP currency code for ALE
Message no. B1888
Diagnosis
There are several entries in TCURC for this ISO code, but none with the
primary flag set.
Procedure
In table TCURC set the primary flag for ISO codes used multiple times.
Required field CURRENCY was not transferred in parameter ACCOUNTPAYABLE
Message no. RW602
Diagnosis
Field CURRENCY is required in parameter ACCOUNTPAYABLE for processing
the document. The document is incomplete without this field.
System Response
The document cannot be processed.
Procedure
Enter a valid value in field CURRENCY in parameter ACCOUNTPAYABLE.
Maybe you are looking for
-
Adding images to the header & footer in Pages for the iPad
How do I add images i.e. logos into the header and footer in Pages for the iPad.
-
Hey, all, I was wondering what others on the list tend to do to create a site-wide 404 handler (I am working on IIS servers but am equally interested in approaches for Apache or other servers) for CFM pages. I've tried a few things here and there wit
-
Mail won't work after upgrade to 3.0
I cannot get my Mail program to work after upgrading to 3.0. It starts, searched for new mail, then quits. I cannot get or send new mail. The program does not operate. Suggestions, please?
-
Brand new iMac does not work wirelessly
This is a very strange situation and I don't know how much to be concerned about it. 6 weeks ago I bought the first of two brand new iMacs. We have two old G4s both wired into a Netgear wireless router, plus the printer. The first new iMac when switc
-
[Solved] pyexiv2 (Rapid Photo Downloader dependency)
I'm trying to install Rapid Photo downloader, and really not sure if there is a solution for this problem that I'm missing, or if I should contact the AUR maintainer for pyexiv2... Any ideas? Start out with this... yaourt -S aur/rapid-photo-downloade