Changing the file name dynamicallly in file Adapter

Hi i want to change the file name directly from Java Mapping in the file adapter
for this i have written this code
DynamicConfiguration dynamicConfiguration = (DynamicConfiguration)map.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
               DynamicConfigurationKey keyFile = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
               DynamicConfigurationKey keyDir = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
               dynamicConfiguration.put(keyFile,fileName);
               dynamicConfiguration.put(keyDir,outputpath);
but it gives a null pointer exception at dynamicConfiguration.put(keyFile,fileName);
please suggest.
regards
Nilesh Taunk.

Hi Nilesh,
If your requirement is to create , the file name dynamically for your receiver file adapter, you can do so using your <b>FILE ADAPTER CONFIGURATION</b> itself, and need not go for any JAVA Mappping / Java Code at all.
The dynamic filename generation concept is as follows.
In your filename field in the receiver file adapter, just give a variable with <b>%</b> symbols. (eg: %file% ).
Now, under the option <b>Variable Name Substitution</b>, you can give how the value has to be created.
<b>It can be your interface name, sender service name, etc or it can be some value dynamically from your payload.</b>
For the former, your give
<b>message:interface_name</b> ,etc
and for the payload part you give,
<b>Payload: "your element root which u wanna acecss"</b>
Just check this link out,
http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
And read the contents under variable substitution and it will help you understand the concepts better.
Also, in your FILE Adapter under the option FILE CREATION MODE, you have options like,
1.Add Counter,
2. Append
3. Create
4. Add Time Stamp
If you have any clarifications on this approach, do get back.
Regards,
Bhavesh

Similar Messages

  • Changing the display name of project file folders for TOC

    I'm interested in changing the display names of the project file folders for my TOC. For example, I want to name the folder "01-intro" so that it is short and lowercase. But I'd like the TOC to say "Introduction to the System." I know I can manually rename the folder in the TOC either through its properties or by right-clicking => Rename, but I auto-create the TOC occasionally and I don't want to have to rename every folder every single time.
    Does anyone know if there is a way to set a persistent property for the folder so that its display name in the TOC is different? I am using RoboHelp 9. I saw an option called "Detail" in the properties of the WebHelp layout in RoboHelp 8 that seems like it may have done that, but I no longer see this property in RoboHelp 9.
    Any assistance would be much appreciated. Thank you.

    I think the lack of response confirms that if you are going to use Auto Create, you have to accept the way it is.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • Changing the file name dynamicallly in file Adapter - NullPointerException

    Hi, I want to change the file name directly from Java Mapping in the file adapter for this i have written this code:
    [code]
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http:""/""/"+"sap.com/xi/XI/System/File","FileName");
    String newFileName = CCC'_'NNN'_'NOMCIA'_'DATE;
    conf.put(key, newFileName);
    return newFileName;[/code]
    Where CCC, NNN, NOMCIA and DATE are input of the user-defined function.
    but it gives a null pointer exception:
    [code]16:44:53 Start of test
    Runtime exception during processing target field mapping /ns0:MT_HSBCAltasTrabajadores_TEST/row/separador7. The message is: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._MM_JDBC_2_HSBCAltasTrabajadores_TEST_ method FileName$[123, James, Gates, Spectory, com.sap.aii.mappingtool.tf3.rt.Context@247d247d]
    com.sap.aii.mappingtool.tf3.MessageMappingException: Runtime exception during processing target field mapping /ns0:MT_HSBCAltasTrabajadores_TEST/row/separador7. The message is: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._MM_JDBC_2_HSBCAltasTrabajadores_TEST_ method FileName$[123, James, Gates, Spectory, com.sap.aii.mappingtool.tf3.rt.Context@247d247d]
    at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:347)
    at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:309)
    at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:309)
    at com.sap.aii.mappingtool.tf3.AMappingProgram.start(AMappingProgram.java:398)
    at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:141)
    at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:102)
    at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInternal(ServerMapService.java:431)
    at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:169)
    at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.execute(MapServiceBean.java:52)
    at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0.execute(MapServiceRemoteObjectImpl0.java:301)
    at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0p4_Skel.dispatch(MapServiceRemoteObjectImpl0p4_Skel.java:146)
    at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320)
    at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198)
    at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129)
    at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
    at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
    at java.security.AccessController.doPrivileged(AccessController.java:215)
    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Root Cause:
    com.sap.aii.utilxi.misc.api.BaseRuntimeException: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._MM_JDBC_2_HSBCAltasTrabajadores_TEST_ method FileName$[123, James, Gates, Spectory, com.sap.aii.mappingtool.tf3.rt.Context@247d247d]
    at com.sap.aii.mappingtool.tf3.rt.FunctionWrapper.getValue(FunctionWrapper.java:56)
    at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:291)
    at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:309)
    at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:309)
    at com.sap.aii.mappingtool.tf3.AMappingProgram.start(AMappingProgram.java:398)
    at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:141)
    at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:102)
    at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInternal(ServerMapService.java:431)
    at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:169)
    at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.execute(MapServiceBean.java:52)
    at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0.execute(MapServiceRemoteObjectImpl0.java:301)
    at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0p4_Skel.dispatch(MapServiceRemoteObjectImpl0p4_Skel.java:146)
    at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320)
    at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198)
    at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129)
    at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
    at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
    at java.security.AccessController.doPrivileged(AccessController.java:215)
    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Root Cause:
    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
    at java.lang.reflect.Method.invoke(Method.java:391)
    at com.sap.aii.mappingtool.tf3.rt.FunctionWrapper.getValue(FunctionWrapper.java:47)
    at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:291)
    at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:309)
    at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:309)
    at com.sap.aii.mappingtool.tf3.AMappingProgram.start(AMappingProgram.java:398)
    at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:141)
    at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:102)
    at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInternal(ServerMapService.java:431)
    at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:169)
    at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.execute(MapServiceBean.java:52)
    at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0.execute(MapServiceRemoteObjectImpl0.java:301)
    at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0p4_Skel.dispatch(MapServiceRemoteObjectImpl0p4_Skel.java:146)
    at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320)
    at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198)
    at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129)
    at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
    at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
    at java.security.AccessController.doPrivileged(AccessController.java:215)
    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Caused by: java.lang.NullPointerException
    at com.sap.xi.tf._MM_JDBC_2_HSBCAltasTrabajadores_TEST_.FileName$(_MM_JDBC_2_HSBCAltasTrabajadores_TEST_.java:564)
    ... 26 more
    RuntimeException in Message-Mapping transformation: Runtime exception during processing target field mapping /ns0:MT_HSBCAltasTrabajadores_TEST/row/separador7. The message is: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._MM_JDBC_2_HSBCAltasTrabajadores_TEST_ method FileName$[123, James, Gates, Spectory, com.sap.aii.mappingtool.tf3.rt.Context@247d247d]
    16:44:53 End of test[/code]
    Regards,
    Luis Diego

    Hey Luis,
    the container object only exists in message mapping runtime.
    Thus you're getting a null pointer exception there.
    For java mappings, remember that you have a .setParameter() method (which is necessary from definition of StreamTransformation interface),
    which sets the private variable param with the transformation parameters. In your .execute() method, just use it like this:
    DynamicConfiguration conf = param.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    Regards,
    Henrique.

  • How I may change the encoding names for downloaded files?

    I have some problem with encoding when I download files from russian sites. The downloaded files look like this "ìîé êàáèíåò - èíôîðìàöèÿ"

    Firefox, as is, will only download the file. You can choose where the file is
    saved, but that's it.
    Go to the '''''[https://addons.mozilla.org/en-US/firefox/ Mozilla Add-ons Web Page]''''' {web link}
    (There’s a lot of good stuff here) and search for '''download managers.'''
    Many of them give you a chance to change the file name.

  • I can not transfer date from one hard drive to another, I keep getting an error because I have two of the same file names and one file name is in caps and I cant change the file name

    can not transfer date from one hard drive to another, I keep getting an error because I have two of the same file names and one file name is in caps and I cant change the file name. My original external has an error and needs to be reformatted but I dont want to lose this informations its my entire Itunes library.

    Sounds like the source drive is formatted as case sensitive and the destination drive is not. The preferred format for OS X is case insensitive unless there is a compelling reason to go case sensitive.
    Why can't you change the filename? Is it because the source drive is having problems?  If so is this happening with only one or two or a few files? If so the best thing would be to copy those over individually and then rename them on the destination drive.
    If it is more then you can do manually and you can't change the name on the source you will have to reformat the destination as case sensitive.
    Btw this group is for discussion of the Support Communities itself, you;d do better posting to Lion group. I'll see if a host will move it.

  • Powershell: How to change the header name in a imported CSV file

    HI All,
    I have a csv file in which I want to change the headers names in powershell.
    oldnames are name,id
    newnames I want to give are: company and transit respectively.
    Following is what I wrote in script:
               $a = import-csv .\finalexam\employees.csv -header name,id'
                       foreach ($a in $as[1-$as.count-1])  // I used 1 here because I want it to ignore the  exiting headers.
                      { $_.name -eq company, $_.id -eq transit}
    I think this not entirely correct way to do this. Can someone show me how to fix this.
    Regards
    SQL 75

    If you're not an experienced PowerShell programmer, I recommend editing the file in a text editor and changing the name that way.
    -- Bill Stewart [Bill_Stewart]

  • Changing the field name at runtime in rpt file

    Hi everybody
    I'm using C# and Crystal Report XI (Deverlop license) to develop windows application in VS.net 2003.
    Please help me to change the field name of the bounded column of Crystal report file at the runtime.
    (In some case client's database had changed the structure as fieldname, fieldtype. Then they request a utility to change the field names in the .rpt file programmatically )
    Thanks
    GiangSon
    My email address: [email protected]

    user11200661 wrote:
    That's fine but still i want to prefix the schema name within the .sql file. My .sql should contain the name of that parameter only as i want to get that parameter replaced by the schema name at runtime. Some other users are using the same .sql file and they have access to that specific schema only. i want to make the .sql file more general so that it can be used by everyone without altering it every time.Sorry, your requirement no longer makes sense.
    If people have to access a specific schema because they need the script for general use, then you will have to hard code the schema name into it.
    If the script is to prompt for the schema name and connect to that schema and then use that schema name inside the called sql script, then people would not be able to use it generically, as it would be reliant upon the schema name being passed in.
    It sounds as if you're trying to write one generic thing that needs to do two different tasks.
    Just have two scripts and make life simple.

  • Changing the form name in a .js file

    hi,
    I am trying to use .js files instead of script in the jsp page with the use of
    <script src="root/scripts/foo.js"></script>.
    This foo.js has got the functions which access the information of the form in which they are included. So if I specify a dummy form name in the script, while a page (say "thisPage.jsp" with a form name "thisForm")is loading I would like all the references in the javascript file which are like this document.someFormName.---- to document.thisForm.--.
    How do I do this.
    regards,
    f

    actually, what you asked is completely a Javascript question. There's nothing JSP related about it. Nothing.
    Your actual question, the one you actually posted, was answered correctly. If your question was wrong, then that's not our problem.
    What does concurrent users have to do with anything anyway? Are they all using the same PC and browser instance at the same time? I doubt it. All the code you are referring to is Javascript code, and that will only run in the browser, not on the server, so concurrent user actions have nothing to do with it.
    If you want to change the form name in JSP, then you can do so when writing the page:
    <form name="<%= theFormName %>" action="..." method="POST">
    Otherwise, 'document.'+name ..., eval(), all that is Javascript, not JSP, has nothing to do with JSP or other users.
    So in conclusion, I don't think it's us people that posted answers interpretting things wrong, it's you who doesn't have any idea what he's doing.

  • Changing the Tape Name of a media file

    I need to change the Tape Name of an hour long media file that I captured a while ago.
    (Gave it the wrong name and didn't notice til today.)
    Is this possible?
    Can I use the new name if sometime down the line I need to recapture the media?
    Or are my only options to recapture or use the old name?
    I haven't done anything with the file, haven't started the edit yet.
    I need to change the Tape Name as well as the File Name and move it into a new FCP project.

    I wish I could share your conviction on this working. I have had many instances of reel number changes not following through the workflow. (afaik reel number info is not embedded into the quicktime file, it remains within the fcp project file. how can you see its there in the quicktime file Michael? ) only too frequently do reel numbers get corrected and then revert to the original bad reel number.
    I know this can be rectified by entering the right reel number in the first place, but human nature being what it is, especially when a big team is involved in ingesting footage, errors will creep in.
    our solution here is to maintain a clear trail to the source tape by prefixing the tape no into the name column.
    FCP's media managing being what it is, this has worked reliably for us.
    regards
    andy
    mac pro 2,66, 4gig ram, quad 2.5ghz g5, 4.5 gig ram,   Mac OS X (10.4.8)   G4 powerbook 1.67gHz, 2gig ram

  • Need help changing the setting to preview entire file names

    Using Leopard, I would like to to be able to read the entire name of a file.
    For example, my files might say (File 2.....609). What the file is named is File 2 Graphs 6209. How can I set up Leopard to allow me to read the entire file, so I don't have to guess the file?

    Ah! I tend to avoid using column view for folders containing items with long names, because it increases the amount of horizontal scrolling needed to see everything, & because I'm usually interested in seeing & sorting items by the non-name columns available in list view.
    FWIW, I tried the column view drag handle double click tip on one of the folders containing some of my extra long named items & it does expand to show the entire name, but I don't care for the result: the Finder window expands horizontally so much that it won't all fit within even a 24" widescreen display! So not only do I have to scroll the window's content horizontally to see everything, I have to move the window partially offscreen to do so. That is too much of a chore to make this a very good alternative for long path names.
    It occurs to me that there might be a more elegant, subtle, & "it just works" Apple-like solution possible: instead of just abbreviating the displayed item name by replacing enough of the middle characters of the name with an ellipsis to make it fit, it would be cool if this were adaptive & tried first to abbreviate the non-unique parts of the name, relative to all the items in the column. So if say 3 files in a view contained the same 12 character sequence, that sequence would appear with the same abbreviation in each file, more frequently preserving the display of the unique parts of each file name.
    Does this make sense?

  • How can transfer the read file name via own developed adapter module

    Hello experts,
    I want to know how I can handle the following issue:
    I developed a J2EE adapter module for the file adapter "sender" with the aim to read the file name of incoming files. Thereto I implement the following code like this:
    public ModuleData process(ModuleContext mc, ModuleData md) throws
    ModuleException
    Hashtable mp = (Hashtable)
    md.getSupplementalData("module.parameters");
    String fileName = null;
    if (mp != null)
    fileName = (String) mp.get("FileName");
    Now I get the filename which includes a order nr.  I need this order number to call a RFC Adapter via mapping. So my question is how can transfer this order nr to the RFC adapter?
    Kind regards,
    Fatih

    Hi,
    >> to read the file name of incoming files
    Use file adapter with Adapter specific identifiers selected.
    >>Thereto I implement the following code like this:
    use udf in message mapping and avoid module
    >>Now I get the filename which includes a order nr. I need this order number to call a RFC Adapter via mapping. So my question is how can transfer this order nr to the RFC adapter?
    use RFC Look up function in message mapping...
    Is module so necessary in this case???
    Regards
    Suraj

  • Why do I receive the exclamation point when I just change the album name? File goes missing?

    I keep all of my itunes media on an attached network hard drive.  Had no problems for months but over the past 45 days I've noticed that material has started to go missing that I know I did not delete.  I have found no malware on my system.
    I read a script to tell me all the files that had an exclamation point.  There were some TV shows (an entire season gone missing) and some CDs.
    I just did a test and imported a CD.  I then clicked "get info" and changed the name of the album.  Immediately I received the exclamation point and when I tried to find the original file it is gone.  I have no idea where the file has gone to.  I've tried searching, looking around to find it, and I can't. 
    Why is itunes having this behavior?  How is the file being deleted?  Any other thoughts or ideas of what I should do to stop this?
    I've also sent a support request to the hard drive mfg (lacie) but I'm not sure I'll get much help there.
    Thanks.

    More info:  I just ran the same test two ways.  One, I had some files on my desktop, run a script to move these files to the "automatically add to itunes" folder, the files move just fine to my external hard drive and to itunes.  The file plays just fine and the "get info" tab shows it is playing the file from the external hard drive where the file was moved to (not copied).  But, as soon as I change the artist name or the album, the file goes missing and I get the exclamation point.
    I ran the same test by putting the files on my desktop, but instead of moving the file to the "automatically add to itunes folder" I just double clicked the file to play it.  I let itunes add a copy and organize my folders.  This time, the file would have been copied (not physically moved) and I see itunes is playing the new copied version.  This time, when I try to change the artist name or album, I have no problems.
    I've never encountered this before.  Any info?  Thanks.

  • Is there a way to change the image numbers in a file in Aperture?

    Is there a way to change the image numbers in a file in Aperture? We shoot with two photographers and so the img numbers are not in order but I would like to have the photos in chronological order on the disc when I give it to them. Does anyone know how to do this? I have them all in order ready to go in Aperture but when I move them to the disc to be burned they default back to the img number order. Thanks for your help!

    What do you mean by "image number"? The file names like "IMG_7822.CR2" or "IMG_7822.jpg"?
    You can create custom names with appended numbers, when you export your image files to be saved on a disk.
    Sort your images by date in the browser, select them, then use the command "File > Export > Version" to write the files to the disk. Set the name format to "Custem Name with Index" or "Custom Name with Counter" to create numbered names in your current sort order.
    Regards
    Léonie

  • How to put the file name in notepad file

    dear frank,
    how to put the file name in notepad file via power shell. I mean i want to put the file name in that notepad file
    for example,
    my file name is ABL and in this file data is
    02/06/2015,180.00,182.00,176.01,180.50,1575500
    02/06/2015,4.20,4.20,4.20,4.20,500
    02/06/2015,113.50,113.70,112.91,113.09,157800
    02/06/2015,682.01,695.90,682.00,683.19,4250
    02/06/2015,213.98,215.00,213.00,214.87,326200
    02/06/2015,21.52,21.65,21.52,21.60,4000
    02/06/2015,111.00,111.25,108.25,108.91,17100
    02/06/2015,52.00,52.00,52.00,52.00,500
    and i want to data in this form
    ABL,02/06/2015,180.00,182.00,176.01,180.50,1575500
    ABL,02/06/2015,4.20,4.20,4.20,4.20,500
    ABL,02/06/2015,113.50,113.70,112.91,113.09,157800
    ABL,02/06/2015,682.01,695.90,682.00,683.19,4250
    ABL,02/06/2015,213.98,215.00,213.00,214.87,326200
    ABL,02/06/2015,21.52,21.65,21.52,21.60,4000
    ABL,02/06/2015,111.00,111.25,108.25,108.91,17100
    ABL,02/06/2015,52.00,52.00,52.00,52.00,500
    There are many file like this that i want to be edit
    plese tell me how can i do it, i think it is possible via windows power shell.
    thanks in advance.

    Hi
    Just for completeness, what version of VB.NET are you using?
    Here is a complete project to copy all the files with the added "ABL," at the start of each line.  You need to start a new Project with a BLANK default Form1, and replace all of Form1 code with the code below. When you run this project, you
    need to use the 2 buttons to set up the ORIGINAL file folder and a folder to place the copies. You need to check if the file EXTENSION is correct (I assumed txt), and check the text to add to each line is correct.  Once all is set up you should have a
    big red button to start the operation.
    NOTE: it is important that you try this out on a copy of some of the files to verify accuracy BEFORE trying on original files. Make sure you have a good back up of the original files before doing anything else.
    ' new project with default BLANK Form1
    ' replace all Form1 code with this code
    ' WARNING: make sure you have a backup of
    ' any files you use this application to
    ' operate on.
    Option Strict On
    Option Infer Off
    Option Explicit On
    Public Class Form1
    Dim OrigFileFolderPath As String = Nothing
    Dim CopyToFolderPath As String = Nothing
    Dim lab1, lab2, lab3 As New Label
    Dim tb1, tb2, tb3 As New TextBox
    Dim b1, b2, b3, b4 As New Button
    Dim fb As New FolderBrowserDialog
    Dim bgw As New System.ComponentModel.BackgroundWorker
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
    Me.Size = New Size(731, 300)
    With lab1
    .Text = "Original Files Folder Path"
    .Location = New Point(15, 5)
    End With
    With tb1
    .Width = 560
    .Location = New Point(10, 30)
    .BackColor = Color.Khaki
    .ForeColor = Color.Maroon
    .Font = New Font(Me.Font.FontFamily, 12)
    .BorderStyle = BorderStyle.FixedSingle
    .Anchor = AnchorStyles.Top Or AnchorStyles.Left Or AnchorStyles.Right
    End With
    With lab2
    .Text = "Copy Files to Folder Path"
    .Location = New Point(15, 125)
    End With
    With tb2
    .Width = 665
    .Location = New Point(10, 150)
    .BackColor = Color.Khaki
    .ForeColor = Color.Maroon
    .Font = New Font(Me.Font.FontFamily, 12)
    .BorderStyle = BorderStyle.FixedSingle
    .Anchor = AnchorStyles.Top Or AnchorStyles.Left Or AnchorStyles.Right
    End With
    With lab3
    .Text = "File Ext"
    .Location = New Point(600, 5)
    .Anchor = AnchorStyles.Top Or AnchorStyles.Right
    End With
    With tb3
    .Text = ".txt"
    .Width = 80
    .Location = New Point(590, 30)
    .BackColor = Color.Khaki
    .ForeColor = Color.Maroon
    .TextAlign = HorizontalAlignment.Center
    .Font = New Font(Me.Font.FontFamily, 12)
    .BorderStyle = BorderStyle.FixedSingle
    .Anchor = AnchorStyles.Top Or AnchorStyles.Right
    End With
    With b1
    .Text = "Choose Original Files Folder Path"
    .AutoSize = True
    .Location = New Point(10, 65)
    End With
    With b2
    .Text = "Choose Copy Files to Folder Path"
    .AutoSize = True
    .Location = New Point(10, 185)
    End With
    With b3
    .Text = "DO THE COPY"
    .AutoSize = False
    .Size = New Size(240, 50)
    .BackColor = Color.Red
    .ForeColor = Color.White
    .Font = New Font(Me.Font.FontFamily, 20, FontStyle.Bold)
    .Location = New Point(420, 80)
    .Anchor = AnchorStyles.Top Or AnchorStyles.Right
    .Visible = False
    End With
    With b4
    .Text = "CANCEL JOB"
    .AutoSize = False
    .Size = New Size(240, 50)
    .BackColor = Color.Red
    .ForeColor = Color.White
    .Font = New Font(Me.Font.FontFamily, 20, FontStyle.Bold)
    .Location = New Point(420, 80)
    .Anchor = AnchorStyles.Top Or AnchorStyles.Right
    .Visible = False
    End With
    Me.Controls.AddRange({lab1, lab2, lab3, tb1, tb2, tb3, b1, b2, b3, b4})
    With bgw
    .WorkerReportsProgress = True
    .WorkerSupportsCancellation = True
    End With
    AddHandler bgw.DoWork, AddressOf bgw_DoWork
    AddHandler bgw.RunWorkerCompleted, AddressOf bgw_Completed
    AddHandler b1.Click, AddressOf b1_Click
    AddHandler b2.Click, AddressOf b2_Click
    AddHandler b3.Click, AddressOf b3_Click
    AddHandler b4.Click, AddressOf b4_Click
    End Sub
    Private Sub b1_Click(sender As Object, e As EventArgs)
    fb.SelectedPath = My.Computer.FileSystem.SpecialDirectories.MyDocuments
    fb.ShowNewFolderButton = False
    Dim r As DialogResult = fb.ShowDialog
    If r = Windows.Forms.DialogResult.OK Then
    tb1.Text = fb.SelectedPath
    If IO.Directory.Exists(tb1.Text) AndAlso IO.Directory.Exists(tb2.Text) AndAlso Not (tb1.Text = tb2.Text) Then
    If tb3.Text = Nothing Then
    redo: tb3.Text = InputBox("Enter the file extension that you want to copy/change", "FILE EXTENSION")
    If tb3.Text = Nothing Then GoTo redo
    End If
    b3.Visible = True
    Else
    b3.Visible = False
    End If
    End If
    End Sub
    Private Sub b2_Click(sender As Object, e As EventArgs)
    fb.SelectedPath = My.Computer.FileSystem.SpecialDirectories.MyDocuments
    fb.ShowNewFolderButton = True
    Dim r As DialogResult = fb.ShowDialog
    If r = Windows.Forms.DialogResult.OK Then
    tb2.Text = fb.SelectedPath
    If IO.Directory.Exists(tb1.Text) AndAlso IO.Directory.Exists(tb2.Text) AndAlso Not (tb1.Text = tb2.Text) Then
    If tb3.Text = Nothing Then
    redo: tb3.Text = InputBox("Enter the file extension that you want to copy/change", "FILE EXTENSION")
    If tb3.Text = Nothing Then GoTo redo
    End If
    b3.Visible = True
    Else
    b3.Visible = False
    End If
    End If
    End Sub
    Private Sub b3_Click(sender As Object, e As EventArgs)
    b3.Visible = False
    b4.Visible = True
    If Not tb3.Text.StartsWith(".") Then tb3.Text = "." & tb3.Text
    bgw.RunWorkerAsync()
    End Sub
    Private Sub b4_Click(sender As Object, e As EventArgs)
    bgw.CancelAsync()
    End Sub
    Private Sub ReadPWFile(fn As String)
    Dim filename As String = My.Computer.FileSystem.GetName(fn)
    Dim barename As String = IO.Path.GetFileNameWithoutExtension(fn)
    Dim copyto As String = tb2.Text & "\" & filename
    Dim line As String = Nothing
    Dim lines As New List(Of String)
    Using sr As IO.StreamReader = New IO.StreamReader(fn)
    Do
    line = sr.ReadLine()
    If Not line = Nothing Then
    lines.Add(barename & "," & line)
    End If
    Loop Until line = Nothing
    End Using
    Using sw As IO.StreamWriter = New IO.StreamWriter(copyto)
    For Each s As String In lines
    sw.WriteLine(s)
    Next
    End Using
    End Sub
    Private Sub bgw_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs)
    Dim ftc As Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Computer.FileSystem.GetFiles(tb1.Text)
    For Each f As String In ftc
    If bgw.CancellationPending Then
    e.Cancel = True
    Exit For
    End If
    Dim ex As String = My.Computer.FileSystem.GetFileInfo(f).Extension.ToLower
    If My.Computer.FileSystem.GetFileInfo(f).Extension.ToLower = tb3.Text.ToLower Then
    ReadPWFile(f)
    End If
    Next
    End Sub
    Public Sub bgw_Completed(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs)
    tb1.Text = Nothing
    tb2.Text = Nothing
    b3.Visible = False
    b4.Visible = False
    MessageBox.Show("Finished copying files", "Job Completed")
    End Sub
    End Class
    Regards Les, Livingston, Scotland

  • Error dynamic File Name in Receiver File Adapter

    Hi all,
    Dynamic file name for Receiver file Adapter Problem
    my multi mapping look like this in design mode
    messages
         message1
              SD01_E
                   FileName
                   row
         message2
              SD02_E
                   FileName
                   row
    by processing the xml look like this:
    <ns2:SD01_E xmlns:ns2="urn:lsv.de/SAP/XXX">
    <FileName>L40SA939.xiConstant</FileName>
    - <row>
    or
    <ns2:SD02_E xmlns:ns2="urn:lsv.de/SAP/XXX">
    <FileName>L40SA939.xiConstant</FileName>
    - <row>
    in file receivere adapter  i have try this but it dos not work
    payload:SD01_E,1,FileName,1
    Error:com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 0(:main:, row:1, col:0)
    is there any way to have access to Filename  in different root elements??
    regards
    Ralf

    Hi Ralf,
    i think, you need for each XML msg (each different root element) a new adapter -> a new IF determination, new rec agreement and a new channel.
    Regards,
    Udo

Maybe you are looking for