03-02-2010 9:14 PM
Hello all,
I am processing Outbound Purchase order Idocs.
I need to know all the IDOC Numbers that got triggered for a particular Purchase Order.
Example : for Purchase Order number 4500000001 there were 10 IDOCS that got created over the last 5 days.
How do i get a list of all those IDOC numbers for that particular PO Number.
Regards,
Arun
03-03-2010 12:17 AM
Hi,
you have to check the objects relationship tables IDOCREL and SRRELROLES.
Hereafter a simple abap, just an example on how the relationship works.
REPORT ZSDN_IDOCREL.
data: lsrrelroles type srrelroles,
lroleid type srrelroles-roleid,
lrole_b type idocrel-role_b.
parameters: pebeln TYPE ekko-ebeln OBLIGATORY default '4500015519'.
* 1 SRRELROLES: From the Business Object Key (Purchase Order) gets the corresponding link
SELECT roleid FROM srrelroles into lroleid up TO 1 rows
WHERE objkey = pebeln
AND objtype = 'BUS2012'
AND roletype = 'OUTBELEG'.
ENDSELECT.
check sy-subrc = 0.
* 2 IDOCREL; From the Purchase Order link get the Idoc Link
SELECT role_b FROM idocrel into lrole_b UP TO 1 ROWS
WHERE role_a = lroleid.
ENDSELECT.
check sy-subrc = 0.
* 3 SRRELROLES: From the Idoc Link gets the corresponding object key (Idoc Number)
SELECT * FROM srrelroles into lsrrelroles UP TO 1 ROWS
WHERE roleid = lrole_b.
ENDSELECT.
check sy-subrc = 0.
write:/ 'Purchase Order:', pebeln.
write:/ 'Outbound Idoc :', lsrrelroles-objkey.
Regards,
Andrea
03-02-2010 9:33 PM
you can use tcode WE09 to search Idocs for a particular value.
try to narrow down you selection as much as possible or else it will run forever.
You certainly need to supply the segment, field and the value you're looking for.
03-02-2010 9:46 PM
Hello Robert,
I need to do it in a program.
Transaction wise i can find it .But how do i get the list in my program.
Regards,
Arun
03-02-2010 9:54 PM
Just check out program RSEIDOC9.
Fill in the selection screen and debug. You'll see how it selects the data.
You could possilbly replicate the process.
Or, you could clone the program into ZRSEIDOC9.
Call it from your program with the appropriate select-options filled, and pass back any results to the calling program for display.
03-03-2010 1:13 AM
Hi, You need to retrieve it from the tables EDIDC,EDID4 tbales.. similar to the transaction WE09.
Regards,
Swaroop Patri
03-03-2010 12:17 AM
Hi,
you have to check the objects relationship tables IDOCREL and SRRELROLES.
Hereafter a simple abap, just an example on how the relationship works.
REPORT ZSDN_IDOCREL.
data: lsrrelroles type srrelroles,
lroleid type srrelroles-roleid,
lrole_b type idocrel-role_b.
parameters: pebeln TYPE ekko-ebeln OBLIGATORY default '4500015519'.
* 1 SRRELROLES: From the Business Object Key (Purchase Order) gets the corresponding link
SELECT roleid FROM srrelroles into lroleid up TO 1 rows
WHERE objkey = pebeln
AND objtype = 'BUS2012'
AND roletype = 'OUTBELEG'.
ENDSELECT.
check sy-subrc = 0.
* 2 IDOCREL; From the Purchase Order link get the Idoc Link
SELECT role_b FROM idocrel into lrole_b UP TO 1 ROWS
WHERE role_a = lroleid.
ENDSELECT.
check sy-subrc = 0.
* 3 SRRELROLES: From the Idoc Link gets the corresponding object key (Idoc Number)
SELECT * FROM srrelroles into lsrrelroles UP TO 1 ROWS
WHERE roleid = lrole_b.
ENDSELECT.
check sy-subrc = 0.
write:/ 'Purchase Order:', pebeln.
write:/ 'Outbound Idoc :', lsrrelroles-objkey.
Regards,
Andrea
03-03-2010 1:17 AM