How to create a table in the file using java code.?

HI,
I should export the data from the view objects to a word document. I have done that but I should
display the data in the form of a table.
Kindly come up with the necessary information on how to create a table in the file using java.
Thanks,
Phani

Hi, Thank you for responding to my query.
The below are the details of my code.
DCBindingContainer dcBindings =
(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding StudentDetailsContent =
(DCIteratorBinding)dcBindings.get("StudentView1Iterator");
OutputStreamWriter w = new OutputStreamWriter(outputStream, "UTF-8");
Row currentRow =
StudentDetailsContent.getRowSetIterator().first();
Object a[]= currentRow.getAttributeValues();
int i;
for(i=0 ;i<=a.length;i++){
w.write(a.toString());
w.write(" ");
w.flush();
I am usning this coding to achieve the task of exporting data to file.
I need to display this information in the table that is where I need help from you people.
Thanks,

Similar Messages

  • How to create and edit a .ini file using java

    Hi All...
    Pls help me in creating and editing an .ini file using java...
    thanks in advance
    Regards,
    sathya

    Let's assume the ini file is a mapping type storage (key=value) so lets use Properties object. (works with java 1.4 & up)
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.Properties;
    public class Test {
         private static Properties props;
         public static void main(String[] args) throws IOException {
              File file = new File("test.ini");//This is out ini file
              props = new Properties();//Create the properties object
              read(file);//Read the ini file
              //Once we've populated the Properties object. set/add a property using the setProperty() method.
              props.setProperty("testing", "value");
              write(file);//Write to ini file
         public static void read(File file) throws IOException {
              FileInputStream fis = new FileInputStream(file);//Create a FileInputStream
              props.load(fis);//load the ini to the Properties file
              fis.close();//close
         public static void write(File file) throws IOException {
              FileOutputStream fos = new FileOutputStream(file);//Create a FileOutputStream
              props.store(fos, "");//write the Properties object values to our ini file
              fos.close();//close
    }

  • How do I produce an excel file using java code

    How do i produce an excel file using java code.
    If it is possible would ne one have ne source code as an example.
    I have tried looking up information on outputing the information to a *.csv file but unfortunality i have had no luck in finding any information. To be exact ne source code.
    Thanks
    Lee

    That's what I use and I'd be the first to admit that it's very messy. But it works. Go use Google and see what else you can find.

  • Code for reading the and placing the file using java webservice

    Hi All,
    Can anybody can guide me on how to read a file and place the file using java.
    Let  me know if any code is available which has been completed using java.
    Regards,
    Rahul

    Hi,
    The "square" symbol that you are referring to is probably a CRLF (Carriage Return - Life Feed) Control Character.
    This is more commonly known as a "Enter" at the end of a line / sentence.
    To clean this character from strings in Java, please use:
    String patternStr = "(?m)$^|[\\r\\n]+\\z";
    String replaceStr = " ";
    Pattern pattern = Pattern.compile(patternStr);
    Matcher matcher = pattern.matcher(inputStr);
    return matcher.replaceAll(replaceStr);
    Hope that helps.
    Thanks.
    p256960.

  • How to Write in bold to a file using java I/O classes?

    Hi,
    Using I/O classes I want to prepare a .doc file in which some text will be there. I want that text to be formatted. Like some text I want to be bold. Some text to be italic. How can I write bold/Italic text to the file using java I/O classes.
    Thanks
    Prashant

    By .doc file, I'm assuming you mean an MS Word document, yes? (fyi, Word Perfect also used the .doc extension)
    The .doc format is proprietary to Microsoft and isn't documented by them. In order to output a file in .doc format you'd have to understand that format correctly, otherwise MS Word will spit out it's tongue at you, call you names, and maybe send the Microsoft Police to "audit" your PC Software Licensing.
    Fortunately for you there is an open source project to demangle the microsoft file formats. See http://jakarta.apache.org/poi/ and especially pay attention to the HDF project (Horrible Document Format).
    - David

  • Not able to checkout Files using Java Code and SAP BAPI  from DMSServer

    Hi
    Able to download / checkout the files using T-Code SE37 (BAPI_DOCUMENT_CHECKOUTVIEW2).
    But when same RFC is executed from Java, it alsways says -
    Message ::::::::Document LGL/10000000003/000/00 does not exist
    My inputs in Java Code is as below -
    import java.io.*;
    import java.util.*;
    import com.sap.mw.jco.*;
    //CREATED ON - 10-APRIL-2010.
    public class BapiDocCheckOutview {
         public static void main(String args[]){
              try{
                   if(mConnection!=null){
    JCO.Repository repository=new JCO.Repository("AraSoft",mConnection);
    JCO.setMiddlewareProperty("jco.middleware.allow_start_of_programs", "SAPFTPA");
    JCO.Function function=repository.getFunctionTemplate("BAPI_DOCUMENT_CHECKOUTVIEW2").getFunction();
                        //End of get function.
                     System.out.println("Before execution1");
                     if(function !=null){
                   JCO.Field DOCUMENTTYPE = function.getImportParameterList().getField("DOCUMENTTYPE");
                    DOCUMENTTYPE.setValue("LGL");
                    JCO.Field DOCUMENTNUMBER = function.getImportParameterList().getField("DOCUMENTNUMBER");
                    DOCUMENTNUMBER.setValue("10000000003");
                    JCO.Field DOCUMENTPART = function.getImportParameterList().getField("DOCUMENTPART");
                    DOCUMENTPART.setValue("000");
                    JCO.Field DOCUMENTVERSION = function.getImportParameterList().getField("DOCUMENTVERSION");
                    DOCUMENTVERSION.setValue("00");
                    JCO.Field GETSTRUCTURE = function.getImportParameterList().getField("GETSTRUCTURE");
                    GETSTRUCTURE.setValue("1");
    JCO.Field GETCOMPONENTS = function.getImportParameterList().getField("GETCOMPONENTS");
                 GETCOMPONENTS.setValue("X");
    JCO.Field ORIGINALPATH = function.getImportParameterList().getField("ORIGINALPATH");
                  ORIGINALPATH.setValue("C:
    TEMP
    DMS_");
    JCO.Field GETHEADER = function.getImportParameterList().getField("GETHEADER");
                          GETHEADER.setValue("X");
    JCO.Field PF_FTP_DEST=function.getImportParameterList().getField("PF_FTP_DEST");
              PF_FTP_DEST.setValue("SAPFTPA");
    //JCO.Field PF_HTTP_DEST=function.getImportParameterList().getField("PF_HTTP_DEST");
         //PF_HTTP_DEST.setValue("SAPHTTPA");
                          System.out.println("Here Setting Values Inside Structure ::DOCUMENTFILE");
    JCO.Structure DOCUMENTFILE=function.getImportParameterList().getStructure("DOCUMENTFILE");
    DOCUMENTFILE.setValue("1","ORIGINALTYPE");
    DOCUMENTFILE.setValue("WWI","WSAPPLICATION");
    DOCUMENTFILE.setValue("ZHCL_CS","STORAGECATEGORY");
    DOCUMENTFILE.setValue("E0DF7893E2BD5DF19C07001517B4A299","APPLICATION_ID");
    DOCUMENTFILE.setValue("E0DF7893E2BD5FF19C07001517B4A299","FILE_ID");
    DOCUMENTFILE.setValue("X","CHECKEDIN");
    DOCUMENTFILE.setValue("X","ACTIVE_VERSION");
                            //DOCUMENTFILE.setValue("LGL","DOCUMENTTYPE");
                            //DOCUMENTFILE.setValue("10000000003","DOCUMENTNUMBER");
                            //DOCUMENTFILE.setValue("000","DOCUMENTPART");
                            //DOCUMENTFILE.setValue("00","DOCUMENTVERSION");
                          //JCO.Field GETCOMPONENTS = function.getImportParameterList().getField("GETCOMPONENTS");
                          //GETCOMPONENTS.setValue("X");
                          //JCO.Field GETHEADER = function.getImportParameterList().getField("GETHEADER");
                          //GETHEADER.setValue("X");
                        mConnection.execute(function);
    If anyone have an Idea on what I have missed out...
    Please do advice me.
    Thanks
    Prashant

    Hi
    To update in the initial requirement, I have added (prefixed, zeroes) in Document No., doing that, now the  application is able to find the document, but not able to transfer the same from DMS Server to my local Machine, always giving the following error -
    Type ::::::::E
    Message ::::::::File d:\dms\z_IPI_PRASHANT01.doc cannot be created
    Please let me know, if some services needed to checked in SAP System or some more information to be provided in RFC.
    Thanks
    Prashant
    Dear Experts
    Any advice on this. Still not able to download the documents from DMS Server.
    I have also added few more code in my Java program -
         private int use_sapgui;
         public void setSapGui(int use_sapgui){
              use_sapgui = 2;
    PLease help !!
    Regards
    Edited by: Prashantroy on Sep 26, 2011 12:49 PM
    Hi,
    Further to my earlier Mail, while checking the Trace suing SM59 in ECC System I got  the following Error -
    Trace file opened at 20111010 142232 India Standard Time, SAP-REL 701,0,134
    ======> cannot open SAPGUI
    ABAP Programm: SAPLSYSE (Transaction: )
    User: IPI_PRASHANT (Client: 220)
    Destination: SAPFTP (handle: 3, , )
    SERVER> RFC Server Session (handle: 1, 43220900, {5D1DF3E0-ACBD-F11F-8EA0-00A0D1
    SERVER> Caller host:
    SERVER> Caller transaction code:  (Caller Program: java)
    SERVER> Called function module: RFC_START_PROGRAM
    Error RFCIO_ERROR_SYSERROR in abrfcpic.c : 1742
    FUNCTION: 'exec_sapgui'
    cannot open SAPGUI
    PROG =sapftp erpdev sapgw00 43232164 IDX=4
    Can someone help me in getting this sorted out.
    Thanks N Regards
    Edited by: Prashantroy on Oct 10, 2011 2:32 PM

  • Read an excel file using java code

    Hi,
    I want to create an excel file on the client machine based on the personal details entered on the web page. And I want to save the file on the client machine in the form of CSV. Then I want to read the contents of the spreadsheet using Java Code from the using servlets. Can I read the contents of the file directly from the client machine or do i need to save the file on the server and then read the contents of it. Please help me solve this.

    Hi,
    I want to create an excel file on the client machine
    based on the personal details entered on the web
    page. And I want to save the file on the client
    machine in the form of CSV. Then I want to read the
    contents of the spreadsheet using Java Code from the
    using servlets. Can I read the contents of the file
    directly from the client machine or do i need to save
    the file on the server and then read the contents of
    it. Please help me solve this.As stated I am rather certain that is impossible.
    Servers don't access the file systems of client machines.

  • How can we get requester's user id using java code

    Hi,
    How can we get requester's user id using java code?
    eg: If i had logged in as xelsysadm and request a resource for user uid101 on the userid field it should display uid101 and not xelsysadm.
    also,
    I have a resoure "A" which on revoking should also revoke resources B and C. How can it be done. Resource A, B, and C are 3 different resource objects.
    ==Thanks,
    doki

    Ok, so there is a way, but it's not available during submission. You can use the findRequests api. From the result set, get the "Requests.Consolidated Data Value" value. In this information, you will get an xml formatted data. It provides the list of users on the request on the left side after submission. After the request is completed, this value is available. Upon completion, you could get the request information, get this value, and parse the information for user ids.
    In the same adapter, use the following API:
    formIntf.setObjectFormData(objInstanceKey, formHash)
    The formHash is a hashtable containing the field name on your object form, and the values you wish to populate it with. You could create a textarea box on your object form and populate the userids for who the request is for.
    However, this makes absolutely 0 sense. When you get a request, the list of userids are listed right there on the request.
    -Kevin

  • How to send sms to mobile from tomcatserver using java code?

    Hi,
    Could you please let me know that,
    How to send sms to mobile from tomcatserver using java code? Please provide the code snippet.
    Thanks in advance.

    Yes, but something needs to send that message. You can't just take an arbitrary computer and send an SMS, it does not have the hardware to do that.
    So either you have a mobile through which you do that or more likely - you use some sort of online service to do it. Whatever choice you make will determine what code you will have to write to get it done. Nobody is going to deliver the code to you, that's your job. It is also your job to figure out what service you are going to use.

  • How to create search path for the file on the desktop..

    hello experts..
          I have used gui_upload module to upload the data from flatfile to the internal table, in that how can i create search path for the file selection in the selection screen, also please help me the code to update the ztable.
    thanks

    HI
      If iam not wrong you want to select a file from a location that you don't know so if this is ur problem then use the function module
    F4_FILENAME
    this FM helps to locate and select the desired file from the system.
    Sample code that you can check is
    How to get windows filename
    PARAMETERS: lv_file LIKE rlgrap-filename.
    Method 1
        CALL FUNCTION u2019KD_GET_FILENAME_ON_F4u2019
        EXPORTING
        MASK = u2019,.txt,.*u2019
        STATIC = u2019Xu2019
        CHANGING
        FILE_NAME = LV_FILE.
    Method 2
    CALL FUNCTION u2019F4_FILENAMEu2019
    EXPORTING
             program_name = syst-cprog
             dynpro_number = syst-dynnr
             field_name  = u2019 u2019
         IMPORTING
             file_name   = LV_FILE.
    Regards
    Pavan

  • How to create a table in the following format?

    Hi,
    I want to create a table of the following layout :
    ATTRIBUTE     Text Key     Description
                         12           B
                        13           C
                         8           D
                         0           F
                         8           G
                         8           G
                         8           U
    Base                    8            K
                        8            M
                        8            N
                        8           Pre
                       80           Pre
    In the table i have added Text key and Description fields.
    But I dont know how to add attribute field with only one value in the middle of the coloumn(BASE) and the whole colomn as blank.
    Please help
    Smriti

    Hi.. Singh....
    What is the table you are talking about?
    Custom table?
    Internal table?
    What all you given? Entries?
    Get back again....
    Thanks,
    Naveen.I

  • How to Create a table in the middle of a transaction ?

    This software was written for sql and has a number of temporary table calls within transactions. We cannot precreate the temporary tables as some of the columns vary.
    So we create temp tables on the fly during the transaction, but the problem with that is that Oracle will commit your transaction at the point you create a temp table.
    Here's the logic:
    Begin Transaction
    Do some inserts, updates and deletes (IUDs)
    Create Global temp Table zx as select <some of those IUDs>
    Do some more inserts, updates and deletes
    Drop temp tables
    If worked
    Commit
    else
    Rollback entire transaction
    This is what I've tried so far:
    1. Run the create table on a different connection - has no visibility to the IUDs in the current transaction
    2. Split the create table and insert (instead of using CREATE AS) statements - to allow just the create table to be on a different connection - its going to be too much work to rewrite all the statements
    3. Create a permanent table instead of a temp table - same problem with committing data before the transaction has ended
    4. Put the Create As in a stored proc with AUTONOMOUS TRANSACTION turned on - same problem it has no visibility to the current outer transaction

    Thanks for coming on this thread
    The tables are used throughout the product, for example to
    (a) simplify complex queries, some too complex for oracle to process in one stmt
    (b) sub selects which will be reused
    (c) performance enhancements
    (d) left joins to summary queries
    We have 120 tables in our data model and there are many scenarios where temp tables are used. In sql server its not considered such a problem and programmers often create temp tables "on the fly".
    In fact, when we ported to oracle a couple of years ago, we had to add more temp table creates because some of the queries were too complex for oracle.
    It would be at least a months work to rewrite so temp tables are either not used or precreated, and we really have to go live with this build by the end of the week.
    No doubt we will rewrite these parts of the product to cut out temp tables, or perhaps drop oracle as a supported database, but for the time being we have oracle customers waiting for other fixes so I must find a way of giving them this software without doing this huge rewrite

  • How to compare and edit Resource bundle file using java programe

    Hi All
    I have two resource bundle with key, value and some comments. I need to write a java code to compare both of the values of the keys and if the values are different then i want to replace the second value with the first value.
    Its a programe which will udpate the second file with the first file values.
    I tried using Properties class but it didnt worked because when i am saving the file using store method it removes all the comments and the order of text also got disturbed.
    How I need to do this any help appriciated.
    Please elt me know if someone needs more info.
    Thanks in advance.

    Let's assume the ini file is a mapping type storage (key=value) so lets use Properties object. (works with java 1.4 & up)
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.Properties;
    public class Test {
         private static Properties props;
         public static void main(String[] args) throws IOException {
              File file = new File("test.ini");//This is out ini file
              props = new Properties();//Create the properties object
              read(file);//Read the ini file
              //Once we've populated the Properties object. set/add a property using the setProperty() method.
              props.setProperty("testing", "value");
              write(file);//Write to ini file
         public static void read(File file) throws IOException {
              FileInputStream fis = new FileInputStream(file);//Create a FileInputStream
              props.load(fis);//load the ini to the Properties file
              fis.close();//close
         public static void write(File file) throws IOException {
              FileOutputStream fos = new FileOutputStream(file);//Create a FileOutputStream
              props.store(fos, "");//write the Properties object values to our ini file
              fos.close();//close
    }

  • How to create a mail user agent by using JAVA...

    my lecturer has asked me to create a mail user agent by using JAVA , i have no idea how to start this assignment......

    What part are you stuck on? Creating a GUI (look at the Swing tutorials), or writing the talk-to-mail-server bit? Look at Java Mail, or the email RFCs.

  • How to store grid points in a file using Java Swing?

    Please someone help me with any suggestions about how to store the grid points in a file using Java Swing

    Actually i have designed a gridlayout in Java Swing and have added some components to it such as buttons or images....My problem is when I click on any of the cell of the grid,the corresponding cell number should be stored in an external file....Do u have any suggestions on how to do it?

Maybe you are looking for

  • Why is my battery discharge completely overnight even  when  the device is not in use?

    Why is my iPod battery draining completely overnight even when not being used and no apps are left open?

  • Photo Wallpapers in iOS7.2

    Why do my photos in Camera Roll blow up in size when I try to use them as wallpapers? This started when I updated to iOS7 and iOS7.2.

  • SAP Database

    Hi experts, How to make enter to SAP database and with querys SQL make reports? Is possible? How to make integration to softwares, of the reports, for example Ireports, CrystalReports? Tanks

  • How to copy album picture?

    Hello. I have a seperat program for printing labels for the cd's. That is labels to put directly on the cd - not cover. How can i copy the album picture to another program? Thanks Morten

  • Connecting to internet from wireless phone?

    Hello there - i have a friend that uses some sort of data type thing to connect her laptop (which is PC) to the internet. Does anybody know if this is possible to do with a macbook pro? I am trying to find a more economical way to get internet withou