How to find documents from the IDOC number from IDOC relationship and vice versa.
When I searched on the forum on how to get the SAP document numbers from IDOC relationship I could not able to find direct straight forward document mentioning how to go about and which tables to follow.
This is quiet general document. And no such document is available on the portal. Since in Retail, IDOCs are extensively used it is more related to SAP Retail.
Below document will give exact information about the issue with detailed steps , table names and field names.
Find the document from the IDOC number.
Eg. Finding the material / article document from IDOC number.
This is done using IDOC relationship tables SRRELROLES (Object Relationship Service: Roles) and IDOCREL (Links between IDoc and application object)
First go to table SRRELROLES.
Enter the field OBJKEY (Key) as IDOC number. Note that it is 16 digit fields so please enter preceding zeros if required.
Take the field ROLETYPE (Role type) from the table SRRELROLES and go to table IDOCREL.
In IDOCREL enter ROLE_A (Role GUID) = SRRELROLES – ROLETYPE
From the ROLE_A field you will get certain entries for ROLE_B in the table IDOCREL.
Also you will get Rel. Type (Binary rel. type BRELTYP). Note that IDC1 Rel. Type is used for inbound IDOC and IDC4 is used for outbound IDOC number reference.
From here take the ROLE_B for type IDC1 for inbound IDOC and again go to table SRRELROLES
Enter IDOCREL- ROLE_B = SRRELROLES – ROLEID.
If its material document then enter SRRELROLES –OBJTYPE = BUS2017.
Now in the table SRRELROLES – OBJKEY (Key) you can get the material document number with last four digits as year.
Finding outbound IDOC numbers from the delivery order.
Go to table SRRELROLES and enter delivery number in SRRELROLES – OBJKEY. Enter Object type as LIKP.
Take ROLEID (GUID of a role) from SRRELROLES for role type OUTBELEG and go to table IDOCREL.
Role type INBELEG refers to inbound and OUTBELEG refers to outbound.
Enter SRRELROLES – ROLEID = IDOCREL- ROLE_A and fetch the value for IDOCREL – ROLE_B
You will get as many entries as number of outbound IDOCs available for the said delivery.
Now again to table SERRELROLES.
SERRELROLES – ROLEID = IDOCREL – ROLE_B
Execute the selection and you will get IDOC numbers in the field SRRELROLES – OBJKEY.
Likewise you can find out various documents created from IDOC number and which are available in the relationship tab of the IDOC and vice versa.
Hope this document will be help full. I am also attaching the same document in word format.