cancel
Showing results for 
Search instead for 
Did you mean: 

Function library in PI 7.1 - retrieval of filename

Former Member
0 Kudos

Hi,

I am trying to use the function library functionality in PI 7.1 but struggling a bit.

Basically, I want a function for the retrieval of the filename - pretty easy in goold old UDF days but not so easy now everything has moved to the function library world in PI 7.1

I have defined the following code in the "init" Function and Java Areas:

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

//For getting filename

DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

//For getting directory

DynamicConfigurationKey key2 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");

// Retrieve the filename

String FileName = conf.get(key1);

// Retrieve the directory

String Directory = conf.get(key2);

This is working ok - but I want to return these values so they can be used in mapping.

when I try to add the statement return FileName; , the compiler then complains with the following error:

cannot return a value from method whose result type is void return FileName;

But where do you define the result type for a method ????? I guess it has something to do with the signature variables but I am a bit lost.

Any help greatly appreciated.

Thanks

Colin.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

Function type Void is not going to return value. It has be String type to return value. Check the function again

Also this documents provides good info on mapping in PI 7.1

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f06d11f2-e7c2-2a10-04a9-f2f6f374...

Thanks

Gaurav

Former Member
0 Kudos

Hi !

Just an idea...store the filename and directory name values in a global container (of the whole mapping program) and then create another UDF whose main purpose is read that global container and return its value.

Regards,

Matias.