on 07-05-2013 8:29 AM
Dear Experts,
I am working on one requirement where i need to add .pgp extension to my source file name.
like this below example,
my source file :sf_out_123.txt
desired filename:sf_out_123.txt.pgp
my scenario is File(NFS)- SFTP(pass trhru) no ESR involved.
I have gone through this below blog
http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=272171407
we can acheive this using run OS command.
we are using windows server 2008.
please provide me the suggestions to achieve my requirement.at sender comm channel(run OS command before processing) end.
1) do we need any additional configuartion required to run OS command?(adding environment varibales, path .....etc)
2) what will be the sytnax to rename the file.
Thanks & Regards,
Pavan
hi Pavan,
you can create a file-to file scenario with no mapping and use OS command on receiver file channel.
For changing name - a small OS command "rename %f %f.pgp" on windows
"mv %f %f.pgp" on Unix should work. I don't think any additional configuration is required.
Regards,
Ankit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pavan,
Could you please elaborate what kind of adapter you are using in receiver side?
Does the adapter offer OS command facility?
Regards
Anupam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anupam,
I want to use OS command at Sender File comm channel( before message processing).
my end to end scenario is
File(NFS) to SFTP (pass thru) no ESR involved
end my exact requirement for using OS command is
i need to add .pgp extension to my source file and send to target SFTP .
like this my source file name:sf_out_*.txt
desired filename:sf_out_*.txt.pgp
Thanks & Regards,
Pavan
Hi Pavan,
You can try putting this command
cmd.exe /C "ren %F %F.pgp"
However I think you cannot use this feature to rename a file in sender file adapter.
The reason being adapter after picking up the file will execute the command which will change the file at OS level. This will not change the filename of the file already picked up. In case this does not work then you need to check the receiver file adapter with following questions
1. Does it suport Dynamic configuration (ASMA) ?
2. Does it support OS command feature?
If you are using SAP SFTP adapter it lacks OS command line feature. Thus only options are to use custom adapter module or add an java mapping code in the scenario. Please check this wonderful blog by Shabarish Vijayakumar. The other helpful articles are
http://wiki.sdn.sap.com/wiki/display/XI/Dynamic+file+name+for+pass-through+scenario
Regards
Anupam
Hi Anupam,
Thanks for the Response. i have changed my design plan.
File (Content conversion) NFS to File (content Conversion) NFS
I am using ESR objects now.
Please find the screen shot of my design
my scenario is working fine end to end. But need to add .PGP extension to file name is still pending.
I need to UDF to add .pgp extension to my source file.Please provide me your valuable inputs.
Thanks & Regards,
pavan
Hi Pavan,
In case of file to file scenario just add an UDF to your scenario
public String AlterFileName(String Message,Container container){
String filename = "";
String timestamp = "";
DynamicConfiguration conf1 = (DynamicConfiguration) container .getTransformationParameters() .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create( "http:/"+"/sap.com/xi/XI/System/File","FileName");
filename = conf1.get(key1);
filename = filename+".pgp";
conf1.put(key1,filename);
return Message;
}
The UDF needs to be written as shown below
Message------>AlterFilename------>Message.
Please check this blog for further settings required in both sender and receiver comm channels to access ASMA http://saptechnical.com/Tips/XI/ASMA/Index.htm
Regards
Anupam
Hi Anupam,
Thnaks for the response, I got my issue resolved. I used below UDF to Achieve my requirement.
try {
String filename = "";
DynamicConfiguration conf1 = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create( "http:/"+"/sap.com/xi/XI/System/File","FileName");
filename = conf1.get(key1);
filename = filename.replaceAll( ".txt","");
filename = filename+".txt.pgp";
conf1.put(key1,filename);
return filename;
}
catch(Exception e)
{
String exception = e.toString();
return exception;
}
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.