Functionality You can use this method to change provisionalinvoice documents>.Provisional invoice documents have the status:
- 'On hold' or
- 'On hold (from parking)' or
- 'Parked' or
- 'Parked as complete' or
- 'Parked and released'
With regard to the reference document categories to which an invoice canrelate, this method offers the following functionalities:
- If you do not change any items in an invoice document, the system
retains the originally chosen reference to a document category.
- If you change items in an invoice document, in other words if you supply
the method with information via the Itemdata> table, the systemtakes the purchase order as the reference document category.Constraints It is not possible to use this method to change invoice documentsflagged for invoice verification in the background. Nor is it possibleto use this method to change invoice documents saved within theframework of the EDI process. Notes The system checks the authorization object M_RECH_WRK > for the invoice document to be changed. For documents from theparking environment the system checks Activity 77; for documents on holdfrom the invoice entry environment the system checks Activity 02. If you add further items to an invoice, the system checks activity 77(documents from parking) or 01 (documents from invoice entry) for theseitems.Input parameters
- Invoice document
Using the Invoicedocnumber> and Fiscalyear> parameters youspecify which invoice document is to be changed.
- Status of the invoice document
The InvoiceDocStatus> parameter contains the status of the changeddocument.
- Header data
Using the HeaderdataChange> parameter you specify the invoiceheader data that you want to be changed. In the HeaderdataChangex> parameter, you specify which information is to be changed.
- Address data
Using the AdressdataChange> parameter you specify the invoiceaddress that you want to change. Using the AdressdataChangex>parameter, you specify which information in the address you want tochange.
- Item data.
The tables Itemdata> and Accountingdata> contain the itemdata of the changed invoice. Unlike with the header data, here you needto describe all the items of the changed document. It is not possible toonly transfer the data that needs changing. Using the TableChange> parameter and the ITEMDATA field you indicate that item data haschanged. IF &[SWITCH]MM_SFWS_TM& = 'X'. For invoices relating to an external transportation management system,you can, instead of the Itemdata> table, use the TM_ITEMDATA table(Transfer Structure Incoming Invoice (ext. TMS)> ENDIF.
- Posting to G/L and material account
Using the Glaccountdata> table you can change the data for postingto a G/L account. The Materialdata> table contains data thatdisplays changes when you post to material accounts. Here too, it isnecessary to describe the postings of the changed documents in full. Thefields GLACCOUNTDATA and MATERIALDATA in the TableChange>parameter show that data has changed.
- Tax information
The Taxdata> table describes the tax information in the changedinvoice. The data of the changed incoming invoice must be passed on infull. You can identify a change using the TableChange> parameterand the TAXDATA field.
- Withholding tax information
To change the information regarding the withholding tax in an invoicedocument, you can use the parameter Withtaxdata>. Via thisparameter, you must specify all data of the changed document. The TableChange> parameter, WITHTAXDATA field, enables you to display achange.
- Amount split
Via the Vendoritemsplitdata> table, you can change thedistribution of the gross amount across several creditor lines. Asalready described in the case of previous parameters, here too you mustdescribe the data of the changed document in full. It is not enough topass on only the information that has changed. The TableChange>parameter contains the VENDORITEMSPLIT field, which can be used todisplay changes.Output parameters If changing the posting date or the document type necessitates theassignment of a new document number, the provisional invoice document iscreated with the previous data under a new document number and - if thefiscal year is changed - under a new fiscal year. The previous invoicedocument is deleted. The method returns the new document number and the new fiscal year inthe parameters InvoicedocnumberNew> and FiscalyearNew>.Return messages INCLUDE BAPI_RET OBJECT DOKU ID TX LANGUAGE EN Further information The method can only perform its function if no error messages weregenerated in the Return> table. This is the case if it waspossible to process the header data and all items without errors. No transaction control is implemented. This means that, if the methodhas been called successfully and no errors are shown in the Return > parameter, the user calling the method must perform the 'CommitWork' him- or herself. INCLUDE BAPI_INCOMINGINVOICE_SPERRL OBJECT DOKU ID TX Note>: If an invoice document parked as complete is again to be parked ascomplete in a new fiscal year, or a change in the document type n ecessitates the assignment of a new document number, the system createsa new document and deletes the old one. In the process, a documentparked as complete is simply parked in an initial step before finallybeing converted to the 'parked as complete' status in a second step. Tobe able to carry out the second step, the system uses a 'Commit Work'program-internally after the first step.Example: Change of posting date in a provisional invoice document This example shows which data you must enter in the parameters InvoiceDocNumber>, FiscalYear>, HeaderdataChange>, andHeaderdataChangex> in order to change the posting date of aprovisional invoice document. In 2004 you parked invoice 5105601000/2004. This contains one item. Youwant to give the invoice a new posting date from the year 2005 withoutchanging the item. Parameter InvoiceDocNumber>
- (invoice document number): 5105601000
Parameter FiscalYear>
- (fiscal year): 2004
Parameter HeaderdataChange>
- PSTNG_DATE (Posting date): 12.05.2005
Parameter HeaderdataChangex>
- PSTNG_DATE (Posting date): X
You do not have to transfer the Itemdata> table. In this case thesystem adopts the invoice items unchanged from the document to bechanged. Due to the changed fiscal year, the old document is deleted and a newinvoice document is created with the old data. The method returns thedocument number and the fiscal year in the fields InvoicedocnumberNew> and FiscalyearNew>.Example: Adding a further item to a provisional invoice document This example shows which data you must enter in the parameters InvoiceDocNumber>, FiscalYear>, HeaderdataChange>, andHeaderdataChangex> in order to be able to add another item to aprovisional invoice document. Furthermore, it describes which item datais entered in the Itemdata> table and which information you haveto enter in the TableChange> parameter. You have parked the invoice document 5105600011/2005. This invoicecontains one item referencing purchase order 4500000100, item 10. Theinvoice quantity amounts to 10 pc, the value is 100 EUR. You now want toadd a second item referencing PO no. 4500000101, item 10. The quantityinvoiced for this item is 5 pc, the value being 50 EUR. For both items,value-added tax of 16% applies. Parameter InvoiceDocNumber>
- (invoice document number): 5105600011
Parameter FiscalYear>
- (fiscal year): 2005
Parameter HeaderdataChange>
- GROSS_AMOUNT (Gross amount): 174,00
Parameter HeaderdataChangex>
- GROSS_AMOUNT (Gross amount): X
Parameter TableChange>
- ITEMDATA (item data): X
Parameter Itemdata> Line 1: Previous invoice item>
- INVOICE_DOC_ITEM (Invoice document item): 00001
- PO_NUMBER (purchase order number): 4500000100
- PO_ITEM (Purchase order item): 00010
- TAX_CODE (Tax code): V1
- ITEM_AMOUNT (Item amount): 100
- QUANTITY (Quantity): 10
- PO_UNIT (Unit of measure): pc
Line 2: Add further invoice item>
- INVOICE_DOC_ITEM (Invoice document item): 00002
- PO_NUMBER (purchase order number): 4500000101
- PO_ITEM (Purchase order item): 00010
- TAX_CODE (Tax code): V1
- ITEM_AMOUNT (Item amount): 50
- QUANTITY (Quantity): 5
- PO_UNIT (Unit of measure): pc
Further information is available in the parameter documentation fortable ItemData>.Example: Adding an unplanned account assignment to a provisional invoicedocument This example indicates which data you have to enter for the parametersInvoiceDocNumber> and FiscalYear>, which item data you haveto enter for the Itemdata> table, and which account assignmentdata you have to enter for the table Accountingdata>. Furthermore,it describes which information you have to enter for the parameter TableChange> in order to be able to add unplanned account assignmentsto a provisional invoice document. In order for you to be able to addaccount assignments, provision must have been made for non-valuated orno goods receipt. You have parked the invoice document 5105600012/2005. This contains anitem relating to purchase order 4500000110, item 10. The purchase orderitem has a single account assignment. You want to apportion the invoiceamount of 100 EUR for 10 pc to the planned account assignment and oneother account assignment. 16% VAT is payable. Parameter InvoiceDocNumber>
- (invoice document number): 5105600012
Parameter FiscalYear>
- (fiscal year): 2005
Parameter TableChange>
- ITEMDATA (item data): X
Parameter Itemdata>
- INVOICE_DOC_ITEM (Invoice document item): 00001
- PO_NUMBER (purchase order number): 4500000110
- PO_ITEM (Purchase order item): 00010
- TAX_CODE (Tax code): V1
- ITEM_AMOUNT (Item amount): 100
- QUANTITY (Quantity): 10
- PO_UNIT (Unit of measure): pc
Parameter Accoutingdata> Line 1: Change planned account assignment item>
- INVOICE_DOC_ITEM (Document item in invoice document): 0001
- SERIAL_NO (Serial number for the account assignment): 01
- TAX_CODE (Tax code): V1
- ITEM_AMOUNT (Amount in document currency): 60,00
- QUANTITY (Quantity): 6
- PO_UNIT (purchase order unit): pc
- GL_ACCOUNT (G/L account number): 890000
- COSTCENTER (Cost center): 1200
Line 2: Add unplanned account assignment>
- INVOICE_DOC_ITEM (Document item in invoice document): 0001
- XUNPL (Unplanned account assignment from Invoice Verification): X
- TAX_CODE (Tax code): V1
- ITEM_AMOUNT (Amount in document currency): 40,00
- QUANTITY (Quantity): 4
- PO_UNIT (purchase order unit): pc
- GL_ACCOUNT (G/L account number): 891000
- COSTCENTER (Cost center): 1300
Further information is available in the parameter documentation for thetables ItemData> andAccountingData>.Description This parameter contains the new fiscal year of the invoice document youchanged. A change in the posting date may result in the generation ofdocument with a different fiscal year and a new number. Description This parameter contains the new document number of the invoice documentyou changed. The system assigns a new document number if a change in theposting date leads to a change in the fiscal year. Furthermore, a newdocument number may also be assigned if this should become necessaryfollowing a change in the document type. Description This parameter contains the address data for aone-time vendor> or adifferent payee, which you can change in a provisional invoice document. Information on the meaning of the individual parameter fields isavailable in the corresponding data element documentation in the ABAPDictionary.Description You can use this parameter to show which fields of theAdressdataChange> parameter are change-relevant.Description INCLUDE BAPI_KEYFIELD OBJECT DOKU ID TX Fiscal Year>Description This parameter contains the information that you can change in theheader of a provisional invoice document. Information on the meaning of the parameter fields that are availablecan be found in the corresponding data element documentation in the ABAPDictionary. Value range Value determination In the following, the behavior of the system in determining data forcertain fields is described. Invoicing Party (DIFF_INV field)> If it is to be changed, the invoicing party must be explicitly specifiedand entered in the DIFF_INV field. No derivation (from the firstpurchase order, for example) takes place. Terms of Payment> If they are to be changed, the terms of payment must likewise beexplicitly specified. In doing so, you can enter a terms of payment keyin the PMNTTRMS field or enter the cash discount days and percentages inthe DSCT_DAYS1, DSCT_DAYS2, DSCT_PCT1, and DSCT_PCT2 fields. Automaticdetermination of the terms of payment (from the first purchase order,for example) does not take place. Baseline Date for Payment (BLINE_DATE field)> The baseline date for payment must also be explicitly specified if achange is desired. Furthermore, you should note that a change in theterms of payment does not automatically lead to an adjustment of thebaseline date for payment. On the contrary, the system assumes that thedate previously entered and in the invoice document remains valid. Anautomatic redetermination of the baseline date for payment in accordancewith the term of payment specified is only carried out if the baselinedate is initial or has been explicitly initialized by you. You can carryout an initialization by leaving the BLINE_DATE field in the parameterHeaderdataChange> empty and displaying a change via the parameterHeaderdataChangex> (that is, entering an 'X' in the BLINE_DATEfield. Document Number of an Invoice Document (INV_DOC_NO field)> The information on the document number of an invoice document(INV_DOC_NO) field stands for an external document number. You mustprovide this to the method if a new document number has to be assignedas a result of a change in the fiscal year or a change in the documenttype and you have defined external document number assignment forLogistics Invoice Verification. In other cases, this field and itscontent are not taken into account in the processing of an invoicedocument.Description This parameter enables you to show which fields of theHeaderdataChange> parameter are change-relevant.Description INCLUDE BAPI_KEYFIELD OBJECT DOKU ID TX Document Number of an Invoice Document>Description This parameter contains the status into which an invoice that is to bechanged is to be transferred. Value range Transfer to a certain status is possible according to the followingrules:
- An invoice document to be changed that has the status 'on hold' can be
transferred to the status 'on hold', 'parked' or 'parked as complete'.
- An invoice document to be changed that has the status 'on hold (from
parking)' can be transferred to the status 'parked' or 'parked ascomplete'.
- An invoice document to be changed that has the status 'parked' can be
transferred to the status 'parked' or 'parked as complete'.
- An invoice document to be changed that has the status 'parked as
complete' can be transferred to the status 'parked' or 'parked ascomplete'.
- An invoice document to be changed that has the status 'parked and
released' can be transferred to the status 'parked' or 'parked ascomplete'. The different statuses correspond to the following values, which you canspecify for the parameter:
- Status 'on hold' - D
- Status 'parked' - A
- Status 'parked as complete' - B
Default If you do not specify a status for the parameter, the (old) status ofthe document that is to be changed will be adopted (provided that theaforementioned rules allow this). Description This parameter enables you to display which of the following parameterscontain change-relevant information: Itemdata> (including Accountingdata>), Glaccountdata>, Materialdata>, Taxdata>, Withtaxdata> and/or Vendoritemsplitdata> IF &[SWITCH]MM_SFWS_TM& = 'X'. This parameter allows you to change invoice items that were created withreference to an external transport management system. ENDIF.Value range Functionality: The use of this parameter enables you to completely delete the data thatexists in the above-mentioned parameters in an invoice that is to bechanged. If, for example, you wish to delete all the items in an invoicedocument, pass on the Itemdata> parameter empty and select thefield of the same name in the TableChange> parameter by enteringan 'X' in it.Description With this table, you pass on the account assignment data for the itemsof the changed invoice document. Further information on the individual fields is available in thedocumentation for the parameterAccountingData> inthe method CreateFromData>.Description This table enables you to supply the enhancement fields from table IVEXTwithout modifications. Description With this table, you pass on the G/L account data for the changedinvoice document. Further information on the individual fields is available in thedocumentation for the parameterGlAccountData> inthe method CreateFromData>.Description With this table, you pass on the data of the items of the changedinvoice document. More information on the individual fields is available in thedocumentation for the parameterItemData> in the methodCreateFromData>Description With this table, you pass on the material account data for the changedinvoice document. More information on the individual fields is available in thedocumentation for the parameterMaterialData> in themethod CreateFromData>.Description This table contains the return messages from the method call. Value range Type>,,ID>,,Number>,,Message> E,,M8,,719,,Further processing of document &1 &2 not possible (Faultystatus) E,,M8,,718,,Enter an external document number S,,M8,,662,,Document & deleted and saved as parked under & Further possible messages> Messages may also be issued by other function modules or programs.Description With this table, you pass on the tax information of the invoice documentthat is to be changed. More information on the individual fields is available in thedocumentation for the parameterTaxData> in the methodCreateFromData>.Description You can use this table to transfer item data from the changed invoicedocument (applies to invoices that were created with reference to SAPTM). Description With this table, you pass on the data of the changed invoice document ifyou want to distribute the gross amount among several creditor lines. More detailed information on the individual fields is available in thedocumentation for the parameterVendoritemsplitdata> in the methodCreateFromData>.Description With this table, you pass on the withholding tax data for the changedinvoice document. Further information on the individual fields is available in thedocumentation for the parameterWithTaxData> in themethod CreateFromData>.
|