How to fill a table with a query?

Hi experts,
J'ai une table que je veux remplir avec ma requête. J'ai aussi un bouton sur lequel je veux cliquer pour exécuter ma requête et afficher le résultat dans le tableau. Quelqu'un peut il m'aider?
Regards.

oDBs_Detail1 = oForm.DataSources.DBDataSources.Item("@HIS_OPDINVD")
                                        oDBs_Head = oForm.DataSources.DBDataSources.Item("@HIS_OPDINVH")
                                        Dim oRS As SAPbobsCOM.Recordset
                                        oRS = objMain.objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                                        Dim Str1 As String
                                        Str1 = "Select T3.U_Qty,T3.U_PList,T3.U_TLName,T3.U_TLID, T3.U_TLPrice from [@UPDATE]    T0,[@UPDATE4] T3"
                                        Str1 = Str1 & " where T0.DocEntry = T3.DocEntry"
                                        Str1 = Str1 & " and T0.U_PID='" & PID & "' and  U_VisitID='" & VisitID & "' and T3.U_TLID IS NOT NULL "
                                        oRS.DoQuery(Str1)
                                        For i As Integer = 1 To oRS.RecordCount
                                            oBillMat.AddRow()
                                            oBillMat.FlushToDataSource()
                                            oDBs_Detail1.Offset = i
                                            Total = oRS.Fields.Item("U_TLPrice").Value
                                            oDBs_Detail1.SetValue("LineID", oDBs_Detail1.Offset, i)
                                            oDBs_Detail1.SetValue("U_SID", oDBs_Detail1.Offset, oRS.Fields.Item("U_TLID").Value)
                                            oDBs_Detail1.SetValue("U_Price", oDBs_Detail1.Offset, oRS.Fields.Item("U_TLPrice").Value)
                                            oDBs_Detail1.SetValue("U_Desc", oDBs_Detail1.Offset, oRS.Fields.Item("U_TLName").Value)
                                            oDBs_Detail1.SetValue("U_PL", oDBs_Detail1.Offset, oRS.Fields.Item("U_PList").Value)
                                            oDBs_Detail1.SetValue("U_TB", oDBs_Detail1.Offset, oRS.Fields.Item("U_TLPrice").Value)
                                            oDBs_Detail1.SetValue("U_Qty", oDBs_Detail1.Offset, oRS.Fields.Item("U_Qty").Value)
                                            oBillMat.SetLineData(i)
                                            oBillMat.FlushToDataSource()
                                            oRS.MoveNext()
                                        Next

Similar Messages

  • How to fill internal table with selection screen field.

    Hi all,
    i am new to sap . pls tell me how to fill internal table with selection screen field.

    Hi,
    Please see the example below:-
    I have used both select-options and parameter on the selection-screen.
    Understand the same.
    * type declaration
    TYPES: BEGIN OF t_matnr,
            matnr TYPE matnr,
           END OF t_matnr,
           BEGIN OF t_vbeln,
             vbeln TYPE vbeln,
           END OF t_vbeln.
    * internal table declaration
    DATA : it_mara  TYPE STANDARD TABLE OF t_matnr,
           it_vbeln TYPE STANDARD TABLE OF t_vbeln.
    * workarea declaration
    DATA : wa_mara  TYPE t_matnr,
           wa_vbeln TYPE t_vbeln.
    * selection-screen field
    SELECTION-SCREEN: BEGIN OF BLOCK b1.
    PARAMETERS : p_matnr TYPE matnr.
    SELECT-OPTIONS : s_vbeln FOR wa_vbeln-vbeln.
    SELECTION-SCREEN: END OF BLOCK b1.
    START-OF-SELECTION.
    * I am adding parameter value to my internal table
      wa_mara-matnr = p_matnr.
      APPEND wa_mara TO it_mara.
    * I am adding select-options value to an internal table
      LOOP AT s_vbeln.
        wa_vbeln-vbeln =  s_vbeln-low.
        APPEND  wa_vbeln TO  it_vbeln.
      ENDLOOP.
    Regards,
    Ankur Parab

  • How to fill internal table with no data in debugging mode

    Hi all,
             I modified one existing program.Now I want to test it.I am not given test data.So in the middle of my debugging, I found that one internal table with no data.My problem is how to fill that internal table with few records in that debugging mode just as we change contents in debugging mode.If I want to proceed further means that internal table must have some records.
    Please I dont know how to create test data so I am trying to create values temporarily in debugging mode only.
    Thanks,
    Balaji

    Hi,
    In the debugging do the following..
    Click the Table button..
    Double click on the internal table name..
    Then in the bottom of the screen you will get the buttons like CHANGE, INSERT, APPEND, DELETE..
    Use the APPEND button to insert records to the internal table..
    Thanks,
    Naren

  • In sm30, when save, how to fill the table with the system data in the table

    Hi all, in SM30, we have user name and time fields, when we create record, after we click the SAVE button, it will automatically fill the fields with the system data, how can we realize it?

    Hi ,
    Do like this.
    1. Go to SE11 -> give your table name and press on change button .
    2.Go to Menu->Utilities-> Table Maintainance Generator , then it will take you another screen .
    3.Assign Functin group if already have one , other wise create function group and assign
    4.Go to Menu->Environment->Modification->Events , again it will take you to another screen
    5.Click on new entries
    ->Now press F4 in T column . Select<u> "01" - Before saving the data in the database</u> and in form routinue give any name of the routinue like "SAVE_USER_DATA" and press enter then u can see an editor symbol in next column click on that it will take you ABAP editor there type this code .
    ztable-username = sy-uname.
    ztable-createtime = sy-uziet.
    check and activate the code .
    With this your job will be complete . Now while entering data just leave columns blank , they will insert corresponding username and time
    Don't forget award points if it helps you.
    Regards,
    Raghav

  • How to Fill Internal Table with contents of Select-Option

    Hi all:
         There is a select-option s_matnr on the self-made screen.   An internal table t_int is declared in the program. The requirement is that users makes selection with multiple  material numbers.  I want to put the values of s_matnr  into internal table  t_int directly. Would you please tell me how?
         Thank you very much in advance.
    Edited by: dongdong guo on Jun 13, 2008 3:40 AM

    Hi,
    Select option works like an internal table only.
    For table selection you can use it directly using IN operator in where clause
    eg : where matnr IN s_matnr.
    Before that you may need to validate the content of the select-option. For that also you need to transfer the content to a new internal table.
    u can loop at the select-option.
    eq: loop at s_matnr.
          if s_matnr-low = 'MAT1'.
            condition.
          endif.
         endloop.
    if you just want to check whether any single valid material number exist in your user screen, then u can use a select single option with s_matnr directly.
      select single matnr from mara
                where matnr in s_matnr.
      select-option s_matnr behaves like an internal table with four fields.
    sign, option, low, high.

  • How to fill a table with data from columns & rows from a txt file

    I am trying to fill say:
    Myname     Myclass     Mycollege
    Mohan     MD     Stanford
    from a txt file into 3 columns of a table. I can easily do it into a textarea component by
    clicking a button:
    try{
    FileReader fr = new FileReader("F:/CreatorProjects1/stan.txt");
    BufferedReader br = new BufferedReader(fr);
    String s1="";
    String s="";
    stantxtarea.setValue(s);
    while((s=br.readLine())!=null) {
    s1 = s1+s;
    s1=s1+"\n";
    stantxtarea.setValue(s1);
    br.close();
    fr.close();
    } catch(Exception e) {
    e.printStackTrace();
    return null;
    All table components seem to need a database. I do not use any database. I run exe files that give output to txt files. How to solve it?
    I appreciate any help in this regard...
    dr.mohan rao

    there may be another way. This is some thing some thing I can recommend. You can create property type of ObjectListDataProvider in session or application based on the scope you required. Create web bean class with property you want to show in the column (say col1, col2, col2). Initialize the list property like similar below
    List dataList = new ArrayList();
    ObjectListDataProvider mytableprops = new ObjectListDataProvider();
    try {
    //start loop read data from your txt file
    //create instance of web bean for each line
    //add web bean instance into dataList
    //end of loop readind data from txt file
    oldpins.setList(dataList );
    oldpins.setObjectType(NotificationProfileBean.class);
    } catch (Exception ee1){;}
    return oldpins;
    Sri Thuraisamy

  • Fill a table with a genil object

    Hello,
    I will fill a custom table with the class CL_CRM_GENIL_GEN_TABLE_OBJ. Could anyone explain me how to fill a table with this class?
    Thank and regards,
    Harris

    Hello,
    Thank you very much so far.
    I followed the instructions in the above link.
    I'm a little bit confused how to fill the table with values. The class CL_CRM_GENIL_GEN_OBJ offers me the method "Save". I can imagine, to use this method to fill my table with values.
    Could anyone describe how to proceed if I want to fill my table.
    Thank you very much so far.
    Best regards,
    Harris

  • How to fill Lookup table run time with desired values in project server 2010.

    HI,
    is this possible to fill LookUp Table with some Desired Values at Runtime ??
    Or How to bind a LookUp table with DataBase  Table??

    Dear Rohan,
    You need to do this via PSI script for lookup table.
    Follow this blog Chris Boyd:
    http://blogs.msdn.com/b/project_programmability/archive/2006/11/08/adding-a-project-to-a-category.aspx
    Regards,
    Avinash kumar | Blog:http://avigr8.wordpress.com | If you found this post helpful, please “Vote as Helpful”. If it answered your question, please “Mark as Answer”.

  • How to fill a table?

    hello all!
    i need to display a result set in a html table. I'm kinda confused with how the table will be filled up, since the table will grow depending on the number of records that the DB table has.
    here is what i have:
    <table border="1">
            <th>Row</th><th>Name</th><th>User/Dept</th><th>Use</th><th>Last Update</th><th>Updated By</th><th> </th>
           <%
            try{Connecting con = new Connecting();
                                ResultSet rs;
                                ResultSet rs;
                                String s[]= new String[10];
                                int x=0;
                                %>
                                <%
                                con.connect();
                                rs = con.viewUsers();
                                x= rs.getRow(); %>
                   <%while(rs.next()){%>
                   <%s[x]=rs.getString(1)
                   %>            
            <tr>
                <td></td> <td><%=s[x]%></td> <td><%=s[x]%></td> <td><%=s[x]%></td> <td><%=s[x]%></td> <td><%=s[x]%><td></td> <td>
            </tr>
        </table>

A: how to fill a table?

Hey!
Thanks for the hint, i'm getting the table filled, but now my issue is that its not showing the right data.
first the query i'm using:
public ResultSet viewUsers(){
        try{
            ps = conMsg.prepareStatement("SELECT  name + ' '+ lastName as 'Name', userDeptName as 'User/Dept.' , userDeptCategory as 'Use', lastChangedDate + ' ' + lastChangedTime as 'Last Update', lastChangedBy as 'Updated By:' from SystemUser");
            rs = ps.executeQuery();
        }catch(Exception e){
            e.getMessage();
            e.printStackTrace();
       return rs;
    }here is my code inside the jsp page:
<table border="1">
        <th>Row</th><th>Name</th><th>User/Dept</th><th>Use</th><th>Last Update</th><th>Updated By</th><th></th>
       <%
        try{Connecting con = new Connecting();
                            ResultSet rs;
                            String s[]= new String[10];
                            int x=0;
                            %>
                            <%
                            con.connect();
                            rs = con.viewUsers();
                            x= rs.getRow(); %>
        <tr>
             <%while(rs.next()){%>
                <%s[x]=rs.getString(1); %>
                <td></td> <td><%=s[x]%></td> <td><%=s[x]%></td> <td><%=s[x]%></td> <td><%=s[x]%></td> <td><%=s[x]%><td></td><a href="#">View</a> <a href="#">Modify</a> <a href="#">Delete</a><td>
        </tr>
             <%
              }catch(Exception e){}   %>
    </table>

Hey!
Thanks for the hint, i'm getting the table filled, but now my issue is that its not showing the right data.
first the query i'm using:
public ResultSet viewUsers(){
        try{
            ps = conMsg.prepareStatement("SELECT  name + ' '+ lastName as 'Name', userDeptName as 'User/Dept.' , userDeptCategory as 'Use', lastChangedDate + ' ' + lastChangedTime as 'Last Update', lastChangedBy as 'Updated By:' from SystemUser");
            rs = ps.executeQuery();
        }catch(Exception e){
            e.getMessage();
            e.printStackTrace();
       return rs;
    }here is my code inside the jsp page:
<table border="1">
        <th>Row</th><th>Name</th><th>User/Dept</th><th>Use</th><th>Last Update</th><th>Updated By</th><th></th>
       <%
        try{Connecting con = new Connecting();
                            ResultSet rs;
                            String s[]= new String[10];
                            int x=0;
                            %>
                            <%
                            con.connect();
                            rs = con.viewUsers();
                            x= rs.getRow(); %>
        <tr>
             <%while(rs.next()){%>
                <%s[x]=rs.getString(1); %>
                <td></td> <td><%=s[x]%></td> <td><%=s[x]%></td> <td><%=s[x]%></td> <td><%=s[x]%></td> <td><%=s[x]%><td></td><a href="#">View</a> <a href="#">Modify</a> <a href="#">Delete</a><td>
        </tr>
             <%
              }catch(Exception e){}   %>
    </table>

  • How to set the table input in Query template?

    Hi all.
    I need to call a Bapi_objcl_change, with import parameter and a table as an input. I have done this, in BLS. I have set the table input in the
    form of xml. In BLS, I get the output(the value gets change in SAP R3, what i have given in BLS).  But if i set the same xml structure  in
    query template, I didn't get the output. Table input parameter does not take that xml source.  How to set the table input in Query template?
    can anyone help me?
    Regards,
    Hemalatha

    Hema,
    You probably need to XML encode the data so that it will pass properly and then xmldecode() it to set the BAPI input value.
    Sam

  • Fill internal table with mutliple entries for nested structure

    Dear ABAP Experts,
    I have a question related to fill internal tables with nested structures.
    I have a structure like this:
    BEGIN OF proto,
              sicht TYPE ysicht,
              version TYPE FAGLFLEXA-RVERS,
              BEGIN OF kons,
    kon TYPE YKONSEINHEIT,
              END OF kons,
              jahr TYPE CHAR04,
    END OF proto.
    Now I need to fill this structure with values (over an internal table), but how can I achieve that I save multiple datas für element "kon" für one single entry of structure "proto"?
    An example could be:
    sicht = '01'
    version = '100'
    kon = 1001 (first entry)
    kon = 1002 (second entry)
    usw... (n entry)
    jahr = '2008'
    Thanks in advance for every helpful answer.
    Regards
    Thomas

    BEGIN OF proto,
               sicht TYPE ysicht,
               version TYPE FAGLFLEXA-RVERS,
               kons TYPE STANDARD TABLE OF YKONSEINHEIT WITH NON-UNIQUE KEY TABLE_LINE,
               jahr TYPE CHAR04,
    END OF proto.
    DATA: ls_proto TYPE proto,
          lt_proto TYPE STANDARD TABLE OF proto,
          ls_kon
    ls_proto-sicht = '01'.
    ls_proto-version = '100'
    INSERT '1001' INTO TABLE ls_proto-kons.
    INSERT '1002' INTO TABLE ls_proto-kons.
    ls_proto-jahr = '2008'.
    INSERT ls_proto INTO TABLE lt_proto
    If you're going to use a more complicated inner table with several components, then you need to define a type for those components. 
    matt

  • How to fill internal table dynamically

    Hi All,
       how to fill internal table dynamically.
    for example:
    begin of itab occurs 0,
    empid like pa0000-pernr,
    empname like pa0001-ename,
    grade(5),
    end of itab.
    now i want to append dynamically field itab-grade along with rest fields.
    is this possible?? if yes kindly let me know how to do that.
    Regards,
    Kiran I

    Hi kiran,
    To fill and create and internal table dynamically you can use this code.
    TYPE-POOLS: slis.
    DATA: it_fcat TYPE slis_t_fieldcat_alv,
          is_fcat LIKE LINE OF it_fcat.
    DATA: it_fieldcat TYPE lvc_t_fcat,
          is_fieldcat LIKE LINE OF it_fieldcat.
    DATA: new_table TYPE REF TO data.
    DATA: new_line  TYPE REF TO data.
    FIELD-SYMBOLS: <l_table> TYPE ANY TABLE,
                   <l_line>  TYPE ANY,
                   <l_field> TYPE ANY.
    is_fieldcat-fieldname = 'FIELD1'.
    is_fieldcat-ref_field = 'MATNR'.
    is_fieldcat-ref_table = 'MARA'.
    APPEND is_fieldcat TO it_fieldcat.
    is_fieldcat-fieldname = 'FIELD2'.
    is_fieldcat-ref_field = 'SPRPS'.
    is_fieldcat-ref_table = 'PA0001'.
    APPEND is_fieldcat TO it_fieldcat.
    is_fieldcat-fieldname = 'FIELD3'.
    is_fieldcat-ref_field = 'BEGDA'.
    is_fieldcat-ref_table = 'PA0002'.
    APPEND is_fieldcat TO it_fieldcat.
    Create a new Table
    CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
        it_fieldcatalog = it_fieldcat
      IMPORTING
        ep_table        = new_table.
    Create a new Line with the same structure of the table.
    ASSIGN new_table->* TO <l_table>.
    CREATE DATA new_line LIKE LINE OF <l_table>.
    ASSIGN new_line->* TO <l_line>.
    Test it...
    DO 40 times.
      ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <l_line> TO <l_field>.
      <l_field> = '12345'.
      ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <l_line> TO <l_field>.
      <l_field> = 'X'.
      ASSIGN COMPONENT 'FIELD3' OF STRUCTURE <l_line> TO <l_field>.
      <l_field> = '20030101'.
      INSERT <l_line> INTO TABLE <l_table>.
    ENDDO.
    LOOP AT <l_table> ASSIGNING <l_line>.
    ASSIGN COMPONENT 'field1' OF STRUCTURE <l_line> TO <l_field>.
      WRITE  / <l_line>.
    ENDLOOP.
    regards,
    Aashish Garg

  • How to fill a table UI element

    hello,
    how can I fill a table header?
    any suggest?

    __day_              __hour_          month_          year_
    Mo                  2                  July          2210
    so i could fill the table with   -
    >  Mo    2    July   2210
    BUT  not the header    -
    >   day   hour  month  year !!
    Edited by: Scafandri on May 13, 2011 1:40 PM
    Edited by: Scafandri on May 13, 2011 1:41 PM

  • How to fill a table using netBeans?

    Hi. I use netBeans with Derby. I can create tables in my database (Create Table in Runtime), but I can't find any option which would allow me to fill my table with particular data. Could You give me some advice how to do this? I know that I can write a simple app which would add data to DB using text fields, but maybe there is some simpler tool?
    Greetings

                while (rs.next()) {
                    Vector ucliente = new Vector();
                    ucliente.add(rs.getString("codigo"));
                    ucliente.add(rs.getString("nombre"));
                    ucliente.add(rs.getString("email"));
                    ucliente.add(rs.getString("fax"));
                    ucliente.add("");
                    clientsModel.addRow(ucliente);

  • How to create a table with events in smartforms?

    How to create a table with events view in smartforms?
    It doesn't like general table with header, main area and footer.
    for example:
    in smartforms: LE_SHP_DELNOTE
    table name is TABLEITEM(Delivery items table)

    Vel wrote:
    I am creating XML file using DBMS_XMLGEN package. This XML file will contain data from two different database tables. So I am creating temporary table in the PL/SQL procedure to have the data from these different tables in a single temporary table.
    Please find the below Dynamic SQL statements that i'm using for create the temp table and inserting the data into it.
    Before insert the V_NAME filed, i will be appending a VARCHAR field to the original data.
    EXECUTE IMMEDIATE 'CREATE TABLE TEMP_TABLE (UNIQUE_KEY NUMBER , FILE_NAME VARCHAR2(1000), LAST_DATE DATE)';
    EXECUTE IMMEDIATE 'INSERT INTO TEMP_TABLE values (SEQUENCE.nextval,:1,:2)' USING V_NAME,vLastDate;What exactly i need is to eliminate the INSERT portion of it,Since i have to insert more 90,000 rows into it. Is there way to have the temp table created with data in it along with the sequence value as well.
    I'm using Oracle 10.2.0.4 version.
    Edited by: 903948 on Dec 22, 2011 10:58 PMWhat you need to do to eliminate the INSERT statement is to -- as already suggested by others - eliminate the temporary table. You don't need it. It is just necessary overhead. Please explain why you (apparently) believe that the suggestion of a view will not meet your requirements.

  • Maybe you are looking for

    • Creating a Web Dynpro Application Accessing ABAP Functions

      Hi all,             I implemented Creating a Web Dynpro Application Accessing ABAP Functions .But recently i heared a new word BW query.Is it not wat i did in the above application or is this a new backend sytem , does  it have a new procedure to cre

    • Exchange 2010 upgrade issue

      dear  we are in the process to upgrade our exchange 2003 to exchange 2010, our domains are 2003 and the functional level is 2003. every time i run the pre deployment analyzer i get this massage Active Directory site 'SITENAME' does not contain any gl

    • Adobe Flash Reader for Palm Pre

      there are some web sites that you need the adobe Flash Reader to watch video, is there anyone that knows how to get it on the palm pre? it shows up saying that i need the latest download, can anyone help me? Post relates to: Pre p100eww (Sprint)

    • Sub Menus/Sub Pages in iWeb09?

      Hi all, VERY new to this iWeb thing, but there is one question I need to ask: Can you do sub-pages after navigating to a main navigation page? For example: If I have a website for a company that has a page for each member of the business that you nav

    • Oracle Application Server 9i

      Is there an XP version, I can download?