cancel
Showing results for 
Search instead for 
Did you mean: 

Scenario Merge two files using BPM

david_ramos2
Explorer
0 Kudos

Hi.

I have a scenario that try to merge two files.

We have implemented a BPM with a fork to receives both files, after that there is a transformation step to perform 2:1 mapping.

First source file:

DT_Fichero1

name

place

ID

Example:

If I test the MM without this tags the MM not run correctly and I think that this is my problem.

Somebody knows how cant I solve it???

King Regards

David Ramos

Accepted Solutions (0)

Answers (13)

Answers (13)

david_ramos2
Explorer
0 Kudos

Hi.

I found a example that SAP provides, it belongs to SW Component

SAP BASIS 6.40.

In the namespace http://sap.com/xi/XI/System/Patterns

Using BPM BpmPatternCollectMultiIf the interface receives 3 files and generates a new one.

This interface uses as input some DT: BpmPatternCollectToBeCollected

If I test this scenario with 3 files with this header

<ns1:BpmPatternCollectMessageToBeCollected xmlns:ns1="http://sap.com/xi/XI/System/Patterns">

the tarjet file is generated correctly

The problem is that my files do not have this header, the structure of my files takes an External Definition.

I tried changing the interface to receive ED instead of MT and it does not work, someone knows it is due?

Kinds Regards

David Ramos

david_ramos2
Explorer
0 Kudos

Hi Lian.

The problem was in the last Mapping.

If I display the container instance of this mapping

I have 2 entry like MESSAGE_IN and one MESAGE_OUT.

If I try to see the MESSAGE_OUT-->Nested Table --> MESSAGES it´s appears 2 message:

The first one with the mapping corresponding to FILE 1 --> FILE_FINAL with status Successfully

The second one with the mappin correponding to FILE 2 --> FILE_FINAL but this message is in status "Trasnfer to Process Engine".

When th tarjet File is created only contains information about the first File.

Example:

File 1

Former Member
0 Kudos

As I said before, your second message does not get into BPM instance, probabaly you do not have correlation defined properly, you should try that first to see what happens.

If there is mapping problem, you can double click on the mapping step in graphic work flow, and select "available object" to get the mapping trace.

Regards.

Liang

david_ramos2
Explorer
0 Kudos

This is a example:

Source examples:

<Agencias>

<agencia>

<codigo_agencia>COD1</codigo_agencia>

<nombre_agencia>NOM1</nombre_agencia>

</agencia>

</Agencias>

<Agencias2>

<agencia2>

<codigo_agencia2>COD_agencia2</codigo_agencia2>

<nombre_agencia2>NOM_agencia2</nombre_agencia2>

</agencia2>

</Agencias2>

The resulting file:

<Agencias>

<agencia>

<correlacion>1</correlacion>

<codigo_agencia>COD1</codigo_agencia>

<nombre_agencia>NOM1</nombre_agencia>

</agencia>

</Agencias>

The resulting file desired:

<Agencias>

<agencia>

<codigo_agencia>COD1</codigo_agencia>

<nombre_agencia>NOM1</nombre_agencia>

</agencia>

<agencia>

<codigo_agencia>COD_agencia2</codigo_agencia>

<nombre_agencia>NOM_agencia2</nombre_agencia>

</agencia>

</Agencias>

Former Member
0 Kudos

Hi, David:

Your problem might be caused by correlation.

Since you have added two transformation message, your file1 and file2 are not orignal message anymore.

What you could try is define a block which is after your two newly added transformation step.

Define another correlation, this can be local correlation for that block.

You can have similar fork inside your block, then followed by your last tranformation.

Regards.

Liang

david_ramos2
Explorer
0 Kudos

Hi.

In my first message I show a example of my scenario, but really I have this definitions:

Fich1(ED)

Agencias

agencia

cod_agencia

num_agencia

agencia

Agencias

Fich2(ED)

Agencias2

agencia2

cod_agencia2

num_agencia2

agencia2

Agencias2

FichFinal

Agencias

agencia

cod_agencia

num_agencia

agencia

Agencias

My BPM:

IP_Prueba_fusion(Begin of BPM)

Beginning of Fork

Receive File1

Receive File2

End of Fork

Mapping(using XSL-> File1)

Mapping(using XSL-> File2)

Mapping(Multimapping)

Send Message

I make 2 transformations using XSL before the last transformation(Multimmaping)

In this transformation I have the next mapping

SOURCE MESSAGES -


TARJET MESSAGES

Agencias -


>Agencias

agencia -


>agencia

cod_agencia -


>cod_agencia

num_agencia -


>num_agencia

agencia agencia

Agencias Agencias

(*)

Agencias2 -


>Agencias

agencia2 -


>agencia

cod_agencia2 -


>cod_agencia

num_agencia2 -


>num_agencia

agencia2 agencia

Agencias2 Agencias

(*) In the tarjet message I duplicate subtree of node Agencias to make the correspondence between the second file to the tarjet message.

When I test this scenario. The adapters take both files and transform its using XSL transformation and when it try to make the last mapping(multimapping) only generate the nodes corresponding to the first file.

david_ramos2
Explorer
0 Kudos

Hi.

In my first message I show a example of my scenario, but really I have this definitions:

Fich1(ED)

Agencias

agencia

cod_agencia

num_agencia

agencia

Agencias

Fich2(ED)

Agencias2

agencia2

cod_agencia2

num_agencia2

agencia2

Agencias2

FichFinal

Agencias

agencia

cod_agencia

num_agencia

agencia

Agencias

My BPM:

IP_Prueba_fusion(Begin of BPM)

Beginning of Fork

Receive File1

Receive File2

End of Fork

Mapping(using XSL-> File1)

Mapping(using XSL-> File2)

Mapping(Multimapping)

Send Message

I make 2 transformations using XSL before the last transformation(Multimmaping)

In this transformation I have the next mapping

SOURCE MESSAGES TARJET MESSAGES

Agencias -


>Agencias

agencia -


>agencia

cod_agencia -


>cod_agencia

num_agencia -


>num_agencia

agencia agencia

Agencias Agencias

(*)

Agencias2 -


>Agencias

agencia2 -


>agencia

cod_agencia2 -


>cod_agencia

num_agencia2 -


>num_agencia

agencia2 agencia

Agencias2 Agencias

(*) In the tarjet message I duplicate subtree of node Agencias to make the correspondence between the second file to the tarjet message.

When I test this scenario. The adapters take both files and transform its using XSL transformation and when it try to make the last mapping(multimapping) only generate the nodes corresponding to the first file.

Source examples:

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

<Agencias>

<agencia>

<codigo_agencia>COD1</codigo_agencia>

<nombre_agencia>NOM1</nombre_agencia>

</agencia>

</Agencias>

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

<Agencias2>

<agencia2>

<codigo_agencia2>COD_agencia2</codigo_agencia2>

<nombre_agencia2>NOM_agencia2</nombre_agencia2>

</agencia2>

</Agencias2>

The resulting file:

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

<Agencias>

<agencia>

<correlacion>1</correlacion>

<codigo_agencia>COD1</codigo_agencia>

<nombre_agencia>NOM1</nombre_agencia>

</agencia>

</Agencias>

The resulting file desired:

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

<Agencias>

<agencia>

<codigo_agencia>COD1</codigo_agencia>

<nombre_agencia>NOM1</nombre_agencia>

</agencia>

<agencia>

<codigo_agencia>COD_agencia2</codigo_agencia>

<nombre_agencia>NOM_agencia2</nombre_agencia>

</agencia>

</Agencias>

david_ramos2
Explorer
0 Kudos

Hi.

In my first message I show a example of my scenario, but really I have this definitions:

Fich1(ED)

Agencias

agencia

cod_agencia

num_agencia

agencia

Agencias

Fich2(ED)

Agencias2

agencia2

cod_agencia2

num_agencia2

agencia2

Agencias2

FichFinal

Agencias

agencia

cod_agencia

num_agencia

agencia

Agencias

My BPM:

IP_Prueba_fusion(Begin of BPM)

Beginning of Fork

Receive File1

Receive File2

End of Fork

Mapping(using XSL-> File1)

Mapping(using XSL-> File2)

Mapping(Multimapping)

Send Message

I make 2 transformations using XSL before the last transformation(Multimmaping)

In this transformation I have the next mapping

SOURCE MESSAGES TARJET MESSAGES

Agencias -


>Agencias

agencia -


>agencia

cod_agencia -


>cod_agencia

num_agencia -


>num_agencia

agencia agencia

Agencias Agencias

(*)

Agencias2 -


>Agencias

agencia2 -


>agencia

cod_agencia2 -


>cod_agencia

num_agencia2 -


>num_agencia

agencia2 agencia

Agencias2 Agencias

(*) In the tarjet message I duplicate subtree of node Agencias to make the correspondence between the second file to the tarjet message.

When I test this scenario. The adapters take both files and transform its using XSL transformation and when it try to make the last mapping(multimapping) only generate the nodes corresponding to the first file.

Source examples:

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

<Agencias>

<agencia>

<codigo_agencia>COD1</codigo_agencia>

<nombre_agencia>NOM1</nombre_agencia>

</agencia>

</Agencias>

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

<Agencias2>

<agencia2>

<codigo_agencia2>COD_agencia2</codigo_agencia2>

<nombre_agencia2>NOM_agencia2</nombre_agencia2>

</agencia2>

</Agencias2>

The resulting file:

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

<Agencias>

<agencia>

<correlacion>1</correlacion>

<codigo_agencia>COD1</codigo_agencia>

<nombre_agencia>NOM1</nombre_agencia>

</agencia>

</Agencias>

The resulting file desired:

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

<Agencias>

<agencia>

<codigo_agencia>COD1</codigo_agencia>

<nombre_agencia>NOM1</nombre_agencia>

</agencia>

<agencia>

<codigo_agencia>COD_agencia2</codigo_agencia>

<nombre_agencia>NOM_agencia2</nombre_agencia>

</agencia>

</Agencias>

I hope the problem gets clearer

david_ramos2
Explorer
0 Kudos

Hi.

In my first message I show a example of my scenario, but really I have this definitions:

Fich1(ED)

Agencias

agencia

cod_agencia

num_agencia

agencia

Agencias

Fich2(ED)

Agencias2

agencia2

cod_agencia2

num_agencia2

agencia2

Agencias2

FichFinal

Agencias

agencia

cod_agencia

num_agencia

agencia

Agencias

My BPM:

IP_Prueba_fusion(Begin of BPM)

Beginning of Fork

Receive File1

Receive File2

End of Fork

Mapping(using XSL-> File1)

Mapping(using XSL-> File2)

Mapping(Multimapping)

Send Message

I make 2 transformations using XSL before the last transformation(Multimmaping)

In this transformation I have the next mapping

SOURCE MESSAGES TARJET MESSAGES

Agencias -


>Agencias

agencia -


>agencia

cod_agencia -


>cod_agencia

num_agencia -


>num_agencia

agencia agencia

Agencias Agencias

(*)

Agencias2 -


>Agencias

agencia2 -


>agencia

cod_agencia2 -


>cod_agencia

num_agencia2 -


>num_agencia

agencia2 agencia

Agencias2 Agencias

(*) In the tarjet message I duplicate subtree of node Agencias to make the correspondence between the second file to the tarjet message.

When I test this scenario. The adapters take both files and transform its using XSL transformation and when it try to make the last mapping(multimapping) only generate the nodes corresponding to the first file.

Source examples:

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

<Agencias>

<agencia>

<codigo_agencia>COD1</codigo_agencia>

<nombre_agencia>NOM1</nombre_agencia>

</agencia>

</Agencias>

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

<Agencias2>

<agencia2>

<codigo_agencia2>COD_agencia2</codigo_agencia2>

<nombre_agencia2>NOM_agencia2</nombre_agencia2>

</agencia2>

</Agencias2>

The resulting file:

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

<Agencias>

<agencia>

<correlacion>1</correlacion>

<codigo_agencia>COD1</codigo_agencia>

<nombre_agencia>NOM1</nombre_agencia>

</agencia>

</Agencias>

The resulting file desired:

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

<Agencias>

<agencia>

<codigo_agencia>COD1</codigo_agencia>

<nombre_agencia>NOM1</nombre_agencia>

</agencia>

<agencia>

<codigo_agencia>COD_agencia2</codigo_agencia>

<nombre_agencia>NOM_agencia2</nombre_agencia>

</agencia>

</Agencias>

I hope you will understand better my problem

Thank you

David Ramos

david_ramos2
Explorer
0 Kudos

Hi Liang.

Thank you for your reply.

Now I have re-configured my BPM.

This is it workfolw log:

IP_Prueba_fusion(Begin of BPM)

Beginning of Fork

Receive File1

Receive File2

End of Fork

Mapping(using XSL-> File1)

Mapping(using XSL-> File2)

Mapping(Multimapping)

Send Message

If I try to show the container of third Mapping, I have:

MESSAGES_IN <2 Entries>

MESSAGE_OUT <1 Entry>

When I try to see this entry(MESSAGES_OUT-->Nested Table --> MESSAGES) it's appears 2 Messages:

the first, who contains the transformation of first file, and whose status is Processed Successfully

The second message, who contains the transformation of second file, but with the status Transfer To Process Engine

Finally the message generated only contains information about the first message.

Someone know why?

former_member200962
Active Contributor
0 Kudos
Now I have re-configured my BPM.

I dont think there was a need to re-design your BPM...

You can take help from the below link which mentions how to get messages using a Fork step and then bundle them into one message:

http://help.sap.com/saphelp_nwpi71/helpdata/en/0e/56373f7853494fe10000000a114084/frameset.htm

But in this source appears some tags that it´s not present in the example, like:
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
<ns0:Message1> </ns0:Message1>
<ns0:Message2> </ns0:Message2>

This behaviour is as expected.....and nothing wrong in it....when you do a N:1 (or vice-versa) mapping.....

Finally the message generated only contains information about the first message

this means that only one message is included in the mapping program or the data from other message is not being passed to the N:1 mapping....once again check the steps...

Also are you sure that the output of both the XSLT mapping programs are perfect? and that they are properly used as Inputs to the N:1 mapping?

Regards,

Abhishek.

david_ramos2
Explorer
0 Kudos

Hi.

Lianj, I have make the test that you say and the BPM take the files correctly but when try to make the transformation, the message OUT is empty.

If I access to the Workflow Log I can see this step:

IP_Prueba_fusion(Begin of BPM)

Beginning of Fork

Receive File1

Receive File2

End of Fork

Mapping

Send Message

If I try to show the container of Mapping, I have:

MESSAGES_IN <2 Entries>
MESSAGE_OUT <1 Entry>

When I try to see this entry(Nested Table --> MESSAGES) its empty because the transformation work wrong.

Alexis I followed the guide that you indicate but in the transformation step the BPM crash.

I don´t understand why the transformation dont work correctly

Former Member
0 Kudos

This probably caused by namespace issue.

Try following:

1. Copy the following code to text editor, save it to *.xsl file, give a name.

2. zip it

3. Import into IR

4. Modify Interface mapping, add this mapping program before your original message mapping

5.Re-try your scenario.

Regards.

Liang


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="rrn:org.xcbl:schemas/xcbl/v3_5/xcbl35.xsd"
version="1.0">

<xsl:output method="xml"/>

<xsl:template match="/">
<xsl:apply-templates select="*" mode="foo"/>
</xsl:template>

<xsl:template match="*" mode="foo">
<xsl:variable name="newname" select="local-name(.)"/>
<xsl:element name="{$newname}">
<xsl:apply-templates mode="copyall" select="@*|comment()|processing-instruction()|text()"/>
<xsl:apply-templates select="*" mode="foo"/>
</xsl:element>
</xsl:template>

<xsl:template mode="copyall" match="@*|comment()|processing-instruction()|text()">
<xsl:copy>
<xsl:apply-templates mode="copyall" select="@*|comment()|processing-instruction()|text()"/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>

Former Member
0 Kudos

Hi victoria,

Those tags are ok, there's created due to the use of multi mapping (changing the occurence of the message from 1 to 1.unbounded)

please follow this guide, this should help you:

search for "XI - BPM Scenario using Fork and correlation" in google

Is exactly your case, i used that one for an backwards example (1to2) scenario too and it works perfectly

Edited by: Alexis Alanis on Jun 4, 2009 3:44 PM

Former Member
0 Kudos

Hi David,

Please delete Victoria's SAP Passport certificate on your client machine...

Thanks,

Julius

Former Member
0 Kudos

Hi, Victoria:

Could you please take following steps to test your scenario and let me know:

1. Creat Dummy mapping program

2. In source meessage of dummy program, select your source message 1

3. Go to tes tab, give payload values

4. Change to source view, copy the xml to file1.xml

You do the same, you will get file2.xml, then you can close dummy mapping without saving it.

In Your RWB, Compoment Monitoring -> Integration Engine -> Test Message.

Fill in mandatory fields and copy the payload of file1.xml then send it.

Do the same thing to send file2.xml

Check your scenario to see if it works.

Also make sure, you have correlation defined.

Your receive step active the correlation.

Regards

Liang

Former Member
0 Kudos

Hi,

it's normal that you have to add these tags manually for testing.

But they are existing at runtime and so I guess your problem is somewhere else.

You could compare your scenario with the example pattern for collecting messages (you could find the scenario in the SAP BASIS SC):

http://help.sap.com/saphelp_nw04/helpdata/en/0e/56373f7853494fe10000000a114084/frameset.htm

Regards

Patrick

Edited by: Patrick Koehnen on Jun 4, 2009 5:01 PM