cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically generating file-name

former_member200339
Participant
0 Kudos

Dear All,

We have a scenario Idoc to flat file. The scenario is bypass and we are not using any mapping.
Using the SAP provided module we are converting the Idoc xml to Idoc flat file at receiver file adapter .We are able to generate the Idoc flat file successfully using this module.

Our PI environment is PI 7.31 dual stack.

But we have also the requirement to set the target file name RCVPRN+"-ZWR-"+DOCNUM+".txt which we are not able to generate at target side .
We tried the variable substitution but the variable substitution is not working while we are using the (IDOC XML->Idoc Flat file conversion module) .

We tried to use dynamic configuration by introducing an operation-mapping instead of by-pass scenario as used earlier.

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

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

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

String filename = RCVPRN+"-ZWR-"+DOCNUM+".txt";

conf1.put(key1,filename);

But we are getting a null pointer exception from the last line. It seems as the sender adapter is not a FILE so the above method is not working.

Is there any other way to meet the required functionality?


Thanks and Regards
Rana Brata De

Accepted Solutions (0)

Answers (4)

Answers (4)

ambrish_mishra
Active Contributor
0 Kudos

Hi Rana,

this should work at runtime.

Seems like you are passing RCVPRN & DOCNUM from the IDoc. Check the parameters.

Ambrish

Former Member
0 Kudos

Hi Rana,

I hope your passing the RCVPRN & DOCNUM inputs to UDF which you created.  Please check if your not passing.  What I mean to say is did you created the UDF with two arguments?

Thanks,

Satish.

anupam_ghosh2
Active Contributor
0 Kudos

Hi Rana Brata,

                            Please check if ASMA property of file name is ticked on in receiver channel.

If this has been set correctly, please kindly post the complete UDF you wrote and the parameters passed into it. Perhaps there might be problems in the UDF code itself. Otherwise everything seems to be ok.

Regards

Anupam

Former Member
0 Kudos

Hello,

>>But we are getting a null pointer exception from the last line.

Where exactly u r getting this error (hope u r not testing DC at mapping level)?

>>It seems as the sender adapter is not a FILE so the above method is not working.

Since, u r setting the dynamic properties in receiver file adapter by just reading the source payload values so it doesn't matter whether u have idoc/RFc/proxy as ur sender adapter.

Thanks

Amit Srivastava

markangelo_dihiansan
Active Contributor
0 Kudos

Hello Rana,

Silly question, but in your file receiver channel, have you checked the FileName under Use Adapter-Specific Message Attributes?

Regards,

Mark