2006 Jul 11 6:38 AM
Hi All,
I am trying to post customer/vendor using BAPI BAPI_ACC_DOCUMENT_POST. Since this BAPI doesnt have provision to tick <b>Calculate tax automatically</b> I have to use the BAPI <b>BAPI_INCOMINGINVOICE_CHANGE</b> after commit. But I get error while using BAPI BAPI_INCOMINGINVOICE_CHANGE saying document doesnt exist. But I can see the document in FB03 and I even put 5 sec wait on posting BAPI still no use. Firstly am I using right BAPI to update and what I am doing wrong? Please check the code below for more details. Thanks in advance.
Regards,
Tim
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
DOCUMENTHEADER = ZGV_DOCUMENTHEADER
CUSTOMERCPD =
CONTRACTHEADER =
IMPORTING
OBJ_TYPE = GV_OBJ_TYPE
OBJ_KEY = GV_OBJ_KEY
OBJ_SYS = GV_OBJ_SYS
TABLES
ACCOUNTGL = ZGV_ACCOUNTGL
ACCOUNTRECEIVABLE = ZGV_ACCOUNTRECEIVABLE
ACCOUNTPAYABLE = ZGV_ACCOUNTPAYABLE
ACCOUNTTAX = ZGV_ACCOUNTTAX
CURRENCYAMOUNT = ZGV_CURRENCYAMOUNT
RETURN = ZGVI2_RETURN
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = '5'
IMPORTING
RETURN = ZGVI3_RETURN.
Update Posting document without X
ZGV_DOC_NO = GV_OBJ_KEY+0(10).
ZGV_FIYEAR = GV_OBJ_KEY+14(4).
Fill in the change values
ZGV_HEADERDATA_CHANGE-CALC_TAX_IND = 'X'.
APPEND ZGV_HEADERDATA_CHANGE.
ZGV_HEADERDATA_CHANGEX-CALC_TAX_IND = 'X'.
APPEND ZGV_HEADERDATA_CHANGEX.
CALL FUNCTION 'BAPI_INCOMINGINVOICE_CHANGE'
EXPORTING
INVOICEDOCNUMBER = ZGV_DOC_NO
FISCALYEAR = ZGV_FIYEAR
INVOICE_DOC_STATUS = ' '
TABLE_CHANGE =
HEADERDATA_CHANGE = ZGV_HEADERDATA_CHANGE
HEADERDATA_CHANGEX = ZGV_HEADERDATA_CHANGEX
ADRESSDATA_CHANGE =
ADRESSDATA_CHANGEX =
IMPORTING
INVOICEDOCNUMBER_NEW =
FISCALYEAR_NEW =
TABLES
ITEMDATA =
ACCOUNTINGDATA =
GLACCOUNTDATA =
MATERIALDATA =
TAXDATA =
WITHTAXDATA =
VENDORITEMSPLITDATA =
RETURN = ZGVI4_RETURN
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN = ZGVI5_RETURN.
2006 Jul 26 8:49 PM
BAPI_ACC_DOCUMENT_POST creates an invoice in tables BKPF, BSEG, etc.
BAPI_INCOMINGINVOICE_* is the API for the invoice verification component which stores the incoming invoices in other tables and with other document numbers.
That is why, when you create an invoice with BAPI_ACC_DOCUMENT_POST and then try to change it with the BAPI_INCOMINGINVOICE_CHANGE it does not find it.
I would suggest to create the invoice with BAPI_INCOMINGINVOICE_CREATE.
The online documentation is quite good for this one.
Best regards... Lucio
Hi All,
I am trying to post customer/vendor using BAPI BAPI_ACC_DOCUMENT_POST. Since this BAPI doesnt have provision to tick <b>Calculate tax automatically</b> I have to use the BAPI <b>BAPI_INCOMINGINVOICE_CHANGE</b> after commit. But I get error while using BAPI BAPI_INCOMINGINVOICE_CHANGE saying document doesnt exist. But I can see the document in FB03 and I even put 5 sec wait on posting BAPI still no use. Firstly am I using right BAPI to update and what I am doing wrong? Please check the code below for more details. Thanks in advance.
Regards,
Tim
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
DOCUMENTHEADER = ZGV_DOCUMENTHEADER
CUSTOMERCPD =
CONTRACTHEADER =
IMPORTING
OBJ_TYPE = GV_OBJ_TYPE
OBJ_KEY = GV_OBJ_KEY
OBJ_SYS = GV_OBJ_SYS
TABLES
ACCOUNTGL = ZGV_ACCOUNTGL
ACCOUNTRECEIVABLE = ZGV_ACCOUNTRECEIVABLE
ACCOUNTPAYABLE = ZGV_ACCOUNTPAYABLE
ACCOUNTTAX = ZGV_ACCOUNTTAX
CURRENCYAMOUNT = ZGV_CURRENCYAMOUNT
RETURN = ZGVI2_RETURN
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = '5'
IMPORTING
RETURN = ZGVI3_RETURN.
Update Posting document without X
ZGV_DOC_NO = GV_OBJ_KEY+0(10).
ZGV_FIYEAR = GV_OBJ_KEY+14(4).
Fill in the change values
ZGV_HEADERDATA_CHANGE-CALC_TAX_IND = 'X'.
APPEND ZGV_HEADERDATA_CHANGE.
ZGV_HEADERDATA_CHANGEX-CALC_TAX_IND = 'X'.
APPEND ZGV_HEADERDATA_CHANGEX.
CALL FUNCTION 'BAPI_INCOMINGINVOICE_CHANGE'
EXPORTING
INVOICEDOCNUMBER = ZGV_DOC_NO
FISCALYEAR = ZGV_FIYEAR
INVOICE_DOC_STATUS = ' '
TABLE_CHANGE =
HEADERDATA_CHANGE = ZGV_HEADERDATA_CHANGE
HEADERDATA_CHANGEX = ZGV_HEADERDATA_CHANGEX
ADRESSDATA_CHANGE =
ADRESSDATA_CHANGEX =
IMPORTING
INVOICEDOCNUMBER_NEW =
FISCALYEAR_NEW =
TABLES
ITEMDATA =
ACCOUNTINGDATA =
GLACCOUNTDATA =
MATERIALDATA =
TAXDATA =
WITHTAXDATA =
VENDORITEMSPLITDATA =
RETURN = ZGVI4_RETURN
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN = ZGVI5_RETURN.
2006 Jul 11 6:44 AM
Hi TIM ,
1.Before gooing to change any Document u have use EnQUEUE / DEQUEUE Functions .
2.In Debug mode , are u getting the Document Number ? before calling it in chage Mode.
Regards
Prabhu
2006 Jul 11 6:47 AM
Hi,
I dont find BAPI_INCOMINGINVOICE_CHANGE fm in 4.6c as well as in 4.7 version of SAP, in which version you are working, what I found was the following,
BAPI_INCOMINGINVOICE_CANCEL
BAPI_INCOMINGINVOICE_CREATE
BAPI_INCOMINGINVOICE_GETDETAIL
BAPI_INCOMINGINVOICE_GETLIST
BAPI_INCOMINGINVOICE_PARK
BAPI_INCOMINGINVOICE_RELEASE
BAPI_INCOMINGINVOICE_SAVE
Probably, you may have to use the ones listed above,
Rgds,
2006 Jul 11 6:49 AM
2006 Jul 26 8:18 PM
Looks like you are using a non-PO invoice so you will not be able to change it using this BAPI BAPI_INCOMINGINVOICE_CHANGE since it is supposed to be used for PO invoices. Check tables RBKP for the document you want to edit. If it is in there, you can change it then using this BAPI.
2006 Jul 26 8:49 PM
BAPI_ACC_DOCUMENT_POST creates an invoice in tables BKPF, BSEG, etc.
BAPI_INCOMINGINVOICE_* is the API for the invoice verification component which stores the incoming invoices in other tables and with other document numbers.
That is why, when you create an invoice with BAPI_ACC_DOCUMENT_POST and then try to change it with the BAPI_INCOMINGINVOICE_CHANGE it does not find it.
I would suggest to create the invoice with BAPI_INCOMINGINVOICE_CREATE.
The online documentation is quite good for this one.
Best regards... Lucio
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |