cancel
Showing results for 
Search instead for 
Did you mean: 

Get message ID using reference IDoc number in SAP PO

former_member228109
Participant
0 Kudos

Hello Experts ,

We are having one scenario in which data will be sent from third party to PO and from PO to SAP ECC (IDoc) to create the opportunity in ECC.

Once opportunity is created successfully in SAP ECC, it will send the success confirmation data to third party(ECC-PO-third party). But in case of technical error in ECC while creating the IDoc, IDoc is having very limited data in it. So we are not able to get the required field (third party opportunity ID) in that IDoc.That field we need to send back to third party so that they can understand the error is for which opportunity ID. The same field is available in first interface (ie third party-PO-ECC)

     so we have decided to use the payload of first interface to parse it and to get the required data(third party opportunity ID) from it.The flow will be like technical error IDoc will be having reference IDoc number of first interface from which we will find the messageID. From messageID we will find the messageKey and from messageKey, payload. Referring below link.

http://scn.sap.com/community/pi-and-soa-middleware/blog/2010/04/13/pixi-how-to-get-a-pi-message-from...

But we are not able to find message ID from IDoc reference number in SAP PO. Do we have any APIs to retrieve the same. Can anyone please help us with the same.

Regards ,

Nikhil Save

Accepted Solutions (0)

Answers (3)

Answers (3)

gagandeep_batra
Active Contributor
0 Kudos

Hi Nikhil,

Another approach you can use is create a proxy and using proxy post the idoc and then check the status of idoc after posting and log according to status in ECC in some table and then in second scenario read that table and send data to third party.

Regards

GB

former_member228109
Participant
0 Kudos

Hi GB ,

As per the requirement, we have to use IDoc only and not proxies .

Regards ,

Nikhil Save

former_member182412
Active Contributor
0 Kudos

Hi Nikhil,

Better solution would be when you receive the first IDoc in ECC you must save opportunity ID some where in the ECC itself and if any error during processing of the first IDoc then send the opportunity ID in the second IDoc from ECC to PI.

Regards,

Praveen.

former_member228109
Participant
0 Kudos

Hi Praveen,

We are already saving the opportunity ID in ECC at the time of first IDoc. But acknowledgement IDoc is a standard IDoc (ALEAUD.ALEAUD01) and we can not extend this IDoc. That is the reason we need to find out the OpportunityID from PO.

Kindly let me know if you are having any other idea.

Regards ,

Nikhil Save

former_member182412
Active Contributor
0 Kudos

Hi Nikhil,

Instead of reading the original payload based on the IDoc number and get the opportunity ID from the payload, is it not complicated process? better to create custom IDoc for sending the response from ECC instead of  ALEAUD IDoc and send the required data in the IDoc and send it to PI and then send it to the sender.

After you processed the first IDoc in ECC trigger this custom IDoc, i think this is better than what you are asking for.

Regards,

Praveen.

former_member228109
Participant
0 Kudos

Hi Praveen ,

I am completely agree with you. But business wants to go by that way. So we are also not having any option.

Kindly let me know if you are having any idea regarding querying PO database table XI_IDOC_OUT_MSG by writing UDF .

Regards ,

Nikhil Save

former_member186851
Active Contributor
0 Kudos

Hello Nikhil,

Try using beans as per the below discussion

former_member228109
Participant
0 Kudos

Hi Raghuraman ,

The provided link is useful to read the messageID of same transaction. But we want to find the messageID of first interface transaction in second interface using reference IDoc number.

So as of now we have found one way using XI_IDOC_OUT_MSG database table. This table is having relation between IDoc number and messageID. But now stuck with how to query the table and extract the messageID.

Can anyone help us with the same.

Regards ,

Nikhil Save

former_member186851
Active Contributor
0 Kudos

Hello Nikhli,

You can query using JDBC adapter.

It is possible but no recommended.

former_member228109
Participant
0 Kudos

Hi Raghuram ,

But how to query  PO's own database is what i want to know .

Regards ,

Nikhil Save

former_member186851
Active Contributor
0 Kudos

Hello Nikhli,

what is ur Database?is that oracle?

Install Oracle drivers and do a normal JDBC scenario,But ensure ur using only select statement as it is not recommended to modify these tables.