Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI_INCOMINGINVOICE_CREATE issue

Former Member
0 Likes
1,162

Hello,

I'm using BAPI_INCOMINGINVOICE_CREATE to create incoming invoices. BAPI works all right bu there is something I don't understand.

When I feed the header data of BAPI, I assign REF_DOC_NO with a number like 123456789.

After BAPI posted the items; when I check the invoice, I can see my REF_DOC_NO with some prefix like

XXXX123456789.

Am I missing a step here. Why BAPI does not use the same number that I provided.

in BAPI


header-ref_doc_no = '123456789'.

Result

Document header

reference = XXXX123456789

2 REPLIES 2
Read only

varma_narayana
Active Contributor
0 Likes
805

Hi...

Here the Ref Doc No is prefixed with the Fiscal Year .. So the XXXX will be the Fiscal year.

Check this code:

/ Assigning Values to the Header Data.

IN_HEAD-DOC_DATE = ZDOC_DATE.

IN_HEAD-PSTNG_DATE = SY-DATUM.

IN_HEAD-COMP_CODE = RECS_BRAND-C_CODE.

IN_HEAD-CURRENCY = 'USD'.

IN_HEAD-GROSS_AMOUNT = '1000.00'.

IN_HEAD-CALC_TAX_IND = 'X'.

IN_HEAD-INVOICE_IND = 'X'.

/ Assigning Values to the Item Data.

IN_ITEM-INVOICE_DOC_ITEM = '1'.

IN_ITEM-PO_NUMBER = RECS_EKKO-EBELN.

IN_ITEM-PO_ITEM = RECS_EKKN-EBELP.

IN_ITEM-ITEM_AMOUNT = '1000.00'.

IN_ITEM-QUANTITY = '1000.00'.

IN_ITEM-PO_UNIT = '$$$'. "RECS_EKPO-MEINS.

APPEND IN_ITEM.

/ Assigning Values to the Account Assignment Data.

IN_ACCT-INVOICE_DOC_ITEM = '1'.

IN_ACCT-SERIAL_NO = '01'.

IN_ACCT-ITEM_AMOUNT = PRINT_INPUT_RECS-BILLING.

IN_ACCT-GL_ACCOUNT = RECS_EKKN-SAKTO.

IN_ACCT-QUANTITY = PRINT_INPUT_RECS-BILLING.

IN_ACCT-PO_UNIT = '$$$'. "RECS_EKPO-MEINS.

APPEND IN_ACCT.

CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'

EXPORTING

HEADERDATA = IN_HEAD

IMPORTING

INVOICEDOCNUMBER = INVOICE_DOC_NUM

FISCALYEAR = FISCAL_YEAR

TABLES

ITEMDATA = IN_ITEM

  • ACCOUNTINGDATA = IN_ACCT

  • TAXDATA = IN_TAX

RETURN = IN_RETURN

.

Read only

Former Member
0 Likes
805

Apparently, there is a user-exit who makes these changes. It was not related to BAPI