IDoc validation; populating in error tables from IDoc

A guide to basic IDoc data validation and to populating in error tables from IDoc

Once I receive orders IDoc data from webMethods, I need to do validation for the following: 1. PO Number and date: exists or not ? 2. Material: exists or not ? 3. Pricing calculation If I find any mismatches in the data, I have to populate these in SAP error tables. Is there any simple way to populate in error tables from IDoc ? I am getting 51 (Status reset after editing IDoc) because I made some changes in IDoc (we05) and reprocessed the IDoc using BD87.
Is there any simple way to populate in error tables from IDoc? Yes. In your IDoc processing routine, add these lines: idoc_status-docnum = idoc_contrl-docnum. idoc_status-status = '51'. idoc_status-msgty = 'E'. idoc_status-msgid = 'VG'. idoc_status-msgno = '204'. idoc_status-msgv1 = xvbak-kunnr. idoc_status-msgv2 = lieferant. APPEND idoc_status IDoc processing is a fully customized process. When you receive an IDoc, the IDoc engine looks for the IDOCTYP and MSGTYP in the IDoc header and loks up the processing function module intable EDIFCT. You can now create an own function module Z_IDOC_ORDER_INPUT and replace the original entry. Then your function will be called instead, and you can pre-process the IDoc as you need it. The best way is like this: Copy the original idoc processing function IDOC_INPUT_ORDERS05 to Z_IDOC_INPUT_ORDERS Delete the coding from the function Z_IDOC_INPUT_ORDERS, and make call function to IDOC_INPUT_ORDERS05 Replace the entry in EDIFCT (with WE42 or with SM31 and view V_EDIFCT) Test it ; it should work as before. Now you can change Z_IDOC_INPUT_ORDERS by adding your code before calling IDOC_INPUT_ORDERS05. If you decide to quit Z_IDOC_INPUT_ORDERS before calling IDOC_INPUT_ORDERS05, do not forget to set the EDIDC-STATUS value correctly.

Dig Deeper on SAP Basis