cancel
Showing results for 
Search instead for 
Did you mean: 

Splitting Messages

Former Member
0 Kudos

Hi,

I'm facing the problem to split messages like

in this blog:

/people/sudharshan.aravamudan/blog/2005/12/01/illustration-of-multi-mapping-and-message-split-using-bpm-in-sap-exchange-infrastructure

Means, an input structure like this:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">

<ns0:Message1>

<ns1:hw_request xmlns:ns1="namespace">

<hardware>

<name>ab</name>

<processor>intel</processor>

</hardware>

<hardware>

<name>ab</name>

<processor>AMD</processor>

</hardware>

</ns1:hw_request>

</ns0:Message1>

</ns0:Messages>

Should be generate TWO files which contains

single hardware nodes.

Problem: In this blog, he splits by a node value.

I would like to generate a new instance for every

occurence of a node.

I think this weblog would like to do the same:

/people/narendra.jain/blog/2005/12/30/various-multi-mappings-and-optimizing-their-implementation-in-integration-processes-bpm-in-xi

But I am not able to define a message name like

output[index] like he uses in integration process.

I can only select container elements and I am not

able to write them manuel. Also I can't see how his

condition for the loop is generated.

How to do this?

Thanks

chris

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Chris,

First are you able to get the 2 msgs in test tab of mapping?

You need to create a container element "index" of category simple and type integer to accomplish this.

In the loop condition, you need to specify "simple variable" and choose "index". Inside the loop, in send step choose the msg from container elements and by the side you can see index, choose "index" here.

Regards,

Jai Shankar

Former Member
0 Kudos

Hi,

@Jai Shankar

I can choose index in loop but he would like to

have a condition? What should I do there? index = 10

or something like this?

I need a multiline container that contains all

hardware nodes and walk through this with the

index. So do I have to take the multiline container

requestFile as condition??? Like this :

index = requestFile

thanks

chris

Former Member
0 Kudos

Christian,

In the weblog, the author has used a field in the source msg that contains the number of msgs. In your case, if you know the number during configuration time itself, then you can give easily, index <not equals> 10. Just give this condition for the loop.

With in the loop, in the send step, you need to specify <b>not</b> the multi line element. It is just a single line container element with a index. Choose the index as I said in the previous reply.

P.S: Create 2 container elements both pointing to same target msg. One is multi line and the other is single line. The response of the transformation should be a container element(multi line). The send step with in the loop is target msg(single line container).

Regards,

Jai Shankar.

Former Member
0 Kudos

Hi Christian,

we implemented the solution described in this blog you refer to as follows:

1. Create a Mapping for a new transform step

(1 target to 1 source e.g. IDOC, 1 Souce counter result)

2. Set number of result messages (e.g. IDOC) to 0...unbounded! (card file "Messages" in Mapping)

3. Create required mapping between source and target.

4. create an own Message-Typ for a "Counter"-Message with a single element which contains the result for the count process in mapping

5. Create for this MT an Mess.Interface abstrakt, asynchron

6. Add for this MT in Mapping from point 1 as second message

7. In mapping from source to count message we added a user defined function to count the number of generated target messages (first target mess. in mapping).

8. Enhance BPM:

- the Container for the first mess.(e.g.IDOC) in mapping is to be changed to multiline

- add a Container for the counter message

- container element to count how much target messages are sent out (IDOC) (Typ: SimpleType, Container:

Prozess) - Name it "Counter"

- Add a Containerstep (before IDOC send step). Here "Counter" has to be initialised (value = 0)

- Add a Loop-Step (including the IDOC-send step (IDOC = example)

- the Loop-Step has this condition:

Counter <> value from Element of count-message

- Container-Step in Loop before IDOC-Send-Step. In this step "counter" is "counter" + 1.

The index in the multiline IDOC container (our message example) is necessary because with this index the BPM is able to count the list of IDOCs in the multiline IDOC container, means to send at frist mess. with index = 1 , then with index = 2 etc.

Hope this helps!

regards

Dirk

Former Member
0 Kudos

@Jai

Problem: I would get 10 message everytime if I would do set the loop like this. But I want only so many messages like nodes..

@dirk

thanks for this description. Creating mappings and loop is already done. My problem is the message count in your step 7. How to do this, that you can use it as container variable???

Former Member
0 Kudos

Christian,

If you do not know the number of msgs at configuration time ie. the number of times the particular node is going to occur, then you need to have a field in the source msg which will contain the number.

If both of the above options are not possible, then you cant use the loop. Go for a "Block for each". This approach is very simple to configure. All you need to do..

1. The response of the transformation goes to a target(multi line container), this is the same with the current approach.

2. Remove the loop.

2. Insert a block step.

Properties>Mode>ForEach

Multi Line --> Multi line container element(target)

Current Line --> Single Line Container element (target)

3. Insert a send step with in the block.

properties>Msg>Single Line Container element (target)

Regards,

Jai Shankar.

Former Member
0 Kudos

hi,

the other options seem not to work an I don't know how to insert a field in the source msg which contains the number.

So I will try this you told me. It sounds more rational than the other ways.

I inserted a block and choose Mode-> ForEach (interessting, in german it's called dynamic sequenz).

I have insert two container types refering to the same Interface like you told me before. But I can't select anything in the current line field. The point Interface-Variable is not selectable....why?

Mutliline : requestFile (Multiline)

current line : not selectable (requestFile single line exist)

thanks

chris

Former Member
0 Kudos

I got it. You need to create the single line container element with in the block. To do this, click on the block and now in the containers list, you can see a line which shows containers within the block. You need to create a container element now(after selecting the block).

P.S You need to use this container, the one created with in the block in the send step.

Regards,

Jai Shankar.

Former Member
0 Kudos

Hi,

sometimes I don't understand XI. Why do I have to use a local container for this?!

Doesn't matter, looks good, but I have a finally problem in further transformation step. Input is message called requestInput this contains multiply hardware nodes. Just like the webblog (/people/narendra.jain/blog/2005/12/30/various-multi-mappings-and-optimizing-their-implementation-in-integration-processes-bpm-in-xi) I mapped it to requestFile (multiline) and it looks like the mapping test in the webblog.

Now what's the definition of multiline? When the mapping result looks like this:

message1

|-mt_hardware

|-name

message2

|-mt_hardware

|-name

or like this

message1

|-mt_hardware

|- name

|-mt_hardware

|- name

I think it is first one, but I can't do it with mapping. I tried it with SplitbyValue, but couldn't create a Message2 node

Former Member
0 Kudos

Chris,

message1

|-mt_hardware

|- name

|-mt_hardware

|- name

This is the expected structure. If you are getting this, then your mapping is ok.

>>definition of multiline?

Similar to usual container element except that it can hold multiple msgs insead of one msg.

Regards,

Jai Shankar.

Former Member
0 Kudos

Damm, then I don't understand the logic.

He creates this structure, but when I do a transformation step from requestInput to this multiline requestFile he told me, that the target don't have to be multiline. Why? If my mapping is really multiline, then it has to be correct, or?

Because of this I ask for the definition of Multiline, not how to define it

Any ideas?

Former Member
0 Kudos

Hi Chris,

You are mistaken. The output of the transformation contains multiple msgs(of same type). Hence the confusion for you. Dont complicate your self. All you are doing in the transformation is creating many which have the same structure.

Since your result of mapping contains multiple msgs, you need a multi line container to hold the result.

Hope I am clear and not confusing you more.

Regards,

Jai Shankar.

Former Member
0 Kudos

The confusion never stops

Once again:

I receive a message like this:

<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">

<ns0:Message1>

<ns1:hw_request xmlns:ns1="namespace">

<hardware>

<name>ab</name>

</hardware>

<hardware>

<name>xy</name>

</hardware>

</ns1:hw_request>

</ns0:Message1>

</ns0:Messages>

after mapping it looks like this:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">

<ns0:Message1>

<ns2:MT_Order_File_request xmlns:ns2="namespace">

<hardware>

<name>123</name>

</hardware>

</ns2:MT_Order_File_request>

<ns2:MT_Order_File_request xmlns:ns2="namespace">

<hardware>

<name>xy</name>

</hardware>

</ns2:MT_Order_File_request>

</ns0:Message1>

</ns0:Messages>

This is multiline? Isn't it?

in transformation step I take the mapping between those and the container for the target IS MULTILINE?

But he wants a non multiline container!!!

So where do I go wrong??

thanks

chris

Former Member
0 Kudos

Chris,

>>This is multiline? Isn't it?

Yes it is. You goit. Cheer up dude...

>>>in transformation step I take the mapping between those and the container for the target IS MULTILINE?

Yes. The response of the transformation must be a multi line element.

>>But he wants a non multiline container!!!

have'nt gone through the blog entirely. Will do it and get back. But be assured, the transformation response is a multi line container element.

Regards,

Jai Shankar.

Former Member
0 Kudos

Hi dude,

I got it.

You got confused coz. the author has used 2 msgs in the target(multi mapping) but each occur only once. See the occurance of target msgs in the blog...

Regards,

Jai Shankar.

Former Member
0 Kudos

Thanks for reading the blog, but that isn't why I'm confused. First I do it also with 2 messages in mapping. I maped hardware to the first and software node to the second message and it work.

But there, every node appeared only once. Now I will for every hardware node an own message and an own file create by file adapter.

Normally your help have to be correct. Split the source message into a multiline container and walk through it and send it line by line.

But he refuse to accept it

Former Member
0 Kudos

Chris,

I dint get it correctly. Do you want both hard ware and sftware nodes to repeat that many times in target(2 different msg structure).

If I am correct, then yes you need multi line container for both messages. Author has used single line coz. his node is going to occur only once and not many times as in your case.

In the blog see author's target msg type's occurance both "bpm_out_MT" and "bpm_out1_MT" occur only once.

Regards,

Jai Shankar.

Message was edited by: Jai Shankar

Former Member
0 Kudos

Good morning,

for testing I my focus is only on hardware node. Later for every hardware and software node should one file be generated.

I know in blog he uses every msg type only once, but my occurences are always 0..unbounded.

So what do I have to change, that the transformation step allows me to use a multiline target??

thanks

Former Member
0 Kudos

Hi Chris,

Me again. All you need to do is change the occurance of target msg to 1..unbounded.

Regards,

Jai Shankar

Former Member
0 Kudos

hi Jai,

I dont't know what happened this night. Perhaps little goblins repaired my BPM or whatever. The occurance had been set correctly before I think, but yesterday evening the BPM check failed (I wrote why) and this morning the check perform without error. It was late yesterday evening...don't know if I changed something special.

Nevertheless, with the mapping you told me, a SplitByValue and the occurence of 1...unbounded in

the tab message of the mapping it works. I get my

two messages as I want )))

Thank you very very very very very much for helping me. A lot of points for you

regards

chris

Former Member
0 Kudos

Chris,

Glad that I helped sove your problem....

Regards,

Jai Shankar.

Former Member
0 Kudos

Ok, not finish so far. Another problem exist.

He ALWAYS generate 2 output files. Doesn't matter

what kind of input I give. Once I gave an occurence

of 0..2 but I changed it to 0..unbouded everywhere.

And Mapping generate me correct 3 message if the input is

so and 4 msg if input is for and so on. So, mapping seems

ok, but couldn't found mistake why he alwasy generates

2 msgs.

Is it possible to see how many entries where made in the

container? I search in graphical view in sxmb_moni, but

couldn't found any informations.

thanks

chris

Message was edited by: Christian Riekenberg

Former Member
0 Kudos

Hi Christian,

goto SXMB_MONI_BPM. In the protocoll go to the "mapping". Doubleclick: YOu will get a dialog where you see how many messages have been created.

Regards Mario

Former Member
0 Kudos

Hi,

thanks for answering, but you mean SXMB_MONI_BPE, right?

After doubleclicking on mapping, I can't see a number of created entries in a container. In the workflow log, I can only see, that the file adapter is called twice.

any further ideas?

thanks

chris

Former Member
0 Kudos

Hi Chris,

Ref weblog: /people/michal.krawczyk2/blog/2005/09/16/xi-how-to-test-your-mapping-in-real-life-scenarios by Michal.

P.S: If you have further querries, post them in a new thread. Most will not have patience to read all the replies(more than 25 now).

Regards,

JaiShankar.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Christian,

the issue with the <index>.

This is only working for multiline containers.

Modify your container to multiline and the field for index is ready for input when adding this container to the container step.

Regards

Dirk

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

><i>I would like to generate a new instance for every

occurence of a node.</i>

Use node function SPLIT BY VALUE.

This link has the descrption of the same,

http://help.sap.com/saphelp_nw04/helpdata/en/21/3bb8c495125e4eb5969f0377885fe0/content.htm

Also, it is possible to create N messages without BPM. Check this blog for this,

/people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible

Regards,

Bhavesh

Former Member
0 Kudos

hi,

@Bhavesh

thanks for response. But I need BPM because

of Alerting.

I just read the SplitByValu docu, but can't direct

understand how to use. But I think this could help.

@other

I will try to test with the index.

regards

chris

Message was edited by: Christian Riekenberg

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

For more info on Splitby value, this blog by Sravya should really help,

/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii

Regards,

Bhavesh