cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a dummy file

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Mickael,

Any option other than Run OS command?

Thanks,

Aravind

Former Member
0 Kudos

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

Answers (2)

Answers (2)

anupam_ghosh2
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

hi Aravind,

I thank the same, but found nothing, here's the list for PI 7.11: [http://help.sap.com/saphelp_nwpi711/helpdata/en/2e/bf37423cf7ab04e10000000a1550b0/frameset.htm]

Mickael

Former Member
0 Kudos

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