cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI: FileName in Header Java Code

vossk2
Explorer
0 Kudos
213

Hello experts,

I have a configuration scenario where I add mapping parameters to the Integrated Configuration. I want to write these parameters in the mapping via Java coding into the parameter filename, so that the receiver channel can use it.

Thanks in advance.

With kind regards David

Ryan-Crosby
Active Contributor
0 Kudos

Where would the value for the parameters originate?

View Entire Topic
Ryan-Crosby
Active Contributor
0 Kudos

Hi David,

The example code for retrieving the value for a parameter would be the following:

String someParam = in.getInputParameters().getString("SOME_PARAM");

Where the "in" is an object of type TransformationInput as part of the method transform.

Regards,

Ryan Crosby

vossk2
Explorer
0 Kudos

Hi Ryan,

thanks for your help.

Do you also know how to get the Value from these Parameters in the FileName via Java Code?

Regards, David

Ryan-Crosby
Active Contributor
0 Kudos

Hi David,

That code is how you would retrieve the value for the parameter. Are you referring to getting the value of the dynamic configuration value for FileName? If so, then you don't necessarily need any special java code depending on how your scenario is setup.

Regards,

Ryan Crosby

vossk2
Explorer
0 Kudos

Hi Ryan,

yes thats exactly what I am trying to do. I want to get the Values from the Dynamic Configuration for the FileName.

Normally I always do this without Java coding, but this time I just want to pass the data through 1:1 without mapping anything and without creating an XML structure. Therefore I need the Java code which is then executed and writes these two parameters into the header (FileName).

Thanks for your help!

Regards, David

Ryan-Crosby
Active Contributor
0 Kudos

Hi David,

If you are using the File or SFTP adapter you can pass through the values without doing any Java work. Unclear what you are trying to achieve by using a Java mapping if you are just passing through 1:1.

Regards,

Ryan Crosby