cancel
Showing results for 
Search instead for 
Did you mean: 

DynamicConfiguration throws NullPointerException

nicola_martella2
Participant
0 Kudos

Hi guys.

I'm developing a UDF in PI 7.10 and I'm trying to use the DynamicConfiguration object.

Just for start, I copyed&pasted the example in SAP Library: [http://help.sap.com/saphelp_nwpi711/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm]

Unfortunately it fails on this statement

String valueOld = conf.get(key);

with

Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._MM_DataA_to_DataB_ method writeDC[Constant, com.sap.aii.mappingtool.tf7.rt.Context@1ed0bdac] com.sap.aii.utilxi.misc.api.BaseRuntimeException: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._MM_DataA_to_DataB_ method writeDC[Constant, com.sap.aii.mappingtool.tf7.rt.Context@1ed0bdac]

Seems that the statement

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

has not gived a DynamicConfiguration instance but this is null.

I already checked that XI ADAPTER FRAMEWORK 7.10 is present on my PI.

Some idea?

Thanks so much.

Nicola

Accepted Solutions (0)

Answers (4)

Answers (4)

nicola_martella2
Participant
0 Kudos

No, it's not a test. Has to work in this way in the real world.

The scenario is composed by two mappings in cascade in an Operation Mapping.

The first mapping summarizes the quantities on each row from the XML in inbound and, for each sum, writes the result in a shared area (I thought to use the DynamicConfiguration for this).

The second mapping reads the last write from the shared area and does something.

Is there a standard way to share values between mappings?

Ciao. Nicola

Former Member
0 Kudos

>>Is there a standard way to share values between mappings?

As far as i know,there is no standard way to share values between different mappings.

You can share values between different UDF's within the same mapping but not across different mapping.

/people/sap.user72/blog/2005/10/01/xi-new-features-in-sp14

A work around can be to write the values which you want to pass at the database level.you can use ABAP mapping to store the values into some custom table on XI system,then in second mapping,you can look at this custom table to use the values.

Thanks

Aamir

nicola_martella2
Participant
0 Kudos

Aamir, I thank you very much for your availability.

Basing of your explanation, I believe to have misunderstood the use of DynamicConfiguration object.

I need to share custom values between two mappings in cascade in an Operation Mapping.

Is there something standard to use?

Ciao. Nicola

Former Member
0 Kudos

Hey

If you just want to test your Operation mapping,you can assign any Constant value.

But the real test of UDF is when you send the actual data from sender system,since the dynamic configuration values are only filled at runtime.

Thanks

Aamir

nicola_martella2
Participant
0 Kudos

Hi Aamir.

Actually, I'm trying it via Test tab.

If the limitation is that I have to use DynamicConfiguration just in a end to end scenario and I cannot test it in Int Build, well, I prefer to develop a RFC that write/read in a Z table.

It's orrible but it's more flexible.

What's your opinion about?

Ciao. Nicola

Former Member
0 Kudos

>>Actually, I'm trying it via Test tab.

Its a very common error which we all make:)

Dynamic configuration variable are initialized at runtime,when you configure your sender communication channel,you need to enable "Adapter specific message attributes" and also enable the properties under it,like Filename,Directory,File Type etc(whatever you need in your UDF).

Once the UDF and the "adapter specific message attributes" are set properly,you need to send message from the actual sender system,then only these parameters will be initialized and will be used in UDF.

In PI 7.1,i think there is an Option in "Interface mapping" to initialize dynamic configuration parameters,try to set values in "Interface mapping" and then test under test tab in "Interface mapping".

You can try by testing your UDF in Interface mapping->Test tab but the real test will be only when you send the message from actual sender system.

Thanks

Aamir

Shabarish_Nair
Active Contributor
0 Kudos

you can always add a try catch to handle such and error when you test via test instance of the mapping.

note that dynamic conf parameters are initialized only during runtime.

ref: /people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name

Former Member
0 Kudos

Just want to make sure how you are tesing the mapping.

if you are testing under test tab in message mapping,it wont work since Dynamic configuration UDF's work at runtime.you need to run the end to end scenario and then see if you still get the error.

Thanks

Aamir