Find IDOC Number from Sales Order Document in SAP
In case sales orders are created automatically using IDOC documents via ABAP programs in your SAP system, you may want to get IDOC number from SAP sales order.
Normally, using Relationships menu option on Services for Object icon on VA02 and VA03 sales document screen will let the SAP professionals to reach the related IDOC documents.
But if you cannot display Services for Object on your sales document transaction screen, you can use one of the methods to find IDOC number using Sales Order number in your SAP system.
WE57 transaction can provide information about business object type, message types, etc in case you don't know existing information about the IDOC structures in your company.
Although it is not so handy, if you can filter IDOC list to a limited number on WE02 transaction code screen, you can check each IDOC for their status 53 record and control if it has the IDOC containing the sales order number you are looking for.
By using filtering criteria Created On and Created At date time selections, processing Direction, Current Status (status 53 includes the sales document number so use 53 for filtering), Basic Type and if possible Partner Number you can limit your search results for a manual check on IDOC status documents.
Services for Object
If you can see the Services for Object icon next to SAP VA02 or VA03 transaction title as seen in below screenshot, then you can easily display the IDOC which created the current sales order.
Click on the right-side of the icon, a dropdown menu will be displayed. Choose Relationships.
This option will lead you to the IDOC list related with this sales document.
You can easily open Idoc by double click on the item and display its segments.
On the other hand, if you do not see the Services for Object icon on the VA02 and VA03 screen menu, if you can modify your User Profile Parameters add SD_SWU_ACTIVE parameter (Activate Workflow Box in VA02 & VA03) with "X" value to enable this function on Sales Order display and change screens.
On main screen, by menu options apply following selections:
System > User Profile > Own Data
Add parameter SD_SWU_ACTIVE with value X to Activate Workflow Box in VA02 & VA03
Now follow the above method to reach Sales Order related Idoc list.
To find the IDOC number used to create sales order, ABAP developer or SAP professional can use BD87 SAP transaction.
Launch BD87 tcode.
When Select IDocs selection screen is displayed, for sales orders enter BUS2032 for Business Object and sales order number (VBELN) you are interested in Object Key field.
You can also limit the results by entering the Message Type as ORDERS.
An other selection parameter that you can use is the IDoc Status field with value 53 (Application document posted).
Also you can provide date range for created on or changed on fields.
Then execute the report.
Drill down IDOCs in inbound processing node.
Under ORDERS, you can see an information message that sales order document with given number is saved.
Double click on the leaf item.
This will display the IDOC number as seen in below screenshot.
Launch SAP transaction WE02 and using IDOC number you found from BD87 tcode, you can display the IDOC details which is used to create the referred sales order document.
SREL_GET_NEXT_NEIGHBORS Function Module for IDoc Document
Executing ABAP function module SREL_GET_NEXT_NEIGHBORS with IDoc number and business object type developers can get a short list of IDoc documents.
The Object input structure values could be set as follows:
OBJKEY is the Sales Order document number with leading zeros if any.
OBJTYPE is BUS2032 for sales orders.
And you can provide or choose not to enter your SAP system id in LOGSYS field.
When you execute the ABAP function module SREL_GET_NEXT_NEIGHBORS with accurately provided OBJECT parameter, you will get the IDoc list in Result table.
Query EDIDS IDoc Status Record Table for IDoc Number
For ABAP programmers, another option to find IDOC number using the Sales Order document number is filtering EDIDS (IDoc) Status Record ABAP table using SE11 or SE16 transactions.
First of all, again most important parameter is log date LOGDAT selection parameter. Keep it as limited as you can.
Then STATUS should be 53.
STAPA2 parameter 2 has the sales order number. So enter your sales document number here without preceeding zeros.
STATYP status type will be successful, so enter S for this parameter.
WE09 Transaction to Find IDoc Number from Sales Order Document
Using WE09 transaction is another method for searching IDOC number, if you have specific values about the order that take place in the IDOC segment fields.
By entering especially create date and time, processing direction, IDoc status, basic type etc. you can limit the search results of your query.
With related to IDOC document, provide an additional criteria with a segment name and field name which can have a specific value related with the sales order.
ABAP developer or SAP user can also use this section to search IDOCs for a spesific value in a certain IDOC segment field.
Result will be as follows. Please note that the search can take long time especially for wide search criteria.