2010 Mar 17 5:49 AM
Hi,
I have a requirement in which I need to obtain latest idoc number for a particular purchase order via a program. Is there any way of doing this?
Thanks in advance.
2010 Mar 17 10:16 AM
Hi,
If its outbound idoc follow this procedure.
1, take the PO number and then go to NAST table in Objectkey provide the number also appliaction EF and medium 6 for idoc using this get cmfpnr number.
2, You will get n number of enteries based upon time and date take the latest entry,
3, Go to CMFP table using cmfpnr number you will get idoc number in MSGNR field.
Now using idoc number you can get the EDDID4 and status using EDIDS table.
I tired this its working fine.
Regards,
Shanmugavel Chandrasekaran
2010 Mar 17 8:25 AM
IDOC PORDCR04 is generated by a BAPI FM BAPI_PO_CREATE1
Check this IDOC or BAPI.
2010 Mar 17 8:58 AM
thanks. But actually user req is to give a po number and get the details of certain fields and also the status of idoc sent. So i was thinking od SQVI. in sqvi we can give only transparent tables. that is why i was trying to find out the any table field in which idoc number is stored along with po number
2010 Mar 17 9:08 AM
Hi,
Idoc data will be stored in
EDIDC control record
EDID4- data record
EDIDS- has status records
In your case you know you IDOC basic type and sgement where the PO number is stored.
So in EDIDD pass the segmant name and PO number to get the idoc numer.
You see the status in EDIDC.
Hope it helps.
Regards,
Shanmugavel Chandrasekaran
2010 Mar 17 9:22 AM
thanks. can you elaborate a bit more? like po number is in e1edk01-belnr. so how can i find this in edidd ?
2010 Mar 17 10:29 AM
Thanks. I will try this out and after that i will update the results. I am not familiar with sap query so dont whether there are provisions for finding the latest entry etc via queries. So you have any idea about this?
2010 Mar 17 11:08 AM
Hi,
You have coding option in SQ02 where you can code your requirement. You can try that.
I think stariaght report will be much easier.
Regards,
shanmugavel Chandrasekaran
2010 Mar 17 10:16 AM
Hi,
If its outbound idoc follow this procedure.
1, take the PO number and then go to NAST table in Objectkey provide the number also appliaction EF and medium 6 for idoc using this get cmfpnr number.
2, You will get n number of enteries based upon time and date take the latest entry,
3, Go to CMFP table using cmfpnr number you will get idoc number in MSGNR field.
Now using idoc number you can get the EDDID4 and status using EDIDS table.
I tired this its working fine.
Regards,
Shanmugavel Chandrasekaran
2010 Mar 17 3:28 PM
Hi,
SAP transaction WE10 helps you do that.
Refer to the below link to know how to use it -
[Find Idoc number based on data|http://www.divulgesap.com/blog.php?p=NDI=]
If you are trying to do it programatically, then try debugging WE10 to find out the logic.
Cheers,
Ravi
2010 Mar 19 11:44 AM
i have tried debugging we10. but there the logic is to first extract all idocs and then search in their segments, which i suppose will be a waste of time in my case.
2010 Mar 19 1:43 PM
Hi samuel,
unfortunately I'm not working on a logistics-related system now.
I remember from a retail project that SAP automatically creates relations between IDOCs and business objects (as i.e. PO, delivery etc.). The related objects can be obtained in GOS generic object services. By doing some debug work, I found the connection from IDOC to purchase order, it should be possible the other way round. Here a code snippet from one of my records (2007, Retail system ECC600) that gives you the tables where to start from:
SELECT srrelroles_idoc~objkey srrelroles_ekko~objkey
INTO (lv_objkey_docnum, lv_objkey_ebeln)
FROM srrelroles AS srrelroles_idoc
JOIN idocrel
ON idocrel~role_a = srrelroles_idoc~roleid
JOIN srrelroles AS srrelroles_ekko
ON srrelroles_ekko~roleid = idocrel~role_b
* just to make sure
JOIN ekko ON ekko~ebeln = srrelroles_ekko~objkey
FOR ALL entries IN lt_objkey
WHERE srrelroles_idoc~objkey = lt_objkey-table_line
AND srrelroles_idoc~objtype = 'IDOC'
AND srrelroles_idoc~roletype = 'INIDOC'.
ls_docnum_ebeln-ebeln = lv_objkey_ebeln.
ls_docnum_ebeln-docnum = lv_objkey_docnum.
INSERT ls_docnum_ebeln INTO TABLE lt_docnum_ebeln.
ENDSELECT.First check tables srrelroles and idocrel if there is anything that could help you.
Regards,
Clemens
2010 Mar 23 4:39 AM
Hi all,
I have solved the problem. i followed the suggestion by shanmugavel Chandrasekaran.
Thanks to all who replied to my question.