cancel
Showing results for 
Search instead for 
Did you mean: 

Idoc Acknowledgements and BPM.

bhavesh_kantilal
Active Contributor
0 Kudos

All,

My current requirement is to post an Idoc from my BPM, and get back the Idoc Acknowledgement. On the basis of the status field in the ALEAUDIT Idoc I need to determine the further course in my BPM.

<u><b>Option 1:</b></u>

1. In the Send Step of my BPM , I can request for Application Acknowledgement. I have done this and am able to receive the Acknowledgement and see the same against the Acknowledgement Msg ID in MONI. I am able to see the ALEAUDIT idoc triggered for my Send Step back to my BPM .

The question in case we are to use this Option is , how do I access this AleAudit Idoc message in my BPM. As I want to have a switch, I need this to be populated in a container element of my BPM. Is this possible? Is this approach a correct one? Any Ideas?

<u><b>Option 2</b></u>

I can have a Send Step in my BPM to send the Idoc from XI to R3. this will be a normal Send Step with no Acknowledgements. I can also use a Receive Step in the BPM to receive the ALEAUDIT Idoc back to the BPM.

This I guess can be done with a Receive determination where R3 is the sender and the AleAudit Idoc is the receive etc.

Issues with this approach, I need to use a Correlation against the Send and Receive Step to send the Idoc and receive the AleAudit.

1. What is the Correaltion that can be used? Is there a standard correaltion. for such cases?I looked into the Idoc and the AleAudit but could' nt find a suitable Correlation Field.

Do both these solutuons make sense? has anyone got a better approach?

Any comments are appreciated.

Regards

Bhavesh

PS: Have gone through the How to guide on Idoc Ack's and the blogs on SDN as well. But if still someone feels that there is a blog that is relevant to this issue, please do let me know if I have missed anything.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Bhavesh ,

I tried the blog which is refered and i m in the same state as Gonçalo Mouro Vaz where i have the Message ID which entered into BPM

but not the message Id which triggered the IDoc send . I think i m missing some small detail where i need to capture the send step MSG Id

i'm aware that its not possible to get the Msg id in BPM . How is that ABAP Mapping in the below blog captures the message id ?

/people/mitesh.parekh/blog/2008/12/01/receiving-aleaud-as-acknowledgment-in-ccbpm

TRY.

l_msgid_ref = param->get(

IF_MAPPING_PARAM=>MESSAGE_ID ).

catch CX_SY_REF_IS_INITIAL into oref.

endtry.

If you can let me know where you got this SourceDocNum would be great in your RFC Look up .

"

Thanks for your time & effort .

bhavesh_kantilal
Active Contributor
0 Kudos

In case someone is still reading this thread, a blog was posted before I could do it.

Discussed the exact solution in this thread,

Regards

Bhavesh

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

to correlate E1STATE-DOCNUM of aleaud

<b>should</b> contain IDOC number from XI

but check it please as I remember there were some issues with that and XI

<i>"E1STATE contains the IDoc number of the sending system (Field DOCNUM), the current status in the receiving system and the message fields from the current status record in the receiving system. In a remote system the DOCNUM value depends on how the IDocs were previously dispatched to the R/3 System. The sending system IDoc number is the number assigned when the INBOUND_IDOC_PROCESS in field EDI_DC-DOCNUM was called. The R/3 System saves this number unless it is the initial value. "</i>

from

http://help.sap.com/saphelp_nw04/helpdata/en/0b/2a65df507d11d18ee90000e8366fc2/content.htm

Regards,

michal

bhavesh_kantilal
Active Contributor
0 Kudos

Michal,

thanks for that input.

Will check this up tomorrow, and update.

Regards

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

Michal,

Your above answer was useful.

I looked into the Outbound Idoc in IDX5 and the Idoc Number is the same as the EISTATE-DOCNUM as correctly pointed by you. This can be used as a correaltion , but...

1. This Idoc number is generated by XI and I dont think this will be available inside my Send Step of the BPM when I am sending the idoc from XI to the R3 system.

I also looked into the list of Context Objects and could not find the Docnum field and so I guess this cannot be used as the correaltion Id.

Another (half) solution~

I dug deeper and found that the ARCKEY field in the AleAudit contains the Message Id of my Idoc. I can use this as the Correaltion Identifiers , but , as you know Message Id's are not accessible inside the BPM and are actually geberated in the IE for each Send Step and this will not be available to my access in the Send step in the BPE.

Any other ideas? Solutions? Options that crop up ?

Regards

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

Very interesting scenario..please explain , how you achieved it..

see the below link may helps, i hope this is already with you..

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/903a0abc-e56e-2910-51a8-9dc616df...

Regards

Chilla

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Chilla,

Am still struggling with it Will update if I do crack this thing.

Have already taken a look at the Document ( actually that is how I have come so far ).

Regards

Bhavesh

henrique_pinto
Active Contributor
0 Kudos

I'm just guessing here, but couldn't you create your own IDoc ack message type?

If you do so, you could populate it with some id like information which was available from sent IDoc.

Regards,

Henrique.

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Henrique,

Am playing around with Idoc ack's here and so I dont want to look at a customization option.

If nothing works out yes such customizations are always possible but for the current scope i just want to figure this out.Considering that Idoc AleAudit is used exactly for this purpose, I still have a feeling there has to be a very obvious way which we have not considered here.

Hopefully someone has some experince with this.

Regards

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

Any clues or ideas folks?

Dont want to close this thread.. not yet hoping that there is some solution!

Regards

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

I did some more searching and found the note : 837285 . Though not relevant to the issue I am facing of trying to access the AleAudit Idoc inside my BPM, I found it to be a useful read.

The Application Ack in the Send Step can only be used to receive the Ack back from the R3 system but it cannot be used to access the content of the AleAudit Idoc.

Also, if you want to read the AleAduit Idoc in a separate Receive step of the BPM, then as Correlation is an issue, we would need some customization to add some Custom Correlation Id to the AleAduit and hence the standard RBDSTATE report cannot be used to trigger AleAduit and customizatons maybe needed here.

Closing this thread under the above 2 assumptions / understanding that AleAduit Idoc cannot be read inside a BPM without customizations to RBDSTATE.

Hopefully someone can prove me wrong and help me out here.

Regards

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

All,

Finally cracked this issue

The EISTATE-DOCNUM contains the Idoc Number created by XI. I knew this was the issue and somewhere XI must be storing the original Idoc number.

Dug in with the help of few ABAP colleagues, and then found this table IDXRCVPOR and this contains the XI Idoc Number and the original idoc number as well.

In the AleAuit mapping when SAP triggers it, I do a lookup with the EISTATE-DOCNUM to get the oriignal idoc number, set this to the required field and use the idoc Number as my correaltion.

Worth a blog? If someone feels yes, do let me know, and I can write one up.

Regards

Bhavesh

Former Member
0 Kudos

congrats:)

definitely this is worth a blog,will help all of us in dealing with IDOC ack and BPM issues.

thanx

Aamir

Former Member
0 Kudos

Hi Bravesh,

One question:

Inside your BPM on the send step you correlate your IDOC-EDI_DC40-DOCNUM with EISTATE-DOCNUM, right?

But how can you have access to IDOC-EDI_DC40-DOCNUM since the value will only be available after processing?

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

The Original Idoc Number from SAP to the Idoc number of XI is maintained in IDXPCVPOR.

Eg : SAP IDoc number is SAP1 , XI Idocnumber is XI2.

IDXRCVPOR will have a entry with SAP1 , XI1 and other values in many coulmns.

Now, when the AleAduit comes back from your other SAP system, the AleAudit will contain in the E1STATE - Docnum field , XI's Idoc number XI1 . We in XI, do a RFC lookup to the table IDXRCVPOR in the Interface determination level, replace XI1 with SAP1 and then when the Idoc hits the BPM instance it is able to corrleate to the correct BPM as needed.

Hope this helps.

Regards

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

One question,

When you say,

"replace XI1 with SAP1 and then when the Idoc hits the BPM instance it is able to corrleate to the correct BPM as needed"

altough we replace XI1 with SAP1 when the IDOC hits the BPM instance will fail since the the correlation value will still be wrong, corerct? So, we'll have to replace the correlation value and not the XI1 value.... Is this correct?

bhavesh_kantilal
Active Contributor
0 Kudos

In my case I used the DOCNUM field of the Idoc as the Correlation Field.

When the Idoc was sent from XI to SAP, i.e, from BPM, the Correaltion would be SAP1.

Now, when the Interface Determination RFC Lookup replaces XI1 with SAP1 it will do so in the same Field DOCNUM which is used as the Response message Correlation ID and now as the Docnum fields match it ends up in the same BPM.

Hope this makes sense.

Regards

Bhavesh

henrique_pinto
Active Contributor
0 Kudos

Oi Bhavesh,

just create the blog already!

Best regards,

Henrique.

Former Member
0 Kudos

Hi Bhavesh,

As I was developing the lookup a problem arised.... You read the DOCNUM from IDXRCVPOR with the messageID, right?

But in mapping level, the messageID you get from the container is related to the first messageID and not to the bpm messageID... How do you get the second messageID? Any special relation?

Meaning you get a first receive step which starts the bpm and the second one to send the IDOC.... after you send the IDOC and before you receive the ALEAUDIT you'll read the DOCNUM with the messageID, right? My problem is that the messageID I get is related to the start of the bpm process and not the the IDOC sending....

Can you give me a hint...?

ravi_raman2
Active Contributor
0 Kudos

Bhavesh,

Interesting..thread...very..

Ravi Raman

bhavesh_kantilal
Active Contributor
0 Kudos

Ha, now that was interesting question. Brains were rusty, relooked into that lookup and these are the fields of the IDXRRCVPOR we use,

Used the RFC - RFC read table

XI's Idoc Number is in Field IDOCNUMBER

Original SAP IDoc Number is in Field SNDLAD.

Code excerpt attached below.

@ Henrique : Work's been crazy past few months. The blog is on my to do list, hopefully someday soon it should be out. My Apologies guys!



Channel rfcChannel =	LookupService.getChannel(BusinessService, CommChannel);
//As the call is being made to RFC, RFCAccessor is obtained.
rfcAccessor = LookupService.getSystemAccessor(rfcChannel);
rfcXML =
				"<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns0:RFC_READ_TABLE xmlns:ns0=\"urn:sap-com:document:sap:rfc:functions\"><DELIMITER/><NO_DATA/><QUERY_TABLE>IDXRCVPOR</QUERY_TABLE><ROWCOUNT/><ROWSKIPS/><DATA><item><WA/></item></DATA><FIELDS><item><FIELDNAME>SNDLAD</FIELDNAME><OFFSET/><LENGTH/><TYPE/><FIELDTEXT/></item></FIELDS><OPTIONS><item><TEXT>IDOCNUMBER EQ &apos;"
					+ SourceDocNum
					+ "&apos;</TEXT></item></OPTIONS></ns0:RFC_READ_TABLE>";
inputStream = new ByteArrayInputStream(rfcXML.getBytes());
XmlPayload inPayload = LookupService.getXmlPayload(inputStream);
Payload outPayload = rfcAccessor.call(inPayload);
responseStream = outPayload.getContent();

DocumentBuilderFactory factory =DocumentBuilderFactory.newInstance();
/* Create DOM structure from input XML */
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(responseStream);
NodeList list = document.getElementsByTagName("WA");
for (int k = 0; k < list.getLength(); k++) {
    Node node = list.item(k);
   if (node != null) {
	node = node.getFirstChild();
                if (node != null) {
		if (!node.getNodeValue().equals("")) {
			OutputDocNum = node.getNodeValue();
		}
	}
}
}

Regards

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

Thanks very much for your reply!!! I already started developiong and executing the lookup, and I'm not using a channel configuration, I'm creating a JCO connection...

However, I'm getting a funny but tiring error....

I'm using the MSGGUID for querying the table and the thing is, if I get the MSGGUID from the container, meaning:

<code>

java.util.Map map = container.getTransformationParameters();

String msgGUID = (String) map.get(StreamTransformationConstants.MESSAGE_ID);

String WHERE_CLAUSE = " GUID = ""'"msgGUID +"'";

</code>

and then query the table I get no results for the IDOCNUMBER.

But if I place for example a MSGGUID which exists in the table :

<code>

String msgGUID = "DCF4DD6F3F66A4F1ABC700145E1855EC";

String WHERE_CLAUSE = " GUID = ""'"msgGUID +"'";

</code>

I'm able to get the IDOCNUMBER.

I've tried million of things (casts, byteArray to strings, etc) but this is an awkward error, can anybody enlight me...

What can be the difference....?

bhavesh_kantilal
Active Contributor
0 Kudos

Where are you accessing the message id?

Is it in a mapping in the Interface determination level or in a mapping inside a transform step of a BPM? Message Id's are not available inside a BPM.

Also try to print the message id in the trace of the mapping step and see what you get.

Regards

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

I'm accessing the MessageID in the interface determination level and like you said I'm able to get the messagID value.

I've tried a simple thing...

If I have:

<code>

java.util.Map map = container.getTransformationParameters();

String msgGUID = (String) map.get(StreamTransformationConstants.MESSAGE_ID);

//String WHERE_CLAUSE = " GUID = ""'"msgGUID +"'";

....

return msgGUID

</code>

I'll have in the IDOC-DOCNUM the msgGUID. So, in the UDF, XI is able to get the msgGUID value but why isn't it able to use it?

This problem is something spectacular... I'm

bhavesh_kantilal
Active Contributor
0 Kudos

Is this Message ID the same value as the entry in the table?

I dont think so, as every message in the pipeline of XI would be a different message id.

Would suggest you use the above way I have explained to do the lookup. XI Idoc number gives you SAP Idoc Number.

Regards

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

The messageID I force is of course one value just for testing. However if I pass the value of the messageID I get from the container to some field like SNDLAD just to check it, I can see that's equal to the table I query.

The main problem, and that is really puzzling me, is how doesn't XI use that value....

Because when I try to get :

<code>

com.sap.mw.jco.JCO.Table valueSet = function.getTableParameterList().getTable("DATA");

</code>

the number of rows I get is 0...and as a consequence I'll have a null value on the IDOCNUMBER.

This seems to be more like a JAVA problem and I've never faced one like this....

Do you have any suggestions....?

Former Member
0 Kudos

Hi Bhavesh,

Since the problem was starting to get on my nerves I've tried the lookup using the method you suggested.

The result is exactly the same...

Using the method you suggested, I'm able to call the lookup but like before I continue to get a null value.... If I force with a test value for a msgGUID (only for testing - which exists in the table IDXRCVPOR) I'm able to execute the lookup and fill in the DEBMAS-EDI_DC40-IDOCNUMBER with the test value....

I'm really start to be amazed with this problem....

However, I've noticed something different in your advice...

You said you get the field SNDLAD with the corresponding IDOCNUMBER. But correct me if I am wrong, what we want is to read the IDOCNUMBER with the field GUID, which is the messageID, right? During the mapping you don't have the IDOCNUMBER or the SNDLAD, only the messageID....

I'm really starting to think that's not possible to read the value, the thing which is really amazing is that it seems that I can't use the messageID value during the UDF for reading the IDOCNUMBER...

Any ideas...please...

henrique_pinto
Active Contributor
0 Kudos

Gonçalo,

an out-of-the-box question.

Did you set your bpm steps to not create new transactions?

If that's the case, maybe when you send the idoc and is waiting for the aleaudit response, no commit was performed in the BPM LUW and hence no entry was saved in the IDXRCVPOR table yet.

If you flag again the "create new transaction" in your bpm steps (at least in the send/receive steps related to idoc & aleaudit messages) that could work.

Could you check it?

Regards,

Henrique.

PS: another idea that may be worth checking: since Bhavesh real scenario was Idoc - XI - Idoc scenario, where the 2nd Idoc lookup was based in the 1st outbound idoc, it made sense to lookup the IDXRCVPOR table; for the BPM -> Idoc + ack scenario though, where you have an inbound Idoc, it may make sense to lookup the IDXSNDPOR table. But that's just a guess. 😛

Former Member
0 Kudos

Hi Henrique,

Thanks a lot for your reply. I thought no one was looking this thread

I'll give it a try. Tomorrow I'll give you feedback

Once again, thanks!

henrique_pinto
Active Contributor
0 Kudos

Sure, let us know the outcome.

Regards,

Henrique.