cancel
Showing results for 
Search instead for 
Did you mean: 

Receiver file format in PO.yymmdd.LA??

Former Member
0 Kudos

Hi All,

We have the following scenario to send files: AS2 Sender --> PI 7.0 --> File. We want the target file to be of the format PO.yymmdd.LA where PO and LA are constant and yymmdd keep changes depending on the current date. How could I get the file name in PO.yymmdd.LA format? I dont see any option in receiver file adapter. Please help.

Thanks in advance.

Thanks,

Riya Patil

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

you can do this using Java mapping (fine name change) with Dynamic Configuration in Adapter level.

Regards,

Senthil Nattamai Sekar

Former Member
0 Kudos

We not doing any mapping in this scenario as it is just a file pass through. Is there a sample java mapping that we can still use just to change the file name (or format the file name) without reading file contents??

Thanks,

- Riya Patil

Former Member
0 Kudos

yes you can change the file name alone , with out touching the contents , search for Dynamic file name scenario you will get good reference from SDN itself.

But you have create a Java mapping for sure

Edited by: Senthil Nattamai Sekar on Dec 8, 2009 1:21 AM

Former Member
0 Kudos

Is there a sample code for java mapping for the same?

Thank in advance.

Riya Patil

Former Member
0 Kudos

Hi,


public String targetFileName(String Sono, String Div, Container container) throws StreamTransformationException
{
DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String MyFileName = sono + div + "<filename>"+".xml";
conf.put(key, MyFileName);
return MyFileName;
}

Regards

Ivan

Former Member
0 Kudos

Hi,

This is the javamapping


public class mymapping implements StreamTransformation {
    /**
     * List of runtime parameters
     */
    Map param=null;
    

    
    /**
     * Set the runtime parameters
     * @param map new runtime parameters
     */
    public void setParameter(Map map) {
        param = map;
        if (param == null) {
            param = new HashMap();
        }
    }
    
    /**
     * Principal method of the javamapping. It executes the transformation, adds information to message tracking and changes the name of the output file.
     * @param in Input content
     * @param out Output content
     * @throws com.sap.aii.mapping.api.StreamTransformationException mapping error
     */
    public void execute(InputStream in, OutputStream out) throws StreamTransformationException {
       
                   //your code here
            String newFileName = "mycustommfilenamel";
            DynamicConfiguration conf = (DynamicConfiguration) param.get("DynamicConfiguration");
            DynamicConfigurationKey KEY_FILENAME = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
            conf.put(KEY_FILENAME, newFileName);
            // </editor-fold>
            
            
        }catch(Exception e){
            throw new StreamTransformationException("Error during the mapping: " + e.toString());
        }
    }
}

Regards

Ivan

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You can use dynamic file name activating "Adapter-Specific Message Atributes".

Check the following link:

Regards

Ivan

Former Member
0 Kudos

Hi Ivan,

Could you please tell me how to use dynamic file name activating "Adapter-Specific Message Atributes" as I am not reading the source file content as it is file pass through only. No Mapping involved whats so ever. Please advise

Thanks,

- Riya Patil