Skip to Content
0

UDF to pickup source file name and pass via mapping to destination file

Dec 22, 2016 at 12:23 PM

241

avatar image

Hi Guys

I've not written a UDF since my training and am slightly unsure how I would go about passing the source file name (which contains a date / time that will determine processing order in proxy).

I've found a few guides for this, but they all seem to require a input as part of the UDF, surely it wouldn't haven an input and the udf would be the source for the field itself?

Attached is my attempt but as you can see, it has an input, would I map the status field to the UDF to the destination status field?

capture.png (30.1 kB)
capture2.png (38.4 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Andrzej Filusz Dec 22, 2016 at 12:34 PM
0

Hi George,

1. Map Status tag to your UDF:

[Status] --> [Filename] --> [Status]

2. Correct your UDF source - remove these two lines:

String filename = "";

(...)

filename = conf1.get(key1);

Best regards,

Andrzej Filusz

Share
10 |10000 characters needed characters left characters exceeded
George Applegate Jan 09, 2017 at 11:35 AM
0

Hi

I'm a bit unsure about this still, I've corrected the UDF but it doesn't seem to work. I don't think I should be specifying the status field in the source dt as the field doesn't / wont exist -when I've tried to set it up with the status IN the source & destination dt's and put status field in my fcc, it just shifts the data up a element and the date isn't parsed.

Should i specify the status field in source & dest DT? If so how do i get FCC to ignore the first field (status)?

Thanks

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi George,

Could you add a new tag to your source DT, just below EmployeePaySourceFile?

For example:

FileName 1..1 xsd:string

Map this field like below:

FileName --> your UDF --> EmployeePayDestinationFile

Best regards,

Andrzej Filusz

0
Sateesh Kumar Putta Jan 10, 2017 at 12:45 PM
0

Hi,

if you don't want to pass any input value then remove the input parameter in UDF.

Regards,

Sateesh.

Share
10 |10000 characters needed characters left characters exceeded
George Applegate Jan 11, 2017 at 10:56 AM
0

Hi

I've setup the FileName below

EmployeePaySourceFile

I've mapped it to the UDF and get the error

'

Cannot create target element /ns1:WppPayFile_MT/FileName. Values missing in queue context. Target XSD requires a value for this element, but the target-field mapping does not create one. Check whether the XML instance is valid for the source XSD, and whether the target-field mapping fulfils the requirement of the target XSD,

'

I don't know how to test in mapping testing because I don't know how to simulate the filename being picked up in test mapping, i've obviously tried filling it in the test tab but get the error:

'

Runtime exception when processing target-field mapping /ns1:WppPayFile_MT/FileName; root message: Exception:[java.lang.NullPointerException: while trying to invoke the method com.sap.aii.mapping.api.DynamicConfiguration.put(com.sap.aii.mapping.api.DynamicConfigurationKey, java.lang.String) of a null object loaded from a local variable at slot 3] in class com.sap.xi.tf._WPP_PayFile_to_Proxie_ method FileNameDateTime[test.psv, com.sap.aii.mappingtool.tf7.rt.Context@7e4fff03]
See error logs for details

'

The method with no input parameter sounds good but with limited java knowledge, I'm not sure how this would look in the udf?

results.png


results.png (59.9 kB)
Share
10 |10000 characters needed characters left characters exceeded
Evgeniy Kolmakov Jan 11, 2017 at 12:21 PM
0

Hi George!

As far as you want to get ASMA parameter from Dynamic Configuration you should use .get(key) method.

Remove all input parameters from your UDF since you don't need any.

Regards, Evgeniy.

Share
10 |10000 characters needed characters left characters exceeded