Application Development 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: 

BAPI : BAPI_INCOMINGINVOICE_CREATE can't set value at RBKP-MWSKZ1

former_member311833
Participant
0 Kudos

Hi all,

When I used MIRO to entry a incoming invoice data for invoice verification,

the tax code of invoice data in RBKP-MWSKZ1 is not space.

but when I used BAPI BAPI_INCOMINGINVOICE_CREATE to create Incoming invoice,

the tax code of invoice data in RBKP-MWSKZ1 is always is space.

I have set the value in field IN_HEADER-DEL_COSTS_TAXC,

but the invoice data in rbkp still no value in field MWSKZ1.

How should I set the tax code in RBKP-MWSKZ1?


REPORT ztemp.

DATA: x_in_header LIKE bapi_incinv_create_header,
      i_in_item LIKE bapi_incinv_create_item OCCURS 0 WITH HEADER LINE,
      lc_belnr LIKE bapi_incinv_fld-inv_doc_no,
      lc_gjahr LIKE bapi_incinv_fld-fisc_year,
      i_gl_item like BAPI_INCINV_CREATE_GL_ACCOUNT OCCURS 0 WITH HEADER LINE,
      d_msg(110),
      i_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.

x_in_header-invoice_ind = 'X'.
x_in_header-pstng_date = '20100702'.
x_in_header-doc_date = '20100702'.
x_in_header-ref_doc_no = 'NU12345680'.   "Reference
x_in_header-comp_code = '1008'.
x_in_header-currency = 'JPY'.
x_in_header-calc_tax_ind = 'X'.
x_in_header-exch_rate = '0.28880'.
x_in_header-gross_amount = '47511'.
x_in_header-DEL_COSTS_TAXC = '13'.

i_in_item-invoice_doc_item = '000001'.
i_in_item-po_number = '4500000230'.        "PO No
i_in_item-po_item = '00010'.
i_in_item-REF_DOC = '5000000733'.          "MM Document
i_in_item-REF_DOC_YEAR = '2010'.
i_in_item-REF_DOC_IT = '0001'.
i_in_item-tax_code = '13'.
i_in_item-item_amount = '15318'.
i_in_item-quantity = '69'.
i_in_item-po_unit = 'EA'.
APPEND i_in_item. clear i_in_item.

i_in_item-invoice_doc_item = '000002'.
i_in_item-po_number = '4500000231'.        "PO No
i_in_item-po_item = '00010'.
i_in_item-REF_DOC = '5000000733'.          "MM Document
i_in_item-REF_DOC_YEAR = '2010'.
i_in_item-REF_DOC_IT = '0002'.
i_in_item-tax_code = '13'.
i_in_item-item_amount = '21312'.
i_in_item-quantity = '48'.
i_in_item-po_unit = 'EA'.
APPEND i_in_item. clear i_in_item.

i_in_item-invoice_doc_item = '000003'.
i_in_item-po_number = '4500000232'.        "PO No
i_in_item-po_item = '00010'.
i_in_item-REF_DOC = '5000000733'.          "MM Document
i_in_item-REF_DOC_YEAR = '2010'.
i_in_item-REF_DOC_IT = '0003'.
i_in_item-tax_code = '13'.
i_in_item-item_amount = '4446'.
i_in_item-quantity = '39'.
i_in_item-po_unit = 'EA'.
APPEND i_in_item. clear i_in_item.

i_in_item-invoice_doc_item = '000004'.
i_in_item-po_number = '4500000233'.        "PO No
i_in_item-po_item = '00010'.
i_in_item-REF_DOC = '5000000733'.          "MM Document
i_in_item-REF_DOC_YEAR = '2010'.
i_in_item-REF_DOC_IT = '0004'.
i_in_item-tax_code = '13'.
i_in_item-item_amount = '6435'.
i_in_item-quantity = '45'.
i_in_item-po_unit = 'EA'.
APPEND i_in_item. clear i_in_item.

CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'
  EXPORTING
    HEADERDATA       = X_IN_HEADER
  IMPORTING
    INVOICEDOCNUMBER = LC_BELNR
    FISCALYEAR       = LC_GJAHR
  TABLES
    ITEMDATA         = I_IN_ITEM
    GLACCOUNTDATA    = I_GL_ITEM
    RETURN           = I_RETURN.

CACTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.

ENDLOOP.LL FUN
IF NOT lc_belnr IS INITIAL.
WRITE: / 'Doc :', lc_belnr.
WRITE: / 'Year :', lc_gjahr.
ENDIF.

3 REPLIES 3

former_member182387
Active Participant
0 Kudos

Hi, There is one more table TAXDATA parameter in the FM BAPI_INCOMINGINVOICE_CREATE

The following fields must be populated:

Tax code (TAX_CODE field)

Tax amount in document currency (TAX_AMOUNT field)

Thanks and Regards,

Senthil Kumar Anantham.

Edited by: Senthil Kumar on Jul 2, 2010 6:05 PM

0 Kudos

Hi Senthil,

When I add the parameter TAXDATA for BAPI, I get the error message "Enter value in either field HEADERDATA-CALC_TAX_IND or field TAX_AMOUNT (import parameter TAXDATA)".

I set the space to field HEADERDATA-CALC_TAX_IND, the BAPI can write 13 tax code to RBKP-MWSKZ1, but I still want RBKP-XMWST value is 'X'. (I set the value of HEADERDATA-CALC_TAX_IND is space, so RBKP-XMWST is space.)

How can I use Parameter TAXDATA for BAPI, and still can used HEADERDATA-CALC_TAX_IND = 'X'?

best regards,

jogarciar
Discoverer

Any solution for that? I'm getting the same error 😞