Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Need list of Idocs for a particular Order Number

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

andrea_olivieri
Contributor
0 Kudos

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

6 REPLIES 6

Former Member
0 Kudos

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.

0 Kudos

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

0 Kudos

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.

0 Kudos

Hi, You need to retrieve it from the tables EDIDC,EDID4 tbales.. similar to the transaction WE09.

Regards,

Swaroop Patri

andrea_olivieri
Contributor
0 Kudos

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

Former Member
0 Kudos

Tcodes : WE09, WE10

Tables :EDID4