Upload 2 files and compare its contents

Hi guys,
I want to upload 2 files in SAP and compare its contents.
How am i going to do that?
Please provide sample code... Thanks a lot!
rgds,
Mark

Hi Mark,
I expected to use this code, once u can try this code.
  OPEN DATASET lv_filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
  IF sy-subrc = 0.
    LOOP AT gi_output1 INTO gwa_output1.
      CLEAR lv_string.
      CONCATENATE gwa_output1-matnr
                  gwa_output1-maktx
                  gwa_output1-werks
                  gwa_output1-bmeng
                  gwa_output1-posnr
                  gwa_output1-idnrk
                  gwa_output1-ojtxp
                  gwa_output1-mngko
                  gwa_output1-mmein
                  gwa_output1-flag
                  INTO lv_string
                  SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
      TRANSFER lv_string TO lv_filename.
      IF sy-subrc <> 0.
        MESSAGE e006(zpdm).
      ENDIF.              "if sy-subrc <> 0.
    ENDLOOP.
     OPEN DATASET lv_filename FOR appending IN TEXT MODE ENCODING DEFAULT.
  IF gi_output2[] is not initial.
    LOOP AT gi_output2 INTO gwa_output2.
      CLEAR lv_string.
      CONCATENATE gwa_output2-matnr
                  gwa_output2-ojtxb
                  gwa_output2-werks
                  gwa_output2-bmeng
                  gwa_output2-posnr
                  gwa_output2-idnrk
                  gwa_output2-ojtxp
                  gwa_output2-mngko
                  gwa_output2-mmein
                  gwa_output2-flag
            INTO  lv_string
       SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
      TRANSFER lv_string TO lv_filename.
      IF sy-subrc <> 0.
        MESSAGE e007(zpdm). " WITH text-006.
      ENDIF.           "if sy-subrc <> 0.
    ENDLOOP.
  ENDIF.

Similar Messages

  • Accessing a file and reading its contents.

    Hi all,
    I created a Portal Application to access a file and display its contents in an iView .
    But it showing the exception like "File Not Found".
    In simple java application i could able to get the result. In portal application i couldn't .
    I have given the full path of the file location.
    I need a help regarding this?
    Regards,
    Eben

    IS the file on the portal server? It must be visible to the service user that runs the Java engine...

  • How to create a file and store its contents into another file?

    Hi,
    I'm having some trouble trying to create a code where I have to to create a file and store its contents into another file?
    I read the API, but I'm not certain how this file thing works.
    Here's my code so far:
    public static void main(String[] args) throws Exception
              File file = new File("tasks.txt");
              if (file.exists())
                   System.out.println("File already exists");
                   System.exit(0);
              Scanner scan = new Scanner(System.in);
              Scanner scan2 = new Scanner(System.in);
              //Scans the input line by line
              scan.useDelimiter("\\n");
              //Scans the input by tabs
              scan2.useDelimiter("\\t");
              PrintWriter outputs = new PrintWriter("newtasks.txt");
              outputs.print("ok");
              outputs.println(3);
              outputs.close();
         }

    I managed to change my text into uppercase, but how do I store the uppercase content into another file.
    -So this is what I did so far, I took a text file and modified its strings to uppercase.
    -Now I need to put those modified strings into another text file, is there a way where I can do that with my current code?
    -I already tried printwriter, but it doesn't seem to work
    public static void main(String[] args)throws IOException
              //Task[] oneHundredTasks = new Task[100];
              String uppercase;
              String combine;
              Scanner scan = null;
              FileInputStream in = null;
            FileOutputStream out = null;
            PrintWriter output = null;
            try
                 scan = new Scanner(new BufferedReader(new FileReader("tasks.txt")));
                 scan.useDelimiter("\\n");
                 scan.useDelimiter("\\t");
                while (scan.hasNext())
                     if(!scan.hasNext())
                          scan.next();
                     combine = scan.next();
                     uppercase = combine.toUpperCase();
                     System.out.println(uppercase);
            finally
                if (scan != null)
                    scan.close();
            //The program will try the input and output files
            try
                 in = new FileInputStream("tasks.txt");
                out = new FileOutputStream("newtasks.txt");
                int c;
                //The number "-1" is used to indicate that it has reached the end of the stream.
                while ((c = in.read()) != -1)
                    out.write(c);
            finally
                if (in != null)
                    in.close();
                if (out != null)
                    out.close();
         }

  • How to browse a file and extract its contents

    i want to browse a file and extract its contents.My code is given below but its not working .Can anybody help me please
    JFileChooser fc = new JFileChooser();
              int returnVal = fc.showOpenDialog(jfrm);
              if (returnVal == JFileChooser.APPROVE_OPTION)
              File file = fc.getSelectedFile();
              //This is where a real application would open the file.
              fileName=file.getName();
              //This is a file function to extract data from a file.
              //It reads data from a file that can be viewed on cmd
              jlab3.setText(fileName);
              try
    // Open the file that is the first
    // command line parameter
    FileInputStream fstream = new FileInputStream(fileName);
    // Convert our input stream to a
    // DataInputStream
              DataInputStream in =new DataInputStream(fstream);
    // Continue to read lines while
    // there are still some left to read
    // while (in.available() !=0)
    // Print file line to screen
              fileName1=in.readLine();
              jlab3.setText(fileName1);
              in.close();
    catch (Exception e)
              System.err.println("File input error");
              }

    JFileChooser fc = new JFileChooser();
    int returnVal = fc.showOpenDialog(jfrm);
    if (returnVal == JFileChooser.APPROVE_OPTION)
    File file = fc.getSelectedFile();
    //This is where a real application would open the file.
    fileName=file.getName();
    //This is a file function to extract data from a file.
    //It reads data from a file that can be viewed on cmd
    jlab3.setText(fileName);
    try
    // Open the file that is the first
    // command line parameter
    FileInputStream fstream = new FileInputStream(fileName);
    // Convert our input stream to a
    // DataInputStream
    DataInputStream in =new DataInputStream(fstream);
    // Continue to read lines while
    // there are still some left to read
    // while (in.available() !=0)
    // Print file line to screenHere you are reading the first line of the file
      fileName1=in.readLine();
    //}and here you are displaying the line in a (I suppose) JLabel. A JLabel is not very suitable for displaying a file content, except is the file contain few characters !!!
    jlab3.setText(fileName1);
    in.close();
    catch (Exception e)
    System.err.println("File input error");
    }If you want to read the complete file content you must uncomment lines inside while instruction, like this
    while (in.available() > 0) {  // I prefer to test in.available like this, instead of !=
      // append text to a StringBuffer (variable named sb here) or directly in a textarea.
      sb.append(in.readLine());
    ...

  • Can a servlet read a jsp file and display its contents?

    Hi,
    I would like to know if Servlets can read a Jsp file and display its contents.. Right now for our website, I am using a html file to be displayed after a successful post operation through the Servlets...
    -Thanks!

    I posted this in another thread.
    Here's some code that reads using a URL. This doesn't work with JSPs as the server executes JSP when it connects but it's useful for other file types. Note that the filename is a URI</h1>This is <code>show.jsp</code></h1>
    <hr>
    <%! String file = null; %>
    <%! java.io.InputStream is = null; %>
    <%
    file = request.getParameterValues("filename")[0];
    try {
       is = (new java.net.URL(file)).openStream();
    } catch (java.io.IOException ioe) { out.write(file + " not found!<br>"); }
    java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(is));
    String line = "";
    %>
    <pre>
    <%
    while((line = in.readLine()) != null) {
    %>
    <%=line%>
    <%
    %>
    </pre>

  • How To read lib*.so files and verbose its content

    Hi
    Is there any command with which we can read shared library files and see whats its contents are i.e. whats are the functions available inside it and how its control flow.
    Regards
    Jeet

    I know of none that shows flow control but you can do a man against nm(1) to see what is in the library (nm libc.so.1).

  • Upload excel file and display content in sapui5 table

    hi:all
       how to upload  excel files and display its contents in the view of sapui5  table ,then  'create ' these data into the abap database using odataservice.
         Do you have any solutions ? I appreciate for your help.

    Two possible way come to mind.
    1. ADF DI (desktop integration): sorry, don't know enough about it to give a how to :-(
    2. POI (http://poi.apache.org/) : open source project to read and write excel file with java. Using POI you can open the .xsl file, read it's contents and display it as af:table. For this you need to read the xsl into a data structure (this can be a temporary db table or a list of POJOs) and build a data control out of it. This you can drop on a page as table.
    Timo
    Edited by: Timo Hahn on 15.02.2010 13:59

  • Upload unicode file and display content in a textarea

    Hi all,
    I am trying to do the following;
    1. upload a unicode file (file with some non-english characters)
    2. after uploading, read the uploaded file and show the content in a textarea in a jsp page.
    I use struts in my project. I use class org.apache.struts.upload.FormFile for uploading the file. The upload works fine. I do the upload with help of FormFile's getInputStream method. When i read and display the content in the textarea, the content is displayed junk. But i tried to open the uploaded file, its fine. I mean it is just as my source file. Please help me out for reading the uploaded unicode and displayed in a textarea.
    Below is the code that i use to upload the file;
    File tempFile = null;
    FileOutputStream fos = null;
    InputStream is = null;
    try {
         tempFile = "c:/ThaiText.txt";
         fos = new FileOutputStream(tempFile);
         is = theFile.getInputStream();
         // Transfer bytes from in to out
         byte[] buf = new byte[1024];
         int len;
         while ((len = is.read(buf)) > 0) {
              fos.write(buf, 0, len);
         logger.info("fileName$$=" + tempFile.getName());
    } catch (Exception e) {
            logger.error(e);
         throw e;
    } finally {
         closeOutputStream(fos);
    }Below is the code that i use for reading the uploaded file's content and store it to a string. I set this string to a form bean's string property.
    public static String readContentNonUTF8(String path) {
         FileInputStream fis = null;
         String value = "";
         try {
              fis = new FileInputStream(path);
              byte[] buf = new byte[1024];
              int len;
              while ((len = fis.read(buf)) > 0) {
                   String tmp = new String(buf, 0, len);
                   value = value.concat(new String(tmp.getBytes()));
         } catch (Exception e) {
              logger.error(e);
         } finally {
              try {
                   fis.close();
              } catch (Exception e) {
         return value;
    }

    Hi,
    Thanks for your reply. You meant that both method also can used to upload file and submit data? How about if i want to use the first method to upload file and submit data? How can i upload the file by using first method?

  • I have purchased a monthly subscription to Adobe PDF pack so that i can edit a PDF file, i have uploaded the file and its now in "my assets". how do i now edit this file??

    I have purchased a monthly subscription to Adobe PDF pack so that i can edit a PDF file, i have uploaded the file and its now in "my assets". how do i now edit this file??

    You can't edit a file with PDF Pack, but you should be able to convert it to a Word document, and if you are really lucky edit THAT and make a new PDF. Don't expect too much though!

  • Reading a properties file in a servlet and passing its contents to a JSP pa

    Hi all,
    I'm totally new to Servlet pgmg n JSP. Please can ne1 tell how to read a simple properties file (in a servlet) and pass its contents to a JSP page.Actually the reason is to fill a combo box in a JSP page with the contents of a properties file.If calling a servlet for the same is d best way to do that, plz can ne1 tell me :
    1> whether to override the doPost method in the servlet in which to read d file using FileInputStream
    2> Putting the contents in an array and then how to pass this array to the JSP page.
    Thanks,
    deepthy.

    I'm using a properties file to let my web application know what the name of the database is. I'm using an abstract class GeneralDao which will be extended by all the DAO's (Data Access Objects or java classes containing SQL statements).
    Here's the code :
    protected Connection getDatabaseConnection()
              throws Melding
         Connection dbconn = null;     
         ResourceBundle resBundle;
         try
         Class.forName("com.mysql.jdbc.Driver").newInstance();
         resBundle = ResourceBundle.getBundle("gcoConfig");
         String dbConnectie = resBundle.getString("databaseconnection");
         gcoLogger.debug("lezen databaseconnection in resourceBundle " );
         dbconn = DriverManager.getConnection(dbConnectie);
         } catch (InstantiationException exc)The ResourceBundle is used to read the properties file, named gcoConfig.properties.
    With the getString() command I read the content of the string named databaseconnection.
    The gcoConfig.properties file is placed inside the folder C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\gco\WEB-INF\classes
    The GeneralDao is placed in the folder C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\gco\WEB-INF\classes\org\gertcuppens\cluifDao.
    So this class is placed some folder below the WEB-INF\classes folder of gcoConfig.properties.
    And the content of the properties file is just one line :
    databaseconnection=jdbc:mysql://localhost/cluif
    If you want to let the JSP know what's inside the properties file, wrap the content in a Javabean, put it in the request or even the session and pass the control to the JSP.

  • I have made .indd file with some form fields in it, now haw to read these fields and manipulate its content through script in indesign

    I have made .indd file with some form fields in it, now haw to read these fields and manipulate its content through script in indesign

    It's probably best to ask in the InDesign Scripting forum:
    InDesign Scripting

  • Strange issue - XI somtimes process a file and sometimes its not detected

    Dear friends,
    We have a strange problem. I’ll describe the situation:
    We have a simple file to file scenario without any mapping or File Content Conversion. Daily a sender system puts a ZIP file on a server and XI processes this file.
    The strange thing is that XI sometimes processes this file and sometimes its not detected at all. After our analysis we come to conclusion that its not random.
    We have looked at almost everything. We have checked the:
    File name;
    Size of the messages.
    Authorisation;
    Users that are assigned to the processing job.
    Has anyone experienced the same problem or does anyone has a suggestion?
    Helpful points will be rewarded,
    Kind regards,
    Kamran

    Hi Mickael,
    There are no stupid questions, there are only stupid answers. So I hope my answers are not stupid
    1. what is your Polling Interval of your Sender Agreement ? Once a day ? every 60s ? etc...
    because you say that your Legacy put the file Daily.
    Answer: The polling Interval is 400 seconds and Modification Check is 400000 Msecs
    2. Are you sure that your Legacy does not put the file after or during the XI adapter try to catch it?
    Answer: No Because Modification Check works perfectly and we get alerts if the file is modify during the process.
    3. Does your filename is always the same ?
    4. or Have you a filename which can changed and which is case sensitve (lowercase and uppercase).
    Answer: It has always the same name and It starts with O2C.zip
    5. What are the size of your failed file?
    Maybe it's too big and maybe you have a timeout somewhere (for instance into the adapter log)
    Answer: It's not too big, it varies from 20 MB to 100 MB and we know that we can process files up to 700 MB
    As I told before we have checked everything. Its very strange...
    Do you have any other suggestion?
    Regards,
    Kamran

  • HT5527 I have had my storage reduced once already.  In the process they removed my "Save" mailbox and all its contents.  I do notcare about contents so much as starting a new Save box.  How?  (OS X 10.7.5)

    My iCloud storage is being reduced.  I have already had it reduced once.  In the process they removed my "Save" mailbox and all its contents.  (One would think that that would be the last thing they removed.  But they took that and the "Trash" mailbox, yet left several thousand old and read messages which were in my "Inbox".)  I do not expect to get the "Save" contents back, but I would like to restore the "Save" mailbox, so that I can start from scratch saving msgs in it again.  But I cannot figure out how to do that.  When I go to "Mailbox" on the top line (between View and Message) and select New Mailbox I get a dialog box in which I can name a new mailbox.  When I type Save, for the name of the new Mailbox I get a response; "The mailbox 'Save" already exists."  But I cannot find it.
    Thanks,  Bill Burner

    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Repair Database. If that doesn't help, then try again, this time using Rebuild Database.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. (In Library Manager it's the FIle -> Rebuild command)
    This will create an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. 
    Regards
    TD 

  • I used to have an application in my iPhone 4 and 4s that captures business card and creates its content to my contacts. Its no longer working with my i5. Can you recommend me a new apps for this same function

    I used to have an application in my iPhone 4 and 4s that captures business card and creates its content to my contacts. Its no longer working with my i5. Can you recommend me a new apps for this same function

    Try CardMunch it works well for me

  • HI. I have itunes 10.6.1.7. When I goto movies i am not able to add and when I click on add file to library and select the file and add its not getting added. When i goto Library it says  that movies I add are in library.Which I cant add

    HI. I have itunes 10.6.1.7. When I goto movies i am not able to add and when I click on add file to library and select the file and add its not getting added. When i goto Library it says "feature films and home movies you add to itunes appear in movies in your iTunes library. To play a movie, just double click it". And below are two options for Downloading movies from store and rent movies. Please help.

    I get the exactly the same problem with win 7, i rang apple support who suggested i try another machine/or create another account on my machine???? why should i, stupid ipad 3rd gen is now sitting here un syncable, apple support ....tut tut very poor support, its a shame im out of the 7 day period otherwise this ipad would be going straight back, older versions of itunes worked fine, some one must know a fix for this??

Maybe you are looking for

  • How do I change the email for my icould account on my iphone 4s?

    I have an iPhone 4S. I have an old email for my icloud that shows on my iPhone 4S. My actual Appleid is a new one that I've had for awhile now. The iPhone when hooked up via USB to my computer is signed in under my new email, however keeps the old em

  • Mac email doesn't work with iCloud

    Since the move from mobileme email to iCloud I can only get email accounts working for a short period, and sometimes not at all on agiven day. What we had on mobileme was a family acount with 4 active email accounts. These all worked fine and all cam

  • Question about functional of a FI/CO infoCube

    Hi all, I'm a new BW consultant. I've an assignment that investigating about functionals of 0FIGL_C01 and 0SD_C03 infocubes and their queries. Does anyone know something about that? please help me Regards, Chuong Hoang

  • How can I record an Adobe meeting with audio from BT MeetMe?

    I am trying to record an Adobe Connect meeting however would like to record the audio from a BT MeetMe conference. Is there a way to tie the two together?

  • Why does Creative cloud cost 33% more in the UK than in USA?

    Creative cloud cost $49.99 per month in the US - which is the equivalent of £31 In the UK Creative cloud cost £46.88 which is the equivalent of $73 Sorry why are we charged so much more? It's the same service? Why? Looks like a rip off to me.