cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic file name using without ESR Objects PI 7.3 SP5

former_member200386
Active Participant
0 Kudos

Dear Experts,

I am working on one scenario where i need to just pick the file from client FTP using SFTP Adapter and post into our Target directory(ecc), scenario is SFTP to File scenario. (without ESR objects(No Mapping)), where i need to maintain file name as as it is from the directory(lets say my source file name will be GAD.CSV. the same name will be maintained at target i.e GAD.CSV). 

i have gone through some links on SDN

http://scn.sap.com/thread/1858693

http://scn.sap.com/thread/3170433

http://scn.sap.com/thread/3237414

Still having some doubts about configuration.

1) Do we need Server Finger print(SFTP Comm channel)?

2) what will be my Sender Comm channel configuration

3) Receiver Comm channel Configuration.

My PI Version is 7.3 SP.

Thnaks in Advance,

Pavan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Pavan,

1. Create Sender SFTP Channel provide the file name schema and check ASMA parameters->click on file name.

2. Create Receiver File Channel put file name scehma as '*' and check the ASMA parameters-> Click on File Name.

Thanks,

Satish.

former_member200386
Active Participant
0 Kudos

Hi Satish,

Thnaks for your Valuable response. now  i am getting the same file name  as output file.

How do i get Server fingerprint. for sender SFTP channel? how i can generate server fingerprint.

I want to go  with Authentication as PASSWORD, not with Private key.  So  Still i need server finger print ?

My PI version is 7.3 SP5 Windows server 2008.

Regards,

Pavan

0 Kudos

Satish,

Thanks for the solution.

I had the same requirement and it worked fine after referring to your reply

Former Member
0 Kudos

>>>How do i get Server fingerprint. for sender SFTP channel? how i can generate server fingerprint.


You can get from server admin or try to connect with SFTP client with login credentials, it will show finger print details.


>>>I want to go  with Authentication as PASSWORD, not with Private key.  So  Still i need server finger print ?

Answer is Yes.

Answers (2)

Answers (2)

smavachee
Active Contributor
0 Kudos

Have a look at Shabarish's blog, you can achieve this with ASMA..

Below document explains how to use SFTP Adapter and describes a step by step procedure to use.

Hope it helps.!

Regards,

Sunil

former_member184789
Active Contributor
0 Kudos

Hi

Do  as below,

1.In ESR create only an imported archive with code for dynamic config, a sample of which is given below, create an operation mapping but without existing service Interfaces..that is type in any dummy names & a real namespace in operation mapping & add the imported archive with Java mapping.

2. In ID, create sender & receiver Channels & Select adapter specific message attributes in both communication channels.

3. Create a configuration, with the dummy service Interfaces. Select the operation mapping. As the service Interfaces do not exist, you have to type in the names manually.

Here is a sample code for your Java mapping. It might not be completely as per you requirement, but you can modify it:

package com.sap.pi.java.mapping;

import java.io.InputStream;

import java.io.OutputStream;

import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.Map;

import com.sap.aii.mapping.api.AbstractTransformation;

import com.sap.aii.mapping.api.DynamicConfiguration;

import com.sap.aii.mapping.api.DynamicConfigurationKey;

import com.sap.aii.mapping.api.StreamTransformationConstants;

import com.sap.aii.mapping.api.StreamTransformationException;

import com.sap.aii.mapping.api.TransformationInput;

import com.sap.aii.mapping.api.TransformationOutput;

public class DynamicFileName extends AbstractTransformation{

     public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput) throws StreamTransformationException

     {

         String oldFilename = "";

         String newFilename = "";

      try

      {

           InputStream inputstream = transformationInput.getInputPayload().getInputStream();

           OutputStream outputstream = transformationOutput.getOutputPayload().getOutputStream();

           Map mapParameters = (Map) transformationInput.getInputHeader().getAll();

           mapParameters.put(DynamicConfigurationKey.create("http://sap.com/xi/XI/Dynamic",StreamTransformationConstants.DYNAMIC_CONFIGURATION), "");

           DynamicConfiguration conf = (DynamicConfiguration) mapParameters.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

            String FileName = conf.get(key);

           conf.put(key, Filename);

           byte[] b = new byte[inputstream.available()];

           inputstream.read(b);

           outputstream.write(b);

      }

      catch (Exception exception)

      {

       getTrace().addDebugMessage(exception.getMessage());

       throw new StreamTransformationException(exception.toString());

      }

}

}