Copyig Data from a TABLE MODEL (TABLE) TO A FILE

Hi guys,
I wont to copy data from a Default Table Model to a File can someone write a pease of code that will do that for me.
DefaultTableModel model = new DefaultTableModel();
JTable table;
public basic()
          super();
              model.addColumn("Full Name");
              model.addColumn("House No");
              model.addColumn("Address");
              model.addColumn("Town/County");
              model.addColumn("Postcode");
              model.addColumn("Telephone Number");
              model.addColumn("Email Address");             
              String[] socrates = { "Example", "33", "York RD", "Poole", "BH18 9RE", "01202776655", "[email protected]" };
              model.addRow(socrates);
          /**This is the main setup for the Address Book
          *This has the main settings for the size, title
          *And main features of the Address book.
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          this.setSize(new Dimension(800, 600));
          this.setTitle("Large Print Address Book");
          this.setLayout(new FlowLayout ());
          //Main Application Parts
          JLabel welcome = new JLabel("Welcome to Thomas's Address Book v2.0.1");
          welcome.setFont(arial20);
          this.add(welcome);
          //Menu Bar
          JMenuBar mb = new JMenuBar();
          this.setJMenuBar(mb);
          //Table
          table = new JTable(model);
          this.add(table);
          JMenu fm = new JMenu("File");
          fm.setFont(arial20);
          mb.add(fm);
          //Menu Items          
          JMenuItem Add = new JMenuItem("Add Record");
          Add.setFont(arial20);
          Add.addActionListener(new ActionListener()
               public void actionPerformed(ActionEvent e) 
                    addw a = new addw();                    
          fm.add(Add);
          //Import from a file
          JMenuItem inp = new JMenuItem("Import Records");
          inp.setFont(arial20);
          inp.addActionListener(new ActionListener()
               public void actionPerformed(ActionEvent e) 
                    //Opens Import Window.
                    inportw i = new inportw();                    
          fm.add(inp);
          JMenuItem quit = new JMenuItem("Exit");
          quit.setFont(arial20);
          fm.add(quit);
          quit.addActionListener(this);
class inportw extends JFrame
          //*Add Window Properties and Settings
          public inportw ()
               this.setSize(new Dimension(400, 150));
               this.setTitle("Inport Records");
               this.setLayout(new FlowLayout ());
               this.setVisible(true);
               //Nmae
               JLabel error_note = new JLabel("Error Here - Need to make table final!?");
               error_note.setFont(arial20);
               this.add(error_note);
               //Add Button
               JButton binport = new JButton("Inport");
               binport.addActionListener(new ActionListener()
                    public void actionPerformed(ActionEvent e) 
                         ArrayList data = new ArrayList();          
               this.add(binport);
     public void actionPerformed(ActionEvent e)
          System.out.println("Application Exit");
          System.exit(0);
     public static void main(String[] args)
          basic b = new basic();
          The information from the atable needs to go into a .txt file with each row on a new line. It also needs to be in the inport/export window that is in a class on its own when someone clicks export.
A complete peace of code would be helpfull that would do this for me. Thankyou guys.

Rite then,
In answer to both post yes i have done my own homework if thats what you wont to call it.
And to the second post yes i have put in a File to export to. the code has not be pasted on my origanal post.
//Export Button - Export Window
               JButton bexport = new JButton("Export (BUAB)");
               bexport.addActionListener(new ActionListener()
                    public void actionPerformed(ActionEvent e) 
                         System.out.println("Export Pressed ");
                         try
                             FileWriter file = new FileWriter("AddressData.txt");
                            BufferedWriter out = new BufferedWriter(file);
                             out.write("AddressBook data File");
                            out.close();
                         catch (Exception ei)
                         System.err.println("Error: " + ei.getMessage());
               this.add(bexport);This is the export button,
I think the code for the table model should be something like this:
I wont to do something like this
model.getModel().getValueAt(0, 0);
Arrylist data = new arrylist();
try
                             FileWriter ffile = new FileWriter("AddressData.txt");
                            BufferedWriter out = new BufferedWriter(file);
                             out.write(data);
                            out.close();
                         catch (Exception ei)
                         System.err.println("Error: " + ei.getMessage());
                             }          Im not 100% sure how to get the information from the model into the arrylist, though a loop.
If there is a section of a webpage that may help could someone please post it for me.
Unfortunatly for me Im visualy impaired and find some of this hard. I learn though looking at examples and creating my own programs that do something similar.
If no one wonts to help then that fine with me !

Similar Messages

  • How to insert data from JTable to mysql Table....

    hello everybody
    i need help about how to insert data from JTable to mysql table... i know about how to create Table model...facing problem about how to insert data from JTable to mysql table....any helping link or code ... ill be thankfulll....for giving me solution...

    table1.getValueAt(table1.getSelectedRow(),0)you are getting the value of a selected row... or if you want you can just use a loop..
    for(.....){
    table1.getValueAt(x,y);
    }I think you know INSERT STATEMENT.. here on it just string concat
    sample e.g. (This not insert)
    "delete from accrule " +
                    "where ruleid= " + tblRA.getValueAt(tblRA.getSelectedRow(),0)+
                    " and accountname='"+tblRA.getValueAt(tblRA.getSelectedRow(),1)+"'"

  • Upload data from Excel to Internal table in ECC

    Hello SDN,
    Here I am facing a problem for uploading the data from excel sheet to internal table in ECC6.0
    Main problem is we don't have any FM ALSM_EXCEL_TO_INTERNAL_TABLE.
    Please provide me the solution how to upload the data from excel to internal table through class. If possible please provide me the sample code so that it will be very helpful for me.
    Waitingfor your valuable response.
    Thanks & Regards,
    Kumar.

    Hi,
    you can use OLE to acces (not only) excel, but this will only work in dialog processing.
    regards,
    Hans

  • Upload data from excel to oracle table

    Hi,
    if i'm user and using an application and i want to upload data from excel to oracle table on button click . Is it possible by using sql loader.
    If yes then please clarify it .
    is it possible from client end.
    thanks
    kam

    Yes it is possible using SQL*LDR, External tables and ORCL Export Utility. Though I didn't try Export Utility to load the external files.
    SQLLdr sysntax:
    Create a control file.
    It looks like this
    Load data
    Infile 'source.dat' 
    Into Table tablename
    Fields terminated by ',' optionally enclosed by '"'
    {code}
    then use sqlldr command from your OS.
    {code}
    sqlldr userid/password@sid control = filename.ctl, data = source.dat, log = logname.log, bad = badname.log, discard = discardname.discard
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Data from Excel to ADF table

    Hi,
    I need to export data from excel to ADF table and edit the data and finally send it back to database.
    Would you kindly let me know how to proceed in this?
    Many thanks in advance
    Regards

    This depends on your excel file structure.
    You can use ADF Desktop Integration or
    something like this(for simple excel files):
    for excel -> adf table
    http://technology.amis.nl/2010/09/16/adf-11g-import-from-excel-into-an-adf-table/
    For adf table -> excel:
    http://www.baigzeeshan.com/2010/04/exporting-table-to-excel-in-oracle-adf.html
    http://adfreusablecode.blogspot.com/2012/07/export-to-excel-with-styles.html
    Dario

  • To upload data from excel to internal table

    hi
    in excel sheet it contains 4 tabs.to upload data from excel to internal table i have used this fm
    text_convert_xls_to_sap .but error wil comeing.that error in tables parameter.iternal table does not contain data.ple help me.(v 6.0) ple give me one example with coding

    Hello,
    Take a look on this: [ABAP - Upload data from Excel to Sap using OO|https://wiki.sdn.sap.com/wiki/x/xOw].
    Regards.

  • Load the data from a transparent customised table in BW to an ODS

    Hi there,
    How can you load the data from a transparent customised table created in BW to an ODS.
    Many thanks.
    Sarah

    Hi,
    just create a generic datasource in rso2 for that table, replicate the datasource for source system 'myself', create a infosource and assign the new datasource to that infosource. Create a update rule from infosource to ods, create a infopackage and load the data.
    regards
    Siggi

  • How to transfer data from a dynamic internal table

    Hi All
    I want to transfer data from a dynamic internal table<dyn_table>
    to a non dynamic internal table itab which should have the same structure as <dyn_table>.
    How can this be done?
    Regards,
    Harshit Rungta

    As stated earlier this can be done only through field symbols...
    You cannot create an non dynamic internal table with ANY structure...using DATA statement
    If the strucutre is defined well and good...you can create an non-dynamic internal table...
    If you do not know the structure then the internal table has to be dynamic...and to be generated using field symbols
    DATA: lv_ref TYPE REF TO data.
    FIELD-SYMBOLS: <fs_dyn_table> TYPE STANDARD TABLE.
    * You create a dynamic internal table...
    CREATE DATA lv_ref LIKE (your_dynamic_internal_table).
    ASSIGN lv_ref->* TO <fs_dyn_table>.
    Now...do the transfer.
    <fs_dyn_table> = "your_dynamic_internal_Table
    Hope it helps!

  • How to select data from a PL/SQL table

    Hi,
    I am selecting data from database after doing some screening i want to store it in a PL/SQL table (temporary area) and pass it to oracle reports.
    Is there any way to select the data from a PL/SQL table as a cursor. Or is there any other way of holding the temporary data and then pass it back as a cursor.
    Regards
    Kamal

    A PL/SQL "table" is anything but a table. Whoever came up with this term in PL/SQL to describe what is known as dynamic arrays (the correct programming terminology that existed since the 70's if not earlier and what is used in all other programming languages I'm familiar with)... well, several descriptions come to mind and none of them are complimentary.
    You cannot "select" from a PL/SQL dynamic array as it is not a table within the Oracle context of tables.
    Thus you need to convert (cast) a PL/SQL dynamic array into a temporary Oracle data set/table in order to select from it. This is in general a Bad Idea (tm). Oracle tables and SQL and concurrency controls and all that are especially designed for processing data. PL/SQL arrays is a very simplistic data structure with very limited usage. Why would you want to use that in SQL via a SELECT statement when you can use Oracle tables (or proper temp tables) instead? Besides that, it is also slow to cast a dynamic PL/SQL array into an Oracle SQL data set structure (context switching, copying of memory, etc).
    The proper way to use PL/SQL to generate data sets for use via the SQL engine is pipelined table functions.
    This is not to say that you should never use PL/SQL arrays and casting in SQL.. simply that you need to make sure that this is the correct and scalable way to do it. And that will also always be an exception to the rule when you do.

  • Loading data from flatfile to relational table,i am getting SQLLDR error

    Hi,
    While loading data from flatfile to relational table,i am getting SQLLDR error and i am unable to proceed further.
    Source is a flatfile and target is a Oracle database,i used "LKM file to oracle(SQLLDR)" and "IKM sql control append"
    and ran the interface.When i checked the seesion in operator window" after generating "CTL file" successfully
    the session got failed at "Call sqlldr" and was not able to proceed further.
    Environment details:
    ODI 11g
    database:Oracle 11g
    Operating system:Windows server 2008
    The error message it displayed in call sqlldr session file was
    org.apache.bsf.BSFException: exception from Jython:
    Traceback (innermost last):
    File "<string>", line 31, in ?
    File "C:\oracle\product\11.1.1\Oracle_ODI_1\oracledi\client\odi\bin\..\..\jdev\extensions\oracle.odi.navigator\scripting\Lib\javaos.py", line 198, in system
    File "C:\oracle\product\11.1.1\Oracle_ODI_1\oracledi\client\odi\bin\..\..\jdev\extensions\oracle.odi.navigator\scripting\Lib\javaos.py", line 224, in execute
    OSError: (0, 'Failed to execute command ([\'sh\', \'-c\', \'sqlldr DEVELOPER/pass_123@CPRDEV control="F:\\\\flatfile/CROSS_CURR.ctl" log="F:\\\\flatfile/CROSS_CURR.log" > "F:\\\\flatfile/CROSS_CURR.out" \']): java.io.IOException: Cannot run program "sh": CreateProcess error=2, The system cannot find the file specified')
         at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
         at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:345)
         at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:169)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2374)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java:1615)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java:1580)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java:2755)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2515)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:534)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:449)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1954)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:322)
         at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:224)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:246)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:237)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:794)
         at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:114)
         at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
         at java.lang.Thread.run(Thread.java:619)
    could u give me a solution to sort out this error ASAP.
    thanks,
    keshav.

    This was the following code generated .
    import java.lang.String
    import java.lang.Runtime as Runtime
    from jarray import array
    import java.io.File
    import os
    import re
    import javaos
    def reportnbrows():          
         f = open(r"F:\flatfile/TEST.log", 'r')
         try:
              for line in f.readlines():
                   if line.find("MAXIMUM ERROR COUNT EXCEEDED")>=0 :
                        raise line
         finally:
              f.close()
    ctlfile = r"""F:\flatfile/TEST.ctl"""
    logfile = r"""F:\flatfile/TEST.log"""
    outfile = r"""F:\flatfile/TEST.out"""
    oracle_sid=''
    if len('CPRDEV')>0: oracle_sid = '@'+'CPRDEV'
    loadcmd = r"""sqlldr DEVELOPER/<@=snpRef.getInfo("DEST_PASS") @>%s control="%s" log="%s" > "%s" """ % (oracle_sid,ctlfile, logfile, outfile)
    rc = os.system(loadcmd)
    if rc <> 0 and rc <> 2:
    raise "Load Error", "See %s for details" % logfile
    if rc==2:
    reportnbrows()

  • How to Pull data from sap r/3 tables to oracle tables

    how to fetch data from sap r/3 tables & data pulled to oracle table .
    GIVE THE APPROPRITE ANSWER FOR THIS.
    THANKS IN ADVANCE.
    If it is useful for me , i am giving point.
    regards ,
    Navita
    Edited by: NAVITA YADAV on Mar 7, 2008 2:07 PM
    Edited by: NAVITA YADAV on Mar 7, 2008 2:08 PM

    You need to perform some native SQL to fetch data. Before doing this connection must be exists b/w your R/3 and Oracle server.
    Basis team will help you to have connection.
    Check the connection name in the table DBCON.
    Check the below code to handle native SQL.
      SELECT SINGLE  DBMS
               FROM  DBCON
               INTO  DBTYPE
               WHERE CON_NAME = DBS.
      IF DBTYPE = 'ORA'.
        TRY.
          EXEC SQL.
            CONNECT TO :dbs
          ENDEXEC.
    ERROR Handling for Native SQL *************
          IF SY-SUBRC <> 0.
            MESSAGE `Docusphere connection failed.` TYPE 'I'.
            EXIT.
          ENDIF.
      EXEC SQL PERFORMING loop_output.
        OPEN C1 FOR
        SELECT  UK1, UK7, uk6, uk9, uk22, uk23, uk25    "field names of Oracle table
        FROM IIS_DOCS_AP10D
        WHERE ( UK2 = 'ZFIINVOICE' OR UK2 = 'ZFIPAYREQ' )    AND
        UK19 = 'E'                                           AND
        UK20 IS NULL
      ENDEXEC.
          DO.
            CLEAR W_OUTPUT.
            EXEC SQL.
              FETCH NEXT C1 into :wa1-arc_doc_id, :wa1-bukrs, :wa1-belnr, :wa1-gjahr, :wa1-wi_id, :wa1-ARCH_METHOD, :wa1-barcd.
            ENDEXEC.
    enddo.
    Reward points if helpful.................

  • Program or Function module to delete data from Open Hub Destination Table

    Hi All,
    Can anybody suggest me a Program or Function module to delete data from Open Hub Destination Table.
    Thanks & Regards,
    Vinay Kumar

    You can simply goto t-code SE14 mention the open hub destination table and Delete data by clicking on "Activate and Adjust database" with radio button "Delete Data".
    Regards,
    Arminder

  • JDBC-XI-FILE scenario. How to extract data from more than one table in JDBC

    Hi,
    I was asked a question like in JDBC-XI-FILE scenario........ How to extract data from more than one tables (i.e from JDBC system) ?? What is the logic to do the same ??
    I am not sure whether this is a valid question..........but any help in this regards is highly appreciated.
    Regards
    Kumar

    HI,
    Yes it can be possible ,please see the following links
    JDBC  Receiver with Oracle Stored Procedures
    configuring jdbc adapter with multiple tables
    RFC -> XI -> JDBC Scenario Updating Multiple Tables
    /people/alessandro.berta/blog/2005/10/04/save-time-with-generalized-jdbc-datatypes
    JDBC Adapter multiple Selects
    https://www.sdn.sap.com/irj/sdn/advancedsearch?query=jdbc%20with%20multiple%20tables&cat=sdn_all
    Regards
    Chilla..

  • Transfer data from ALV to Z table

    Hi,
    I need to confirm the exact procedure to transfer data from ALV into z table.I am entering few values at runtime in the ALV & need to populate the z table with the same.
    I created a z table,it has been assigned a internal table & work area.A loop is there on the internal table passed to fieldcatalog.
    LOOP AT GIT_EKPO INTO GS_EKPO.
        LS_ZPS005-EBELN = GS_EKPO-EBELN.
        LS_ZPS005-EBELP = GS_EKPO-EBELP.
        LS_ZPS005-ERECDAT = GS_EKPO-ERDAT. "this field is not passing value into z table
        LS_ZPS005-LINEID = SY-TABIX.
        LS_ZPS005-POQTY = GS_EKPO-POQTY.
        LS_ZPS005-EREQTY = GS_EKPO-EREQTY. "this field is not passing value into z table
    ENDLOOP.
      INSERT INTO ZPS005 VALUES LS_ZPS005.
    When I assign the values from Internal table into internal table of z table,the values in fields populated at runtime does not come.
    Please help me with your suggestions on the same.
    Thanks.

    Hi,
    I tried the procedure,but do I need to include this before method set_table_for_first_display?
    You can have a look at the whole code.Please let me know of a possible solution.Looking forward to an early reply.
    Thanks.
    TABLES: EKKO,
            EKPO,
            ZPS005.
    INITIALIZATION.
    PERFORM CREATE_FIELD_CATLOG.
                               Types Declaration                          *
    *Structure for EKPO table
      TYPES: BEGIN OF TYPE_EKPO,
              EBELN TYPE EKPO-EBELN, "PURCHSE ORDER NUMBER
              EBELP TYPE EKPO-EBELP, "Item Number of Purchasing Document
              POQTY TYPE EKPO-MENGE, "Purchase Order Quantity
              ERDAT TYPE SY-DATUM, "Date on Which Record Was Created
             LINEID TYPE ZPS005-LINEID, "Unique identification of document line
              EREQTY TYPE ZPS005-EREQTY, "Erection Quantity
         END OF TYPE_EKPO.
                                        Data                              *
               Data Declaration for Internal Table & Work Area            *
    *INTERNAL TABLE FOR EKPO TABLE
      DATA:LIT_EKPO TYPE TABLE OF EKPO,
           LS_EKPO TYPE EKPO.
    *SECOND INTERNAL TABLE FOR EKPO TABLE
      DATA: GIT_EKPO TYPE TABLE OF TYPE_EKPO.
      DATA: GS_EKPO TYPE TYPE_EKPO.
    *INTERNAL TABLE FOR FIELD CATALOG
      DATA: LIT_FIELDCAT TYPE lvc_t_fcat,
            LS_FIELDCAT LIKE LINE OF LIT_FIELDCAT. "WORK AREA FOR FIELD CATALOG
    *INTERNAL TABLE FOR Z TABLE ZPS005
      DATA: LIT_ZPS005 TYPE TABLE OF ZPS005,
            LS_ZPS005 TYPE ZPS005.
                            ALV GRID Data Declaration                     *
      DATA: V_CONTAINER TYPE REF TO cl_gui_custom_CONTAINER.
      data: grid TYPE REF TO cl_gui_alv_grid.
      data: ok_code type sy-ucomm.
      DATA: V_LAYOUT TYPE lvc_s_layo.  " FOR LAYOUT
      DATA: V_LINE TYPE I,
            LINEID TYPE I.
      DATA: V_INDEX TYPE SY-TABIX.
                                   PARAMETER                              *
      parameter : p_ebeln like ekko-ebeln.
                                  START OF SELECTION                      *
    START-OF-SELECTION.
                                   SELECTION OF DATA                      *
      CALL FUNCTION 'ME_PURCHASE_DOCUMENT_DATA_READ'
        EXPORTING
          I_EBELN                    = P_EBELN
          I_TCODE                    = 'ME23'
      I_NO_COMMIT                = ' '
          I_TRTYP                    = 'A'
      I_NO_MESSAGING             =
      I_NO_MESSAGE_REQ           =
      I_NO_AUTHORITY_CHECK       =
      I_VORGA                    =
    IMPORTING
      E_EKKO                     =
       TABLES
         T_EKPO                     = LIT_EKPO
      T_EKET                     =
      T_EKKN                     =
      T_KOMV                     =
       EXCEPTIONS
         NO_EBLNR                   = 1
         EBLNR_NOT_FOUND            = 2
         NO_TCODE                   = 3
         TCODE_NOT_ALLOWED          = 4
         NO_TRTYP                   = 5
         INVALID_CALL_OF_FB         = 6
         OTHERS                     = 7
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      LOOP AT LIT_EKPO INTO LS_EKPO.
        MOVE : LS_EKPO-EBELN TO GS_EKPO-EBELN,
               LS_EKPO-EBELP TO GS_EKPO-EBELP,
               LS_EKPO-MENGE TO GS_EKPO-POQTY.
        APPEND GS_EKPO TO GIT_EKPO.
      ENDLOOP.
    End-of-selection.
      perform field_catalog.
      call screen 100.
                                   END-OF-SELECTION                       *
                                MODULES FOR ALV DISPLAY                   *
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'PF-STAT'.
      SET TITLEBAR 'TITLE'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    **&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
      CASE OK_CODE.
        WHEN 'BACK'.
          LEAVE PROGRAM.
        WHEN 'EXIT'.
          LEAVE TO SCREEN 0.
       WHEN 'SWITCH'.
         PERFORM switch_edit_mode.
        WHEN 'SAVE'.
          PERFORM FILL_TABLE.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    **&      Module  layout_0100  OUTPUT
          text
    MODULE layout_0100 OUTPUT.
      V_LAYOUT-grid_title = 'Purchase Order Erection Details'.
    ENDMODULE.                 " layout_0100  OUTPUT
    **&      Module  data_retrivaL  OUTPUT
          text
    MODULE data_retrivaL OUTPUT.
      IF V_CONTAINER IS INITIAL.
        CREATE OBJECT V_CONTAINER
          EXPORTING container_name = 'GRID'.
        CREATE OBJECT grid
        EXPORTING i_parent = V_CONTAINER.
      ENDIF.
      CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IS_LAYOUT                     = V_LAYOUT
        CHANGING
          IT_OUTTAB                     = GIT_EKPO
          IT_FIELDCATALOG               = LIT_FIELDCAT
        EXCEPTIONS
          INVALID_PARAMETER_COMBINATION = 1
          PROGRAM_ERROR                 = 2
          TOO_MANY_LINES                = 3
          others                        = 4.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " data_retrivaL  OUTPUT
    *&      Module  field_catalog  OUTPUT
          text
    FORM field_catalog.
      CLEAR LS_fieldcat.
      LS_fieldcat-fieldname = 'EBELN'.
      LS_fieldcat-ref_table = 'GIT_EKPO'.
      LS_FIELDCAT-coltext  = 'PURCHSE ORDER NUMBER'.
      LS_FIELDCAT-col_pos   = 0.
      LS_FIELDCAT-EDIT = ' '.
    ls_FIELDCAT-style = cl_gui_alv_grid=>mc_style_disabled.
    INSERT LS_FIELDCAT INTO TABLE LIT_FIELDCAT.
      APPEND LS_fieldcat TO LIT_fieldcat.
      CLEAR LS_fieldcat.
      LS_fieldcat-fieldname = 'EBELP'.
      LS_fieldcat-ref_table = 'GIT_EKPO'.
      LS_FIELDCAT-coltext  = 'ITEM NUMBER'.
      LS_FIELDCAT-col_pos   = 1.
      LS_FIELDCAT-EDIT = ' '.
    ls_FIELDCAT-style = cl_gui_alv_grid=>mc_style_disabled.
    INSERT LS_FIELDCAT INTO TABLE LIT_FIELDCAT.
      APPEND LS_fieldcat TO LIT_fieldcat.
      CLEAR LS_fieldcat.
      LS_fieldcat-fieldname = 'POQTY'.
      LS_fieldcat-ref_table = 'GIT_EKPO'.
      LS_FIELDCAT-coltext  = 'PURCHASE ORDER QUANTITY'.
      LS_FIELDCAT-col_pos   = 2.
      LS_FIELDCAT-EDIT = ' '.
    ls_FIELDCAT-style = cl_gui_alv_grid=>mc_style_disabled.
    INSERT LS_FIELDCAT INTO TABLE LIT_FIELDCAT.
      APPEND LS_fieldcat TO LIT_fieldcat.
      CLEAR LS_fieldcat.
      LS_fieldcat-fieldname = 'ERDAT'.
      LS_fieldcat-ref_table = 'GIT_EKPO'.
      LS_FIELDCAT-coltext  = 'DATE OF ERECTION'.
      LS_FIELDCAT-col_pos   = 3.
      LS_FIELDCAT-EDIT = 'X'.
    ls_fieldcat-style = cl_gui_alv_grid=>mc_style_enabled.
    INSERT LS_FIELDCAT INTO TABLE LIT_FIELDCAT.
      APPEND LS_fieldcat TO LIT_fieldcat.
      CLEAR LS_fieldcat.
      LS_fieldcat-fieldname = 'EREQTY'.
      LS_fieldcat-ref_table = 'GIT_EKPO'.
      LS_FIELDCAT-coltext  = 'ERECTION QUANTITY'.
      LS_FIELDCAT-col_pos   = 4.
      LS_FIELDCAT-EDIT = 'X'.
    ls_fieldcat-style = cl_gui_alv_grid=>mc_style_enabled.
    INSERT LS_FIELDCAT INTO TABLE LIT_FIELDCAT.
      APPEND LS_fieldcat TO LIT_fieldcat.
    ENDFORM.                 " field_catalog  OUTPUT
    *&      Form  SWITCH_EDIT_MODE
          text
    -->  p1        text
    <--  p2        text
    *FORM switch_edit_mode.
    IF GRID->is_ready_for_input( ) eq 0.
    set edit enabled cells ready for input
       CALL METHOD GRID->set_ready_for_input
         EXPORTING
           i_ready_for_input = 1.
    ELSE.
    lock edit enabled cells against input
       CALL METHOD GRID->set_ready_for_input
         EXPORTING
           i_ready_for_input = 0.
    ENDIF.
    *ENDFORM.                               " SWITCH_EDIT_MODE
    *&      Form  FILL_TABLE
          text
    -->  p1        text
    <--  p2        text
    FORM FILL_TABLE .
      LOOP AT GIT_EKPO INTO GS_EKPO.
        LS_ZPS005-EBELN = GS_EKPO-EBELN.
        LS_ZPS005-EBELP = GS_EKPO-EBELP.
        LS_ZPS005-POQTY = GS_EKPO-POQTY.
        LS_ZPS005-ERECDAT = GS_EKPO-ERDAT.
        LS_ZPS005-EREQTY = GS_EKPO-EREQTY.
      ENDLOOP.
      MODIFY ZPS005 FROM LS_ZPS005.
    ENDFORM.                    " FILL_TABLE

  • Is it possible to show data from two different sql tables?

    Is it possible to show data from two different sql tables? Either to show combined data by using a join on a foreign key or showing a typical master detail view?
    I have one table With data about a house, and another table With URL's to images in the blob. Could these two be combined in the same Gallery?
    Best regards Terje F - Norway

    Hi Terje,
    If you have a unique key, you could use one of the following functions for your scenarios:
    If you only have one image per house, you can use LookUp:
    http://siena.blob.core.windows.net/beta/ProjectSienaBetaFunctionReference.html#_Toc373745501
    If you have multiple images per house, you can use Filter:
    http://siena.blob.core.windows.net/beta/ProjectSienaBetaFunctionReference.html#_Toc373745487
    Thanks
    Robin

  • Export data from MS sql server table to an oracle table

    I need to move data from a sql server table to an oracle table and when ever the sql server table is updated it needs to automatically update the oracle table. Is there procedure to do this or do I migrate the data once and set up a trigger on the sql server table to update the oracle table? If the trigger is the answer how do I do that?

    You might want to check out Oracle's heterogeneous services functionality if you haven't done so already. Here are a few links:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14232/toc.htm
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14232/majfeat.htm#sthref74
    Also, consulting the Oracle streams manual may be helpful -- particularly Chapter 5.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14228/toc.htm
    Perhaps someone who is more familiar with SQL Server could provide a more helpful answer.

Maybe you are looking for