BAPI_ACC_INVOICE_RECEIPT_POST Error
Hello All,
I am using BAPI_ACC_INVOICE_RECEIPT_POST and receiving this error:
"FI/CO interface: Line item entered several times"
Does anybody have any idea how to fix this error?
Here is my code:
REPORT zacm_test NO STANDARD PAGE HEADING
LINE-COUNT 65
LINE-SIZE 132.
DATA:
wait TYPE bapita-wait,
comm_return TYPE bapiret2,
obj_type TYPE bapiache02-obj_type,
obj_key TYPE bapiache02-obj_key,
obj_sys TYPE bapiache02-obj_sys,
accountgl LIKE STANDARD TABLE OF bapiacgl03, "Structure
wa_accountgl LIKE LINE OF accountgl,
docheader TYPE bapiache03, "Structure
accountpay TYPE STANDARD TABLE OF bapiacap03, "Structure
wa_accountpay LIKE LINE OF accountpay,
accounttax TYPE STANDARD TABLE OF bapiactx01, "Structure
wa_accounttax LIKE LINE OF accounttax,
curramount TYPE STANDARD TABLE OF bapiaccr01, "Structure
wa_curramount LIKE LINE OF curramount,
return TYPE STANDARD TABLE OF bapiret2, "Structure
wa_return LIKE LINE OF return,
extension1 TYPE STANDARD TABLE OF bapiextc, "Structure
wa_extension1 LIKE LINE OF extension1.
START-OF-SELECTION.
PERFORM build_header_rec.
PERFORM build_bapi_parameters1.
PERFORM build_bapi_parameters2.
PERFORM build_bapi_parameters3.
PERFORM build_bapi_parameters4.
PERFORM update_gl.
*& Form build_header_rec
FORM build_header_rec.
*build header data for bapi
CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
IMPORTING
own_logical_system = docheader-obj_sys.
docheader-obj_type = 'BKPFF'.
docheader-obj_key = 'test1'.
docheader-username = sy-uname.
docheader-comp_code = '0050'. " Company Code
docheader-fisc_year = '2006'. " Fiscal Year
docheader-doc_date = '12012006'. " Document Date
docheader-pstng_date = '12012006'. " Posting Date
docheader-trans_date = '12012006'. " Translation Date
docheader-fis_period = '12'. " Fiscal Period
docheader-doc_type = 'KQ'. " Document Type
docheader-ref_doc_no = 'T&S'. " Reference
ENDFORM. " build_header_rec
*& Form build_bapi_parameters1
* text
FORM build_bapi_parameters1.
*Build Accounts Payable data for BAPI
wa_accountpay-itemno_acc = 1. " Line Item Number
wa_accountpay-vendor_no = 'TSA01004'. " Vendor Number
wa_accountpay-gl_account = '0000290430'. " GL Account Number
wa_accountpay-pmnttrms = 'NT00'. " Payment Terms
wa_accountpay-bline_date = '12012006'. " Bline Date
wa_accountpay-pmtmthsupl = '06'. " Payment Method Supplement
wa_accountpay-pymt_meth = 'S'. " Payment Method
wa_accountpay-item_text = '*T&S Withdrawal'. " Text
wa_accountpay-w_tax_code = '**'. " Tax Code
APPEND wa_accountpay TO accountpay.
CLEAR wa_accountpay.
*Build account GL data for BAPI
wa_accountgl-itemno_acc = 1. " Line Item Number
wa_accountgl-gl_account = '0000290430'. " GL Account Number
wa_accountgl-comp_code = '0050'. " Company Code
wa_accountgl-pstng_date = '12012006'. " Posting Date
wa_accountgl-doc_type = 'KQ'. " Document Type
wa_accountgl-fisc_year = '2006'. " Fiscal Year
wa_accountgl-fis_period = '12'. " Fiscal Period
wa_accountgl-item_text = ''. " Item Text
APPEND wa_accountgl TO accountgl.
CLEAR wa_accountgl.
*Build currency data for BAPI
wa_curramount-itemno_acc = 1. " Line Item Number
wa_curramount-curr_type = '00'. " Currency Type
wa_curramount-currency = 'USD'. " Currency Key
wa_curramount-currency_iso = 'USD'. " ISO Code
wa_curramount-amt_doccur = '-3750.00'. " Amount
wa_curramount-amt_base = '5000.00'. " Base Amount
APPEND wa_curramount TO curramount.
CLEAR wa_curramount.
ENDFORM. " build_bapi_parameters
*& Form build_bapi_parameters2
* text
FORM build_bapi_parameters2.
*Build account GL data for BAPI
wa_accountgl-itemno_acc = 2. " Line Item Number
wa_accountgl-gl_account = '0000720300'. " GL Account Number
wa_accountgl-comp_code = '0050'. " Company Code
wa_accountgl-pstng_date = '12012006'. " Posting Date
wa_accountgl-doc_type = 'KQ'. " Document Type
wa_accountgl-fisc_year = '2006'. " Fiscal Year
wa_accountgl-fis_period = '12'. " Fiscal Period
wa_accountgl-item_text = ''. " Item Text
APPEND wa_accountgl TO accountgl.
CLEAR wa_accountgl.
*Build currency data for BAPI
wa_curramount-itemno_acc = 2. " Line Item Number
wa_curramount-curr_type = '00'. " Currency Type
wa_curramount-currency = 'USD'. " Currency Key
wa_curramount-currency_iso = 'USD'. " ISO Code
wa_curramount-amt_doccur = '5000.00'. " Amount
wa_curramount-amt_base = ''. " Base Amount
APPEND wa_curramount TO curramount.
CLEAR wa_curramount.
ENDFORM. " build_bapi_parameters
*& Form build_bapi_parameters3
* text
FORM build_bapi_parameters3.
*Build account GL data for BAPI
wa_accountgl-itemno_acc = 3. " Line Item Number
wa_accountgl-gl_account = '0000256166'. " GL Account Number
wa_accountgl-comp_code = '0050'. " Company Code
wa_accountgl-pstng_date = '12012006'. " Posting Date
wa_accountgl-doc_type = 'KQ'. " Document Type
wa_accountgl-fisc_year = '2006'. " Fiscal Year
wa_accountgl-fis_period = '12'. " Fiscal Period
wa_accountgl-item_text = ''. " Item Text
APPEND wa_accountgl TO accountgl.
CLEAR wa_accountgl.
*Build currency data for BAPI
wa_curramount-itemno_acc = 3. " Line Item Number
wa_curramount-curr_type = '00'. " Currency Type
wa_curramount-currency = 'USD'. " Currency Key
wa_curramount-currency_iso = 'USD'. " ISO Code
wa_curramount-amt_doccur = '-1000.00'. " Amount
wa_curramount-amt_base = ''. " Base Amount
APPEND wa_curramount TO curramount.
CLEAR wa_curramount.
ENDFORM. " build_bapi_parameters
*& Form build_bapi_parameters4
* text
FORM build_bapi_parameters4.
*Build account GL data for BAPI
wa_accountgl-itemno_acc = 4. " Line Item Number
wa_accountgl-gl_account = '0000256167'. " GL Account Number
wa_accountgl-comp_code = '0050'. " Company Code
wa_accountgl-pstng_date = '12012006'. " Posting Date
wa_accountgl-doc_type = 'KQ'. " Document Type
wa_accountgl-fisc_year = '2006'. " Fiscal Year
wa_accountgl-fis_period = '12'. " Fiscal Period
wa_accountgl-item_text = ''. " Item Text
APPEND wa_accountgl TO accountgl.
CLEAR wa_accountgl.
*Build currency data for BAPI
wa_curramount-itemno_acc = 4. " Line Item Number
wa_curramount-curr_type = '00'. " Currency Type
wa_curramount-currency = 'USD'. " Currency Key
wa_curramount-currency_iso = 'USD'. " ISO Code
wa_curramount-amt_doccur = '-250.00'. " Amount
wa_curramount-amt_base = ''. " Base Amount
APPEND wa_curramount TO curramount.
CLEAR wa_curramount.
ENDFORM. " build_bapi_parameters
*& Form update_gl
* text
FORM update_gl.
CALL FUNCTION 'BAPI_ACC_INVOICE_RECEIPT_POST'
EXPORTING
documentheader = docheader
IMPORTING
obj_type = obj_type
obj_key = obj_key
obj_sys = obj_sys
TABLES
accountpayable = accountpay
accountgl = accountgl
accounttax = accounttax
currencyamount = curramount
return = return
extension1 = extension1.
LOOP AT return INTO wa_return.
WRITE: / 'Return Type: ', wa_return-type.
WRITE: / 'Return ID: ', wa_return-id.
WRITE: / 'Return #: ', wa_return-number.
WRITE: / 'Message 1: ', wa_return-message.
WRITE: / 'Message 2: ', wa_return-message_v1.
WRITE: / 'Message 3: ', wa_return-message_v2.
WRITE: / 'Parameter: ', wa_return-parameter.
WRITE: / 'Row: ', wa_return-row.
WRITE: / 'Field: ', wa_return-field.
WRITE: / 'System: ', wa_return-system.
SKIP.
ULINE.
SKIP.
ENDLOOP.
* CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* wait = wait
* IMPORTING
* return = comm_return.
* REFRESH: accountgl, curramount, return, extension1.
* CLEAR: docheader.
ENDFORM. " update_gl
END-OF-SELECTION.
Hi Aaron - I believe that for each line item you should only have only one of the accountgl or accountpayable tables populated but not both. So for the first line item remove the code for the accountgl since it appears it is a vendor item. The GL will be updated inherently.
Andy
Similar Messages
-
Im creating an AP with invoice with taxes but no PO. I started with working test code / data without taxes and tried to add support for taxes following the example in Note 626235. Im coding in C# using the SAP .NET Connector but also tried it via SE37 and received the same error. Test data from SE37 below:
DOCUMENTHEADER
Username validuser
Comp_code 3000
Doc_date 02/14/2008
Pstng_date 02/14/2008
Fis_period 00
Doc_type KR
ACCOUNTPAYABLE
Itemno_acc 1
Vendor_no 3904
ACCOUNTGL
Itemno_acc 2
Gl_account 470000
Fis_period 00
Tax_code I1
Taxjurcode FL1011001 Custom but valid (FB60 tested), returned from BBP_CALCULATE_TAX_FRM_NET_40B
Costcenter 1000
ACCOUNTTAX
Itemno_acc 3
Tax_code I1
Acct_key NVV
Taxjurcode FL0000000
Cond_key JP1I
Stat_con X
Taxjurcode_deep FL1011001
Taxjurcode_level 1
Itemno_acc 4
Tax_code I1
Acct_key NVV
Taxjurcode FL1010000
Cond_key JP2I
Stat_con X
Taxjurcode_deep FL1011001
Taxjurcode_level 2
CURRENCYAMOUNT
Itemno_acc 1
Curr_type 00
Currency USD
Amt_doccur -107
Amt_base -107
Itemno_acc 2
Curr_type 00
Currency USD
Amt_doccur 100
Amt_base 100
Itemno_acc 3
Curr_type 00
Currency USD
Amt_doccur 6
Amt_base 100
Itemno_acc4
Curr_type 00
Currency USD
Amt_doccur 1
Amt_base 100
Please note that there are no taxes for level 3 (FL1011001) as the rate is 0.
Thanks in advance for any help,
KarlHi Karl,
Even i am also facing the same error. Please find below my code and do help me out in this problem.
DOCUMENTHEADER
Username validuser
Headertext XMS:
Comp_code 0B70
Fisc_year 2008
Doc_date 20080612
Pstng_date 20080708
Fis_period 07
Doc_type KR
REF_DOC_NO ERA0002120080612
ACCOUNTPAYABLE
Itemno_acc 0000000001
Vendor_no 0005147036
REF_KEY_1 20080612
ITEM_TEXT XMSA00021
ACCOUNTGL
Itemno_acc 0000000002
Gl_account 0260121000
comp_code 0B70
Fis_period 00
Tax_code P3
ALLOC_NMBR A00021
ITEM_TEXT DESK SUPPLIES
Costcenter 0000104648
Itemno_acc 0000000003
Gl_account 0226006010
comp_code 0B70
Fis_period 00
ALLOC_NMBR A00021
ITEM_TEXT SINGAPORE VAT ON DESK SUPPLIES
Costcenter 0000104648
ACCOUNTTAX
Itemno_acc 0000000004
GL_ACCOUNT 0226006010
Tax_code P3
Acct_key VST
Cond_key MWVS
Stat_con X
CURRENCYAMOUNT
Itemno_acc 0000000001
Curr_type 00
Currency_ISO SGD
Amt_doccur 85.6000-
Amt_base 80.0000-
Itemno_acc 0000000002
Curr_type 00
Currency_ISO SGD
Amt_doccur 80.0000
Amt_base 80.0000
Itemno_acc 0000000003
Curr_type 00
Currency_ISO SGD
Amt_doccur 5.6000
Amt_base 0.0000
Actually the IDOCS were getting generated successfully before adding the tax parameter "ACCOUNTTAX". Since the requirement is to calculate the VAT tax. I Introduced the parameter "ACCOUNTTAX". But now im getting the error "BALANCE IN TRANSACTION CURRENCY".
Please help me out in this issue.
Regards,
Meridius.
Edited by: Meridius max on Jul 8, 2008 1:01 PM -
Hi experts
Can i have the sample program for invoice posting through bapi ,hi,
Please refer this link
BAPI_ACC_INVOICE_RECEIPT_POST Error
or
search on this
https://www.sdn.sap.com/irj/scn/advancedsearch?query=invoicepostingthrough+bapi&cat=sdn_all
thanks -
Hello,
I recently used a BAPI called 'BAPI_ACC_INVOICE_RECEIPT_POST'. However an error message appeared in my return table stating "No currency line exists for line item ....".
Is there a way to resolve this?
Thank you all and good day.hi Chad,
the BAPI has four important tables parameters:
ACCOUNTPAYABLE
ACCOUNTGL
ACCOUNTTAX
CURRENCYAMOUNT
In CURRENCYAMOUNT there should be a corresponding line for each lines in the first three tables.
hope this helps
ec -
Error F5 702 for bapi_acc_invoice_receipt_post
Hello,
I am using bapi_acc_invoice_receipt_post to post vendor invoices. I am getting this error ' Balance in transaction currency F5 702'
The credit and debit entries match and zero out. I am unable to figure out why this is happening. Please Suggest.Rob,
I filled in the tax line items with gl account and tax code its asking for account determination key and condition key. I don't know if i have to pass these for tax exempt invoices and I entered amount in tax items as '0' , the error still shows up.. Am I missing something? -
Error in Bapi : BAPI_ACC_INVOICE_RECEIPT_POST
Hi Experts,
Iam using bapi " BAPI_ACC_INVOICE_RECEIPT_POST " to post outgoing payments ( tcode F-53 ).
I have passed all the values to the bapi structures. It is giving the error saying -- " Required field DOC_TYPE was not transferred in parameter DOCUMENTHEADER ". What could be the problem.
Iam passing the doc_type field also. In debugging also, it is showing the doc_type value.
Still error is throwing.
Thanks in advance
Regards
Murali Krishan.THi Vinod,
Thanks for prompt reply.
I have compared my program code with the standard program that you suggested.
And I passed the values to the bapi strucutres accordingly.
But it is throwing these errors :
Error in document: BKPFF $ KDVCLNT201
Required field USERNAME was not transferred in parameter DOCUMENTHEADER
Required field COMP_CODE was not transferred in parameter ACCOUNTPAYABLE
Required field PSTNG_DATE was not transferred in parameter ACCOUNTPAYABLE
Required field COMP_CODE was not transferred in parameter DOCUMENTHEADER
Required field PSTNG_DATE was not transferred in parameter DOCUMENTHEADER
Required field DOC_TYPE was not transferred in parameter DOCUMENTHEADER
what could be the problem?
regards,
Murali -
BAPI_ACC_INVOICE_RECEIPT_POST balance error
Hi.
I've read all the posts I can find about this BAPI. I want to post an invoice, but seem to be a problem somewhere.. Is there anyone who had such a problem or can help me please? Thanks.
The header is like this:
gd_documentheader-obj_type = 'BKPFF'.
gd_documentheader-obj_key = ref_key.
gd_documentheader-username = sy-uname.
gd_documentheader-header_txt = 'HD BAPI Test'.
gd_documentheader-comp_code = '4020'.
gd_documentheader-doc_date = sy-datum.
gd_documentheader-pstng_date = sy-datum.
gd_documentheader-ref_doc_no = 'ttt'.
where i generate a random key for ref_key.
The account payable is like with corresponding currency amount:
it_accountpayable-itemno_acc = 1.
it_accountpayable-vendor_no = '2000001010'.
it_accountpayable-item_text = 'Test'.
APPEND it_accountpayable.
it_currencyamount-itemno_acc = 1.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'EUR'.
it_currencyamount-amt_doccur = -100.
APPEND it_currencyamount.
The account is:
it_accountgl-itemno_acc = 2.
it_accountgl-gl_account = '0064414401'.
it_accountgl-doc_type = 'KR'.
it_accountgl-tax_code = 'GQ'.
it_accountgl-item_text = 'Test'.
it_accountgl-orderid = '405200BE0800'.
it_accountgl-fisc_year = '2005'.
it_accountgl-fis_period = '07'.
APPEND it_accountgl.
it_currencyamount-itemno_acc = 2.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'EUR'.
it_currencyamount-amt_doccur = 100.
APPEND it_currencyamount.
And the tax:
it_accounttax-itemno_acc = 3.
it_accounttax-gl_account = '0062212201'.
it_accounttax-tax_code = 'GQ'.
it_accounttax-acct_key = 'VST'.
it_currencyamount-itemno_acc = 3.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'EUR'.
it_currencyamount-amt_doccur = 100.
The bapi will keep giving me the "Balance in current transaction" error, unless I remove the doc type KR in the header.
Many thanks in advance.
Tiago.Thank you Arjan!
But I've got the same message when using the "AMT_BASE" instead of "AMT_DOCCUR".
I can post, but in a strange way..
If i do this, then i have 2 documents posted. A KR and an AB. But then, when i try to pass the BSCHL with the extends section in the BAPI i get wrong bschl error in the bapi...
it_accountpayable-itemno_acc = 1.
it_accountpayable-vendor_no = '2000001075'.
it_accountpayable-item_text = 'AP BAPI Test'.
APPEND it_accountpayable.
it_currencyamount-itemno_acc = 1.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'EUR'.
it_currencyamount-amt_doccur = -100.
APPEND it_currencyamount.
it_accountpayable-itemno_acc = 3.
it_accountpayable-vendor_no = '2000001075'.
it_accountpayable-item_text = 'AP BAPI Test'.
APPEND it_accountpayable.
it_currencyamount-itemno_acc = 3.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'EUR'.
it_currencyamount-amt_doccur = 100.
APPEND it_currencyamount.
fill GL (line 2)
it_accountgl-itemno_acc = 2.
it_accountgl-gl_account = '0062212201'.
it_accountgl-doc_type = 'KR'.
it_accountgl-tax_code = 'GQ'.
it_accountgl-item_text = 'GL BAPI Test'.
it_accountgl-orderid = '402500VE0800'.
it_accountgl-fisc_year = '2005'.
it_accountgl-fis_period = '07'.
APPEND it_accountgl.
it_currencyamount-itemno_acc = 2.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'EUR'.
it_currencyamount-amt_doccur = 100.
APPEND it_currencyamount.
it_accountgl-itemno_acc = 4.
it_accountgl-gl_account = '0062212201'.
it_accountgl-doc_type = 'KR'.
it_accountgl-tax_code = 'GQ'.
it_accountgl-item_text = 'GL BAPI Test'.
it_accountgl-orderid = '402500VE0800'.
APPEND it_accountgl.
it_currencyamount-itemno_acc = 4.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'EUR'.
it_currencyamount-amt_doccur = -100.
APPEND it_currencyamount. -
Error BAPI_ACC_INVOICE_RECEIPT_POST
Hello,
I try to use the bapi 'BAPI_ACC_INVOICE_RECEIPT_POST'.
If I run with transaction SE37 it works correctly.
But I've created a program that do the same and don't work well.
The message in the table it_message is the following:
Vendor 3000320 is not defined in company code 001.
This exists in tables LFA1, KNA1, LFB1 and KNB1 in the company code 001.
And if I execute the transaction FB60 and F70 works well too.
Somebody know what I'm doing wrong?
Thanks!!
This is the source code of the program.
DATA: BEGIN OF it_documentheader OCCURS 0.
INCLUDE STRUCTURE bapiache03.
DATA: END OF it_documentheader.
DATA: BEGIN OF it_customercpd OCCURS 0.
INCLUDE STRUCTURE bapiacpa00.
DATA: END OF it_customercpd.
DATA: BEGIN OF it_accountpayable OCCURS 0.
INCLUDE STRUCTURE bapiacap03.
DATA: END OF it_accountpayable.
DATA: BEGIN OF it_accountgl OCCURS 0.
INCLUDE STRUCTURE bapiacgl03.
DATA: END OF it_accountgl.
DATA: BEGIN OF it_accounttax OCCURS 0.
INCLUDE STRUCTURE bapiactx01.
DATA: END OF it_accounttax.
DATA: BEGIN OF it_currencyamount OCCURS 0.
INCLUDE STRUCTURE bapiaccr01.
DATA: END OF it_currencyamount.
DATA: BEGIN OF it_return OCCURS 0.
INCLUDE STRUCTURE bapiret2.
DATA: END OF it_return.
CLEAR it_documentheader.
CLEAR it_accountgl.
CLEAR it_accounttax.
CLEAR it_currencyamount.
CLEAR it_return.
CLEAR it_accountpayable.
REFRESH it_documentheader.
REFRESH it_accountgl.
REFRESH it_accounttax.
REFRESH it_currencyamount.
REFRESH it_return.
REFRESH it_accountpayable.
*/HEADER
it_documentheader-doc_type = 'G3'.
it_documentheader-doc_date = sy-datum.
it_documentheader-comp_code = '001'.
it_documentheader-pstng_date = sy-datum.
it_documentheader-header_txt = 'HEADER_TXT'.
it_documentheader-username = sy-uname.
it_documentheader-ref_doc_no = 'REF_DOC_NO'.
it_documentheader-fisc_year = 2009.
APPEND it_documentheader.
*/CUSTOMER CPD
it_customercpd-name = 'NAME'.
it_customercpd-city = 'CITY'.
it_customercpd-country = 'ES'.
APPEND it_customercpd.
*/ACCOUNTGL
it_accountgl-itemno_acc = 1.
it_accountgl-gl_account = '0057100002'.
it_accountgl-comp_code = '001'.
it_accountgl-pstng_date = sy-datum.
it_accountgl-item_text = 'ITEM_TEXTS'.
APPEND it_accountgl.
*/CURRENCY DEL ACCOUNTGL
it_currencyamount-itemno_acc = 1.
it_currencyamount-currency = 'EUR'.
it_currencyamount-currency_iso = 'EUR'.
it_currencyamount-amt_doccur = '100.00'.
APPEND it_currencyamount.
*/ACCOUNTPAYABLE
it_accountpayable-itemno_acc = 2.
it_accountpayable-vendor_no = '003000320'.
it_accountpayable-item_text = 'ITEM_TEXTS_ACCOUNT_PAYABLE'.
APPEND it_accountpayable.
*/CURRENCY DEL ACCOUNTPAYABLE
it_currencyamount-itemno_acc = 2.
it_currencyamount-currency = 'EUR'.
it_currencyamount-currency_iso = 'EUR'.
it_currencyamount-amt_doccur = '100.00-'.
APPEND it_currencyamount.
CALL FUNCTION 'BAPI_ACC_INVOICE_RECEIPT_POST'
EXPORTING
documentheader = it_documentheader
TABLES
accountpayable = it_accountpayable
accountgl = it_accountgl
accounttax = it_accounttax
currencyamount = it_currencyamount
return = it_return.
BREAK-POINT.
WAIT UP TO 2 SECONDS.
COMMIT WORK AND WAIT.
BREAK-POINT.
Edited by: Francesc Ribot Cobo on Mar 19, 2009 12:22 PMHi Aaron - I believe that for each line item you should only have only one of the accountgl or accountpayable tables populated but not both. So for the first line item remove the code for the accountgl since it appears it is a vendor item. The GL will be updated inherently.
Andy -
BAPI_ACC_INVOICE_RECEIPT_POST giving error
Grabled Code removed
Edited by: Ashish Kansara on Sep 12, 2011 9:30 AM
Moderator Message: Please post relevant portions of the code only!
Thread locked. Please conitnue with the other post
Edited by: Suhas Saha on Sep 12, 2011 1:37 PM
Edited by: Suhas Saha on Sep 12, 2011 1:40 PMHi
Please, copy the coding between two , so, perhaps, somebody could help you because it's so difficult to read it.
Regards
Eduardo -
Uploading Vendor invoices with BAPI_ACC_INVOICE_RECEIPT_POST
I am working on putting together a program that will allow users to upload invoices from a spreadsheet into SAP using BAPI_ACC_INVOICE_RECEIPT_POST. I realize that I will have to calculate the tax before feeding the information into the BAPI. My problem is that we have 3 currencies that the FI document is posted in: document, local, and group. I am putting this program together for our Europe office so the the document and local currencies are EUR but the group currency is USD. When I try to use the BAPI and feed the information in to it I get a message that states "Foreign currency translation not supported for tax calculation". Have you run in to this error message before(F5681)? If so, is there a way around it? If not how have you been able to upload vendor invoices into SAP?
Hi Ron,
I think it is better to post this question in the abap forum. But anyway, it sounds like you need to customize the currency translations for that specific calculation type.
regards
Siggi -
What are all mantatory fields for BAPI_ACC_INVOICE_RECEIPT_POST
Hi Friends..
I tried to use BAPI_ACC_INVOICE_RECEIPT_POST for FB60 transaction.
But whenever I gave input it throws some error message in return statement.
So plz let me know the mantatory input fields for the BAPI "BAPI_ACC_INVOICE_RECEIPT_POST"
Thanks in Advance.
Thanks
GowrishankarHi,
Check in the import tab of the BAPI the parameters that are not marked as optional are mandatory --DOCUMENTHEADER(Table)
Regards,
Bhanu -
BAPI_ACC_INVOICE_RECEIPT_POST - State Withholding
Hello All,
I call BAPI_ACC_INVOICE_RECEIPT_POST and pass it tax withholding information in the EXTENSION. This is then used to populate Structure ACCIT_WT.
When there is Federal withholding, the BAPI works correctly and automatically creates the Fed withholding ledger entry.
When there is State withholding, the BAPI attempts to create the ledger entry, but returns an error: "Field Region is a required field for G/L account 0050 256167".
This is because we have a field called ZZREGION that is required when posting to account 256167. Sense the BAPI generates the withholding entries automatically through SAP code, ZZREGION is not populated, thus causing the error.
Any ideas on how to solve this problem?
Thanks!Hi Aaron,
I saw your thread regarding the BAPI BAPI_ACC_INVOICE_RECEIPT_POST (url: BAPI_ACC_INVOICE_RECEIPT_POST - State Withholding)
I have a requirement to use the same BAPI. It is working fine for all scenarios other that withholding tax.
I not getting any idea where to pass the withhold tax details inside the customer exit. please help with this
Thanks in Advance. -
BAPI_ACC_INVOICE_RECEIPT_POST incoming message
Hi Friends,
during the BAPI_ACC_INVOICE_RECEIPT_POST I have an error, but this error is not shown in the return table.
When I try to create a new Invoice with the same obj_key the return table has 1 entry 'S' but later the Business workplace pops up with ' a new message in the inbox' and that shows an error during the BAPI call.
How can I avoid this and catch the error.
Thank you very much in advance.
Rg. JimbobYOU'RE NOT LISTENING. THE UPDATE HAS FAILED. THE DOCUMENT WAS NOT CREATED. IT NEVER WILL BE CREATED. YOU CAN WAIT FROM NOW TILL TUESDAY.
Sometimes (maybe due to a configuration error) SAP thinks everything is OK and tries to update the database (does an INSERT or something). But Oracle or DB2 or whatever the database you are using disagrees and cannot do the update even though SAP thinks everything is OK. Then you get express mail.
USE THE TRANSACTIONS I SUGGESTED.
Rob -
BAPI_ACC_INVOICE_RECEIPT_POST, Accounting Documents grouped?
Hi there,
Hope I'm posting this in the right place. There is a custom program which reads the file from AL11 and then uses BAPI_ACC_INVOICE_RECEIPT_POST to create the invoices.
It's creating the invoices but when we view them at tcode KSB1, the drill down of the accounting documents are wrong.
Normally a drill down will be a single Accounting Document, Cost Center and etc right? but I'm able to view ALL the accounting documents created.
Is it configuration or the program error?
Thanks for the advice.Answered in another post. Thanks.
BAsically I just removed entries from OBJ_TYPE, OBJ_KEY and OBJ_SYS -
BAPI_ACC_INVOICE_RECEIPT_POST how to calculate tax
Hallo folks,
i can't figuere out how to calculate the tax with the bapi BAPI_ACC_INVOICE_RECEIPT_POST. I already searched the Forums and google but no Solution helped me.
I don't really get it, which fields i have to fill. For example i do i have to fill the amt_base for every item or just for the tax structure?
ls_accgl-comp_code = ls_outtab-zzfaleiemp.
ls_accgl-tax_code = 'V3'.
ls_accgl-profit_ctr = ls_outtab-prctr.
ls_accgl-sales_ord = ls_outtab-kdauf.
ls_accgl-s_ord_item = ls_outtab-kdpos.
APPEND ls_accgl TO lt_accgl.
CLEAR ls_curamt.
ls_curamt-itemno_acc = l_itemno.
ls_curamt-currency_iso = 'EUR'.
ls_curamt-amt_doccur = ls_outtab-zzsum.
ls_acctax-itemno_acc = l_itemno.
ls_acctax-tax_rate = '19.000'.
ls_acctax-gl_account = ls_accgl-gl_account.
ls_acctax-tax_code = 'V3'.
ls_acctax-acct_key = 'VST'.
ls_acctax-cond_key = 'MWVS'.
APPEND ls_acctax TO lt_acctax.
CLEAR ls_curamt.
ls_curamt-itemno_acc = l_itemno.
ls_curamt-currency = 'EUR'.
* ls_curamt-amt_doccur = l_sum.
ls_curamt-amt_base = l_sum.
APPEND ls_curamt TO lt_curamt.
Because it doesn't matter what field i fill in TA FB03 there never come any taxes up.
has anybody some Ideas?
Best regards
MathiasHi,
check the below code
Read Invoice Work item data
CLEAR: lwa_inv_header.
SELECT SINGLE * INTO lwa_inv_header
FROM zbw_inv_header
WHERE zinv_id = i_documentheader-zinv_id.
IF sy-subrc = 0.
Get history line count
SELECT COUNT(*) INTO lv_hist_lineid
FROM zbw_wi_history
WHERE zinv_id = i_documentheader-zinv_id.
Get exception line count
SELECT COUNT(*) INTO lv_lineid
FROM zbw_wi_exception
WHERE zinv_id = i_documentheader-zinv_id.
Get document type
SELECT SINGLE zdoctype INTO lv_doc_type
FROM zbw_doc_types
WHERE zinvtype = i_documentheader-zinvoicetype AND
zinvind = i_documentheader-invoice_ind.
IF sy-subrc <> 0.
CLEAR t_return.
t_return-ztype = 'E'.
t_return-zmessage = 'Document type configuration is not done'.
APPEND t_return.
lv_lineid = lv_lineid + 1.
CLEAR lwa_exceptions.
lwa_exceptions-zinv_id = i_documentheader-zinv_id.
lwa_exceptions-zlineid = lv_lineid.
lwa_exceptions-zstep_id = i_stepid.
lwa_exceptions-zuser = sy-uname.
lwa_exceptions-zdate = sy-datum.
lwa_exceptions-ztime = sy-uzeit.
lwa_exceptions-zexception = t_return-zmessage.
MODIFY zbw_wi_exception FROM lwa_exceptions.
EXIT.
ENDIF.
Read posting date config
SELECT SINGLE * INTO lwa_posting
FROM zbw_posting_date
WHERE zarea = i_documentheader-zinvoicetype.
IF sy-subrc <> 0.
CLEAR t_return.
t_return-ztype = 'E'.
t_return-zmessage = 'Posting date configuration is not done'.
APPEND t_return.
lv_lineid = lv_lineid + 1.
CLEAR lwa_exceptions.
lwa_exceptions-zinv_id = i_documentheader-zinv_id.
lwa_exceptions-zlineid = lv_lineid.
lwa_exceptions-zstep_id = i_stepid.
lwa_exceptions-zuser = sy-uname.
lwa_exceptions-zdate = sy-datum.
lwa_exceptions-ztime = sy-uzeit.
lwa_exceptions-zexception = t_return-zmessage.
MODIFY zbw_wi_exception FROM lwa_exceptions.
EXIT.
ENDIF.
IF lwa_posting-zcurrentdate = 'X'.
Todays date as posting date
lwa_documentheader-pstng_date = sy-datum.
ELSE.
lv_today = sy-datum.
CLEAR: lv_days,
lv_months,
lv_years,
lv_calcdt.
Calculate last day of previous month as posting date
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = lv_today
days = lv_days
months = lv_months
signum = '-'
years = lv_years
IMPORTING
calc_date = lv_calcdt.
IF sy-subrc <> 0.
CLEAR t_return.
t_return-ztype = 'E'.
CONCATENATE 'Error while calculating the'
'Last day of previous month'
INTO t_return-zmessage SEPARATED BY space.
APPEND t_return.
lv_lineid = lv_lineid + 1.
CLEAR lwa_exceptions.
lwa_exceptions-zinv_id = i_documentheader-zinv_id.
lwa_exceptions-zlineid = lv_lineid.
lwa_exceptions-zstep_id = i_stepid.
lwa_exceptions-zuser = sy-uname.
lwa_exceptions-zdate = sy-datum.
lwa_exceptions-ztime = sy-uzeit.
lwa_exceptions-zexception = t_return-zmessage.
MODIFY zbw_wi_exception FROM lwa_exceptions.
EXIT.
ENDIF.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = lv_calcdt
IMPORTING
last_day_of_month = lwa_documentheader-pstng_date
EXCEPTIONS
day_in_no_date = 1
OTHERS = 2.
ENDIF.
Populate the header data
lwa_documentheader-obj_type = 'IBKPF'.
CONCATENATE sy-datum sy-uzeit lwa_documentheader-comp_code
INTO lwa_documentheader-obj_key.
lwa_documentheader-obj_sys = sy-sysid.
lwa_documentheader-username = sy-uname.
lwa_documentheader-header_txt = 'HD BAPI Test'.
lwa_documentheader-comp_code = i_documentheader-comp_code.
lwa_documentheader-fisc_year = i_documentheader-zfisc_year.
lwa_documentheader-doc_date = i_documentheader-doc_date.
lwa_documentheader-trans_date = sy-datum.
lwa_documentheader-fis_period = i_documentheader-zfisc_period.
lwa_documentheader-doc_type = lv_doc_type.
ALL ITEM DATA *
Populate Account payble data
CLEAR lt_accountpayable.
lt_accountpayable-itemno_acc = 1.
lt_accountpayable-vendor_no = i_documentheader-zvendor.
lt_accountpayable-item_text = 'Webdesk invoice posting'.
APPEND lt_accountpayable.
clear lt_accountpayable.
Populate the currency for Account payble
CLEAR lt_currencyamount.
lt_currencyamount-itemno_acc = 1.
lt_currencyamount-currency = i_documentheader-currency.
lt_currencyamount-amt_doccur = i_documentheader-gross_amount * -1.
APPEND lt_currencyamount.
clear lt_currencyamount.
Loop the GL table
CLEAR lv_errfl.
LOOP AT t_glacc.
CONCATENATE i_documentheader-supcountry t_glacc-tax_code
INTO lv_vakey SEPARATED BY space.
SELECT knumh INTO lv_knumh
UP TO 1 ROWS
FROM konh
WHERE vakey = lv_vakey.
ENDSELECT.
IF sy-subrc = 0.
SELECT SINGLE kbetr INTO lv_kbetr
FROM konp
WHERE knumh = lv_knumh.
IF sy-subrc <> 0.
lv_errfl = 'X'.
ENDIF.
ELSE.
lv_errfl = 'X'.
ENDIF.
lv_kbetr = lv_kbetr / 10.
IF t_glacc-tax_base_amount IS INITIAL.
lv_taxamt = ( i_documentheader-gross_amount * lv_kbetr ) / 100.
ELSE.
lv_taxamt = ( t_glacc-tax_base_amount * lv_kbetr ) / 100.
ENDIF.
Populate the GL data
lt_accountgl-itemno_acc = 2.
lt_accountgl-gl_account = t_glacc-gl_account.
lt_accountgl-tax_code = t_glacc-tax_code.
lt_accountgl-acct_key = t_glacc-zacct_key.
lt_accountgl-item_text = 'Webdesk invoice posting'.
APPEND lt_accountgl.
clear lt_accountgl.
CLEAR lt_currencyamount.
lt_currencyamount-itemno_acc = 2.
lt_currencyamount-currency = i_documentheader-currency.
lt_currencyamount-amt_doccur = t_glacc-item_amount - lv_taxamt.
APPEND lt_currencyamount.
clear lt_currencyamount.
IF NOT t_glacc-tax_code IS INITIAL.
Populate the Tax data
lt_accounttax-itemno_acc = 3.
lt_accounttax-gl_account = t_glacc-ztaxgl_account.
lt_accounttax-tax_code = t_glacc-tax_code.
lt_accounttax-acct_key = t_glacc-zacct_key.
APPEND lt_accounttax.
clear lt_accounttax.
CLEAR lt_currencyamount.
lt_currencyamount-itemno_acc = 3.
lt_currencyamount-currency = i_documentheader-currency.
lt_currencyamount-amt_doccur = lv_taxamt.
IF t_glacc-tax_base_amount IS INITIAL.
lt_currencyamount-amt_base = i_documentheader-gross_amount.
ELSE.
lt_currencyamount-amt_base = t_glacc-tax_base_amount.
ENDIF.
APPEND lt_currencyamount.
clear lt_currencyamount.
ENDIF.
ENDLOOP.
IF lv_errfl = 'X'.
CLEAR t_return.
t_return-ztype = 'E'.
CONCATENATE 'Error while calculating the'
'Tax amount'
INTO t_return-zmessage SEPARATED BY space.
APPEND t_return.
lv_lineid = lv_lineid + 1.
CLEAR lwa_exceptions.
lwa_exceptions-zinv_id = i_documentheader-zinv_id.
lwa_exceptions-zlineid = lv_lineid.
lwa_exceptions-zstep_id = i_stepid.
lwa_exceptions-zuser = sy-uname.
lwa_exceptions-zdate = sy-datum.
lwa_exceptions-ztime = sy-uzeit.
lwa_exceptions-zexception = t_return-zmessage.
MODIFY zbw_wi_exception FROM lwa_exceptions.
EXIT.
ENDIF.
CALLING BAPI *
CLEAR lwa_wi_history.
lwa_wi_history-zinv_id = i_documentheader-zinv_id.
lwa_wi_history-zlineid = lv_hist_lineid.
lwa_wi_history-zstep_id = i_stepid.
lwa_wi_history-zuser = sy-uname.
lwa_wi_history-zdate = sy-datum.
lwa_wi_history-ztime = sy-uzeit.
CLEAR: lt_return[].
CALL FUNCTION 'BAPI_ACC_INVOICE_RECEIPT_POST'
EXPORTING
documentheader = lwa_documentheader
IMPORTING
obj_type = obj_type
obj_key = obj_key
obj_sys = obj_sys
TABLES
accountpayable = lt_accountpayable
accountgl = lt_accountgl
accounttax = lt_accounttax
currencyamount = lt_currencyamount
return = lt_return.
Thanks & Regards,
Sateesh.
Maybe you are looking for
-
My functions are not showing up on my screen
Hi I am not exactly sure how to describe this, I just installed cs6 and my functions are not showing up on my live preview. I have never seen anything like this before. here is my file, I have filled it in hot pink. This is how it shows up in the lay
-
How to convert this into alv display and also change parameterstoselect opt
tables :mara,marc,stpo. parameters: p_werks like t001w-werks obligatory, p_matnr like mara-matnr obligatory. *select-options : p_matnr for mara-matnr obligatory. *parameters: p_werks like marc-werks obligatory, *p_matnr like marc-matnr obligatory. co
-
Hello We don't want to view the bank account or tax id by any user , How to control this view or any sort encryption ? Any help will be highly appreciated Thanks Nic
-
PDF servlet, freezing on save not open.
I have a servlet that generated Reports in PDF format, the report is written to the output stream and generated as an attachment, not inline. My problem is if I choose to save the document it freezes the application, but if I open it, it's all ok. Do
-
What are Color Moods and how can I use them?
Color Moods allow you to select color themes from an image based on a pre-set mood. Moods can be accessed by tapping on the flower icon after you take a picture. The preset Color Moods are: colorful, bright, muted, deep, dark, custom. You can experi