cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI for Non PO Invoice posting?

Former Member
0 Likes
3,329

Hi Experts,

I am posting invoices using BAPI_INCOMINGINVOICE_CREATE. These invoices have POs associated with the Item Details. This is working fine for me.

I want to post invoices that DO NOT have a PO. Can someone please point me to a BAPI that is similar to BAPI_INCOMINGINVOICE_CREATE in functionality but does not require a PO?

Thanks,

- Vik.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Hi Vik,

Try <b>BAPI_ACC_GL_POSTING_POST</b>. If there is no PO, there is no Logistics Invoice Verification and hence it is quite simply an AP Invoice in Accounting.

Use the BAPI above to post an AP (Vendor Invoice) directly in FI.

Hope that helps!

Rishi

Former Member
0 Likes

I am not sure whether you shoudl use this BAPI for your purpose or not !!

But if you are sure then probably you are not balancing the items while calling BAPI_ACC_GL_POSTING_POST.

eg if one value is +100 then another should be -100.

or +50, +50 then one -100

Balance should always be zero..

If you are still not sure how to use it then search

"BAPI_ACC_GL_POSTING_POST Code" in google or on sdn.

Answers (3)

Answers (3)

Former Member
0 Likes

I too was looking for a BAPI for non PO invoice posting. I found that the above counsel did not work for me. Instead of creating a buyside invoice, it just created a journal entry. What DID work for me was BAPI_ACC_INVOICE_RECEIPT_POST.

Below, I am pasteing the subroutines that I created for its calling. In it, for my purposes, only the invoice amount is parameter driven. My needs allowed all other BAPI parameters to stay the same.

I hope that this helps someone.

Donald Nigro

-


FORM create_buyside_invoice USING value(invoice_amt) TYPE p.

DATA:

gd_documentheader LIKE bapiache03,

it_accountpayable LIKE bapiacap03 OCCURS 0 WITH HEADER LINE,

it_accountgl LIKE bapiacgl03 OCCURS 0 WITH HEADER LINE,

it_accounttax LIKE bapiactx01 OCCURS 0 WITH HEADER LINE,

it_currencyamount LIKE bapiaccr01 OCCURS 0 WITH HEADER LINE,

it_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.

DATA:

wa_obj_key(20) TYPE c.

  • fill header

gd_documentheader-username = sy-uname.

gd_documentheader-header_txt = 'E-Payables Invoice'.

gd_documentheader-comp_code = 'EAUS'.

gd_documentheader-doc_date = sy-datum.

gd_documentheader-pstng_date = sy-datum.

gd_documentheader-doc_type = 'KR'.

CONCATENATE 'BOA' sy-datum sy-uzeit(4)

INTO gd_documentheader-ref_doc_no.

  • fill AP (line 1)

it_accountpayable-itemno_acc = 1.

IF sy-sysid(3) = 'DEV'.

it_accountpayable-vendor_no = '0600013370'.

ELSE.

it_accountpayable-vendor_no = '0600009022'.

ENDIF.

APPEND it_accountpayable.

  • fill GL (line 2)

it_accountgl-itemno_acc = 2.

it_accountgl-gl_account = '0001112227'.

it_accountgl-comp_code = 'EAUS'.

it_accountgl-pstng_date = sy-datum.

it_accountgl-fisc_year = sy-datum(4).

it_accountgl-fis_period = sy-datum+4(2).

it_accountgl-bus_area = '0100'.

APPEND it_accountgl.

  • fill currency ammounts for lines 1 & 2

it_currencyamount-currency = 'USD'.

it_currencyamount-itemno_acc = 1.

it_currencyamount-amt_doccur = invoice_amt * -100.

APPEND it_currencyamount.

it_currencyamount-itemno_acc = 2.

it_currencyamount-amt_doccur = invoice_amt * 100..

APPEND it_currencyamount.

CALL FUNCTION 'BAPI_ACC_INVOICE_RECEIPT_CHECK'

EXPORTING

documentheader = gd_documentheader

TABLES

accountpayable = it_accountpayable

accountgl = it_accountgl

accounttax = it_accounttax

currencyamount = it_currencyamount

return = it_return.

PERFORM invoice_error_check TABLES it_return.

CALL FUNCTION 'BAPI_ACC_INVOICE_RECEIPT_POST'

EXPORTING

documentheader = gd_documentheader

IMPORTING

obj_key = wa_obj_key

TABLES

accountpayable = it_accountpayable

accountgl = it_accountgl

accounttax = it_accounttax

currencyamount = it_currencyamount

return = it_return.

PERFORM invoice_error_check TABLES it_return.

COMMIT WORK.

WRITE: / 'ePayables Bank of America'.

WRITE: / ' Invoice Document Number:',

wa_obj_key(10).

ENDFORM.

----


  • Form invoice_error_check

----


FORM invoice_error_check TABLES it_return STRUCTURE bapiret2.

DATA:

bapi_success(5) TYPE c VALUE 'false'.

LOOP AT it_return.

IF it_return-type = 'S' AND bapi_success = 'false'.

bapi_success = 'true'.

ENDIF.

ENDLOOP.

IF bapi_success = 'false'.

WRITE: / 'Unable to post a buyside invoice with',

'BAPI_ACC_INVOICE_RECEIPT_POST'.

LOOP AT it_return.

WRITE: / 'Message Type: ', it_return-type,

/ 'Message Class: ', it_return-id,

/ 'Message Number: ', it_return-number,

/ 'Message: ', (80) it_return-message.

ENDLOOP.

ROLLBACK WORK.

STOP.

ENDIF.

ENDFORM.

Former Member
0 Likes

Vic,

Can you send me a code that is working for you for BAPI_INCOMINGINVOICE_CREATE?

Thanks.

0 Likes

I have also used this BAPI but at after the execute the return tables indicates that the postig was succesful but when I try to find the document it seems that is isn't created at all. I tried using a commit BAPI BAPI_TRANSACTION_COMMIT but this doesn't solve my problem. What am i doing wrong?

Hope someone can help. Thanks in advance.

Regards,

Pascal Blij

Former Member
0 Likes

Hello Jelle-

Replace function call to 'BAPI_TRANSACTION_COMMIT' with 'COMMIT_WORK'. Try just 'COMMIT WORK' in your code. It works for me.

Thanks,

- Vik.