How can i get the external Sql result return data to abap?

Dear All
         I have a problem to how to get the select  result data return abap.
I used abap to run external SQL server. below is my code:
***in above ,abap has already connected external SQL.
Sql = u2018select * from user01u2019
      CALL METHOD OF rec 'Open'
        EXPORTING #1 = sql
        #2 = con
        #3 = '1'.
      IF NOT sy-subrc = 0.
        MESSAGE e000 WITH 'run external sql error!'.
      ENDIF.
***now ,below code how can I get the select result to abap code?
I know I can use native_sql  such as u2018OPEN CUR1 FOR SELECT * FROM user01 AND FETCH NEXT CUR1 INTO :WAu2019.
    Thanks for all
Sun

Thanks.
it is okay now by myself.
con_str = 'Provider=SQLOLEDB.1;Password=pwd;Persist Security Info=True;User ID=name;Initial Catalog=VTL_DEMO;Data Source=192.168.21.50'.
  CREATE OBJECT o_conn 'ADODB.Connection'.
  CREATE OBJECT o_rec 'ADODB.Recordset'.
  SET PROPERTY OF o_conn 'Provider' = provider.
  SET PROPERTY OF o_conn 'ConnectionString' = con_str.
  CALL METHOD OF o_conn 'Open'.
  sql_str = 'select *  from userh'.
  CALL METHOD OF o_conn 'Execute' = o_recordset
    EXPORTING
    #1 = sql_str.
   #2 = o_conn.
  GET PROPERTY OF o_recordset 'EOF' = rs_eof.
  REFRESH itab.
  WHILE rs_eof NE 1.
    CALL METHOD OF o_recordset 'fields' = o_field
      EXPORTING
      #1 = 0.
    GET PROPERTY OF o_field 'Value' = itab-name.
    CALL METHOD OF o_recordset 'fields' = o_field
      EXPORTING
      #1 = 1.
    GET PROPERTY OF o_field 'Value' =  itab-cid.
    APPEND itab.
    CALL METHOD OF o_recordset 'MoveNext'.
    GET PROPERTY OF o_recordset 'EOF' = rs_eof.
  ENDWHILE.

Similar Messages

  • How can i get the time and result together show in one Array or in Cluster?

    hello everyone i am a new user .I want to get the time and voltge form a Generater. How can i get the time and result together show in one Array or in Cluster?When i selecte the first(or third...) result then in the front panel display the time and the voltge.Thank you!
    I post the time and voltge NOT together photo
    Attachments:
    12345.GIF ‏54 KB

    You can create an array of clusters with one element being the time and the other being the voltage, like so (using the "Get Waveform Components" function):
    Message Edited by smercurio_fc on 10-17-2007 03:15 PM
    Attachments:
    pic.PNG ‏11 KB

  • I have all my music on an external media drive that has crashed. How can I get the music of my ipod touch back onto the comupter without loosing the music when it syncs?

    I have all my music on an external media drive that has crashed. How can I get the music of my ipod touch back onto the comupter without loosing the music when it syncs. in order to start rebuilding my music collection?

    You should be able to recover the media with the tips in  this post from forum regular Zevoneer but I'm not sure what the implications are for your application settings. You can probably transfer your purchases into a newly authorised library, backup the device, recover any other media using third party tools, then restore the device from the backup. That should switch the assocation of the device to the new library but it is not something I've personally tested.
    When you get it all working, make a backup!
    tt2

  • How can i get the date of the last update of one PL/SQL package ?

    Hello,
    How can i get the date of the last update of a PL/SQL package
    named MYPACKAGE ?
    Thanks in advance ! ;-)

    to get the timestamp,last ddl time of object
    select timestamp,last_ddl_time from user_objects
    where object_name='<package name>';
    this will give you last transaction time ,date of object

  • How can i get the id of the external application in my portlet??

    How can i get the id of the external application in my portlet??

    Hi Alf,
    I am not sure that you can get that information from within JPDK.
    thanks,
    Harsha

  • How can I get the return code of SQL*Plus under Win2000Pro

    How can I get the return code of SQL*Plus under Win2000Pro ?

    In a DOS batch script? Try ECHO %ERRORLEVEL%
    -- CJ

  • DDL statements in v$sql tables, how can i get the password.....

    Hi friends,
    When I create a user by issuing a statement like
    create user abcd identified by xyz;
    user created.
    but, how can i get the password without encryption in the v$XXXXX tables. Is there any dynamic table which stores the statement executed above in the current session, so that I can get the original password given.
    but when selecting the password by the query
    select password from sys.user$
    where name = 'abcd';
    Password
    ==========
    345ISDF9K4590DFJ35
    .........this is not my password(yes it is!) but not understandable..,
    Anybody please, show me the right way or query..,
    Post-Query Thanx..
    Praveenkumar Talla (Pune, India)

    I would hope there is no way to get this data. I wouldn't want a mechanism to grab passwords out of the SGA. Passwords are stored encrypted in the database. If you need to know the password, run another 'alter user username identified by password' and make not of what you changed it to.

  • How can I get the variable with the value from Thread Run method?

    We want to access a variable from the run method of a Thread externally in a class or in a method. Even though I make the variable as public /public static, I could get the value till the end of the run method only. After that scope of the variable gets lost resulting to null value in the called method/class..
    How can I get the variable with the value?
    This is sample code:
    public class SampleSynchronisation
         public static void main(String df[])
    sampleThread sathr= new sampleThread();
    sathr.start();
    System.out.println("This is the value from the run method "+sathr.x);
    // I should get Inside the run method::: But I get only Inside
    class sampleThread extends Thread
         public String x="Inside";
         public void run()
              x+="the run method";
    NB: if i write the variable in to a file I am able to read it from external method. This I dont want to do

    We want to access a variable from the run method of a
    Thread externally in a class or in a method. I presume you mean a member variable of the thread class and not a local variable inside the run() method.
    Even
    though I make the variable as public /public static, I
    could get the value till the end of the run method
    only. After that scope of the variable gets lost
    resulting to null value in the called method/class..
    I find it easier to implement the Runnable interface rather than extending a thread. This allows your class to extend another class (ie if you extend thread you can't extend something else, but if you implement Runnable you have the ability to inherit from something). Here's how I would write it:
    public class SampleSynchronisation
      public static void main(String[] args)
        SampleSynchronisation app = new SampleSynchronisation();
      public SampleSynchronisation()
        MyRunnable runner = new MyRunnable();
        new Thread(runner).start();
        // yield this thread so other thread gets a chance to start
        Thread.yield();
        System.out.println("runner's X = " + runner.getX());
      class MyRunnable implements Runnable
        String X = null;
        // this method called from the controlling thread
        public synchronized String getX()
          return X;
        public void run()
          System.out.println("Inside MyRunnable");
          X = "MyRunnable's data";
      } // end class MyRunnable
    } // end class SampleSynchronisation>
    public class SampleSynchronisation
    public static void main(String df[])
    sampleThread sathr= new sampleThread();
    sathr.start();
    System.out.println("This is the value from the run
    method "+sathr.x);
    // I should get Inside the run method::: But I get
    only Inside
    class sampleThread extends Thread
    public String x="Inside";
    public void run()
    x+="the run method";
    NB: if i write the variable in to a file I am able to
    read it from external method. This I dont want to do

  • How can I get the variable with the value from Thread's run method

    We want to access a variable from the run method of a Thread externally in a class or in a method. Even though I make the variable as public /public static, I could get the value till the end of the run method only. After that scope of the variable gets lost resulting to null value in the called method/class..
    How can I get the variable with the value?
    This is sample code:
    public class SampleSynchronisation
         public static void main(String df[])
    sampleThread sathr= new sampleThread();
    sathr.start();
    System.out.println("This is the value from the run method "+sathr.x);
    /* I should get:
    Inside the run method
    But I get only:
    Inside*/
    class sampleThread extends Thread
         public String x="Inside";
         public void run()
              x+="the run method";
    NB: if i write the variable in to a file I am able to read it from external method. This I dont want to do

    Your main thread continues to run after the sathr thread is completed, consequently the output is done before the sathr thread has modified the string. You need to make the main thread pause, this will allow sathr time to run to the point where it will modify the string and then you can print it out. Another way would be to lock the object using a synchronized block to stop the main thread accessing the string until the sathr has finished with it.

  • How can i get the value when the field name is user defined

    Hi,
    I have a one java method:
    public ResultSet countUserDb(String id) {
    ResultSet rs = null;
    con = dbcon.connect();
    String queryString = ("select count(*) as count from
    db_allocation where user_id='"+id+"'");
    Statement stmt = con.createStatement();
    rs = stmt.executeQuery(queryString);
    When i call it in a jsp file.
    ResultSet counter =db.countUserDb(request.getParameter("id"));
    if(counter.next())
    int x=rs.getInt("count");
    Tomcat said incorrect column name.How can i get the result set when the field name is user's defined.
    Best regards
    Ricky

    Hi Ricky
    To access pseudo columns you can specify an alias or use the index on the column (e.g. getInt(1)).
    Chris
    NB: you should use bind variables instead of concatenating the id to the SQL statement.

  • How can I get the language of the user logged on using only DI API?

    Hello,
    how can I get the language of the user logged on using only DI API,
    without invoking the UI?
    Can I read the value from some table using sql?
    I could write to file the first user's connection to the language code in SAP and then use it from external program, but I do not like this solution ...
    I know only this possibility:
            '_SboCy ==> SAPbobsCOM.Company
            '_SboCys ==> SAPbobsCOM.CompanyService
            '_SboApp ==> SAPbouiCOM.Application
            CodLng Dim As String = ""
            Dim lng As SAPbobsCOM.UserLanguages _SboCy.GetBusinessObject = (BoObjectTypes.oUserLanguages)
            If lng.GetByKey (_SboApp.Language) Then
                codLng = lng.LanguageShortName
                'Etc. ..
            End If
            lng = Nothing
    Thanks

    Hi Enrico,
    The language settings are held on the user's Windows profile and not in the database. In SBO 2007A onwards there is an XML file that is created by the SBO client (previous versions stored the information in the registry). The file is called b1-current-user.xml and you'll find it in the temporary application data under the user's profile (by default this will be C:\Documents and Settings\<profile>\Local Settings\Application Data\SAP\SAP Business One for Windows XP). This XML file contains a node that looks like the following:
    <leaf kind="single" name="Language" type="String">
         <value>8</value>
    </leaf>
    where the value is the language id that should correspond to the same setting in the DI API. If your application will always run on a workstation where the SBO client is installed then you could read this XML file. Of course, this file may not exist for a particular Windows user if they have never opened the SBO client so you'd need to have a default setting.
    If you application will be installed on a workstation which doesn't have an SBO client installed on it then there is no way to tell what default language to use and you'll need to build this logic in to your own application (eg have a screen where the user can choose their preferred langauge and then store this as a config file in a similar way to how the SBO client works).
    Kind Regards,
    Owen

  • How can I get the responsibility for concurrent programs

    Guys,
    How can I get the responsibility for a list of concurrent programs. Is there a query that I can run to get the results?
    Thanks in advance,

    Refer to Note: 134036.1 - WHOCANRUN.SQL - List Responsibilities That Can Run a Given Concurrent Program
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=134036.1
    From the output of the query in the note referenced above, you can run "Users of a Responsibility" concurrent program then to find out the list of users who have access to a certain responsibility.

  • I am having macbook air recently my iphotos did not open and was showing report apple and reopen but i came to know that by pressing alt and iphotos i open an new photo library and stored the pics but now how can i get the pics which i had in the earlier

    i am having macbook air recently my iphotos did not open and was showing report apple and reopen but i came to know that by pressing alt and iphotos i open an new photo library and stored the pics but now how can i get the pics which i had in the earlier photo please help me to recover my photos

    Well I'll guess you're using iPhoto 11:
    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Repair Database. If that doesn't help, then try again, this time using Rebuild Database.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. (In early versions of Library Manager it's the File -> Rebuild command. In later versions it's under the Library menu.)
    This will create an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.  
    Regards
    TD

  • How can i get to itunes to store all data on an external drive

    how can i get to itunes to store all data on an external drive rather than the drive ITUnes run off. I can get photos and music off but my apps and movies seem to go to the drive where itunes is run from?

    See if this helps:
    http://support.apple.com/kb/HT1364

  • How can I get the elapse time for execution of a Query for a session

    Hi ,
    How can I get the elapse time for execution of a Query for a session?
    Example - I have a report based on the procedure ,when the user execute that it takes say 3 min. to return rows.
    Is there any possible way to capture this session info. for this particular execution of query along with it's execution elapse time?
    Thanks in advance.

    Hi
    You can use the dbms_utility.get_time tool (gives binary_integer type value).
    1/ Initialize you time and date of beginning :
    v_beginTime := dbms_utility.get_time ;
    2/ Run you procedure...
    3/ Get end-time with :
    v_endTime := dbms_utility.get_time ;
    4/ Thus, calculate elapsed time by difference :
    v_elapsTime := v_endTime - v_beginTime ;
    This will give you time elapsed in of 100th of seconds...
    Then you can format you result to give correct print time.
    Hope it will help you.
    AL

Maybe you are looking for

  • Problem with LONG column in 8.1.7

    Hello All, Our db version is 8.1.7.0.0. ( Unix OS ). We have a table with a LONG column, which stores BINARY data(Billing Details). Is there any way to manipulate it, other than converting it to LOB column? I dont know where to start.Any help or hint

  • How to use forfiles= without recreating over and over?

    I'm struggling trying to get some file testing done and can't figure what the right combination of commands should be. The goal is to have a number of files created (64, for example), then run different tests on those files, varying the number of fil

  • Adoacorectl.sh time out when the computer is not connected to the network

    Hi, I successfully installed R12.1 on Oracle Linux 4.5 on my laptop. It worked perfectly when I connected the laptop to the network (router). However, if I disconnected the laptop from the network, I got all kinds of errors when running adstrtal.sh.

  • Error 200141 when trying to measure motor encoder's speed from PCI 6221 card,

    Hi,          I was trying to measure angular speed of a motor from its encoder signal. I'm using Ctr pin from PCI 6221 card take signals from the encoders. The problem comes when I've got an Error-200141 saying "data was overwritten before it could b

  • Update for iOS 8.1.2 requires 5.6 GB on iPhone 5S?

    I'm currently running iOS 7.1.2 on my iPhone 5S and my iPad 2. Is that 5.6 GB number really correct? That's pretty big on a 16 GB phone. Since my total user storage shows 12 GB, is iOS 7 consuming the bulk of that 4 GN difference, and I'll get that b