on 07-14-2010 8:17 PM
HI,
I have a requirement in which I have to get the file from FTP and save the file to the another FTP based on the file name.
FTP....................XI.....................FTP
Example
XXXXX_XXINXXX_XXXX
XXXXX_XXPHXXX_XXXX
XXXXX_XXMYXXX_XXXX
XXXXX_XXIDXXX_XXXX
XXXXX_XXBDXXX_XXXX
I need to check the 9th and 10th char of the file and based on that I have to put the File in the specific folder.
If IN then place the file in India\XX\Inbound
If PH then place the file in Philippine\XX\Inbound
If MY then place the file in Malaysia\XX\Inbound
If ID then place the file in Indonesia\XX\Inbound
If BD then place the file in Bangladesh\XX\Inbound
Do I need to do any kind of mapping because I just need to transfer the file. I have seen couple of blog and I believe I need to do the mapping and use Dynamic Configuration.
Can somebody please tell me if this code is fine
DynamicConfiguration conf = (DynamicConfiguration)
container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String FName = conf.get(key);
String Country = FName.substring(9,2);
If Country = "IN" then
String MyDirName="India\xx\Inbound";
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
conf.put(key,MyDirName);
return ""
Can somebody please guide me if this is the correct way to achieve this.
Thanks
No solution
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Muhammad,
There are two different options for you to fix the issue.
Option 1: To use Variable substitution paramters, so that depending upon the country name you can process.
If you do not wish to have the country name in the output file, then use FCC parameters to fix the length of the field.
Option 2: Write a UDF using Dynamic configuration.
Try this UDF:
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key =
DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String Country = FName.substring(9,2);
If (Country == "IN") // need to write a if else condition for all the countries
{
String Dirname="India\"Country"\Inbound";
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
conf.put(key,Dirname);
}
return "";
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hareen,
That code is not working and I am getting error could you please tell me if I am doing anything wrong.
Could you also tell me how do I use Variable Substitution and FCC.
could you please tell me is there any way I can put condition in Interface determination because my scenario is that I have to pick up the files from FTP and back them and also email it to the user as well but all the files contain the same name and inside the file I have to check the condition and upon which I have to perform mapping.
If inside the file , field 1 = blank than it will goto mapping 1 otherwise it will goto mapping 2.
I am using this code for Dynamic Configuration
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String fname = conf.get(key);
String Country = fname.substring(7,2);
If (Country == "IN")
{
String Dirname="DGE008\"India\"Inbound";
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
conf.put(key,Dirname);
Else
String Dirname="DGE008\"All\"Inbound";
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
conf.put(key,Dirname);
}
return "";
Error
Function getFileName, Line 11:
';' expected { ^ 1 error
I have checked everything but don't know why I am getting this error. could you please check and let me know.
Thanks,
Your approach is correct-
In this case in Sender as well as receiver u have to select the ASMA and do the dynamic configuration.
This case is valid in case u have common FTP and u r maintaining the Different folders as u said in ur thread.
chirag
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this.
container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String FName = conf.get(key);
String Country = FName.substring(9,2);
If (Country == "IN"){
String MyDirName="India\"Country"\Inbound";
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
conf.put(key,MyDirName);
}
return ""
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Iqbal,
Use variable substitution (ref:- http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm ). Also, check ASMA -> File Name in Sender File channel.
Regards,
Neetesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.