cancel
Showing results for 
Search instead for 
Did you mean: 

if condition in BPM

Former Member
0 Kudos

Hi All,

I have a scenario(actually idoc to file) that I need to receive two IDOC : PEXR2001 as payment details and IDCREF01 as verfication details. Here in PEXR2001 i have a field MOABETR in segment E1IDKU5 for which I need to sum the total value of this field(MOABETR). And after that I need to compare this with condition

if IDCREF01-E1IDRH1-PAYRUNID equals to PEXR2001-E1IDRH1-PAYRUNID and

IDCREF01-E1IDRH1-PAYRUNDT equals to PEXR2001-E1IDRH1-PAYRUNDT and

IDCREF01-E1IDRS1-SUM01 equals to PEXR2001-E1IDKU5-MOABETR.

if all the condition is satisfied I need to send a mail notification to the user and also the file. but if it is failed I need to send only the mail notication. Please let me know how to configure in BPM.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi

i think u have done the scenario idoc 2 file.Could please expalin wat exactly the business requirenent was?

if u do so ur very thankful to me.

Former Member
0 Kudos

sorry for the late reply because I really confused whether to user BPM or not BPM

The actual scenario is

I will be receiving n no. of idocs including both idoc type PEXR2001 and IDCREF01(control idoc).

Then I need to collected all payment idoc PEXR2001 which will be having one control idoc

IDCREF01. This will be grouped by checking

if IDCREF01-E1IDRH1-PAYRUNID equals to PEXR2001-E1IDRH1-PAYRUNID and

IDCREF01-E1IDRH1-PAYRUNDT equals to PEXR2001-E1IDRH1-PAYRUNDT

so for example I will be having 5 payment idoc and 1 control. in this I need to sum the

value of field MOABETR which is in payment idoc. after this i need to check

if IDCREF01-E1IDRS1-SUM01 equals to PEXR2001-E1IDKU5-MOABETR.

if this condition is satisfied then i will be sending the file to both email adapter and

file adapter otherwise failed file will be sending only to email adaper.

I request to give detailed step in BPM if needed or let me know how we can configure this.

Dhil.

henrique_pinto
Active Contributor
0 Kudos

Well, seems that you do need a BPM, since you have correlation.

Your first concern would be on how to generate the correlation.

Apart from the correlation strings (in your case, they would be PAYRUNID and PAYRUNDT), you need to determine how to control the receivement of payment idocs. You can have a maximum number of idocs (and in this case the BPM will end only when the max number has been reached), you can have a deadline control (all payments that have arrived in a certain period of time), or you can have a mix of both.

As for BPM design, I'd go for a fork with receiver for control idoc in 1 branch, and in the other the block step (to define deadline) + loop + receiver for payment idoc in the other branch.

For your logic, I don't know if you'll be able to do all the checks in a simple switch step (though it may be possible with XPath expressions). But if you want to make it work as fast as possible, go for mapping. It'd be simpler. Then you can try alternatives.

Regards,

Henrique.

Former Member
0 Kudos

Dhil,

You need to create instances of BPM with unique values for PAYRUNDT and PAYRUNID against PEXR2001 and IDCREF01.For this create two receive steps for above two types of messages in a loop.Co-relate using IDCREF01-E1IDRH1-PAYRUNID,IDCREF01-E1IDRH1-PAYRUNDT and PEXR2001-E1IDRH1-PAYRUNID , PEXR2001-E1IDRH1-PAYRUNDT.

Using Assign step (container operation) keep on accumulating the values of PEXR2001-E1IDKU5-MOABETR in a container variable .

Define the end condition to end the loop.

Outside the loop,compare the value of the accumulated container variable with

IDCREF01-E1IDRS1-SUM01 and branch (Swicth) into sending mail or both mail and file.

Regards,

Bikram

Former Member
0 Kudos

HI Bikram and Henrique,

Thank you very much finally I am done with BPM :-). Actually

1. I started with Fork step with 2 branch then for verfication idoc I used receive step with correlation and for payment idoc

2. I used loop with condition if

if IDCREF01-E1IDRH1-PAYRUNID equals to PEXR2001-E1IDRH1-PAYRUNID and

IDCREF01-E1IDRH1-PAYRUNDT equals to PEXR2001-E1IDRH1-PAYRUNDT then

inside the loop I used one receiver for payment idoc with correlation and one container to store the sum value of payment and ended the loop

3. then created switch statment with condtion as

if IDCREF01-E1IDRH1-PAYRUNID equals to PEXR2001-E1IDRH1-PAYRUNID and

IDCREF01-E1IDRH1-PAYRUNDT equals to PEXR2001-E1IDRH1-PAYRUNDT and

IDCREF01-E1IDRS1-SUM01 equals to PEXR2001-E1IDKU5-MOABETR.

4. IF yes i used fork with 2 send statement because two receiver one is mail and the other one file both using the same interface object MIFILE.(But not sure whether this will work or not because there is no parameter to specify to which communication channel it has go..... please clarify this)

5. If NO I use only one Sender need to go email adapter (same doubt here also )

Now I started creating Integration Directory

here i import one R/3 system and 2 business systerm EMAIL and FILE and Integration process system.

I hope we don't sender communcation channel and sender agreeement but I request you to tell me how many Receiver Determination, Interface Determination and Receiver agreeemnt needed for this scenario...

It would be very helpful for me if u can tell me in steps.

thankyou very much for your time.

Regards,

Dhill

henrique_pinto
Active Contributor
0 Kudos

Hey Kumar,

actually if you correctly define the correlation, then you won't need any check on the PAYRUNID and PAYRUNDT fields in switchs and loop.

For your correlation, go into the correlation editor. Create two correlation fields, with names "PAYRUNID" and "PAYRUNDT". As message interfaces which will use this correlation, define both Idoc (control and payment) interfaces that you already use in receive steps in BPM (IDCREF01 and PEXR2001).

And finally, for each of these messages, point the correct fields in structure which refer to the defined correlation fields. In IDCREF01, you will have

PAYRUNID = IDCREF01-E1IDRH1-PAYRUNID and

PAYRUNDT = IDCREF01-E1IDRH1-PAYRUNDT.

As for PEXR2001, you'll have

PAYRUNID = PEXR2001-E1IDRH1-PAYRUNID and

PAYRUNDT = PEXR2001-E1IDRH1-PAYRUNDT.

Make sure you use and activate this correlation in both receive steps in BPM (for control and payment idocs).

Now you can remove all explicit checks on PAYRUNID and PAYRUNDT of your switch and loop steps. All you need to worry about is the sum logic.

Regards,

Henrique.

Former Member
0 Kudos

Henrique,

Thank you very much i modified as specified but i little confusion with regards to ID. Currently I created

3 Receiver Determincation

Sender // SenderInterface // Reciver

-


R/3System // EUPEXR.IDCREF01.ZDCREF01 // IP

R/3System // PAYEXT.PEXR2002.ZEXR2002 // IP

IP // FileAbstract Interface // File and Mail (but any without condition) and

4 Interface Determination

Sender // SenderInterface // Receiver // InboundInterface

-


R/3System // EUPEXR.IDCREF01.ZDCREF01 // IP // MIEUPEXR

R/3System // PAYEXT.PEXR2002.ZEXR2002 // IP // MIPAYEXT

IP // FileAbstract Interface // File // MIFILE

IP // FileAbstract Interface // Mail // MIFILE

(But I am not able to find my Interface Mapping in any of this Interface Determination) and 2 Receiver Agreement.

Please let me know is this the above correct configuration or we need to do more.

Dhil.

henrique_pinto
Active Contributor
0 Kudos

Hey Kumar,

sounds about right.

Make sure you have created interface mappings and not just message mappings.

Also, try to use configuration wizard whenever it is possible. It's easier.

Regards,

Henrique.

Answers (3)

Answers (3)

henrique_pinto
Active Contributor
0 Kudos

What is the message type of the file? Or you just need to save IDOC structure in file?

If that's so, mapping would not be recommended.

You could try to use XPath operations (such as sum() ) in order to achieve that, but I have never used it in switch step, only receiver determinations.

Regards,

Henrique.

Former Member
0 Kudos

HI,

One way ,try to write a UDF with Queue option

And in the UDF, try to receive the all values which are to be sum , and check that value to second input value as per your business requirement . If condition satisfies then you would have to raise an Alert from Message mapping itself.

Here if you are not able to store the resultant sum and carried to then next calculation then use the global variable ( which can be defined in MM itesefl).

See the below link how to generate an Alert from Message mapping.

Alerts with variables from the messages payload (XI) - UPDATED - /people/michal.krawczyk2/blog/2005/03/13/alerts-with-variables-from-the-messages-payload-xi--updated

Triggering XI Alerts from a User Defined Function - /people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function

Regards

Chilla

Former Member
0 Kudos

Hi,

I guess the best way is to merge both Idoc into one Structure.

Because now you have two container in the Integration process.

Do a transformation Step where you do all this conditions.

The new structure after the mapping you can use for simple condition in the process like:

if filedA= true than send to file and mail. if false send only to mail.

Regards,

Robin

Former Member
0 Kudos

Hi,

Actually I don't need to send any data from IDCREF01 idoc to file and it is just for the verification (validating the condition). even though do u want me to merge both IDOCs

Regards,

Dhil.

Former Member
0 Kudos

Hi,

You dont have to use Data from IDCREF01.

Just do the 2:1 Mapping, so you are possible to make condition withe values from both IDocs.

Within the mapping you can set a checkvalue in your target message if they are valid or not. Yo have to create your own Datatype/Messagetype/AbstractInterface for that checkvalue.

In the Integration Process you will use this checkvalue Interface in a container only for some condition.

The Value you send to File will be still the Container you already use for your "checkmapping". The one with the IDOC.

Regards,

Robin