How to read the data from a sorted table

Hi all,
How to read data from the sorted tables. Please provide some examples.
Thanks and regards,
Lisa

You can read like this :
DATA: BEGIN OF LINE,
COL1 TYPE I,
COL2 TYPE I,
END OF LINE.
DATA ITAB LIKE SORTED TABLE OF LINE WITH UNIQUE KEY COL1.
DO 4 TIMES.
  LINE-COL1 = SY-INDEX.
  LINE-COL2 = SY-INDEX ** 2.
INSERT LINE INTO TABLE ITAB.
ENDDO.
CLEAR LINE.
READ TABLE ITAB WITH TABLE KEY COL1 = 3
                INTO LINE TRANSPORTING COL2.
WRITE:   'SY-SUBRC =', SY-SUBRC,
       / 'SY-TABIX =', SY-TABIX.
SKIP.
WRITE: / LINE-COL1, LINE-COL2.

Similar Messages

  • How to read the data from an internal table,when column names are known

    Hi All
    I have a specific requirement. I got an internal table with many fields (let it be my_tab).  Some of the fieldnames (column names in internal table my_tab) are stored in separate internal table(let it be my_fields).
    I need to store/read data corresponding to the fields (whose name is stored in my_fields) from my_tab.
    I am able to build dynamic table (referred by field-symbol) with respect to the given field names in my_fields.
    But i am unable to read the data corresponding to the fieldnames from my_tab.
    Please provide  me some pointer in this regard.
    Regards
    Swetabh Shukla

    HI All
    Thanks for the prompt response. I got solution for my question. Please check below thread. For quick reponse i posted my question in one more category. Thanks to all of you.
    How to read internal table w.r.t. fieldnames stored in other table

  • How to read the data from Excel file and Store in XML file using java

    Hi All,
    I got a problem with Excel file.
    My problem is how to read the data from Excel file and Store in XML file using java excel api.
    For getting the data from Excel file what are all the steps i need to follow to get the correct result.
    Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
    Thanks & Regards,
    Sreenu,
    [email protected],
    india,

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • How to read the data from a file in another computer with user name and password login

    How to read read the data from a file in anohter computer which need to login with user name and password?

    duplicate post:  http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2061478
    duplicate post:  http://forums.ni.com/t5/LabVIEW/do-need-to-enter-the-user-name-and-password-when-TCP-ip/m-p/2061612
    duplicate post   http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2060682

  • How to pass the data from a input table to RFC data service?

    Hi,
    I am doing a prototype with VC, I'm wondering how VC pass the data from a table view to a backend data service? For example, I have one RFC in the backend system with a tabel type importing parameter, now I want to pass all the data from an input table view to the RFC, I guess it's possible but I don't know how to do it.
    I try to create some events between the input table and data service, but seems there is no a system event can export the whole table to the backend data service.
    Thanks for your answer.

    Thanks for your answer, I tried the solution 2, I create "Submit" button, and ser the mapping scope to  be "All data rows", it only works when I select at least one row, otherwise the data would not be passed.
    Another question is I have serveral imported table parameter, for each table I have one "submit" event, I want these tables to be submitted at the same time, but if I click the submit button in one table toolbar, I can only submit the table data which has a submit button clicked, for other tables, the data is not passed, how can I achieve it?
    Thanks.

  • How to get the data from a cluster table to BW

    Dear All,
    I want to extract the data from R/3 to BW by using 2 tables and one Cluster B2.
    Actually my report contains some fields from PA2001, PA2002 and one cluster table B2 (Table ZES). Can I create View by using these 3 tables? If it is not possible how can I get the data from the cluster? Can I create generic datasource by using cluster tables directly?
    In SE11 Transaction the Cluster (table ZES) is showing invalid table.
    I referred some Forums, but no use.
    Can any body tell me procedure to get the data from a cluster (table ZES) ?
    Waiting for you results.
    Thanks and regards
    Rajesh

    HI Siggi,
    Thank you for your reply..
    I am also planning to do FM to get the data. But it is saying that the Cluster table ZES does not exist (ZES is the the standard table, in SE11 also).
    How can I use the Fields from the that table.?
    What can I do now, can you please explain me about this point.
    Waiting for your reply.
    Thanks and Regards
    Rajesh
    Message was edited by:
            rajesh

  • How to recover the data from a  dropped table in production/archive mode

    How to recover the data/change on a table that was dropped by accident.
    The database is on archive mode.

    Oracle Version. ? If 10g.
    Try this Way
    SQL> create table taj as select * from all_objects where rownum <= 100;
    Table created.
    SQL> drop table taj ;
    Table dropped.
    SQL> show recyclebin
    ORIGINAL NAME    RECYCLEBIN NAME                OBJECT TYPE  DROP TIME
    TAJ              BIN$b3MmS7kYS9ClMvKm0bu8Vw==$0 TABLE        2006-09-10:16:02:58
    SQL> flashback table taj to before drop;
    Flashback complete.
    SQL> show recyclebin;
    SQL> desc taj;
    Name                                      Null?    Type
    OWNER                                              VARCHAR2(30)
    OBJECT_NAME                                        VARCHAR2(30)
    SUBOBJECT_NAME                                     VARCHAR2(30)
    OBJECT_ID                                          NUMBER
    DATA_OBJECT_ID                                     NUMBER
    OBJECT_TYPE                                        VARCHAR2(19)
    CREATED                                            DATE
    LAST_DDL_TIME                                      DATE
    TIMESTAMP                                          VARCHAR2(19)
    STATUS                                             VARCHAR2(7)
    TEMPORARY                                          VARCHAR2(1)
    GENERATED                                          VARCHAR2(1)
    SECONDARY                                          VARCHAR2(1)
    SQL>M.S.Taj

  • How to read the data from excel file and store into the table?

    Hi All,
    I have table with BLOB datatype contains a excel file. I have to read that data from excel and store into one table with all the fields in excel.
    All the excel fields and my table columns are same.
    Can you share with me how can acheive this using LOB's?
    Thanks

    Hi OraSuirya,
    you can try with external tables .
    syntax as follows
    create table ext_table_csv (
    i Number,
    n Varchar2(20),
    m Varchar2(20)
    organization external (
    type oracle_loader
    default directory ext_dir
    access parameters (
    records delimited by newline
    fields terminated by ','
    missing field values are null
    location ('file.csv')
    reject limit unlimited;
    For this you need to create directory
    Directory Creation syntax:
    create or replace directory ext_dir as 'D:\oracle\user_dir\ext_dir';
    grant read, write on directory ext_dir to <User>;
    please paste the excel file in the particular directory .
    I hope this will help you.
    Please correct me if I am wrong anywhere .
    Thanks,
    Tippu.

  • How to read the data from a column that is in clob data type (but XMLdata)

    Hi ,
    I have a table XYZ which has a column RESPONSE_XML in clob datatype format.we can convert it to XMLTYPE(RESPONSE_XML) to read the data in XML format.
    Now this is the DynamicXML schema file. Here I want to see all the COMMONNAME, ResourceDescribedby_VALUE into column_A, ResourceDescribedby_ResourceSpecCharacteristic_Name tags into column_B
    How can I do that .. any suggestions please ..
    Here is a sample XML:
    <?xml version="1.0" encoding="WINDOWS-1252" ?>
    _- <soap:Body>
    - <SearchResourceResponse xmlns="http://www.google.com/google.xsd">
    - <MessageElements xmlns:tns="http://www.www.google.com/google.xsd" xmlns="">
    <MessageStatus>SUCCESS</MessageStatus>
    - <MessageAddressing>
    <from>gmail</from>
    <to>Gmail SOAPTester</to>
    <messageId>1234</messageId>
    <action>SearchResource</action>
    <transactionId>OR</transactionId>
    <ServiceName>SearchResource</ServiceName>
    <ServiceVersion>1.1</ServiceVersion>
    </MessageAddressing>
    </MessageElements>
    -<SearchResponseDetails xmlns:tns="http://www.www.google.com/google.xsd" xmlns="">
    - <SubNetwork>
    - <Pipe xsi:type="icl:Trail" xmlns:icl="http://www.www.google.com/google.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <CommonName>318-223-4675</CommonName>
    <objectID>91535716980514105329</objectID>
    <SourceSystem>MARS</SourceSystem>
    - *<ResourceDescribedBy> <value>RDSSLA</value>* *<ResourceSpecCharacteristic> <name>*CentralOfficeCode</name>   </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceRelationship>
    - <Resource xsi:type="icl:Trail">
    - <ResourceDescribedBy> <value>001</value> - <ResourceSpecCharacteristic> <name>AssignLocationExternalFormat</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceDescribedBy> <value>001</value> - <ResourceSpecCharacteristic> <name>PairVerticalExternalFormat</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceDescribedBy> <value>001</value> - <ResourceSpecCharacteristic> <name>PairVerticalInternalFormat</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceDescribedBy> <value>+</value> - <ResourceSpecCharacteristic> <name>PairVerticalSign</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceDescribedBy> <value>RDSSLA</value> - <ResourceSpecCharacteristic> <name>CentralOfficeCode</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceDescribedBy> <value>B</value>- <ResourceSpecCharacteristic> <name>EntityType</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    - <ResourceType>FeederCircuit</ResourceType>
    - <LogicalPhysicalResource>
    - <PhysicalResource xsi:type="icl:PhysicalConnector">
    <usageState>S</usageState>
    - <ResourceDescribedBy> <value>25.392</value> - <ResourceSpecCharacteristic> <name>CableLength</name> </ResourceSpecCharacteristic>
    </ResourceDescribedBy>
    </PhysicalResource>
    </LogicalPhysicalResource>
    - <TerminationPoint xsi:type="icl:TrailTerminationPoint">
    <CommonName>1000/34A</CommonName>
    - </Resource>
    </ResourceRelationship>
    <lrStatus>W</lrStatus>
    </Pipe>
    </SubNetwork>
    </SearchResponseDetails>

    you don't appear to have posted valid XML, so I can't reproduce using your example, but you will need to look at something like this:
    select xtab.common_name
      from your_table yt
          ,xmltable('/SearchResourceResponse'
              passing xmltype(yt.response_xml)
              columns
                  common_name varchar2(20) path 'SearchResponseDetails/CommonName'
          ) xtab
    ;

  • How to read the data from a refcursor

    Hi all,
    Here my program . I'm calling pr_test into another program there i need to read the values from refcursor of pr_test program . I dont want use all the values in my second program I need to pass empno and job only.
    pls help me out how to read this?
    package pg_test
    is
    type curvartype is ref cursor;
    procedure pr_test(p_empno in number, o_curvar_out curvartype);
    end;
    package pg_test is
    procedure pr_test( o_curvar_out curvartype)
    is
    begin
    open o_curvar_out for
    select * from emp;
    end loop;
    end;
    end;Thanks,
    Venkat.

    I dont want use all the values in my second program I need to pass empno and job only.Since your cursor gets all the columns (using the * is not a good way to code the cursor), that is what your other program will get when it calls pr_test procedure. You will have to FETCH all the columns in that other procedure and discard the ones you do not need.
    Alternatively, change the code of cursor to select only the columns you would actually need.

  • How to read the data from a PDF document into SAP

    Hi Everyone,
    I am trying to read a PDF document from my desktop and get the data into SAP but i am not getting successful.
    I am using the method cl_gui_frontend_services=>gui_upload and passing the filename and type and importing the file length and the data into an internal table.
    I tried the file type as ASC but i couldn't get any records in the internal table and the filelength is displayed as 0.
    When i tried the file type as BIN, it is giving the short dump. I guess that is because the file i am trying to read is not with the extension BIN.
    Please Advice me on this
    Poornima

    Hi Kiran,
    Below is my program..
    REPORT  zpdf_data_update.
    DATA : lt_file_table TYPE filetable.
    DATA : lv_rc TYPE i.
    DATA : lv_filename TYPE string.
    DATA : lv_filelength TYPE i.
    TYPES : BEGIN OF hex_record,
              data TYPE string,
            END OF hex_record.
    DATA: lt_rawtab TYPE TABLE OF hex_record.
    CALL METHOD cl_gui_frontend_services=>file_open_dialog
    CHANGING
    file_table = lt_file_table
    rc = lv_rc
    EXCEPTIONS
    file_open_dialog_failed = 1
    cntl_error = 2
    error_no_gui = 3
    not_supported_by_gui = 4
    OTHERS = 5.
    IF sy-subrc <> 0.
    ENDIF.
    READ TABLE lt_file_table
    INTO lv_filename
    INDEX 1.
    cl_gui_frontend_services=>gui_upload(
    EXPORTING
        filetype = 'BIN'
        filename = lv_filename
    IMPORTING
        filelength = lv_filelength
    CHANGING
        data_tab = lt_rawtab
    EXCEPTIONS
        file_open_error = 1
        file_read_error = 2
        no_batch = 3
        gui_refuse_filetransfer = 4
        invalid_type = 5
        no_authority = 6
        unknown_error = 7
        bad_data_format = 8
        header_not_allowed = 9
        separator_not_allowed = 10
        header_too_long = 11
        unknown_dp_error = 12
        access_denied = 13
        dp_out_of_memory = 14
        disk_full = 15
        dp_timeout = 16
        not_supported_by_gui = 17
        error_no_gui = 18
        OTHERS = 19 ).
    But it is giving me a short dump saying that the field symbol is not assigned ...
    If i give the file type as ASC , then i am getting an empty table... Please advise me on this
    Thanks
    Poornima

  • How to read the data from an excel file into MYSQL by java language

    Hi all,
    I have some data in excel spread sheet and I want to put the data into MYSQL data base. I created the tables in MYSQL> How can I write a program in JAVA that puts the value from excel sheet to mysql??
    I would appreciate your help
    regards

    By typing code at the keyboard... but presumably you meant to ask what code you should type.
    To get data out of Excel there are a few alternatives. The Google keywords I would use to find them are "java excel". I use Apache POI but there are other possibilities, I believe. As for getting the data into MySQL once you have extracted it from Excel, you would use JDBC. But you already knew that, didn't you? You did find the JDBC forum.
    In general it's better to ask a specific question on a forum. If you don't have a clue (which is the way we all start out) then just telling people that isn't going to be helpful. The best you're going to get is links to tutorials, which you could perfectly well have found for yourself by simple web searches.

  • How to read the data from XML file and insert into oracle DB

    Hi All,
    I have below require ment.
    I will receive data in the XML file. then i need to read that data and insert into oracle tables. please let me know how this can be handled.
    Many Thanks.

    Sounds a lot like this question, only with less details.
    how to read data from XML  variable and insert into table variable
    We can only help if you provide us details to help as we cannot see what you are doing and only know what you tell us.  Plenty of examples abound on the forums that cover the topics you seek as well.

  • I need the detail about how to read the data from spreadsheet file. but the file should not created by labview.

    i face some difficulties here. the datas are encrypted...... how to get correct data ..........

    Excel files are in a propriertary microsoft format. A LabVIEW "spreadsheet" file is a file containing an ASCII table with tabs separating columns and linefeeds separating rows. They are not ther same!
    If you use "write to spreadsheet file" and name the file *.xls, this does NOT make it an excel file, it just tells the operating system to open it with excel if you double-click it. Excel is smart enough to notice that it is not really an excel file and does its best to convert it transparently. The same does not work in reverse.
    You have several options:
    You can use excel to export your data to something LabVIEW can read. Try e.g. tab delimited text.
    You can use e.g. activeX to read an excel file, see: http://zone.ni.com/devzone/cda/epd/p/id/3409
    Search for excel in your example finder for more possibilites.
    LabVIEW Champion . Do more with less code and in less time .

  • How to fetch the data from pl/sql table dynamically

    Hi All, I have the requirement of comparing two db views data in pl/sql. So, I have bulk collect the view into pl/sql table. But, the issue is, It is expecting to provide the column name for comparison. But, in my case, column name is dynamic. So, i cannot provide the column name directly for comparison.
    For eg: In my view t1_VW, i have 4 columns. stid, c1,c2,c3,c4 and similar structure for t2_vw
    my code
    TYPE v1_type IS TABLE OF t1_vw%ROWTYPE;
    l_data v1_type;
    TYPE v1_type1 IS TABLE OF t2_vw%ROWTYPE;
    l_data1 v1_type1;
    test varchar2(1000);
    test1 varchar2(1000);
    temp1 number;
    begin
    SELECT * Bulk collect into l_data
    FROM T1_VW;
    SELECT * Bulk collect into l_data1
    FROM T2_VW;
    select l_data(1).stid into temp1 from dual; -- It is working fine and gives me the value properly
    -- But, in my case, we are reading the column names from array, i am constructing the query dynamically and execute it.
    test :='select l_data(1).stid into temp1 from dual';
    execute immediate test into temp1;
    -- I am getting error as follows:
    Error report:
    ORA-00904: "L_DATA": invalid identifier
    ORA-06512: at "SYSTEM.BULKCOMPARISON", line 93
    ORA-06512: at line 2
    00904. 00000 - "%s: invalid identifier"
    *Cause:   
    *Action
    end;
    - Please help me to get rid of this issue. Is it possible to construct the query dynamically and fetch the data?. If not, is there any other better approach to compare the data between two views?.

    Output should display what are all columns changed and its old value and new value.
    For eg., output should be
    COLUMNNAME OLD_VALUE NEW_VALUE STID
    C1 20 10 1
    C2 50 40 2
    C3 60 70 2
    C2 80 90 3Why no do this only via a simple sql ?
    create table a (STID number, C1 number,  C2 number, C3 number);
    insert into a values (1, 20, 30, 40)
    insert into a values (2, 40, 50, 60);
    insert into a values (3, 90, 80, 100);
    create table b as select *
    from a where 1 = 0;
    insert into b values (1, 10, 30, 40)
    insert into b values (2, 40, 40, 70);
    insert into b values (3, 90, 90, 100);
    commit;And now you can issue such a kind of select
    SELECT stid , c1, c2, c3                      
       FROM
      ( SELECT a.*,
             1 src1,
             to_number(null) src2        
       FROM  a   
       UNION ALL
       SELECT b.*,
             to_number(null) src1,
             2  src2        
        FROM b
       GROUP BY stid , c1, c2, c3
       HAVING count(src1) <> count(src2)
       order by stid;I would then create a new table a_b_difference having the same structure as a or b and insert into it like this
    create table a_b_diff as select * from a where 1 = 0;
    insert into a_b_diff
    SELECT stid , c1, c2, c3                      
       FROM
      ( SELECT a.*,
             1 src1,
             to_number(null) src2        
       FROM  a   
       UNION ALL
       SELECT b.*,
             to_number(null) src1,
             2  src2        
        FROM b
       GROUP BY stid , c1, c2, c3
       HAVING count(src1) <> count(src2)
       order by stid
       ;Then each time there is a difference between a column in a and its equivalente one in b (per unique stid ) a record will be inserted in this table.
    You can do more by adding the name of the table in front of each record in this table to see exactly where the data comes from
    Best Regards
    Mohamed Houri

Maybe you are looking for