Skip to Content
0

PI Java - Access Adapter Additional Parameters into UDF

Jan 18, 2017 at 04:14 PM

74

avatar image
Former Member

I have an UDF to do somethings and it has some hardcode values (variables) and we need to avoid the hardcoding.

I tryed configuring the hardcoded values as Additional Parameters into:

Communication Channel -> Parameters -> Advanced -> Advanced Mode -> Additional Parameters

But I don't know how to access them on the UDF. I tryed with the code bellow, but I get a null value:

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

DynamicConfigurationKey keyTest = DynamicConfigurationKey.create( "http:/"+"/sap.com/xi/XI/System/File","<ADDITIONAL PARAMETER NAME>");

String testString = confTest.get(keyTest);

int testInt = testString.length();

Does anyone know how to access them from UDF code?

Best Regards,

Gregory Mayorga.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Manoj K Jan 18, 2017 at 04:53 PM
0

Gregory,

If you want to re-use the same UDF for multiple parameters and namespace check this.

https://blogs.sap.com/2016/09/11/reuse-functionlibrary-for-dynamicconfiguration-and-message-header-attributes/

Br,

Manoj

Share
10 |10000 characters needed characters left characters exceeded
Evgeniy Kolmakov Jan 18, 2017 at 06:34 PM
0

Hi Gregory!

It's worth noting, that additional parameters for file adapter are described in SAP Note 801926. You can't use your own custom parameters.

In addition to Manoj's answer: in order to make your UDF's more reusable you should use function arguments and parameters instead of hard-coded values. Further you can assign values to it using payload values or message/operation mapping parameters.

Regards, Evgeniy.

Share
10 |10000 characters needed characters left characters exceeded
tarika manchanda Aug 11, 2017 at 10:23 AM
0

Hi Gregory!

Have you got any answer to your question?

I have a similar requirement of reading deltasync.maxDateFromLastRun in the lookup udf. This parameter is defined under additional parameters in SFSF channel.

Share
10 |10000 characters needed characters left characters exceeded