Get filename and directory name during runtime
Hi guys,
I am developing a file to file interface without content conversion, just a simple file transfer from one ftp server to another. I have to read the same filename (invent.txt) from multiple folders (mstransfer/M01/IN1, mstransfer/M02/IN1, mstransfer/M03/IN1....) that represent different stores and transfer it as it is with the same name to exactly the same directory name in the target ftp location.
My problem is found inside a dummy mapping that I have created in order to specify the target directory and the name of the file. I am doing the following:
A) A Java UDF to specify the filename
trace = container.getTrace();
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);
trace.addWarning("filename = "+filename);
conf.put(key, filename);
return "";
//return filename;
B) A Java UDF to specify the directory name
//write your code here
trace = container.getTrace();
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
String directory = conf.get(key);
trace.addWarning("directory before = "+directory);
directory = "/usr/sap/trans"+directory;
trace.addWarning("directory after = "+directory);
conf.put(key, directory);
return "";
//return "/usr/sap/trans"+directory;
In receiver file adapter I do not specify neither a filename nor a target directory.
When I am testing it, I always get a mapping runtime error.
Any ideas?
--Evaggelos
Guys,
First of all, I am doing an end to end testing, i.e. I let the FTP adapter pick the file up and another FTP adapter delivers the file to target folder. I am definitely not testing the mapping in mapping editor.
I get the error in Request message mapping (pipeline step, which I can see in SXMB_MONI transaction) which is a dummy mapping between two message types that I have created and are based on two data types with two fields each.
The UDF's that I have created go in-between the source and target fileds of the message types/data types.
The error that I see in the trace section of the XML message in SXMB_MONI is the following:
"<Trace level="1" type="T">RuntimeException during appliction Java mapping com/sap/xi/tf/_MM_G_SRS_FileTransfer_MNS_</Trace>
<Trace level="1" type="T">java.lang.NullPointerException at com.sap.aii.mappingtool.tf3.AMappingProgram.exceptionCaught$(AMappingProgram.java:59) at com.sap.aii.mappingtool.tf3.Transformer.checkParserException(Transformer.java:182) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:149) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:102) at com.sap.aii.ibrun.server.mapping.JavaMapping.executeStep(JavaMapping.java:64) at com.sap.aii.ibrun.server.mapping.Mapping.execute(Mapping.java:91) at com.sap.aii.ibrun.server.mapping.MappingHandler.run(MappingHandler.java:90) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleMappingRequest(MappingRequestHandler.java:95) at"
I have included some trace.addWarning() lines in Java code to help me debug my code, but I cannot see them anywhere inside the trace to be getting executed.
I will try Bhavesh's idea and I will write the code in the Java Section of my message mapping ( either Intialization or Destrcution ) section.
Similar Messages
-
Getting processflow and mapping names at runtime
how can I indenfy at runtime in a generic way the name of my actual process flow or mapping so that I can refer to this (maybe for error logging aspects)?
Hi,
within a mapping, use an expression operator. For an output attribute, use the expression get_model_name
It returns the mapping name at runtime.
Regards,
Carsten. -
File and directory names with Danish characters
I have installed the Novell Client v2.0 for Linux on my Open Suse 10.3. The Client is connecting to my Netware servers (6.0 & 6.5) without any problems...
There is one problem... Filenames and directory names with the Danish , & (ae, oe & aa), e.g the filename bger.doc (bger = books) is shown as b. and when clicking the file the file disappears from the file list. It seems to be the same problem with the German (umlaub).
What to do?
/MichaelOriginally Posted by J.H.M. Dassen (Ray)
mimo <[email protected]> wrote:
> There is one problem... Filenames and directory names with the Danish ,
> & (ae, oe & aa), e.g the filename bger.doc (bger = books) is shown as
> b. and when clicking the file the file disappears from the file list. It
> seems to be the same problem with the German (umlaub). What to do?
As far as I know, the Novell Client for Linux expects that file and
directory names use the UTF-8 encoding and does not support a traditional
8-bit encoding like ISO 8859-1. Try changing the encoding of file and
directory names to UTF-8 as described in
SDB:Converting Files or File Names to UTF-8 Encoding - openSUSE
HTH,
Ray Dassen
Technical Support Engineer, EMEA Services Center, Novell Technical Services
Novell, Inc. Software for the Open Enterprise Software for the Open Enterprise
Seems a good hint. When I create a folder or file from within SUSE using an "Umlaut" everything is OK and NCL 2.0 displays them correctly as they are UTF-8 formatted.
The proposed tool is no solution: one cannot convert folders or files that one cannot see (does it work for folders at all?). Maybe a windows tool would work because one could search for all files or folders with "Umlaute" and convert them. Other options? -
Getting Application root directory name dynamically
hi all,
For some reason I need to get Application root directory name dynamically
and use it somewhere.
Im using resin and default app dir is "doc" i've another directory "abc" and set
that as application root directory.
So from jsp i need to get the application root directory name.
thx in adv,
kiranhttp://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#getRealPath
use the following in you jsp
<%=application.getRealPath("/")%>this will give you the application root directory. -
File Scenario with Dynamice Filename and Directory
Hi All,
we have a requirement that PI has to pickup the file from 2 FTP Server.
First PI has to pickup an XML file from Server1 , this XML file has a details about the Filename and Directory of the second FTP server., then PI should login to the server2 and pickup the file form the directory.
Regards,
ManiHi Mani,
Can you try below approach ,
Read file 1 from Server 1 using sender file Communication channel and read 2nd filename and directory details and pass these values to UDF/Java mapping to log in to server 2 and retrieve the data/file2 ?
Thanks
Hari. -
Java Message Mapping : Dynamic FileName and Directory for ASMA
How to Put Dynamic FileName and Directory for ASMA Properties of File Receiver adapter in Java Message Mapping ???
I know How to Do this in UDF , But In Java Type Message Mapping . How to do this ????
Regards
PS.Hi
chk this:
http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=95093307
Thanks
Amit -
Getting the context and host name during initialization
I am trying to find a way to get the Context path and the host name during the ContextInitialized event, but without any luck. I think it is very strange that you can not even find the context path or the host name of the application you are running yourself.
Does anybody have an idea?What I mean are the configuration elements which are put in the server.xml
The BIG problem with the getServletContextName is that this returns the name which is put in the web.xml. But I have a web application which is generic and only some config parameters should be altered. Thats why I need to now in which context I am.
I think the deployment of web applications is wrong by design. I have to specify deployment information inside the application package which in fact should be presented to the servlet container separately. It's like installing new applications on a computer. It should be possible to create 1 installation file (read a web archive) and then specify the location where you want to install it while deploying it (read specify the host name, context location etc.) Now these two are mixed together which I think is wrong.
Besides the above problem, I think it is also not correct to let users specify properties while configuring a context (either in the server.xml or the web.xml) and then not having an equivelant in the object model (Read the ServletContext object).
Morten -
Getting sequence filename and sequence name in process model error handler
We are using the sequential process model and would like to log sequence step error information to a file. We have an Error Handler callback in SequentialModel.seq and that is where we will write to the error file. In the Error Handler callback, I can get the error container info for the step where the error occurs and the name of the that step thru the Error Handler Step parameter. I would also like to record the sequence file and the sequence where the error occurred, but I have not been able to find those in the sequence context. I know they are available because the TestStand RunTime Error dialog box displays them. How can I access the name of the sequence file and the name of the sequence where the error occurred?
Thanks,
HansHey hans,
Use the API. Since you already have the Step object reference coming in as a parameter you can just use a few ActiveX steps to get the Sequence File and Sequence from which the error was thrown.
Step.Sequence
Sequence.Name (gets the name of the sequence)
Sequence.SequenceFile
SequenceFile.Path (gets the path of the sequence file)
So basically just 4 activex steps. I hope this helps.
Regards,
jigg
CTA, CLA
teststandhelp.com
~Will work for kudos and/or BBQ~ -
Get filename and full path from Forms on local directory in MS Windows
I am writing a Form, when clicking a Push Button, I can click on sub-directory and select a filename, and the filename and the full path are then passed to a Text Item.
Does any one know how this could be done?which version of forms?
webforms you can use the webutils bean thing.
client server forms there is/was the hierarchical tree object -
Dynamic File and Directory Name without Mapping
Hello Experts,
We have following requirement:
1) Files will be picked from R/3 AL11 directory and would be placed in corresponding folder in target system.
2) On source side ,there would be only one folder for all types of files(around 20),but on target side,there would be one folder for each kind of file(20 folders)
3) File name should be same on the target side but target directory should be selected based on file name.
I have gone through a number of posts related to similar requirements and hence,sorry for a new post but I am not yet able to find a solution to this.
I could understand,this can be achieved using DynamicConfiguration UDF .
But I have no possibility to have mapping in my scenario.It would just be a pass through scenario.
Can anyone please suggest a solution to this?
Thanks.
Regards,
ShwetaHello,
Thanks a lot for suggesting solution to this problem.
I could achieve this using following Java mapping:
import com.sap.aii.mapping.api.*;
import java.io.*;
import java.text.*;
import java.util.*;
public class GetDynamicConfiguration implements StreamTransformation {
private Map param;
public void setParameter(Map map1) {
this.param = map1;
public void execute(InputStream inputstream, OutputStream outputstream) throws StreamTransformationException {
try {
AbstractTrace trace = null;
// a) Set ouput File name
String directory=null;
trace = (AbstractTrace)param.get(StreamTransformationConstants.MAPPING_TRACE );
param.put(DynamicConfigurationKey.create("http://sap.com/xi/XI/Dynamic", StreamTransformationConstants.DYNAMIC_CONFIGURATION), "");
DynamicConfiguration conf = (DynamicConfiguration) param.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "Directory");
String filename =conf.get(key);
conf.put(key, filename);
trace.addInfo("File name is "+filename);
if(filename.equals("in.txt"))
directory = "/home/ftpxi/in";
if(filename.equals("test.txt"))
directory = "/home/ftpxi/in/test";
if(filename.equals("shweta27.txt"))
directory = "/home/ftpxi/in/test";
trace.addInfo("Directory name is "+directory);
conf.put(key1, directory);
// b) Just copy input file to output file
byte[] b = new byte[inputstream.available()];
inputstream.read(b);
outputstream.write(b);
} catch (Exception exception) {
exception.printStackTrace();
Thanks again.
Regards,
Shweta -
Dynamic FileName and Directory - UDF
My scenario is to get Target Directory Name based on part of Filename. How can I do that using UDF. I will select adapter specific parametrs and like to change using UDF. TO achive this I will create a dummy field names in the target structure. Can someone let give me UDF code?.
For Example: Source FileName : SD00123456Prod.csv
Target Directory Should be /Sales/
Target File: Prod.csv
Thanks for any help.I changed function this time. I took exact coy of Michals Blog.
Function:
public String SourceFileName(Container container){
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;
Now the error when activate message mapping:
Activation of the change list canceled Check result for Message Mapping Source_2_Target | http://test.com: Starting compilation Source code has syntax error: /usr/sap/DPI/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Map36d73f104e5e11db977f001125a56eca/source/com/sap/xi/tf/_Source_2_Target_.java:55: cannot resolve symbol symbol : variable conf location: class com.sap.xi.tf._Source_2_Target_ String ourSourceFileName = conf.get(key); ^ 1 error -
Impdp: looks right, but still getting ORA-39087: directory name invalid
This is fairly mysterious, particularly since I've done this many other times without problems.
I created the directory C:\OracleImportTest on the server's filesystem, created a corresponding directory object DP_DIR in Oracle, and granted my user read and write access to it. I've been staring at it and trying different things all morning, but I still get the following results:
C:\test>impdp cgernon/**** DIRECTORY=dp_dir SERVICE_NAME=test1 DUMPFILE=export.dmp LOGFILE=import.log
Import: Release 11.1.0.6.0 - Production on Friday, 27 May, 2011 12:01:08
Copyright (c) 2003, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 11g Release 11.1.0.6.0 - Production
ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-39087: directory name DP_DIR is invalid"But Mercurial!" you say, "surely you screwed something up setting up the directory and either it doesn't exist or you don't have access to it!" I would be the first to agree that is the most likely cause of the problem, but performing the following queries to double-check leaves me in a state of complete confusion:
select * from all_directories;
OWNER DIRECTORY_NAME DIRECTORY_PATH
SYS DP_DIR C:\OracleImportTest
select * from user_tab_privs where table_name = 'DP_DIR';
GRANTEE OWNER TABLE_NAME GRANTOR PRIVILEGE GRANTABLE HIERARCHY
CGERNON SYS DP_DIR SYS READ NO NO
CGERNON SYS DP_DIR SYS WRITE NO NO Does anyone know of any other conditions that can trigger this error, or see anything I'm missing here? I am thoroughly mystified. Thanks!Good suggestion, but I'm still getting the same error ... using that command, as typed above.
HOWEVER, changing the command as follows works:
impdp cgernon/****@test1 DIRECTORY=dp_dir DUMPFILE=export.dmp LOGFILE=import.logWhich brings up another question. In the past, I've used the SERVICE_NAME option to specify the TNS Name for the database instance I want to connect to. Is that not what this option actually represents? And if not, why was it working for me in the past?
At this point, I guess my original problem is resolved, but if anyone can explain the SERVICE_NAME option to me, I would appreciate it - thanks! -
Good day,
I searched through the forum and cant find anything.
I have around 300 published reports on SSRS and we are busy migrating to a new system.
They have already setup their tables on the new system and I need to provide them with a list of table names and column names that are being used currently to generate the 300 reports on SSRS.
We use various tables and databases to generate these reports, and will take me forever to go through each query to get this info.
Is it at all possible to write a query in SQL 2008 that will give me all the table names and columns being used?
Your assistance is greatly appreciated.
I thank you.
Andre.There's no straightforward method for that I guess. There are couple of things you can use to get these details
1. query the ReportServer.dbo.Catalog table
for getting details
you may use script below for that
http://gallery.technet.microsoft.com/scriptcenter/42440a6b-c5b1-4acc-9632-d608d1c40a5c
2. Another method is to run the reports and run sql profiler trace on background to retrieve queries used.
But in some of these cases the report might be using a procedure and you will get only procedure. Then its upto you to get the other details from procedure like tables used, columns etc
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Get path and file name from Bfile
Hi,
I'm using Bfile to store images in a database. Is there a way to get the path and file name of the image from Bfile, because I need to pass that information into an image processing function.
Many thanks.
SheldonCan you use FILEISOPEN in the DBMS_LOB package?
See http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96591/adl03prg.htm#281893
-- CJ -
PowerShell - Need to output filename and company name
Hi
I've looked into get-ChildItem and Get-Item but can get neither to output the company name which would be handy for me later on. This is to help me just double check dll files which just belong to the company I work for.
Ideally, can anyone advise me the next step in working this out. I've googled and looked that the member of these two commands but still not sure how to progress :-
Get-ChildItem | Get-MemberHi Chen
Thats exactly what I was looking for. Thank you so much.
Can I ask? How did you know that FileVersionInfo contains so many properties or what is it just general knowledge?
If I run a command like this, it wouldn't be obvious that CompanyName is a property that can be found within Get-Item
(Get-Item*)|Get-Member
Cheers
Matt
Maybe you are looking for
-
Problem in sending table to excel in attach file .
I want to send excel file in attachment ( build from my internal table ) . so i use func. SO_DOCUMENT_SEND_API1 and it's ok. But when i want to send line bigger than 255 characters in the attach i can't do so , The table "CONTENTS_BIN" is type SOLI
-
[JS CS3] Why do sub menus disappear?
Hello, The below script creates a new menu with three sub menus. One of the sub menus invokes a script, while the other two are still under construction. This seems to work except for one irksome thing: When I close InDesign and then reopen it, the m
-
Copy standard bapi to Zbapi in the same standard package
Dear SAP, I wanted to copy a standard bapi into Zbapi. As soon as i do this it is asking for access key. Is it ok to use the access key and create?? Is there any exit to do this ? Please help me in this regard. The Bapi name /AFS/BAPI_SALESORD_CREAT
-
Extra files from C Drive are beng included in Dreamweaver site file
Has anyone encountered this issue? Extra files from computer's C Drive are being included in the Dreamweaver website cache (within Dreamweaver) but are not located in the website file on the computer. Any suggestions are appreciated. Thank you
-
unable to open pc files from my migration to new mac; can see them but finder says they have been moved or deleted and will say i don't have permission to open any clues???