cancel
Showing results for 
Search instead for 
Did you mean: 

Export Parameters in Parameterized Message Mapping does not work.

Former Member
0 Kudos

Hello, XI-Gurus!

I have a question: how to use an EXPORT parameter in Parameterized Message Mapping? seems it does not work...

(I use XI / PI 7.1)

For example, I have a follow scenario: a large message comes to XI from one BS (message contains a lot of rows), then this large message splits to some small messages (something about 1000 rows in one small message), and send small messaeg one by one from XI to second BS. So, after receive step I use a transformation step with Parameterized Message Mapping to get a total amount of rows in large message (it needs for making condition for loop in IP, for example). I want to use an EXPORT parameter to pass this number from Parameterized Message Mapping to Integration Process. How can I do it?

Of course, I know the way to how to make this scenario without any parameterizing, but I want to use exactly "Parameterized Message Mapping" like it writes in this help:

http://help.sap.com/saphelp_nwpi71/helpdata/en/43/c3e1fa6c31599ee10000000a1553f6/frameset.htm

This topic contains something about procedure how to use an EXPORT parameter, but this procedure does not work. I don't understand how to write this UserDefined Function, which I can set any export parameters.

I read this blog:

/people/jin.shin/blog/2008/02/14/sap-pi-71-mapping-enhancements-series-parameterized-message-mappings

this blog has NO solutions about EXPORT parameters. about IMPORT parameters - everything OK.

Some topics about how to use export parameters in MM in this forum marked as "answered", but this is not true.

WBR,

Vsevolod

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Vsevolod,

as mentioned in help.sap.com first of all you have to define export params in your mapping. You can not transfer export params from UDF directly.

The steps are as follows:

1. Create export parameter in mapping signature.

2. Initialize export parameter in UDF.

3. Link the message mapping parameter to operation mapping parameter.

4. Use operation mapping from p.3 in transformation step within IP. In "Properties" you should see now all your import as well as export parameters.

5. Now by using "Configurable parameters" of your IP you can transport export parameters within IP from one step to another.

BR

Rudolf

Former Member
0 Kudos

Hi Rudolf,

thanks for you answer.

Could you explain your step #2 more clearly for me? How can I initialise an export parameter in UDF? Can you write an example of code of this UDF?

All other steps like binding in Operation Mapping and Int.Process is very simple.

I don't know how to set a value for my export parameter in UDF.

WBR,

Vsevolod

Former Member
0 Kudos

Hi Vsevolod,

the method called by the PI mapping runtime is public void transform (TransformationInput in, TransformationOutput out). The class com.sap.aii.mapping.api.TransformationOutput has as method getOutputParameters(). The derived com.sap.aii.mapping.api.OutputParameters class provides setString() / Value / Int methods.

Means: suppose you define export parameters in your mapping signature called "FILE_TYPE", "FILE_NAME" and get from your business data from payload filetype "PDF" and "Order" as filename.

Init it in UDF by calling getOutputParameters.setString. :

public String testUDF (String var1, Container container) throws StreamTransformationException{

getOutputParameters.setString("FILE_NAME" , "Order");

getOutputParameters.setString("FILE_TYPE" , "PDF");

return "";

}

To get deeper inside have a look at SAP Mapping API com.sap.aii.mapping.api.

Regards

Rudolf

Former Member
0 Kudos

Hi Rudolf,

It still does not works.

Great thanks for all your answers! If your advice works on your PI-server, it means that my problem not in UDF.

Step by step:

1) I create in "Signature" tab two parameters: FILE_NAME, FILE_TYPE (of course, they both Export and xsd:string type)

2) Then, I goes to "Functions" tab and create new function "testUDF" with one argument var1.

3) In body of this UDF insert 2 strings:

getOutputParameters.setString("FILE_NAME" , "Order");

getOutputParameters.setString("FILE_TYPE" , "PDF");

4) in "Definition" tab I bind function "Local.testUDF" with one field in my input message and goes to "Test" tab for testing.

5) And then I have a message window "Problems While Testing":

-


Source text of object Message Mapping: mm_ParamMap | urn:****.*.:****:TEST has syntax errors:

  • Function testUDF, Line 1:

cannot find symbol

symbol : variable getOutputParameters

location: class com.sap.xi.tf._mm_ParamMap_

getOutputParameters.setString("FILE_NAME" , "Order");

^

  • Function testUDF, Line 2:

cannot find symbol

symbol : variable getOutputParameters

location: class com.sap.xi.tf._mm_ParamMap_

getOutputParameters.setString("FILE_TYPE" , "PDF");

^

Note: /usr/sap/PID/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapb1562570ca9e11deb3fe00237d301cd6/source/com/sap/xi/tf/_mm_ParamMap_.java uses or overrides a deprecated API.

Note: Recompile with -Xlint:deprecation for details. Note: /usr/sap/PID/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapb1562570ca9e11deb3fe00237d301cd6/source/com/sap/xi/tf/_mm_ParamMap_.java uses unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

2 errors

-


Look at this notes, first writes that I use a deprecated API, second - about unchecked or unsafe operations.

And I have no idea what's wrong... Can you help me?

Thanks!

WBR,

Vsevolod

Former Member
0 Kudos

Hi Vsevolod,

sorry for delays. Try the same steps as described above but init export params in the same UDF on the following way ():

...

GlobalContainer gc = container.getGlobalContainer();

OutputParameters out = gc.getOutputParameters();

out.getOutputParameters.setString("FILE_NAME" , "Order");

out.getOutputParameters.setString("FILE_TYPE" , "PDF");

....

BR

Rudolf

Former Member
0 Kudos

Rudolf,

Your solution doesn't work. see below

OutputParameters out = gc.getOutputParameters();

out.getOutputParameters.setString("FILE_NAME" , "Order");

The out.getOutputParameters.setString("FILE_NAME" , "Order"); ends up in an error. You need to define this as follows

out.setString("FILE_NAME" , "Order");

the getOutputParameters is already defined in the preseeding declaration

Greets