cancel
Showing results for 
Search instead for 
Did you mean: 

Access StreamTransformation values in Java initialisation section

Former Member
0 Kudos

Hi,

I'd like to access the StreamTransformation parameter SENDER_PARTY in the Java initialisation section of my message mapping. Does anyone know how I can do this?

Regards,

Pete

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor

Hi Peter,

In the initialisation section you can use:

party = (String) getParameters().get(StreamTransformationConstants.SENDER_PARTY);

In a user defined function it works as well with:

party = (String) container.getTransformationParameters().get(StreamTransformationConstants.SENDER_PARTY);

Regards

Stefan

stefan_grube
Active Contributor
0 Kudos

Maybe I should explain this:

The mapping program is a class derived from the interface GlobalContainer. So you can use the methods of GlobalContainer all the time during the mapping program.

http://help.sap.com/saphelp_nw04/helpdata/en/e0/7d8e40496f6f1de10000000a1550b0/frameset.htm

You can test this by a user defined function:

return container.getGlobalContainer().getClass().toString();

You will see the name of generated message program as the output of the function.

Compare it with this function:

return getClass().toString();

Regards

Stefan

Former Member
0 Kudos

Thanks Stefan, I have implemented this and it works a treat...

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Peter,

AFAIK, We cannot access StreamTransformation values in Java Initialisation section of Graphical mapping.

Instead you can try this work around:

1. Declare a global variable in Java Section.

2. Write a UDF at Parent node to set the Dynamica value from Container to global variable.

3. At node level write a UDF to read value from global variable.

This technique will store the Dynamic value once in global variable and can be read many times in another UDF at node level.

Design:

Header -


| SetDynamicValueUDF |----> Target header

Item Item [0- Unbounded]

Regards,

Ananth

Former Member
0 Kudos

Hi,

String senderParty;

map = container.getTransformationParameters();

senderParty = (String) map.get("SenderParty");

Regards,

Smitha.

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

String headerField;
java.util.Map map;

// get runtime constant map

map = container.getTransformationParameters();

// get value of header field by using variable key

headerField = (String) map.get(SenderParty);

From,,

http://help.sap.com/saphelp_nw04/helpdata/en/b3/9a2aeb24dc4ab6b1855c99157529e4/content.htm

Regards,

Bhavesh