cancel
Showing results for 
Search instead for 
Did you mean: 

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

former_member233999
Participant
0 Kudos

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?

Accepted Solutions (0)

Answers (5)

Answers (5)

former_member190293
Active Contributor
0 Kudos

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.

former_member233999
Participant
0 Kudos

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

sateesh437
Participant
0 Kudos

Hi,

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

Regards,

Sateesh.

former_member233999
Participant
0 Kudos

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

Andrzej_Filusz
Contributor
0 Kudos

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

Andrzej_Filusz
Contributor
0 Kudos

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