cancel
Showing results for 
Search instead for 
Did you mean: 

File to File Scenario

Former Member
0 Kudos

Hi,

1) I have a scenario like file to file, here based on my vendor no in receiver side have to save different files. For this is it necessary to use bpm or wot bpm, plz give me suggestions.

ex: if vendor no 001 means save as vendor1.txt

if vendor no 002 means save as vendor2.txt

Plz send me the total scenario in scence of IR & ID details.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hello ,

Hope This is useful...

String newfilename="";

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

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

// Get Sourcefilename

String oldfilename=conf.get(key);

//extract first 3 chars of source filename

newfilename=oldfilename.substring(0,2);

//get the date

java.text.SimpleDateFormat dateformat = new java.text.SimpleDateFormat( "yyyyMMdd" );

dateformat.format( new java.util.Date() );

//append sourcedateL

newfilename=newfilenamedateformat"L";

// determine if prod/ dev / qa

map = container.getTransformationParameters();

senderService = (String) map.get("SenderService");

if(senderServcie.equald("Prod"){

newfilename=newfilename+"P";

}

// change to new file name

conf.put(key, newfilename+".tmp");

With Regards,

Raju.

Former Member
0 Kudos

Hi

You can achieve this by writing User Defined Function module in mapping

You can refer to this blog, with little modifications as per your requirement

/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14

write a UDF as refered in above blog and use as :

vendor no(as UDF parametr)----> UDF--


> Target(assign to respected node in mapping)

The UDF hint is as below:

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

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

<b>// here write a logic to concatenate your input parameter - vendor no so as to make it " vendor1.txt "</b>

<b>// then put a final fileName in conf.put() as: </b>

conf.put(key,fileName);

String ourSourceFileName = conf.get(key);

return ourSourceFileName;

Hope this helps

Former Member
0 Kudos

Hi,

if you are happy with vendor001.txt and vendor002.txt as well, than you need nothing special. (like user function).

just use variable for filename with some message payload.

regards,

Robin

Former Member
0 Kudos

Hi Sundar,

you dont need BPM for this. This dynamic file generation.

In Design

1. Maintain a node for holding a file name

2. the file has to be mapped based on the vendor number

3. Use user defined mapping to generate the file name

In Configuration

1. user variable substitution to give the file name (%file%)

In Content Conversion

2. Remove the node which contain the file name.

Regards,

Ramesh P