on 02-27-2008 4:43 PM
Dear SAP experts,
I need some advise regarding my scenario.
I am converting a message into flatfile. (customized .csv)
But, the output .csv flatfile must have a naming convention.
E.g. Globus_20071020 (Customer name_YearMonthDate)
Can somebody give me ideas/inputs on what will I configure in File Receiver (FCC) in order to have an output file having a naming convention indicated above.
Or do i need additional configurations?
Please advise.
Thank you very much in advance.
Fred
Hi,
You could pass this kind of File name from mapping at runtime or
You could use the variable substitutions to create the fiel neame as per naming convention as adding date .
With reference to Variables youcould set file name as Globus_%payload.<Date>%
Pass the value in date field of payload
Refer
Variable Substitution
How to use Variable substituion
/people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi
/people/sravya.talanki2/blog/2005/08/11/solution-to-the-problem-encountered-using-variable-substitution-with-xi-sp12
Dynamic file name
/people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i --> Dynamic File Name using XI 3.0 SP12 Part I
/people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii --> Dynamic file name(XSLT Mapping with Java Enhancement) using XI 3.0 SP12 Part -II
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
1. In the sender file adapter , select Adapter Specific Attributes --> FileName.
2. Use the code in this link to read the filename inside a UDF in your mapping.
DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create(
http://sap.com/xi/XI/System/File,
FileName);
String filename = conf.get(key);
http://help.sap.com/saphelp_nw2004s/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm
Thanks
Swarup
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks for the inputs.
Globus is an example of customer name.
There are 3 customers that will send the message.
Globus_20071020.csv
Karstadt_20080729.csv
Metro_20070516.csv
Format of output file : Customer name_YearMonthDate
How can i handle this?
in the message you've said, it seems that i will configure also SENDER file adpater, am i right?
Kindly advise.
Thank you!
Fred,
Then it's easy.
Write the following UDF. The logic must be
GLN , Date -
> UDF----
>Root Node of Target Message
The UDF must be simple, with two parameters (here I took GLN, dat)
String fname="";
if(GLN.equals("23456"))
{
fname ="Globus" +dat;
}
else if(GLN.equals("5678"))
{
fname ="Karstadt"+dat;
}
else if(GLN.equals("6789"))
{
fname ="Metro"+dat;
}
DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create(
"http://sap.com/xi/XI/System/File",
"FileName");
conf.put(key,fname );
In receiver comm.channel, just tick the checkbox ASMA for File.
The above code will solve ur needs!
Hope it helps!
raj.
Hi
you can use the following things in ur receiver adapter.
click on the check box "use adapter specific message attributes".
then it that select the file name.
and u also the set the file construction mode as AddTimeStamp.
when u run the scenarion then it will get the file name from the moni at runtime.
Thanks
Rinku
Hi Raj,
just a question. this is included in the UDF,
DynamicConfigurationKey key = DynamicConfigurationKey.create(
"http://sap.com/xi/XI/System/File",
"FileName");
conf.put(key,fname );
http://sap.com/xi/XI/System/File --> is the Agency in the Integration Directory, right?
FileName --> this is based on where?
Hi,
OK.
regarding the Integration Directory configurations,
Processing Parameters:
File Construction Mode : (what will be my value here? is it CREATE, APPEND, ADD TIME STAMP, ADD MESSAGE ID, ADD COUNTER ? )
Write Mode: (is it Use Temporary File, or Directly ? )
File Type: (is it Binary or Text ? )
This is included in the parameters that needs to configure in File Receiver Comm channel.
Please advise.
Thank you very much!
Fred
Fred,
>http://sap.com/xi/XI/System/File --> is the Agency in the Integration Directory, right?
No. This code is used to set the file name Dynamically at runtime. It's no way related to Agency all those stuff.
Refer- http://help.sap.com/saphelp_nw2004s/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm
raj.
Fred,
Directory u need to give correctly. For the File name option give some bla-bla values, coz what ever values u give, the code which we wrote will overwrite them in the runtimw.
File Construction Mode :CREATE
Write Mode: Directly
File Type:Text or Binary doesn't matter (i.e in your case)
raj.
Ok, thanks for the information.
Regarding my question a while ago,
Processing Parameters:
File Construction Mode : (what will be my value here? is it CREATE, APPEND, ADD TIME STAMP, ADD MESSAGE ID, ADD COUNTER ? )
Write Mode: (is it Use Temporary File, or Directly ? )
File Type: (is it Binary or Text ? )
What will be my value configured for this paremeters in Integration Directory?
Is it CREATE in File Construction Mode ?
And in the Write Mode?
File Type?
Kindly advise.
Thanks!
Hi Raj,
Good day!
I've inputted this codes in my UDF.
+String fname="";
if (GLN.equals("4304218000002"))
{
fname="Globus"+dat;
}
else if (GLN.equals("4334400000008"))
{
fname="Karstadt"+dat;
}
else if (GLN.equals("4331016000002"))
{
fname="Metro"+dat;
}
DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key= DynamicConfigurationKey.create (
"http://sap.com/xi/XI/System/File",
"Filename");
conf.put(key,fname);+
But, when I will now activate the mapping, there is an exception error encountered,
This is the error,
*Activation of the change list canceled Check result for Message Mapping MM_XsdUnD96A_SLSRPT_To_CSV | http://pg.com/xi/tom/connect/edi: Starting compilation Source code has syntax error: /usr/sap/GDD/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Map3a9eac70e93811dccc9c00306e2d0d38/source/com/sap/xi/tf/_MM_XsdUnD96A_SLSRPT_To_CSV_.java:485: missing return statement } ^ 1 error *
Kindly advise on what is missing in the code.
Thank you very much!
Fred
Hi Raj!
I've tested the UDF you have advised.
I linked it in the root node of the target message.
In the configurations in the Integration Directory, ive set these following parameters,
Adapter Specific Message Attributes
- Use Adapter-Specific Message Attributes
- Fail If Adapter-Specific Message Attributes Missing
- File Name
When i've tested my scenario, there is no output obtained.
Is there something missing in the set-up?
Or do I need to add some codes in the UDF?
The output .csv file must be 'CustomerName_YYYYMMDD'.
E.g. Globus_20080304.
Please advise.
Thank you very much!
Fred
Here is the error in the log,
"Attempt to process file failed with com.sap.aii.adapter.file.configuration.DynamicConfigurationException: The Adapter Message Property 'FileName' was configured as mandatory element, but was not supplied in the XI Message header"
There is no output csv file obtained because of the error.
Kindly advise.
Am i missing something configs in the variable substitution parameters in the Integration Directory?
I've only configured Adapter Specific Message Attributes.
Kindly provide me the complete parameters/configurations that should be set in the Integration Directory.
Is it ok?
So that i will have an output .csv file of "Globus_20080304" --> 'CustomerName_YearMonthDate'
I have UDF defined, (indicated in the first part of the threads).
I linked it in the root node of the target message , DT_CSV.
Hoping for your consideration.
Thank you very much!
Fred
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.