How to get Multiple records from functions

Hi Everyone
Im new to this stuff. Im trying  through JCO. As far as the single recordsets like data of customer or article are concerned i get it through an array.
But i wanted to retrieve
1- Whole tables like (all articles)
2- Selected articles. or Customer order details (articles in PO)
That means multiple records in one go.
Later on ill display it in JTables.
Like for the past three days i was googling around. Thought like this ones not for my stomach. Came across this Forum. Thought its worth posting a request.
Here is the code
public String[] KSearch(String Knr) throws Exception{
                        String[] Result=new String[11];
                        IFunctionTemplate ftemplate= Con.repository.getFunctionTemplate("SucheKUNDE");
                        if (ftemplate == null)
                                throw new Exception("Funktionstemplate nicht gefunden");
                        JCO.Function function = ftemplate.getFunction();
                        JCO.ParameterList input = function.getImportParameterList();
                        input.setValue(Knr,"FieldName");
                   JCO.Client client = JCO.getClient(Con.conPoolId);
                   client.execute(function);
                   JCO.ParameterList output = function.getExportParameterList();
                   Result[0]=output.getString("NAME");
                   Result[1]=output.getString("VORNAME");
                   Result[2]=output.getString("GDATE");
                   Result[3]=output.getString("TELEFON");
                   Result[4]=output.getString("MAIL");
                   Result[5]=output.getString("STRASSE");
                   Result[6]=output.getString("PLZ");
                   Result[7]=output.getString("ORT");
                   Result[8]=output.getString("KONTO");
                   Result[9]=output.getString("INSTITUT");
                   Result[10]=output.getString("BLZ");
                                                                                JCO.releaseClient(client);
                   return Result;
now instead of a single record what if im expecting a number of records, like what if i need customer over 25. Which means more than one. I have to get in tabular format so that i can display it in JTables.
Hope it a bit illustrative.
Regards
Edited by: Aaron Maleck on Jan 5, 2008 7:35 AM

public String[] KSearch(String Knr) throws Exception{
String[] Result=new String11;
IFunctionTemplate ftemplate= Con.repository.getFunctionTemplate("SucheKUNDE");
if (ftemplate == null)
throw new Exception("Funktionstemplate nicht gefunden");
JCO.Function function = ftemplate.getFunction();
JCO.ParameterList input = function.getImportParameterList();
input.setValue(Knr,"FieldName");
JCO.Client client = JCO.getClient(Con.conPoolId);
client.execute(function);
// Maybe here you should use a JCO.Table Class to get the //ExportParameters such as
JCO.Table output = function.getTableParameterList().getTable( "tabelname" );
// so you can use setRow() Function to get the information of the //relevant record. such as the 3. Costum
output.setRow(3);// Record Number
Result[0]=output.getString("NAME");
Result[1]=output.getString("VORNAME");
Result[2]=output.getString("GDATE");
Result[3]=output.getString("TELEFON");
Result[4]=output.getString("MAIL");
Result[5]=output.getString("STRASSE");
Result[6]=output.getString("PLZ");
Result[7]=output.getString("ORT");
Result[8]=output.getString("KONTO");
Result[9]=output.getString("INSTITUT");
Result10=output.getString("BLZ");
JCO.releaseClient(client);
return Result;
Iam not sure that works. But you can try it. and reply me to tell if it really works as i think.
Hope helps.
Amao

Similar Messages

  • How to get multiple records from internal table through BDC

    PERFORM DYNPRO USING:
      'X'  'SAPMM61L'  '0500',
      ' '  'BDC_OKCODE'  '=NEWC',
      'X'  'SAPMM61L'  '0500',
      ' '  'BDC_CURSOR'  'PLPTU-PLWRK(01)',
      ' '  'BDC_OKCODE'  '=TAKE',
      ' '  'PLPTU-PLWRK(01)' '2531'. (2531 is a plant)
    This is the recording used to get plant via BDC of MS31.
    Using this code i can get only single plant...
    If i want to get multiple plants from an internal table,how i can change this code?
    Since it is a recording i cant put this code in LOOP..ENDLOOP.
    Suggest any method for doing this....
    Awaiting for ur reply...

    Hi,
    While recording also record the scroll down button.
    The you can place different plant in the BDC using loop and endloop
    Regards
    Arun

  • How to get multiple records using fn-bea:execute-sql()

    Hi,
    I created Proxy service(ALSB3.0) to get records from DB table. I have used Xquery function(fn-bea:execute-sql()). Using simple SQL query I got single record, but my table having multiple records. Please suggest how to get multiple records using fn-bea:execute-sql() and how to assign them in ALSB variable.
    Regards,
    Nagaraju
    Edited by: user10373980 on Sep 29, 2008 6:11 AM

    Hi,
    Am facing the same issue stated above that I couldnt get all the records in the table that am querying in the Proxyservice.
    For example:
    fn-bea:execute-sql('EsbDataSource', 'student', 'select Name from StudentList' ) is the query that am using to fetch the records from the table called StudentList which contains more than one records like
    Id Name
    01 XXX
    02 YYY
    03 ZZZ
    I tried to assign the result of the above query in a variable and while trying to log the variable, I can see the below
    <student>
    <Name>XXX</Name>
    </student>
    I want to have all the records from my table in xml format but it's not coming up. I get the value only from the first row of my table.
    Please suggest.
    regards,
    Venkat

  • How to select multiple records from a TREE in the table

    HI,
    I have a tree structure which is in the table.When I open the node of the tree,all the subnodes are coming as one-one records in the table.I want to slect multiple record from this table.I applied onLeadSelect for this table,I can select only 1 record from the table.
    Can any one plz suggest me how to select multiple records from the table so that I can get all the data of those selected record.
    Regards
    -Sandip

    Rashmi/Kukku,
    First of all, Thanks for your help!
    Is there any other way in which we can access tables other than using BAPIs or RFCs?
    In my case, there is a table structure which has to be updated with values after validating a key. i don't think there is any RFC available now. do i need to create bapi/rfc for that?
    Krishna Murthy

  • How to get multiple values from the list

    I've a list of an item which I queried it from the database. I also created a button that will takes a selected items from the list when it was clicked. I used javabean to get the data from database.
    <%     // clicked on Select District Button
    Vector vselectedDistrict = new Vector();
    Vector vdistrictID = new Vector();
    String tmpSelectDistrict = "";
    tmpSelectDistrict = request.getParameter("bSelectDistrict");
    if(tmpSelectDistrict != null)
         // get multiple values from the list
         String[] selectedDistrict = request.getParameterValues("usrTDistrict");
         vselectedDistrict.clear();
         vdistrictID.clear();
         if((selectedDistrict != null) && (selectedDistrict.length != 0))
                             for(int i=0;i<selectedDistrict.length;i++)
                   vselectedDistrict.addElement(selectedDistrict);           
              vdistrictID = dbaseInfo.getcurrentDistrictID(nstate,vselectedDistrict);
              for(int i=0;i<vdistrictID.size();i++)
                   out.println("district = " + selectedDistrict[i]);                         out.println("district ID= " + vdistrictID.get(i).toString());
    %>
    // get vdistrict from the database here......
    <select name="usrTDistrict" size="5" multiple>
    <%     for(int i = 0; i< vdistrict.size(); i++)
    %>
         <option value="<%=vdistrict.get(i).toString()%>"><%=vdistrict.get(i).toString()%></option>
    <%
    %>          
    </select>
    <input type="submit" name="bSelectDistrict" value="Select District">
    Lets say the item that i selected from the list is 'Xplace' and I clicked on the Select District button,
    what I got is this error message:
    org.apache.jasper.JasperException: Unable to convert string 'Xplace' to class java.util.Vector for attribute usrTDistrict: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager
    So where is going wrong and what the message means?. Any help very much appreciated. Thanks

    These are just guesses that might hopefully steer you in directions you haven't looked in yet.
    I presume you used triangle brackets (< >) to avoid having the Jive Forum think it was the "italics" tag?
    Are you certain this: dbaseInfo.getcurrentDistrictID(nstate,vselectedDistrict);
    expects a Vector as its second parameter? And returns a Vector?
    I don't believe you've shown how you use the javabean, or its code? Perhaps it should be rewritten to accept an array of strings instead of a Vector?

  • How to get multiple rows from database table?

    hello !
    I need to get multiple rows from a OLEDB database table and display them on a table object.
    I did "Wrap in subfrom" on the table,  set  subform of the table to "flowed", and checked "Repeat row for each data item" of Row1 of the table.
    But I can get only one row on the table object.
    I need your help.
    Thanks

    Hi,
    best practices when deleting multiple rows is to do this on the business service, not the view layer for performance reasons. When you selected the rows to delete and press submit, then in a managed bean you access thetable instance (put a reference to a managed bean from the table "binding" property") and call getSeletedRowKeys. In JDeveloper 11g, ADF Faces returns the RowKeySet as a Set of List, where each list conatins the server side row key (e.g. oracle.jbo.Key) if you use ADF BC. Then you create a List (ArrayList) with this keys in it and call a method exposed on the business service (through a method activity in ADF) and pass the list as an argument. On the server side you then access the View Object that holds the data and find the row to delte by the keys in the list
    Example 134 here: http://blogs.oracle.com/smuenchadf/examples/#134 provides you with the code
    Frank

  • How to get multiple selections from jsp page in my servlet

    Hello Everyone,
    I've a list that allows users to make multiple selections.
    <select name=location multiple="multiple">
        <option>
             All
        </option>
        <option>
             Hyd
        </option>
        <option>
             Dub
        </option>
        <option>
             Mtv
        </option>
      </select>I want to get the selections made by user in jsp page from my servlet, selections can be multiple too.
    ArrayList locList = new ArrayList();
    locList = request.getParameter("location");when I do so, I get compilation error as the request returns string type. How do I then get multiple selections made by the user.
    Please let me know.

    For those kind of basic questions it would help a lot if you just gently consult the javadocs and tutorials.
    HttpServletRequest API: [http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpServletRequest.html]
    Java EE tutorial part II: [http://java.sun.com/javaee/5/docs/tutorial/doc/]
    Coreservlet tutorials: [http://courses.coreservlets.com/Course-Materials/]

  • Q. How to get multiple results from a single column in a recordset using PHP

    Hi everyone
    Hope someone can help. I have a column called categories and about 5 categories listed. I want to show all products that are listed in say 2 categories. I only have basic php skills so only know how to pass a url value to show the products from 1 category e.g. 
    Select *
    FROM product
    WHERE category = colname
    $colname = $_GET['category'];
    URL...page.php?category=fruit
    Questions is how do I get the products from multiple categories to show e.g. all products from categories 'fruit', 'dairy', 'meat'
    Your help will be much appreciated as I am getting tired of beating my head against the wall. (should invent a PHP wall pillow and sell it online)
    Thanks

    $colname1 = $_GET['category1'];
    $colname2 = $_GET['category2'];
    $colname3 = $_GET['category3'];
    Select *
    FROM product
    WHERE category IN  ('$colname1', '$colname2', '$colname3')
    >Your help will be much appreciated as I am getting tired of beating my head against the wall
    My guess is that you are trying to build a web application without having first learned the basics on PHP and SQL. That's certainly the hard way.

  • How to get Scavenged Records from Windows DNS Server uisng WMI API Call?

    Hi Guys,
    I'm facing one problem to find below things,
    DNS Server have list of zones and each zones may have DNS Records. DNS Server provides an option set scavenging interval on server or in zone level.
    Once records are old the server automatically apply scavenging process to remove that record.
    I need to get DNS Records that are scavenged and timestamp using WMI Call?
    sharavanna

    The DNS log has this information.  Just extract it from the log.
    A scavenged record does not exisit when it is scavenged so it cannot be read from the DNS server.  It has been deleted.
    ¯\_(ツ)_/¯

  • Data merging: how to get multiple records in single text frame?

    Hi
    I'm experimenting with data merging in InDesign CS3. The biggest stumbling block I've come across is trying to get my records to flow as continuous text in a single text frame (which would, ideally, autoflow onto new pages in the document). The records vary considerably in length, and so I can't just create a standard text frame to repeat on the page.
    Perhaps data merging isn't the best way of doing this and I should be learning to script instead. I feel like I'm just one step away, though.
    Any suggestions would be appreciated.

    OK, new scenario now:
    Is it possible to set a text box to auto-resize to fit the content that comes in during the data merge?
    I have placed one of my data fields in a text box with a stroke and fill, and placed this as an anchored object in the main text box with the other fields. The problem is that the length of text in this field varies considerably, and I'd like the text to fit snugly within its box. Ideally this text box would not appear at all if the field is blank for a particular record.
    I hope I've explained all of that clearly enough. Any ideas?

  • How to Getting 10lack records from 2 tables and share  into 10 tables

    Hi Experts,
    i have some special requirement about counting records before we we procees them in to intenal table.
    here is the sample code .
    **Needed to get users for ref users data
    DATA: BEGIN OF gt_usr02 OCCURS 0,
            bname LIKE usr02-bname,
          END OF gt_usr02.
    DATA:g_wa_usr02 LIKE LINE OF gt_usr02.
    **Needed To get reference users data
    DATA: BEGIN OF gt_usrefus OCCURS 0,
            bname LIKE usrefus-bname,
            refuser LIKE usrefus-refuser,
            END OF gt_usrefus.
    DATA:g_wa_usrefus LIKE LINE OF gt_usrefus.
    SELECTION-SCREEN :BEGIN OF BLOCK blk1 WITH FRAME TITLE text-000.
    SELECT-OPTIONS : s_user FOR usr02-bname.
    SELECTION-SCREEN :END OF BLOCK blk1.
    START-OF-SELECTION.
    REFRESH:gt_usr02,gt_usrefus.
    CLEAR:gt_usr02,gt_usrefus
    CLEAR:g_wa_usr02,g_wa_usrefus ,
    SELECT bname FROM usr02 INTO TABLE
           gt_usr02 WHERE bname IN s_user. "say suppose "*" in s_user
    1.Here i need to get no of records befor we are getting data from this select statement
    basically i need to know the no of records (like count (sy-dbcnt) with same condition like below.
    IF NOT gt_usr02 IS INITIAL.
        SELECT bname refuser FROM usrefus INTO TABLE  gt_usrefus
         FOR ALL ENTRIES IN  gt_usr02
        WHERE bname =  gt_usr02-bname AND refuser <> space.
      ENDIF.
    2.if i found no of records based on that  i have to broke those records into diff tables
    say i found 10,000 records ,that time i have spilt those 10,000 records into 10 tables(Similar strcture like table gt_usrefus ) with 1000 records each .
    Can you help us.this requirement is for avoiding memory issues.

    Hi nagraju102,
    - please try to post code formatted as code
    - splitting a table of 10000 records into 10 tables of 1000 records will use not less memory at all, even a little bit more for the administrative overhead
    - the numer of lines in an internal table can  determinde used system function lines( itab )
    - you can create an internal table of references and then create any number of internal tables,
    data:
      lt_tabref type table of ref to data.
    field-symbols:
      <table> type  table,
      <tabref> type ref to data.
    DO 10 TIMES.
      append initial line to lt_tabref assigning <tabref>.
      create data <tabref> type table of usrefus.
      assign <tabref>->* to <table>.
      perform fill_table changing  <table>."fill this table as you prefer
    ENDDO.
    Here you have 10 internal tables with USREFUS structure.
    Regards,
    Clemens

  • Get Multiple Records in FUNCTIONS

    Dear All
    I have created the following function in oracle database 10g then I used it in Oracle reports 6 . It is working fine for single row(one value). But when there is multiple rows then it show error .
    Note:ot.po_code is number datatype and clr_name is varchar2 data type.
    this is the script
    create or replace FUNCTION get_colour_name (POC number)
    RETURN VARCHAR2 IS
    CLR_NAME VARCHAR2(100);
    BEGIN
    SELECT DISTINCT BC.COLOUR_NAME INTO CLR_NAME
    FROM PEM.COMBO_COLOURS CC,
    PEM.basic_colours BC, PEM.BUNDLE_PCS BP,
    PEM.oper_tickets OT
    WHERE (OT.PO_CODE = POC)
    AND (CC.PO_CODE = OT.PO_CODE)
    AND (CC.COLOUR_CODE = BC.COLOUR_CODE)
    AND (CC.PO_CODE = BP.PO_CODE)
    AND (CC.COMBO_NO = BP.COMBO_NO)
    AND (BP.CUT_REF = OT.CUT_REF)
    AND (BP.PO_CODE = OT.PO_CODE)
    AND (CC.PO_CODE = BP.PO_CODE);
    RETURN (CLR_NAME);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    RETURN (NULL);
    END;
    please guide me what I should do now?

    Ghulam Yassen wrote:
    Dear All
    I have created the following function in oracle database 10g then I used it in Oracle reports 6 . It is working fine for single row(one value). But when there is multiple rows then it show error .
    Note:ot.po_code is number datatype and clr_name is varchar2 data type.
    this is the script
    create or replace FUNCTION get_colour_name (POC number)
    RETURN VARCHAR2 IS
    CLR_NAME VARCHAR2(100);
    BEGIN
    SELECT DISTINCT BC.COLOUR_NAME INTO CLR_NAME
    FROM PEM.COMBO_COLOURS CC,
    PEM.basic_colours BC, PEM.BUNDLE_PCS BP,
    PEM.oper_tickets OT
    WHERE (OT.PO_CODE = POC)
    AND (CC.PO_CODE = OT.PO_CODE)
    AND (CC.COLOUR_CODE = BC.COLOUR_CODE)
    AND (CC.PO_CODE = BP.PO_CODE)
    AND (CC.COMBO_NO = BP.COMBO_NO)
    AND (BP.CUT_REF = OT.CUT_REF)
    AND (BP.PO_CODE = OT.PO_CODE)
    AND (CC.PO_CODE = BP.PO_CODE);
    RETURN (CLR_NAME);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    RETURN (NULL);
    END;
    please guide me what I should do now?So what do you want it to do?
    Do you want it to capture the error and return a single result indicating it's multiple values?
    Do you want the function to actually return multiple values as if it's a table of data?
    The issue isn't a problem with the code, but with the requirements for what it should do in the case where there are multiple values... and you haven't explained what it is you actually require.

  • How to get multiple records in one row and different column

    Hi All,
    I am using oracle database 11g
    and i have a two tables table_1, table_2
    table_1 having columns
    emp_no
    first_name
    middle_name
    last_name
    email
    and table_2 having columns
    emp_no
    phone_type
    phone_number
    and having entires
    emp_no phone_type phone_number
    1001 MOB 9451421452
    1001 WEMG 235153654
    1001 EMG 652341536
    1002 MOB 9987526312
    1003 WEMG 5332621456
    1004 EMG 59612356
    Now i want the output of values with phone type as MOB or WEMG in a single row with different columns
    emp_no first_name middle_name last_name email mobile officeno
    1001 mark null k [email protected] 9451421452 235153654
    1002 john cena gary [email protected] 9987526312 null
    1003 dany null craig [email protected] null 5332621456
    1004 donald finn sian [email protected] null null
    can i have any inputs to achive this???
    Regards
    $sid

    Frank Kulash wrote:
    sonething like this:Frank, you missed aggregate function (pivot requires one). However main thing is it will cause ORA-01748:
    with table_1 as (
                     select 1001 emp_no,'mark' first_name,null middle_name,'k'last_name,'[email protected]' email from dual union all
                     select 1002,'john','cena','gary','[email protected]' from dual union all
                     select 1003,'dany',null,'craig','[email protected] null' from dual union all
                     select 1004,'donald','finn','sian','[email protected]' from dual
         table_2 as (
                     select 1001 emp_no,'MOB' phone_type,9451421452 phone_number from dual union all
                     select 1001,'WEMG',235153654 from dual union all
                     select 1001,'EMG',652341536 from dual union all
                     select 1002,'MOB',9987526312 from dual union all
                     select 1003,'WEMG',5332621456 from dual union all
                     select 1004,'EMG',59612356 from dual
    SELECT     *
    FROM     table_1      t1
    JOIN     table_2      t2  ON  t1.emp_no = t2.emp_no
    PIVOT     (    max(t2.phone_number)
         FOR  t2.phone_type  IN  ( 'MOB'   AS mob
                                 , 'WEMG'  AS wemg
            FOR  t2.phone_type  IN  ( 'MOB'   AS mob
    ERROR at line 19:
    ORA-01748: only simple column names allowed hereYou need to:
    with table_1 as (
                     select 1001 emp_no,'mark' first_name,null middle_name,'k' last_name,'[email protected]' email from dual union all
                     select 1002,'john','cena','gary','[email protected]' from dual union all
                     select 1003,'dany',null,'craig','[email protected] null' from dual union all
                     select 1004,'donald','finn','sian','[email protected]' from dual
         table_2 as (
                     select 1001 emp_no,'MOB' phone_type,9451421452 phone_number from dual union all
                     select 1001,'WEMG',235153654 from dual union all
                     select 1001,'EMG',652341536 from dual union all
                     select 1002,'MOB',9987526312 from dual union all
                     select 1003,'WEMG',5332621456 from dual union all
                     select 1004,'EMG',59612356 from dual
         table_3 as (
                     select  t1.emp_no,first_name,middle_name,last_name,email,
                             phone_type,phone_number
                       FROM     table_1      t1
                       LEFT JOIN     table_2      t2  ON  t1.emp_no = t2.emp_no
    SELECT     *
    FROM     table_3
    PIVOT     (    max(phone_number)
         FOR  phone_type  IN  ( 'MOB'   AS mob
                                 , 'WEMG'  AS wemg
        EMP_NO FIRST_ MIDD LAST_ EMAIL                     MOB       WEMG
          1004 donald finn sian  [email protected]
          1003 dany        craig [email protected] null            5332621456
          1001 mark        k     [email protected]      9451421452  235153654
          1002 john   cena gary  [email protected]    9987526312
    SQL>SY.

  • How to get multiple values from the db using select

    hi all,
    i am using oracle 9i database
    i created a procedure
    create or replace procedure sample_proce
    as
    to_i varchar2(50)
    begin
    select to_id into to_i from sample where flag in('y');
    dbms_output.put_line('hai'|| to_i);
    end;
    when i executed this procedure the following error occurred.
    error at line 5 fetching too many rows.
    but when i execute the select query alone i can able to view all the rows.
    how to resolve it

    i used the following procedure
    create or replace procedure sample_proc
    as
    begin
    for s in(select to_id from sample where flag='y')
    loop
    dbms_output.put_line(s.to_id);
    end loop.
    end;
    it is executed fine. i can able to fetch all the rows.
    how to pass all these values into the another procedure.
    we usually pass only one value into another procedure, i do no how to pass all the values . please help me.
    Thank u.

  • How to get missing records from one table

    I have one table with many records in the table. Each time a record is entered the date the record was entered is also saved in the table.
    I need a query that will find all the missing records in the table.
    so if I have in my table:
    ID          Date          Location
    1           4/1/2015        bld1
    2           4/2/2015        bld1
    3           4/4/2015        bld1
    I want to run a query like
    Select Date, Location FROM [table] WHERE (Date Between '4/1/2015' and '4/4/2015') and (Location = bld1)
    WHERE Date not in
    (Select Date, Location FROM [table])
    and the results would be:
    4/3/2015   bld1
    Thank you

    Do you have a table with all possible dates in it?  You can do a left join from that to your above mentioned table where the right side of the join is null.  If you don't have a table with all possible dates you could user a numbers table.
    Below is one way to achieve what you want with a numbers table...
    DECLARE @Table table (ID Int, DateField Date, Location VarChar(4))
    DECLARE @RunDate datetime
    SET @RunDate=GETDATE()
    IF OBJECT_ID('dbo.Numbers') IS NOT NULL 
    DROP TABLE NUMBERS
    SELECT TOP 10000 IDENTITY(int,1,1) AS Number
       into Numbers
        FROM sys.objects s1
        CROSS JOIN sys.objects s2
    ALTER TABLE Numbers ADD CONSTRAINT PK_Numbers PRIMARY KEY CLUSTERED (Number)
    INSERT INTO @Table (ID, DateField, Location)
    VALUES ('1','20150401','bld1')
    ,('1','20150402','bld1')
    ,('1','20150404','bld1');
    WITH AllDates
    as
    SELECT DATEADD(dd,N.Number,D.StartDate) as Dates
    FROM Numbers N
    cross apply (SELECT CAST('20150101' as Date) as StartDate) as D
    select * 
    from AllDates AD
    left join @Table T on AD.Dates = T.DateField
    where ad.Dates between '20150401' and '20150404'
    AND T.ID IS NULL
    LucasF

Maybe you are looking for