cancel
Showing results for 
Search instead for 
Did you mean: 

BPM: Wait for response in asynch scenario

Former Member
0 Kudos

Hi,

I have implemented a BPM which is working (but not as it should). The scenario is R3 IDoc - XI - Legacy SOAP - XI - SAP, and the requirement from the legacy web service is that we cannot sent another Idoc to the web service until we get a response (ALEAUD) back. We also cannot use synchronous interfaces.

I thought that the BPM would solve this, the BPM contains a receive IDoc step, send Idoc (SOAP), receive ALEAUD response (SOAP) and send ALEAUD (IDOC), all steps asynchronous. But if I send two IDocs from R/3 they get both get sent to web service, even though the second Idoc should wait for a the ALEAUD from the web service before being sent. It seems that XI just creates a new instance of the BPM and runs the second IDoc in this one.

Is there a way to implement that when XI receives several IDocs from R/3, XI queues them up and sends them one by one and wait for a response before sending next one?

I have implemented correlation to relate the response to the message sent out.

Thanks a lot for your help!

-Kenneth

Message was edited by: Kenneth Eriksen

Message was edited by: Kenneth Eriksen

Accepted Solutions (1)

Accepted Solutions (1)

moorthy
Active Contributor
0 Kudos

Hi,

To do EOIO in BPM, you can refer this-

http://help.sap.com/saphelp_nw04/helpdata/en/43/65ce41ae343e2be10000000a1553f6/content.htm

But ALEAUD is response from Idoc right ? Not from SOAP Service? from where you want to get the response ? From Webservice ? Elaborate the scenario.

If you want to get the Response from Webservice and after that you need to send this response to SAP again, then you need to have Synch. Webservice scenario. ...

Regards,

Moorthy

Former Member
0 Kudos

Hi Moorthy,

I don't think EOIO is the solution, as I don't care what order the Idocs are sent as long as they are sent one by one and waiting for the response ALEAUD before sending the next one.

The ALEAUD is a message created by the web service we sent the initial data Idoc to.

R/3 will send out x number of data idocs which I want to be queued up in XI, and send one by one to the web service. The web service performs its logic and returns (preferrably in a separate asynch call) with an ALEAUD message to XI. Only then should the next data IDoc be sent from XI to the web service. The ALEAUD messages will also then be sent to R/3.

Is this at all possible without using sync interface between XI and web service? I was hoping some BPM magic would do the trick..

Thanks for your help!

-Kenneth

MichalKrawczyk
Active Contributor
0 Kudos

hi,

BPM can do this magic... once it's designed for this:)

you can implement a global check (abap table or whereever) and before sending the BPM will check

if it's ON of OFF if ON change it to OFF and

do the SOAP call if ON try again in a few minutes

then the response from the web service

has to change it to OFF again

this is just one of the ways how you should

be able to do it... but I'm sure there are a few more

ways

Regards,

michal

moorthy
Active Contributor
0 Kudos

Hi,

It is possible. But don't you think, you are making your BPM process to wait for long time.

You can do with cross reference table, or you can use of Container variable with setting flags in the mapping.

Instead of this, if you think of Sync, it may be good .

Regards,

Moorthy

Former Member
0 Kudos

Thank you guys!

Personally I wouldn't think twice of implementing this with sync interface, but I don't control the requirements so..

I will give the global flag option a try, and let you guys know if I need any more help:)

Br,

Kenneth

henrique_pinto
Active Contributor
0 Kudos

Well,

do the ALEAUD responses from legacy system contain any info that can associate them to the requesting message?

If yes, you could make a infinite-loop BPM with local correlation. It only will complete the loop when you receive a ALEAUD response which corresponds to the request you just sent.

Regards,

Henrique.

Former Member
0 Kudos

Yes, the response references the Idoc number of the request.

I actually tried this, but it didn't work the way I expected it. It seems that XI just creates a new instance of the BPM for the next IDoc it receives from R/3, so there are in fact several instances of the BPM running at the same time.

I tried with a fork, where branch 1 is a loop that is always true (1=1) and branch2 has a receive step with the local correlation. The fork should stop if two branches are true. This did not work as I hoped.

Right now I am trying a fork with two branches, branch1 includes a loop, inside loop I have a switch which invokes a send step if a simple type flag is on and a cont operation which turns the flag off, otherwise it waits for a minute. Branch2 of the fork has a receive step waiting for the response, with local correlation, and a cont operation which turns the flag on.

Will this work? I am not sure if this simple type flag is global, that is if it works for all instances of this BPM or just the one BPM it resides in.

Is there some way of forcing XI to not create new instances of a BPM, but rather have all messages go the same instance? this would solve my issue as I see it.

Thanks!

henrique_pinto
Active Contributor
0 Kudos

Do it like this:

A loop step with condition 1=1. Inside it, put a block step which defines a local correlation. Inside the block, use steps like this:

receive IDOC async (which starts correlation, but don't use it)

send SOAP async

receive SOAP response async (uses correlation)

send ALEAUD async

This way, the loop will always run and BPE should understand that it doesn't need to create another BPM instance (since the running one is still valid). Also, the second receive step will only work when a message which suffices the correlation arrives.

For your correlation, you should set both messages (receive IDOC and receive SOAP response) as relevant messages, but you will only have one correlation field (IDOC_number).

Try that. If it doesn't work, try setting another correlation which all IDOC requests satisfy. Then, set this one as global correlation (don't put it inside any block step) and activate and use it in first IDOC receive step. This way, all IDOC's will be sent to same BPM instance.

Regards,

Henrique.

Former Member
0 Kudos

Great, this sounds like it might work! The only problem I have when I implement this solution is with the correlation. I defined the local correlation in the block, then the first receive step says that both use and start correlation are mandatory. Will it work if I set both use and start correlation, and then in second receive step only use correlation?

I'll give it a try and report back with findings!

Regards, Kenneth

henrique_pinto
Active Contributor
0 Kudos

hmmm,

since the first receive is also inside the loop, it'll try to use that correlation. 😕

So, you will need to create two correlations:

correl01: is a correlation which all IDOC messages that arrive satisfy (something like client number, for example).

correl02: idoc number (only the correspondent ALEAUD will satisfy)

First IDOC receiver activates and uses correl01.

Send SOAP activates correl02.

Receive SOAP response uses correl02.

Send ALEAUD doesn't use nor activate any correlation.

All of them inside a Block (which defines correl02 as local correlation) which is inside a infinite loop.

Regards,

Henrique.

Former Member
0 Kudos

It works!! Thanks a million Henrique, and also Moorthy and Micheal for your help.

My XI world suddenly became a better place to be:)

Regards,

Kenneth

henrique_pinto
Active Contributor
0 Kudos

Yay!!!

Very nice to hear that your scenario worked!

See, XI isn't a 7-headed monster as they had told...

Cheers,

Henrique.

Answers (0)