Help , How to get data from database using recordset with UI API

I want to get a data from database
when I want to create recordset i notice that UI API didn't has record set
so I created recordset using DI API (SAPbobscom.recordset and SAPbobscom.company)
======================================================
Dim oCompanyUI As SAPbouiCOM.Company <<UI API
Dim oRecSet As New SAPbobsCOM.Recordset << DI API
Dim oCompanyDI As New SAPbobsCOM.Company << DI API
'=====================================================
oCompanyDI.Connect
Set oRecSet = oCompanyDI.GetBusinessObject(BoRecordset)
oRecSet.DoQuery ("SELECT T0.CardCode, T0.CardName FROM OCRD T0")
SBO_Application.MessageBox oRecSet.Fields.Item(1).Value
======================================================
but I got an error it said "you are not connected to company"
I'm really don't have an idea about how to get a data from using UI API (exp I want to get a date or costumer code)
can someone help me please, I really need it
Thanks

you need a single sign on
        Dim oDICompany As SAPbobsCOM.Company
        Dim sCookie As String
        Dim sConnStr As String
        Dim ret As Integer
        oDICompany = New SAPbobsCOM.Company
        sCookie = oDICompany.GetContextCookie
        sConnStr = SBO_Application.Company.GetConnectionContext(sCookie)
        If oDICompany.Connected Then
            oDICompany.Disconnect()
        End If
        ret = oDICompany.SetSboLoginContext(sConnStr)
        If Not ret = 0 Then
            SBO_Application.MessageBox("set Login Context failed!")
            Exit Sub
        End If
        ret = oDICompany.Connect()
        If Not ret = 0 Then
            SBO_Application.MessageBox("Company Connect failed!")
        End If

Similar Messages

  • How to get data from Oracle using Native SQL in SAP.. Problem with date

    Hi Masters.
    I'm trying to get data from an Oracle DB. I was able to connect to Oracle using tcode DBCO. The connetion works fine
    I wrote this code and it works fine without the statement of where date > '01-09-2010'
    But i need that statement on the select. I read a lot about this issue, but no answer.
    My code is (this code is in SAP ECC 6.0)
    DATA: BEGIN OF datos OCCURS 0,
          id_numeric(10),
          component_name(40),
          comuna(10),
          record_id(10),
          status,
          sampled_date(10),
          END OF datos.
    DATA: c TYPE cursor.
    EXEC SQL.
      connect to 'LIM' as 'MYDB'
    ENDEXEC.
    EXEC SQL.
      SET CONNECTION 'MYDB'
    ENDEXEC.
    EXEC SQL PERFORMING loop_output.
      SELECT ID_NUMERIC, COMPONENT_NAME, COMUNA, RECORD_ID, STATUS, SAMPLED_DATE
      into :datos from lims.SAMP_TEST_RESULT
      where     date > '01-09-2010'
    ENDEXEC.
    EXEC SQL.
      disconnect 'MYDB'
    ENDEXEC.
    How can i get the data from that date?? If i delete the where statemet, the program works well, it takes 30 mins and show all the data, I just need the data from that date.
    Any help
    Regards

    Please refer the example in this link which deals with Oracle date format.
    You can finnd a command DECODE which is used for date formats. If you have a look at whole theory then you will get an idea.
    Link:[Bulk insert SQL command to transfer data from SAP to Oracle|http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bulk-insert-sql-command-to-transfer-data-from-sap-to-oracle-cl_sql_connection-3780804]

  • How save & retrive data from database using flex, coldfusion, sql server

    hi , i am very new in flex, i am trying to insert data in
    database using flex2, coldfusion, sql server. any one can help me
    please. or give me any example.

    Hi try to goto the following sites, you will get some
    direction to think
    http://weblogs.macromedia.com/pent/archives/2006/11/example_of_flex.cfm
    http://pdxphp.org/node/258
    Good Luck

  • How to fetch data from Database using SUP MBOs

    I'm learning to develop blackberry apps using SUP.I am new to both blackberry api and SUP.
    I need to make a login page for a Student and then validate the username and password entered using data from a database.
    I need to check the database for the username and password entered. What should be my next step? How do i get this data from the database. Using findAll() method is not working . Do i need to connect to SCC or unwired server first. If yes , then someone please provide a sample code for it.

    Hi!, I see your code and I see that you have a fee errors, try to use this:
    import java.text.*;
    import java.sql.*;
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.OutputStream;
    * NOTE: You must put the try-catch and your sql code into the get method
    /** Servlet program to take fetchdata from database and display that on the broswer*/
    public class Fetchdata
        extends HttpServlet {
      String query = new String();
      String uid = "ashvini";
      String pwd = "******";
      public void doGet(HttpServletRequest request, HttpServletResponse response) throws
          ServletException, Exception {
        try {
          Connection con = null;
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          String url = "jdbc:odbc:Testing";
          con = DriverManager.getConnection(url, uid, pwd);
          Statement s = con.createStatement();
          query = "select * from gowri.msllst1";
          ResultSet rs = s.executeQuery(query);
          response.setContentType("text/html");
          ServletOutputStream out = response.getOutputStream();
          out.println("<HTML>" + "<BODY BGCOLOR=\"#FDF5E6\">\n" +
                      "<H1 ALIGN=CENTER>" + title + "</H1>\n" +
                      "<table>" + " <th>ITEM Code</th>");
          while (rs.next()) {
            out.println("<tr><td>" + rs.getString(1).trim() + "</td></tr>");//I change </tr></td> for </td></tr>
          } //end of while
          out.println("</table></BODY></HTML>");
        catch (Exception e) {
          System.out.println(e);
      } //end of doGet method
    }I hope this help you :)

  • How to get data from database to JComboBox

    hi
    i am trying to get data which is in database. here the problem is i am getting only one row in the JcomboBox
    i want all data just like list. i dont know how to get that . below is the code plz any one help me....
    import javax.swing.*;
    import javax.swing.JList.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.lang.String.*;
    import java.lang.Integer.*;
    import java.sql.*;
    public class customer_code extends JFrame implements ActionListener
    Container c=getContentPane();
    JLabel customer_code=new JLabel("Customer Code and Name");
    customer_code()
    super("Customer Details");
    setSize(300,250);
    setVisible(true);
    setLayout(null);
    setLocation(430,310);
    Font f=new Font("SansSerif",1,16);
    Font f1=new Font("SansSerif",0,14);
    customer_code.setBounds(10,20,250,30);
    add(customer_code);
    customer_code.setFont(f);
    ResultSet rs=null;
    String j=null,k=null;
    try
    System.out.println("MySQL Connect Example.");
    Statement st=null;
    Connection con=null;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection("jdbc:odbc:project","vikky","vishu");
    System.out.println("Connected to the database");
    st=con.createStatement();
    rs=st.executeQuery(" select code as c,Customer_name as n from customer_details ");
    while(rs.next())
    j=rs.getString("c");
    k=rs.getString("n");
    System.out.println(j);
    System.out.println(k);
    String[] names = new String[] {j,k};
    JComboBox comboBox = new JComboBox(names);
    add(comboBox);
    comboBox.setBounds(25,60,250,50);
    comboBox.setFont(f);
    comboBox.addActionListener(this);
    comboBox.setMaximumRowCount(10);
    con.close();
    System.out.println("Disconnected from database");
    catch (Exception e)
    e.printStackTrace();
    public void actionPerformed(ActionEvent event)
    if ("comboBoxChanged".equals(event.getActionCommand()))
    System.out.println("User has selected an item from the combo box.");
    JComboBox comboBox = (JComboBox) event.getSource();
    if(comboBox.getSelectedItem().equals("None"))
    public static void main(String agr[])
    customer_code cd=new customer_code();
    }

    r035198x wrote:
    Also separate that database code from interface display code.
    You should never access the database on the EDT.
    See [Doing Swing Right|http://bytes.com/topic/java/insights/853297-doing-swing-right] for more details.
    Yes! By the time you are working with Swing and JDBC you should already know how to structure code. If not, then you are not ready for these topics and you've jumped the gun.

  • How to fetch data from DataBase using Servlet ?

    Hi all,
    Till now, i was just sending values from web page and receive the data in excel format using servlets.
    But, now, i want to fetch data from data base. I will be giving inputs in the web page(for the query)....ON click of submit button,
    Servlet should be called.
    Depending on the input, query has to be executed, and response should be sent to the user.
    How to do it?
    Code
    import java.text.*;
    import java.sql.*;
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.OutputStream;
    /** Simple servlet that reads three parameters from the html
    form
    public class Fetchdata extends HttpServlet
              String query=new String();
              String uid="ashvini";
              String pwd="******";
              try
                   Connection con=null;
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");     
                   String url = "jdbc:odbc:Testing";     
                   con = DriverManager.getConnection(url, uid, pwd);
                   Statement s = con.createStatement();
                   query = "select * from gowri.msllst1";
                   ResultSet rs = s.executeQuery(query);
              public void doGet(HttpServletRequest request,HttpServletResponse response)
              throws ServletException, IOException
                        response.setContentType("application/vnd.ms-excel");
                        ServletOutputStream out=response.getOutputStream();
                        out.println("<HTML>" +"<BODY BGCOLOR=\"#FDF5E6\">\n" +
                        "<H1 ALIGN=CENTER>" + title + "</H1>\n" +
                        "<table>" +" <th>ITEM Code</th>");
                        while(rs.next())
                        out.println("<tr><td>" rs.getString(1).trim()"</tr></td>");
                        }//end of while
                        out.println("</table></BODY></HTML>");
                   }//end of doGet method
         }catch(Exception e)
                        System.out.println(e);
    It is giving error message as:
    C:\Program Files\Apache Tomcat 4.0\webapps\general\srvlt>javac Fetchdata.java
    Fetchdata.java:17: illegal start of type
    try
    ^
    Fetchdata.java:48: <identifier> expected
    ^
    2 errors
    Is this format is correct? am i placing this doGet method at the right place? is my program's logic is correct?
    Please help me?
    Regards
    AShvini

    There is some mistakes in ur code.....how can try catch exists outside a function???
    make use of try catch isde ur doGet method and put
    Connection con=null;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String url = "jdbc:odbc:Testing";
    con = DriverManager.getConnection(url, uid, pwd);
    Statement s = con.createStatement();
    query = "select * from gowri.msllst1";
    ResultSet rs = s.executeQuery(query);
    isdie doGet method, for the time being,
    i think u get me..
    regards
    shanu

  • How to get data from bean using selectmanycheckbox

    Am not able to understand how to get selectmanycheckbox data of datatable from backing bean
    help me on this
    thanks

    hi balu,
    Am getting the error in running the jsp. the error is like
    org.apache.jasper.JasperException: "{2}" Conversion Error setting value ''{0}'' for ''{1}''.
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
         com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
         com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    root cause
    java.lang.IllegalArgumentException: "{2}" Conversion Error setting value ''{0}'' for ''{1}''.
         com.sun.faces.util.Util.getSelectItems(Util.java:642)
         com.sun.faces.renderkit.html_basic.SelectManyCheckboxListRenderer.encodeEnd(SelectManyCheckboxListRenderer.java:115)
         javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:712)
    can u seggest me on this
    can u give the example code for setters And getters of selecteditems, selectitems
    thanks

  • How to Insert Data in Database using BCS with out External List

    Hi,
    How to Insert,Update and Delete User Interface  data using business connectivity service with out External List.Please suggest me solution.
    Regards,
    khadar

    Once you've configured the external content type, you can interact with it using the BDC Object Models available to you.  You can use server side or client side and interact with the database without an external list.
    Check these links:
    Server side:
    http://msdn.microsoft.com/en-us/library/office/ff464357(v=office.14).aspx#sectionSection3
    Client Side: http://msdn.microsoft.com/library/jj164116.aspx
    Brandon Atkinson
    Blog: http://sharepointbrandon.com

  • How to display data from Database individually??? Anyone can help ?

    HI,
    i i had select a row of data from database using ,
    /* Query * From Table RESOURCEORDER where po = selected no and project = selected project */
         public ResultSet getAllData() throws SQLException
         getConnection();
         Statement stmt = conn.createStatement();
         ResultSet rs = stmt.executeQuery("SELECT * FROM RESOURCEORDER WHERE PROJECT = '" + getSelProject() + "' and PURCHASEORDERNO = '" + getPo() + "'" );
         return rs;
    After that , how do i display the data individually ?
    Eg select data is ('projectA','7891203-1', '10-4-2005','lcd',2000,'121-45217-8','electrical','pending','donwong')
    i want to display them individually, like this in a page
    Projectname: /* should display the Project A*/
    P.O no:
    Date:
    Order:
    Cost:
    Acc no:
    Type:
    status:
    Orderedby:
    Can anyone help ? cos i'm new to JSP ......Thanks alot!!!!!
    Regards,
    khim

    I assume PO being a unique key, will always return 1 row from db.
    public String[] getAllData() throws Exception
    getConnection();
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("SELECT * FROM RESOURCEORDER WHERE PROJECT = '" + getSelProject() + "' and PURCHASEORDERNO = '" + getPo() + "'" );
    String [] returnValue = new String[9];
    while(rs.next())
    returnValue[1] = rs.getString("colname");
    returnValue[2] = rs.getString("colname");
    ///and so on
    return returnValue;
    }Once you get that you could individually view it by setting a loop to run through the returned array.
    Hope it helps

  • How to get data from a USB-UIRT device using Labview?

    How to get data from a USB-UIRT device using Labview?
    I'm trying to get data from a USB-UIRT device, is it posible with Labview?
    I really appreciate your help, 
    thanks

    You may want to contact the developer of the device for the API and DLL.
    http://65.36.202.170/phpBB2/viewforum.php?f=3

  • Question regarding Polling data from database using DB Adapters in BPEL

    Hi,
    I have the following question regarding Polling data from database using DB Adapters in BPEL -
    If I am selecting data from multiple tables/view to ultimately generate hierarchical xml document, is there a way that I specify polling all of these tables/views. Is polling limited only to one table/view?
    Thanks
    Ravi

    Hi Ravi,
    your question seems to have been answered for the question of polling a set of tables with one as the root, and getting back a hierarchical xml representing multiple related tables.
    However you can also poll for changes to both the root table and its related tables. Not sure if this was your question or the one already answered. If the former please check out the sample
    bpel/samples/tutorials/122.DBAdapter/advanced/polling/PollingForChildUpdates
    Thanks
    Steve

  • How to get data from three tables (A,B,C) having one to many relation between A and B .and having one to many reation between b and c

    i have  three tables A,B,C.  there is one to many relation between A and B. and one to many relation existed between table b and c . how will get data from these three tables

    check if this helps:
    select * --you can always frame your column set
    from tableA a
    left join tableB b on a.aid=b.aid
    left join tableC c on c.bid=b.bid
    This is just a general query. However, we can help you a lot more, if you can post the DDL + sample data and required output.
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • How to retrieve data from MDM using java API

    hi experts
    Please explain me the step by step procedure
    how to retrieve data from MDM using java API
    and please tell me what are the
    important classes and packages in MDM Java API
    thanks
    ramu

    Hi Ramchandra,
    You can refer to following links
    MDM Java API-pdf
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2d18d355-0601-0010-fdbb-d8b143420f49
    webinr of java API
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/89243c32-0601-0010-559d-80d5b0884d67
    Following Fourm Threads will also help.
    Java API
    Java API
    Re: usage of  java API ,
    Matching Record
    Need Java API for Matching Record
    Thanks and Regards,
    Shruti.
    Edited by: Shruti Shah on Jul 16, 2008 12:35 PM

  • How to display items from database using catagorylookupdroplet

    Hi everyone,
    i want to know how to display items from database using catagorylookup droplet. if anybody have any code snippet please share it.
    Thanks in advance,

    <dsp:droplet name=".................../CategoryLookup">
         <dsp:param name="id" param="itemId"/>
         <dsp:oparam name="output">
              <dsp:valueof param="element.displayName"/>
                   <%-- This is show the Child Category --%>
                   <dsp:droplet name="......................./ForEach">
                   <dsp:param name="array" param="element.childCategories"/>
                   <dsp:oparam name="outputStart">Child Categories</dsp:oparam>
                   <dsp:oparam name="output">
                        <dsp:a href="">//bydefault it will take its own file's name
                             <dsp:param name="itemId" param="element.repositoryId"/>                                                                                          <dsp:valueof param="element.displayName"/>
                        </dsp:a>
                   </dsp:oparam>                                             
                   </dsp:droplet>
                   <%-- This is show the Child Product --%>          
                   <dsp:droplet name=".............../ForEach">
                        <dsp:param name="array" param="element.childProducts"/>
                        <dsp:oparam name="outputStart">Child Products</dsp:oparam>
                                  <dsp:oparam name="output">
                                       <dsp:droplet name="................/ProductLookup">
                                            <dsp:param name="id" param="itemId"/>
                                            <dsp:param name="elementName" value="Prod"/>
                                            <dsp:oparam name="output">
                                                 <dsp:getvalueof id="img102" param="Prod.smallImage.url" idtype="java.lang.String">
                                                      <dsp:img height="250" width="250" src="<%=img102%>"/>
                                                 </dsp:getvalueof>
                                            </dsp:oparam>
                                       </dsp:droplet>
                                       <dsp:a href="productView.jsp">
                                            <dsp:param name="itemId" param="element.repositoryId"/>
                                            <dsp:valueof param="element.displayName"/>
                                       </dsp:a>
    Hope this helps.
    -RMishra

  • How to get data from MS CRM into Crystal Reports

    Hello All,
    Can anybody tell me how to get data into   crystal XI reports with MS CRM.
    Thanks in Advance
    Ramesh

    First you should refer to the Rules of Engagement and then add more info.
    Start off by telling us what version of CR are you using and what is MS CRM?
    Thank you
    Don

Maybe you are looking for

  • SQL Developer 1.1 close - no error msg (connect after changed TNS info)

    We installed a new QA database and as a result I had to change the connection credentials. After doing this on a connect, SQL Developer closed without any warning. The following repro steps: 1.) I right click on the connection name and click on Prope

  • Operation Not Allowed

    does anyone know what operation not allowed means? I had a timeline with a .PSD in it, as i draged it over a piece of video in the timeline a red box in the viewer came up and asked me to refresh the window. A dialogue Box came up and said out of mem

  • Same old same old: calling David Powers

    It has been interesting to watch and read the comments recently about the DW tangle with database-driven sites. I am using DW CS6 (12.03) Mac with Mountain Lion, and have MAMP installed and runnning. I have religiously finished David Powers tute at h

  • Weird one! Phone sending random SMS from earlier.....

    Has anyone ever come across this one before? The last couple of days, when I have sent an SMS (particularly one which is long enough to be sent as two parts), the recipient has not received what I sent but has instead received a text again that I sen

  • Incoming Payment: Distribute Differences

    When applying payments and you want to distribute differences . . . the screen shows the amount and reason code  . . . how can you add another field to this view such as payment terms?