on 12-15-2011 11:00 AM
Hi All,
I have a file pick and place scenario. So I am using Integrated configuration for this.
But along with the target file I want to create one extra dymmy zero byte file with the same name as source file name but with file extension as *.ok
How can this be done? please help.
Thanks,
Aravind
hi,
by writing a unix script which create a "dummy" file, and by calling this script in your CC under option "Run OS command after process".
The difficulty will be perhaps to have the same filename.... So maybe the solution is to develop a Module to your FILE CC.
Mickael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I believe as suggested by Mickael, OS commands is easier to implement. You have just use 2 things to achieve
1. Use vairable substitution
2. OS commands
http://wiki.sdn.sap.com/wiki/display/XI/SAPXIFileAdapterOSCommandLine+Feature
Regards
Ramesh
Hi Aravind,
Try using the following java mapping
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
import com.sap.aii.mapping.api.AbstractTransformation;
import com.sap.aii.mapping.api.StreamTransformationException;
import com.sap.aii.mapping.api.TransformationInput;
import com.sap.aii.mapping.api.TransformationOutput;
public class createFile extends AbstractTransformation {
/**
* @param args
*/
public void execute(InputStream in, OutputStream out)
throws StreamTransformationException {
// TODO Auto-generated method stub
try
{
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String s = conf.get(key);
//here specify the directory where you need the file(depends on OS)
String d="c:\\apps\\";
String s=s.substring(0,s.indexOf("."))+"ok";
s=d+s;
FileOutputStream f=new FileOutputStream(s);
f.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
public void setParameter(Map arg0) {
// TODO Auto-generated method stub
}
public void transform(TransformationInput arg0, TransformationOutput arg1)
throws StreamTransformationException {
this.execute(arg0.getInputPayload().getInputStream(), arg1.getOutputPayload().getOutputStream());
}
}
Pls Don't forget these steps ---> In sender communication channel use Adapter Specific Message Properties. Tick on this two options
"set Adapter Specific Message Properties" and "Filename".
Include this in Interface mapping in last step.
Regards
Anupam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you all for the reply,
I was trying to achieve my above requirement without any objects in ESR as it is just a file pick and place scenario.
As Mickael suggested we can develop a custom Adapter module for this. But I was looking if it can be done using some standard modules like DynamicConfigurationBean in Module processing sequence.
Thanks,
Aravind
Aravind,
This can be acieved via multi mapping or java mapping
1. Create one source message type and 2 target message type (one for actual value, second once for dummy file and to carry source file name)
2. Do the mapping accordingly.
3. Use enhanced interface determination
4. Use variable substitution concept to create sourcefilename.ok
Regards
Ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.