Removing the empty line during Receiver FCC!

Hi, Guys,
I used file content conversion in receive FCC. My data type is like this:
<TextFromSAP_DT>
<FileName>
  <FileName>abc.txt</FileName>
</FileName>
<Record>
  <TEXT>dasfafaf</TEXT>
</Record>
<Record>
  <TEXT>qqqqqqqq</TEXT>
</Record>
<Record>
  <TEXT>fgfffff</TEXT>
</Record>
</TextFromSAP_DT>
I need to get file name from <FileName> and output a flat file with the value in <TEXT>. But I always got an empty line at the file beginning. And I tried to move <FileName> to the end. And I got an empty line at the file end. My custom said they are having trouble to read the file with the empty line no matter it is in the beginning or end.
I followed sample as link below but does not work. 
https://wiki.sdn.sap.com/wiki/display/profile/2007/07/30/Removing%20the%20empty%20line%20during%20Receiver%20FCC!
Does any body can give a help?
Thanks a lot!
Meiying
Edited by: Meiying Yang on Aug 14, 2009 11:16 PM

Hi Yang,
You create the value udf GetFileName with one input value say a. Add this code:
Imports: java.*;
Add this code:
   //write your code here
DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http:" + "/" + "/" + "sap.com/xi/XI/System/File", "FileName");
conf.put(key, a);
return "";
Map like this:
FileName --> GetFileName(udf) --> target_mt
Map other fields like:
Record --> Record
TEXT ---> TEXT
Save it and activate it. When you test in mapping you will get an error so dont worry. I go the error like:
RuntimeException in Message-Mapping transformation: Runtime exception during processing target field mapping /ns0:Target_MT. The message is: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._TestFileName_ method file1$[abc.txt, com.sap.aii.mappingtool.tf3.rt.Context@32dcebf1]
Dont worry about this activate and do the rest of the configuration.
In your receiver communication channel for file name put as FileName and check the file name in adapter specific message attributes. Then test it and it should work and you will get the file with file name abc.txt. I tested the whole end to end scenario and I am getting the file name abc.txt and the output what you want. If you still could not get it send me a m ail to my i d from my business card. I will send you the screen shots.
Regards,
---Satish

Similar Messages

  • How to remove the empty lines in the generated XML?

    Hi, XML/JDOM experts,
    I used JDOM to generate an XML file in my exercise of comparing two xml files.
    I used a lot of times addContent()...
    The resuting xml is fine for its contents.
    But I don't like so many empty lines (or carriage return).
    Would you help to refine the result?
    Best regards,
    AG
    Sample results:
    <li delta:property="Modified">
    <code delta:property="Modified">
    <delta:NewValue>foreignObject</delta:NewValue>
    <delta:OldValue>text</delta:OldValue>
    </code>
    <svg xmlns="http://www.w3.org/2000/svg" width="6cm" height="45px" delta:property="Removed">
    <rect y="0" x="27px" width="110px" height="45px" style="fill: #C1FFFF" />
    <foreignObject width="120px" y="0" x="20px">
    <div xmlns="http://www.w3.org/1999/xhtml">
    <ul>
    <li>First item</li>
    <li>Second item</li>
    </ul>
    </div>
    </foreignObject>
    </svg>
    <svg xmlns="http://www.w3.org/2000/svg" width="9.5cm" height="1.2cm" delta:property="Added">
    <text y="33px" x="13px" style="font-family: helvetica; font-size: 14pt; fill: #FFAA00">A simple
    text in SVG
    </text>
    </svg>
    </li>

    The solution is to add
    outputter.setTrimAllWhite(true);
    Below is the sample code.
         FileOutputStream out = new FileOutputStream("delta.xml");
         XMLOutputter outputter = new XMLOutputter(" ", true, "UTF-8");
         outputter.setTrimAllWhite(true);
         outputter.output(doc1, out);
         out.close();

  • Credit Release thru VKM3 remove the schedule line delivery block ...

    HI Gurus,
    I have created the sales order with the delivery block at the schedule line. i have save the order . The order goes to the credit block . So when i release credit block with the help of VKM3 then system also removes the schedule line level block.
    This is not std behaviour . Can any one come across such scenario ?
    Details: I have removed the routine 101 in the OVB8 so that if order goes to credit block still order will have the confirm qty.
    Also in the OVAK order type is mark D for automatic credit check.
    Thanks in advance

    Hi ,
    I have checked the sales order thru the program but we are not using any user exit for the same.
    Now i have found that if the qty is confirm on the first date i mean on the date given then system does not remove the block & if the ATP check suggest the diff date so there are two schedule line in this case block get removed ..
    May be this is like after credit removes system must be running the ATP check again ..
    Please help

  • How can i remove the empty sting from IList collection?

    How can i remove the empty sting from IList collection. If i use the code i got  System.NotSupportedException was unhandled exception. How can i achive this?
    IList record = (IList)records;
    int count = record.Count;
    for (int i = 0; i < count;i++)
    bool contains = record[i].Equals("");
    if (contains)
    record.Remove(record[i]);
    Is anyone know, please suggest me.
    Thanks in Advance!

    Try:
    items.RemoveAll(s => string.IsNullOrEmpty(s));
    Or you can filter them out using where:
    var noEmptyStrings = items.Where(s => !string.IsNullOrEmpty(s));
    Having fun with custom collections!
    Basics of .NET Collections in C#
    How does it work in C#? - Part 3 (C# LINQ in detail)
    Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP]

  • Remove the new line character

    Hello All,
    I have a CLOB in my database. That CLOB contains new line characters. Now I have to remove the new lines and make the whole CLOB object as a string without the new lines.
    Can anybody help in that matter ?.
    Thanks and regards,
    Sachin

    Check this code for file instead of CLOB and reply.
    import java.io.*;
    import java.io.FileInputStream;
    import java.io.InputStream;
    public class CLOBCheck {
         public static void main(String[] args) throws Exception {          
              InputStream fis = new FileInputStream("C:\\cpsweb.log");
              BufferedReader d = new BufferedReader(new InputStreamReader(fis));
              StringBuffer sfr = new StringBuffer();
              String line = null;
              int c = 0;
              while((c= fis.read())>-1){
                   sfr.append((char)c);               
              System.out.println(sfr.toString());          
              String a = sfr.toString().replaceAll("\n","");
              System.out.println(a);
    Thanks,
    Sachin

  • How do I remove the location line in a calendar appointment

    How do I remove the location line in a calendar appointment

    Hi Happy,
    To remove the ink tanks and print head from the printer, please follow the steps located here.  Please note that we do not recommend cleaning the print head using any other methods other than the ones built into the printer, as it may do damage to the printer.  If performing at least one cleaning and two deep cleanings on the printer do not resolve the issue, the printer may require servicing; please call or email us at one of the methods on the Contact Us page to obtain your servicing options.
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

  • How to remove the blank lines at the end of the JTextArea .

    Hi,
    I need to remove the blank lines in the JTextArea at the end. Suppose i am giving 'A' in the first line and press the enter key two times, after i am giving the 'B' in the third line and press enter key for two times. I need to remove, the last two lines of JTextAreae, . How i can remove these lines?

    String#trim() removes all whitespace from both ends of the String.
    The requirement was to remove line breaks from the end of the String only.
    String#replaceAll with a suitable regex would do the trick. Untested regex for this:text.replaceAll("[\\n\\r]+$", "")db

  • How to remove the last line of  SUBTOTAL_TEXT ?

    i have used this event but i am totaling displaying at bottom rather than total i am getting another line 
    that i no need so given a some idea a if possible give some code.
    it like as:
    saleso  item no quan  net amt
    5063        10       47.23   554.23
    5063         20      40.00   665.25
    TOTAL                87.23    1219.48
    ---> iam getting extra line  want to delete it give me some solution.
    thanks to all,
    shabeer ahmed

    >5063 10 47.23 554.23
    >5063 20 40.00 665.25
    >TOTAL 87.23 1219.48
    >---> iam getting extra line want to delete it give me some solution.
    what is that extra line, is it total line..?
    if You want to remove the total line
    layout-no_totalline = 'X'.

  • How to remove the thick line at the end of each page of my report

    Please how do I remove the thick line that appears at the end of each page of my report anytime I publish the report unto the Web.

    Bring up the property inspector against the report object. In here you will see the settings for HTML output. Remove the entry against the "After Page Value" property.

  • Remove the dotted line in the image map

    dear all, i would want to know how to remove the dotted line
    of the image map, for my case, i cannot see the dotted line in IE
    but can see the line in firefox, (in my boss computer, he can see
    the dotted line in both IE and firefox)
    i have try some method such as using the component of
    Remove
    IE Link Scrubber by PVII. while i find it is not work. could
    any one give some suggestion for me to remove the dotted link of
    the image map or give me some ways that other than using map.
    thx a lot !!!!!!!!

    i have find a way to solve the problem of the dotted line in
    the image map
    e.g. <map name="123" >
    <area style="cursor: hand" shape="circle"
    coords="223,261,76"
    onClick="checkit('m_strategic/m_strategic.cfm')"></map>
    the checkit() method is just to redirect the page into other
    page only.
    however another problem is face, the cursor will not change
    to hand when i point to the image map, i have try adding
    onMouseMove="this.style.cursor=hand" on the <area> tag
    however it don;t work, it only work when i put into the <img>
    tag. can any one tell me how to change the mouse cursor in this
    situtation??
    thx a lot

  • How to remove the gray line in JDeveloper?

    Hello,
    I'm working with JDev now.Now I'm facing a problem, when I want to format my codes in JDev I find many lines of code changed to double. I also notice that the point for newline is the gray line in the coding area.
    Now I want to remove the gray line or move it more right so I can format my codes really more beautiful.
    If there is anybody knows the way,please show me how to deal it.Thank you.

    Sorry,your answer has not figure my issue. The link you gave me does not contain my question.Thank you for your answer.

  • Skip the empty line while processing

    Hi all
    i'm reading from a file and i want to skip the empty line and process the line which has some data, but it seem that i doesnot process the "\n"as an empty line
    for example i have the following data
    i went to school
    (empty line)
    5 days a week
    (empty line)
    and i have the following code
        while((line = in.readLine() ) !=null) 
                 if(line!="\n")
                      codes=line.split("   ");
                      }//if else
                      else
                      //do nothing
                      }

    thanks dmbdmb
    it works
    may i ask another question
    i have a file which has several sentences but the spaces between these sentences are not unique i.e some time 3 empty lines some times more or less
    i have a code to make all the spaces just 1 between any sentece but it work with system.out.print but not with files any ideas
    here is the code
            StringBuffer buffer=new StringBuffer();
            try{
                BufferedReader read=new BufferedReader(new FileReader(fname));
    BufferedWriter br = new BufferedWriter(new FileWriter("111.txt"));
                String line=read.readLine();   
                boolean isNewLine=false;
                while(line!=null){
                    if(line.length()==0 && !isNewLine){
                        buffer.append("\n\n");
                                       isNewLine=true;
                    }//if
                    else if(line.length()!=0){
                        buffer.append(line);
                        System.out.println("in ELSE");
                        isNewLine=false;
                    }//else
                    line=read.readLine();
                }//while
                br.write(buffer.toString());
                 read.close();
           br.close();
            }//try
            catch(IOException ioe){
                ioe.printStackTrace();
            }

  • Is it possible to remove the delimiting line between Bookmarks bar and Tab bar?

    I place the Tab bar between the Bookmarks bar and the page content area, as the attached image shows.
    Is it possible to remove the delimiting line between Bookmarks bar and Tab bar? I feel that line is redundant.

    Your Tab bar doesn't look standard.
    Did you check the code with the default theme if you currently use a custom theme?
    ''(note that you can still use the code with a smaller font size if you like the monospace font; I do prefer this to make it easier to click the mouse)''

  • How to Remove the Last line of Instance in subform ?

    I thought I ran across an example in this forum of how to specify which instance you want to delete from a subform but I can not find it. I can get removeInstance to work but it removes the top line and I just want it to remove the bottom or last instance that was added. I can do it if I only had 2 instances and tell it to removeInstance(1); but the form is going to be dynamic and there will be more than 2 lines when people start to use the form.

    I've found the reason... :-)
    I'm using the designer from Acrobat professional instead of the designer from Adobe LiveCycle.
    I've got Acrobat professionnal 7.0.0 and trying your sample it didn't function.
    Knowing that there was a new version of Acrobat professional (7.0.7)I've installed it, and now your sample function.
    I have to mention that the count method is not listed in the choice menu that appears when you're typing code inside the designer. It means that some functions have to be tryed even if the popup menu of the list of available methods doesn't mention it.. (in this case it's the count method)... :-)
    There are a lot of things like that (for example there is the checkbox problems that are not good managed before Acrobat Reader 7.0.7, and Acrobat professional 7.0.7)
    So I suggest to the developpers that are reading this post to always install the last version of Acrobat Reader, Acrobat Professionnal, Designer, in order that everything goes well with the product.
    gpalmieri

  • How to Remove the Vertical Line in Forward Mail

    when using apple's mail program how do I remove the vertical line when I forward email ?
    Thanks

    If you are doing this on an iPhone:
    For forwarding or replying to an email without the Blue Vertical line to the left of the text...
    - Open the email
    - Select Forward or reply (this will open a new window)
    - Select All of the text in the new email.
    - In the pop-up bar that says "cut, copy, paste" select the right arrow for more options.
    - Select Quote Level
    - Select Decrease
    Voila!

Maybe you are looking for

  • How do I get the messgae icon to show number of unread messages?

    How do I change the message icon on the 5s to show the number of unread messages?

  • Java Packages and Imports

    Hi, I have 2 java classes A.java B.java ### A.java ### import B; public class A public static void main(String[] args) public class B public void foo() when I compile B , it works fine, but when i compile A. it gives following error '.' expected why

  • Data Guard configuration-Archivelogs not being transferred

    Hi Gurus, I have configured data guard in Linux with 10g oracle, although I am new to this concept. My tnsping is working well both sides. I have issued alter database recover managed standby using current logfile disconnect command in standby site.

  • User Exit for Transaction CO11N Transaction

    Hello Friends,                          I have a requirment , In the Transaction C011N , When I specify the Order Number, When I am confirming the Production Order , I want to compare the Item Level Material with some manipulated data .... But I am n

  • Thunderbolt 1.0 Firmware Update

    My new MBP Pro 13 inch, has a software update called Thunderbolt Firmware Update 1.0 (93kb) I have followed the onscreen instruction to download, install and restart. But when i click on software updates in the apple menu it still saids I need to get