Condition based on source file name - PI 7.1
Hi Friends
I have an file2file interface without any mapping requirement , source is sending .csv files and I need to post those source files to two target systems in which each target system have two directories where I need to post based on few conditions and here are my queries.
1. As mapping is not required I guess File Content Conversion is also not required as I simply pick and drop the .csv files into target - please confirm.
2. One of the condition is : source file name will be XXXX-AABB-C-XXXX-XXX-XXX.csv , here SAP PI has to read the company code (AABB) to determine the target system. Z001 and Z007 should be sent to TARGET1 & All other files will be sent to Target2.
3. 2nd Condition : SAP PI has to read the type of file indicator (C). The files will be sent to the following target application directories:
Simulation files (indicator = S): /interfaces/XXX/simulation
Production files (indicator = P): /interfaces/XXX/inbound/
Please kindly provide your ideas/solutions .
Regards
Suman.
Hi Suman,
If the Target is two different locations, then i guess you need to have two receiver Channels. Please check the below thread for details:
Re: Genrate file in 2 different locations
Incase of different directories in same server, you can check out this link:
Dyanamic Configuration at receiver file adapter determine target directory
kanan
Similar Messages
-
Condition check (based on sender file name) at receiver determination step
Hi,
My scenario is File to AS2 (Sender side file adapter and receiver side AS2 adapter)
We have 5 customers, but the source location is same to pick the files, Here we are not using any ESR objects.
Based on the source file name PI need to determine to whoom this file need to send at receiver determination step
Craeted objects
1 Sender CC,
1 Sender agreement,
1 Receiver determination
5 Interface determinations
5 Receiver agreements
5 Receiver CCs.
Could you please provide me your valuable inputs.
Thanks
RameshHi Venkataramesh,
I understand your scenario as, picking files (different file naming standard for different target customer) from one source folder. Based on file name, that payload should be sent to corresponding target customer. You have mentioned u201CHere we are not using any ESR objectsu201D. I can see two reasons for this decision
1. PI is used to route the messages, i.e., no need to transform the payload. OR
2. Files can binary files like PDF, ZIP, JPG, GIFu2026
Now I can see two possible solutions
1. Simple solution, as proposed by u201CPrabhu Rajesh Janardananu201D, make it into 5 different scenarios (5 sender channels).
2. Bit complex solution, only one sender channel, using extended receiver determination
Step 1:- In Sender File channel check u201CAdapter u2013 Specific Message Adapteru201D in Advanced tab. File Name should be checked.
Step 2:- In Receiver Determination, Select Type of Receiver Determination as u201CExtendedu201D. http://help.sap.com/saphelp_nwpi711/helpdata/en/48/ce2a423a8e5430e10000000a42189b/frameset.htm
Step 3:- Do a Graphical Mapping (use it Operation Mapping in Receiver Determination).
Step 4:-
Source and target of graphical mapping will be same (below), because you donu2019t want to access input payload (it can be XML, flat file, JGP, GIF and you donu2019t have its structure).
<Receivers>
<Receiver>
<Party agency="" scheme=""></Party>
<Service></Service>
</Receiver>
</Receivers>
Step 5:- Write a UDF in Graphical mapping as below. http://help.sap.com/saphelp_nwpi71/helpdata/EN/43/03612cdecc6e76e10000000a422035/frameset.htm Pay attention to method declaration
public String Determine_Receiver( Container container) throws StreamTransformationException
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create(u201Chttp://sap.com/xi/XI/System/Fileu201D,u201CFileNameu201D);
String valueOld = conf.get(key);
//Put your logic here
if (valueOld.equal(u201Cuser1u201D)) {
return u201Cuser1u201D;}
if (valueOld.equal(u201Cuser2u201D)) {
return u201Cuser2u201D;}
if (valueOld.equal(u201Cuser3u201D)) {
return u201Cuser3u201D;}
Step 6: Now use this UDF to map to u201CReceiveru201D and u201C Serviceu201D.
This solution need more fine tuning.
Regards,
Raghu_Vamsee
Edited by: Raghu Vamsee on Jan 8, 2011 5:56 PM -
UDF to capture the source file name or the source folder for mapping
Hi All,
i have 2 files - File1 from File2 from 2 different folders- single comm channel FTP (FCC). i have to pass a constant A and B respectively to a field in target structure.
my options are -
either create a new field in source str populating different constants and then map to the target str
or a udf to get the source file name or the source folder so that i can map the constant using the value mapping/FixValue mapping.
please suggest. thanks.
rajibHi,
please use the UDF to determine the file name. Then based on file name either pass A or B to your target field.
The code is as given below. Just tweak the code to pass either A or B as per your requirement.
public String G_GetFileName(Container container) throws StreamTransformationException{
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String ourSourceFileName = conf.get(key);
return ourSourceFileName;
Regards,
Deepak. -
Accessing comapny code from the source file name
Hi,
Iam doing FILE FILE to scenario.
My source file name is XXXX237061606.txt. (XXXX is company code)
My requirement is
Based on company code from the source file name; I need to send the file to the corresponding receiver.
How to retrieve the company code from the source file name?
Thanks,
Hem.hem chand wrote:>
> Hi Varun,
>
> Could u please provide me detailed procedure to get the company code.
>
> Reg,
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String ourSourceFileName = conf.get(key);
This will get you the File name...TRuncate it to extract company code...
Then have a mapping program with the receivers message type which is persent under SAP BASIS component....
There map to the required receiver by getting the file name above..
Create an int mapping for the above mapping and use that in ur enhanced recv determination -
Pdf portfolio source file name and date in file details
Is it possible to import the source file name and extension as well as the source file created date in the portfolio file details? Need to document source to portfolio in working with 3rd parties that will only have the original source. Need to document what was converted into pdf as not all files in a directory will successfully convert to pdf. Sometimes need to convert 100's of files. Manual entry is inefficient. the file names and modified dates are displayed on the Combine Files dialog. is there a way to capture the detail on that page?
I don't need the detail of when the pdf was added to the portfolio. I
need know which dwg or jpg or word file was converted and the original
created date of that file for control of information.
That is impossible; sorry. For some *very specific* types of conversion to PDF the pdfx:SourceModified XMP tag will be set to show the last-modification date of the source file (for example DOCX files converted using MS Word), but there will never be a human-readable record of the source filename or its creation date unless you have manually added them as document XMP properties after conversion (this is what the "Custom Properties" dialog is for). To embed source data automatically would raise no end of privacy and security problems for customers, who most certainly do NOT want their recipients seeing details of internal documents.
Without writing a plugin there's no access to the internal workflow of the Combine Files dialog, so you cannot use a script to read the names and dates of the files *before* conversion and store them automatically in the new PDF Portfolio's Fields array. -
Get source file name in the structure itself or in the payload
Hi everyone,
I have a task regarding mapping
In my structure , i defined a field for Filename . What I need is, what ever source file name am sending, that should be mapped into this filed.
If am sending inputfile.txt.
My output file should appear like this,
<?xml version="1.0"?>
<message id=u201DmessageIDu201D>
<header>
<filename>D:\\inputfile.txt</filename>
</header>
<body>
FileContent
</body>
</message>
Any help would be appreciated. Do I need to create any UDF. If So please provide.
Regards,
VarunHi Varun,
are u using the same UDF that I replied. also note that the variable key should be declared only once.
Use this without changing any thing. It works for me...
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String ourSourceFileName = conf.get(key);
key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
String dir = conf.get(key);
return dir+'/'+ourSourceFileName;
Also let us know where do you het this error..
Thanks
SaNv... -
Dynamic File Name depending on the Source File name
Hi Experts,
I have a problem like Dynamic File name depending on the Source File Name. I will explain with example as follwos
Source File name Targer Folder/Filename
NK01.VR59.L2007030 VR59/Rec.l200
NK01.VR71.L2017030 VR71/Rec.l201
NK01.VR77.L2027030 VR77/Rec.l202
See above the exaple, Depending on the Source file name, I am deciding where i need to place my file and what name i need to name it.
So please suggest me the solution and How can i do this with a single communication channel ? Do i need to create multiple CC for each folder??
Points will be rewarded for Valuable anwer.
Thanks in Advance,
Best Regads,
VijayHi VIjay,
Thanks for quick reply. But i am getting error in End to End Scenarios only. If i remove the Return " " statement from the UDF, while activating it is showing the error saying like missing return statement. I also mapped to the top most node to this UDF.
I am getting the following error in End to End error Scenarios:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!-- Request Message Mapping
-->
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
<SAP:Category>Application</SAP:Category>
<SAP:Code area="MAPPING">EXCEPTION_DURING_EXECUTE</SAP:Code>
<SAP:P1>com/sap/xi/tf/_MM_Target_File_determined_</SAP:P1>
<SAP:P2>com.sap.aii.utilxi.misc.api.BaseRuntimeException</SAP:P2>
<SAP:P3>Fatal Error: com.sap.engine.lib.xml.parser.Parser~</SAP:P3>
<SAP:P4 />
<SAP:AdditionalText />
<SAP:ApplicationFaultMessage namespace="" />
<SAP:Stack>During the application mapping com/sap/xi/tf/_MM_Target_File_determined_ a com.sap.aii.utilxi.misc.api.BaseRuntimeException was thrown: Fatal Error: com.sap.engine.lib.xml.parser.Parser~</SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error> -
RH10 variable and build tag source file names
I'm using RH10 and outputting to WebHelp. My company requires that I archive project source files to our CVS via Eclipse. I am not using RoboSource_Control and must use the company's development resources for archiving.
Since archiving the initial project, I have been uploading only source files with modified dates.
However, I have discovered that the files I thought were storing user variables and build tags are not the correct files to archive. Since I am uploading all files with a newer date and that's not working, I need to know the user variable source file name and the build tag source file name that stores the currently defined variables and build tags.
I have already tried the WebHelp forum and was directed to this forum to pose the question because I'm looking for source file information instead of output file information.
Thanks for your help!
karenYes, Eclipse does work that way. However, we do not use our development directory as the local Eclipse repository. I need to move changed files to the local repository (stores all source files in the project) so that Eclipse can upload changes to the server. Yes, this is planned redundancy.
That said, it is not acceptable to spend the time copying all files in the large projects from the work folder to the local repository. I simply need to know which individual files to copy that include the currently defined variables and build tags. Note, we do not copy the SSL folder output files to our local source file repository, or other associated reference files that are not actually project source files.
Can you find someone who knows which files I need?
Thanks,
karen -
File Sender adapter - source file name - weird
Hi all,
We have a sender file adapter polling an ftp location. The Dynamic config has been enabled to get the source file name.
The actual file name is - "hrmd.xml", but in the dynamic configuration node, in sxmb_moni, the fileName is shown as ./hrmd.xml.
This does not occur with any other file sender adapter comm channels polling ftp locations.
I guess this has something to do with the ftp server. Did anyone face this issue?the fileName is shown as ./hrmd.xml
The file name surely cant have a / in it....such characters are not allowed.
is there any way we can change the fileName message attribute once the file is picked up
Create a UDF for Dynamic Configuration and change the name as per your requirement (in XI)....the source file may be having proper format for name and i assume that you have to change it for receiver file name -
Getting the Source File name Info into Target Message
Hi all,
I want to get the Source file name Info into Target message of one of the fields.
i followed Michal BLOG /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
Requirement :
1) I am able to get the Target file name as same as the source file name when i check the ASMA in Sender & Receiver Adapter , with out any UDF...............this thing is OK
2) I took One field extra in the target structure Like "FileName" & I mapped it Like
Constant(" " )--UDF-----FileName
I Checked the Option ASMA in Both Sender & Receiver Adapters
Here iam getting the Target File name as same as Source file name + Source File name Info in the Target Field " FileName".
I Dont want to get the Target File name as same as Source file name. I want like Out.xml as Target file name.
If i de-select the Option ASMA in Adapters means it is showing " null" value in the target field "FileName".
Please Provide the Solution for this
Regards
BopannaHi All,
Iam able to do this by checking the Option ASMA in only sender adapter itself
Regards
Bopanna -
Need to genereate Target file name same as Source File Name thru Local J2SE
Hi Everyone,
I want to genereate Target file name exactly same as Source File Name. I know how to handle this in Central Adapter Engine(Sender & Receiver Communication Channel).
But I need to do this in Local J2SE adpater engine.
Please help me in this regard.
Thanks & Regards,
NagarajuU can use the parameter to save the filename in the message header
file.messageAttributes=<name,directory>
This is similar "Adapter-Specific Message Attributes" concept.
http://help.sap.com/saphelp_nw04/helpdata/en/6f/246b3de666930fe10000000a114084/frameset.htm
Regards,
Prateek -
File-File - Need to extract data from source file name???
Hello Experts,
I have a unique situation. In my file to file scenario, the source file name is of the format XYZ_yymmddHHMM.dat. there is field in the target file which has to filled with the date that is there in the file name of the source file (yymmdd). How can this be achieved? Normally we do the other way round using vaiable substitution where we can name a file depending on the value in any of the target field structure.
Please help.
Regards,
YashHi,
please prepare the udf with the following code.
i mean, dynamic configuration concept.
where u get the file name, then use substring function to capture date from right side.
//write your code here
// getFileName User Defined Function
// function to create name of output file
String filename;
filename = strFile;
try {
// initialize DynamicConfiguration for create file with given name
DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File", "FileName");
//create file with the specified name
conf.put(key, filename);
} catch (Exception ex) {
return filename;
warm regards
mahesh. -
Hi my mapping is sql loader mapping,
i want to capture the source file name and make in lower case . owb is 11.2.0.3 .
please helpyou can pass the file name in as an input paramter so you can dynamically change it when the mapping is invoke, not sure if that is what you want, you have to know the file name first when you are loading orelse it means you hardcode it in the mapping config.
-
** How to get Source File Name thru XSLT Mapping
Hi friends,
We require source file name after message processing (SXMB_MONI) in the output structure. We understad from Forums and blog 2664, this is possible thru UDF - DynamicConfiguration class. This UDF will work if we use message mapping. But, in our case we are using XSLT mapping. So, how do we call the same from Java Pacakage ? (Imported Archives). For writing java class separately, what are the changes to be made in the program?
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String ourSourceFileName = conf.get(key);
return ourSourceFileName;
Kindly reply, friends.
Kind Regards,
Jeg P.Hi,
This is the example in this similar manner u have to call the method in which u have to write the code for picking the source file name.
<name>
<xsl:if test="function-available('javamap:concat')">
<xsl:value-of select="javamap:concat($first, $last, $inputparam)"/>
</xsl:if>
</name>
for reference check the Link,
http://help.sap.com/saphelp_nw04s/helpdata/en/73/f61eea1741453eb8f794e150067930/frameset.htm
Regards,
Phani -
Hello,
Sometimes when I change the name of songs or videos in iTunes, the name of the source file changes, and sometimes it doesn't.
When I say "source file," I mean the name of the file that comes up when I look at the contents of a folder via "My Computer" in the Windows interface.
I'd like a change of the iTunes name to always change the source file name. Can anyone help?
Thanks
Beni added music to a clean, newly installed iTunes from a music folder on my desktop with subfolders for different cds that i downloaded recently. after i added those folders to iTunes, i changed the artist names and album titles. the files changed in the folder on my desktop...the only thing that won't change is the song title...it's odd!
Maybe you are looking for
-
Move PC iTunes library to external hard drive and consolidate with iMac
Hi, I have a PC that I'm not using much. I have a ton of iTunes music files on it so I went through the process of copying these files to my networked external hard drive. I have my iMac connected wirelessly to this same hard drive. I went into the S
-
How can I stop Microsoft IE renaming .jar files to .zip files?
I realise this question has been asked before on this forum, but as far as I can tell no answer has yet been posted. If I put a .jar file on my webserver for people to download, later versions of Internet Explorer will rename the file from xxx.jar to
-
If I delete my ID, will my music and applications still be there?
IF I delete my apple ID on my phone, will my music and my applications still be there?
-
Can't access BAM from JDeveloper
Hi, I tried to create a connection to my local BAM Server in JDev 10.1.3.1., but I always failed! Error messages: Server is not set up correctly LTMHE1 ...OR... Authentication Failed for Basic realmI'm running on Windows XP and installed BAM accordin
-
Need information on Environment Parameters in EH&S
Hi Friends, I am working on an application related to EH&S. I need to create a new environment parameter in EH&S for the Email ID and send the mail from program to that Email ID assigned to the environment parameter. I do not know any thing about the