Skip to Content

Need help on run OS command

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jul 05, 2013 at 10:44 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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;

      }

  • avatar image
    Former Member
    Jul 05, 2013 at 12:32 PM

    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

    Add comment
    10|10000 characters needed characters exceeded