cancel
Showing results for 
Search instead for 
Did you mean: 

Problem 1 source to 1 or 2 targets!

Marçal_Oliveras
Active Contributor
0 Kudos

Hi,

I have the following scenario:

File -> PI -> IDoc1 and IDoc2.

The file can contain items only for Idoc1, only for Idoc2 or for both.

I know how to do "1 to n" mapping, but my problem is that when there are only items for one of the Idocs, the 2nd Idoc is sent to ECC too (with empty positions), and that generates an error. I don't know how to avoid that without a BPM. I need to "detect" the empty Idocs and don't send them

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

you should be having some field or segment whose data decides whether IDOC 2 should be generated or not...........so in your msg mapping, put the condition for this field or segement and using creatif function, map it to the IDOC node of the IDOC 2..........then your IDOC 2 will be generated only when there is data for it.

Regards,

Rajeev Gupta

Answers (1)

Answers (1)

former_member192295
Active Contributor
0 Kudos

Hi,

I think one of filed should be decide either idoc1 or 2. Check it and accordingly put condition in mapping window. Else based on data field pass control record value(ie. logical system name or port) to idoc. If data is related to first idoc mean only first idoc will be triggered else second idoc will be triggered.

Marçal_Oliveras
Active Contributor
0 Kudos

Hi NALLAM,

I think that works, but it will generate an error in PI for the empty IDOC. I'm working in a test scenario with RAJEEV solution. Thank you both

Marçal_Oliveras
Active Contributor
0 Kudos

Hi, I still need help for this situation.

My problem is that the IDOCs have occurrence 1..1 so when there isn't registers for 1 of the targets IDOCs the mapping throws an exception because the XSD specifies that almost 1 target result is necessary...

Now I'm sure that I need a BPM but I don't have an idea how to do it. The BPM must receive the source message and then go to "branch1" with mapping1 if there are registers for IDOC1 and/or go to "branch2" if ther are registers for IDOC2.

I've searched a lot in the SDN and I found quite similar scenarios but not identically and I dont have any knowledge to develop that... can you help me with the steps of the BPM, conditions, etc...

Thanks in advance

former_member200962
Active Contributor
0 Kudos

If you want to go with BPM:

Receive ---> Switch{apply condition to check if the node exists -


> if exists then go into the condition branch and do the mapping and other stuff......if node does not exist go into the Otherwise branch ---> here you can put a Control Step to throw Alert or to Cancel Process, as the case may be}

The number of Branches in Switch will depend on how many nodes you want to apply the check for (you seem to have mentioned IDOC for register1, register2.....)

Regards,

Abhishek.

Marçal_Oliveras
Active Contributor
0 Kudos

Hi abhishek,

But it's possible that I need to take the 2 branches (if there are register for both IDOCs)... and I think a switch node only takes 1. Am I wrong?

former_member200962
Active Contributor
0 Kudos

You can insert more than 1 Condition Branch in a Switch Step...by default it will be 1 Condition Branch and 1 Otherwise Branch.

If you want to insert more Condition Branch......right-click on Switch -


> Choose Insert ---> branch (not sure of the name)...but yes you can insert more than one branches....check and confirm.

just a doubt cant you change the occurence of the IDOC from 1..1 to 0..unbounded and then perform the logic to create the 1 or 2 IDOCs?..... there is blog by Michal on how to do this..../people/michal.krawczyk2/blog/2005/12/04/xi-idoc-bundling--the-trick-with-the-occurance-change

Also check this WIKI: https://wiki.sdn.sap.com/wiki/display/XI/File%20to%20Multiple%20IDOC%20Splitting%20without%20BPM

Check if you can implement something similar in your case also.

Regards,

Abhishek.

Marçal_Oliveras
Active Contributor
0 Kudos

Thanks abhishek, when I say that I need more than 1 branches, I'm talking that the same source message can be valid for the 2 branches and must be mapped with 2 different mappings to generate IDOCs type 1 and type 2. And I think that in a switch step, when find a branch where the condition is OK, the other branches are ignored then.

But maybe the solution to change the IDOC data type with an external message can be good for me. I will try that and post it here if it works, thank you.