Doubt in read table statement.

hi friends
i have a doubt in read statement
please suggest me which one i can use.
i have one master table
with fields like
contract contract line wbs
500060    10                XXX
500070     10               XXX
and the transaction table has
500060     10             01              01              01
500060      10            02              02              02
500070       10            01              01             01
500070       10            02              02              02
what i am doing is like
loop at master table into wamastertable
read table tranintertab into tranintertab1 with key contract=wamastertable-contract                                                                               
contractline = wamastertable-contractline.
endloop.
As my read query satifies multiple lines of transaction internal table i am in a posistion to do this
but if i do like the above it is giving error that tranintertab1 is not the line type of tranintertab
please provide me ur valuable suggestions.

>
janagar sundaramoorthy Nadar wrote:
>
contract contract line wbs
> 500060    10                XXX
> 500070     10               XXX
> and the transaction table has
> 500060     10          01              01              01
> 500060     10          02              02              02
> 500070     10          01              01             01
> 500070     10          02              02              02
>
>
loop at master table into wamastertable
> read table tranintertab into tranintertab1 with key contract=wamastertable-contract
>                                                                                contractline = wamastertable-contractline.
> endloop.
>
Try it like this..........
loop at tranintertab into tranintertab1.
read table master table into wamastertable with key
                                                                       contract = tranintertab1-contract
                                                                  contractline = tranintertab1-contractline.
endloop.
Regards,
Suneel G

Similar Messages

  • How to get the number of hits ("returned rows") in read table statement

    Hi Experts
    I have the statement shown below, which seems not to work as I would like it to. My problem is that I would like to do two different things depending on weather or not a read table statement results in 0 hits or 1 (or more) hits.
        READ TABLE g_ship_item
            WITH KEY
         l_ztknum = DATA_PACKAGE-/bic/ztknum
         BINARY SEARCH.
          IF sy-subrc is initial.
          no hits found
            DATA_PACKAGE-/BIC/ZSTAGEERR = 1.
          ELSE.
          hits where found and we will do something else...
            DATA_PACKAGE-/BIC/ZSTAGEERR = 0.
    Hope someone can help me out of my problem...
    Thanks in advance, regards
    Torben

    Hi,
    As you are using READ statement with Binary search, check whether the internal table g_ship_item is sorted with field /bic/ztknum or not. If it is not sorted then the result of this READ statement is not correct.
    Below is the correct code.
    sort  g_ship_item by /bic/ztknum.
    READ table g_ship_item with key g_ship_item = xxx.
    Thanks,
    Satya

  • Need help regarding Dynamic Read Table statement

    Hello
    I know that the syntax for dymanic read table statement is
    READ TABLE  <ITAB> WITH KEY (KEY1) = VALUE1  (KEY2) = VALUE2 .....(KEYN) = VALUEN
    Here is my problem..
    I am dynamically creating an internal table based on parameter table entered by user.
    The key for this table can be determined only at runtime.
    The table entered might have by one field as key field or 10 key fields..
    How can I use the dynamic read in this situation ?
    Thanks for your help in advance,
    Santosh
    Edited by: Santosh Kulkarni on Jan 3, 2010 6:58 AM
    Edited by: Santosh Kulkarni on Jan 3, 2010 7:01 AM

    Hello Santosh,
    please check out the following solution. The program demonstrates how to use the dynamic read statement with three key field conditions. Additional key fields can be added in the same way.
    REPORT z_dynamic_read.
    DATA: gt_itab TYPE REF TO data,
          ge_key_field1 TYPE char30,
          ge_key_field2 TYPE char30,
          ge_key_field3 TYPE char30,
          go_descr_ref TYPE REF TO cl_abap_tabledescr.
    FIELD-SYMBOLS: <gt_itab> TYPE STANDARD TABLE,
                   <gs_key_comp> TYPE abap_keydescr,
                   <gs_result> TYPE ANY.
    PARAMETERS: pa_table TYPE tabname16 DEFAULT 'SPFLI',
                pa_cond1 TYPE string DEFAULT sy-mandt,
                pa_cond2 TYPE string DEFAULT 'LH',
                pa_cond3 TYPE string DEFAULT '0123'.
    START-OF-SELECTION.
    * Create and populate internal table
      CREATE DATA gt_itab TYPE STANDARD TABLE OF (pa_table).
      ASSIGN gt_itab->* TO <gt_itab>.
      SELECT * FROM (pa_table) INTO TABLE <gt_itab>.
    * Get the key components into the fields ge_key_field1, ...
      go_descr_ref ?= cl_abap_typedescr=>describe_by_data_ref( gt_itab ).
      LOOP AT go_descr_ref->key ASSIGNING <gs_key_comp>.
        CASE sy-tabix.
          WHEN 1.
            ge_key_field1 = <gs_key_comp>-name.
          WHEN 2.
            ge_key_field2 = <gs_key_comp>-name.
          WHEN 3.
            ge_key_field3 = <gs_key_comp>-name.
        ENDCASE.
      ENDLOOP.
    * Finally, perform the search
      READ TABLE <gt_itab> ASSIGNING <gs_result>
              WITH KEY (ge_key_field1) = pa_cond1
                       (ge_key_field2) = pa_cond2
                       (ge_key_field3) = pa_cond3.
      IF sy-subrc = 0.
        WRITE / 'Record found.'.
      ELSE.
        WRITE / 'No record found.'.
      ENDIF.
    One note: When an internal table is created dynamically like in my program above, the table key is not the key defined in the DDIC structure -- instead, the default key for the standard table is used (i.e. all non-numeric fields).
    Hope this helps,
    David

  • READ TABLE statement in ECC 6.0

    hi,
    in 4.6, my statement was
    READ TABLE S_XVTTS WHERE TKNUM = S_XVTTK-TKNUM
    AND NOT S_XVTTS-VSTEL IS INITIAL.
    This wont work in ECC 6.0, hence I need to modify this. so i write like
    READ TABLE S_XVTTS INTO wa_vttsvb WITH KEY TKNUM = S_XVTTK-TKNUM ..................................
    how to accomodate the check for NOT initial of S_XVTTS-VSTEL .. how will my statement look like ? thks

    Hi Sdnuser1,
    Try to use LOOP statement as follow.
    "// This LOOP read only one line of table s_xvtt exactly as READ TABLE do.
    LOOP AT s_xvtts INTO wa_vttsv WHERE tknum EQ s_xvttk-tknum AND s_xvtts-vstel IS NOT INITIAL.
      EXIT.
    ENDLOOP.
    IF sy-subrc IS INITIAL.
       "// You can use wa_vttsv
    ELSE.
        "// Do something
    ENDIF.
    I hope it helps yous.
    Greetings.
    Marcelo Ramos

  • Hello experts read table statement is not working properly

    Hello Experts.
    my code is like this.
    sort it_matnr by matnr.
    loop at itab_result.
    read table it_matnr with key matnr = itab_result-matnr  binary search.
    endloop.
    there are nearly 2000 records in it_matnr . The records which satisfy the above condition is there here in this internal table. But it is unable to read the record which matches the condition. One thing is that , there are more than one record with the same material. ie mblnr is different but material is the same. In it_matnr table i have only 1 field ie matnr ,so i need to compare only with the matnr.I also tried by sorting it_result by matnr but of no use. Then finally I used loop at where matnr = it_result-matnr , it is working fine. But due to performance reasons we should not use this. so please tell me what to do and correct the code.

    1. Make sure that the table IT_MATNR is not getting updated inside the loop. Because it will then destroy the sorting.
    2. Secondly, if there are multiple records in IT_MATNR for the same material then it will search for the first record encountered in binary algo. So it is advisable that you may provide further filter criteria if possible. check if ITAB_RESULT & IT_MATNR have any other matching field that can be put in filter criteria.
    3.Thirdly, check if your requirement can be achieved by STABLE SORT.
    <b>SORT <itab> ... STABLE BY <f1>[ASCENDING/DESCENDING].</b>
    It will allows you to perform a stable sort, that is, the relative sequence of lines that are unchanged by the sort is not changed. If you do not use the STABLE option, the sort sequence is not preserved. If you sort a table several times by the same key, the sequence of the table entries will change in each sort. However, a stable sort takes longer than an unstable sort.
    4. Lastly, you can use parallel cursor technique of multiple loops which is given below:
    LOOP AT itab_result.
      READ TABLE it_matnr
        WITH KEY matnr = itab_result-matnr
        BINARY SEARCH.
    Process record
      LOOP AT it_matnr FROM sy-tabix.
        IF it_matnr <> itab_result-matnr.
          EXIT.
        ENDIF.
    Process record based on yuor condition
      ENDLOOP.
    ENDLOOP.

  • Read table statement

    hi,
    while reading the internal table, if the subrc value is 8 .
    what does it mean.
    any help will be appreciated.

    Hi rajkumar,
    here's an example :
    *in progtab are 2 entries
    *now entry is'nt found:
    sy-subrc = <b>8</b> , sy-tabix = number of entries + 1 = <b>3</b>.
    DATA:  BEGIN OF PROGTAB OCCURS 10,
           NAME LIKE TRDIR-NAME,
           END OF PROGTAB.
    MOVE TRDIR-NAME TO PROGTAB-NAME.
    READ TABLE PROGTAB WITH KEY PROGTAB BINARY SEARCH.  
    IF SY-SUBRC <> 0.                                   
       INSERT PROGTAB INDEX SY-TABIX.                    
    ENDIF.
    regards Andreas

  • Doubt in Drop Table statement

    Hi,
    what will happen(internally), when we use DROP TABLE <table name>?
    Could you please elaborate for the above?
    Version : Oracle 9.2
    For example:
    If we use DML statements. It ll record the changes in redo log/archive log.
    My doubt is...
    i use DROP TABLE <table name>;
    What operation takes place?
    Will it record the changes in redo log/archive log file?
    Thanks in advance

    Hi,
    You can start 10046 trace and see what all happens when you fire a drop table command.
    Different Version and different functionalities would do additional task.
    eg: Database with recyclebin on would perform different task when compared to the database with recyeclebin off.
    They all would fire set of recursive SQL which would insert/update/delete the data dicitionary objects.
    Since drop table command would internally fire these dmls, hence would get logged into the redo log too.
    Regards
    Anurag

  • Field symbols and READ TABLE with system code 4

    Hi,
    I have a hashed table and I am using field symbols to point to it to retrieve the field content. I then use it in the READ TABLE statement in the following way:
    Loop at x_data assign <fs>.
    ASSIGN COMPONENT 'xxx' OF STRUCTURE <fs> TO <c1>.
    ASSIGN COMPONENT 'xxx' OF STRUCTURE <fs> TO <c2>.
    READ TABLE ZZZZ assign <fs> with table key a1 = <c1>
                                               a2 = <c2>.
    If sy-subrc = 0.
    endif.
    I ran the debugger and I keep getting a 4. I am not able to get the value from a1 and a2 to see what it is and why it is causing a 4 sy-subrc. I know the value from the hashed table and the values c1 and c2 are the same, so the sy-subrc should be 0.
    How would I read a hashed table using field symbols? I know that usig a standard table, I have to sort the table on the key fields() before I actually can do the READ TABLE using the binary search.
    Please advise. Thanks
    RT

    Hai Rob
    Go  through the following Code
    Field-Symbols are place holders for existing fields.
    A Field-Symbol does not physically reserve space for a field but points to a field, which is not known until run time of the program.
    Field-Symbols are like Pointers in Programming language ‘ C ‘.
    Syntax check is not effective.
    Syntax :
    Data : v1(4) value ‘abcd’.
    Field-symbols <fs>.
    Assign v1 to <fs>.
    Write:/ <fs>.
    DATA: BEGIN OF LINE,
    COL1 TYPE I,
    COL2 TYPE I,
    END OF LINE.
    DATA ITAB LIKE SORTED TABLE OF LINE WITH UNIQUE KEY COL1.
    FIELD-SYMBOLS <FS> LIKE LINE OF ITAB.
    DO 4 TIMES.
    LINE-COL1 = SY-INDEX.
    LINE-COL2 = SY-INDEX ** 2.
    APPEND LINE TO ITAB.
    ENDDO.
    READ TABLE ITAB WITH TABLE KEY COL1 = 2 ASSIGNING <FS>.
    <FS>-COL2 = 100.
    READ TABLE ITAB WITH TABLE KEY COL1 = 3 ASSIGNING <FS>.
    DELETE ITAB INDEX 3.
    IF <FS> IS ASSIGNED.
    WRITE '<FS> is assigned!'.
    ENDIF.
    LOOP AT ITAB ASSIGNING <FS>.
    WRITE: / <FS>-COL1, <FS>-COL2.
    ENDLOOP.
    The output is:
    1 1
    2 100
    4 16
    Thanks & regards
    Sreenivasulu P

  • Read   table and loop at

    Hi EXpert,
    I have an internal table say itab and I need to fetch a single record with some given conditions.
    Hence I have used READ table statement ,
    But on using this read table statement , I am unable to fetch the record :-(((( . It gives sy-subrc  =  4.
    And the same conditions when are put in Loop at itab  statement, then I am able to fetch the data .
    My requirement is only 1 record for the given conditions ( in where clause in case of loop at statement).
    I think I am probably missing out on some minor thing..
    <removed_by_moderator>
    Warm Regards,
    SUDHA
    Edited by: Julius Bussche on Feb 7, 2009 2:48 PM

    Hi,
    Test the following Code hope it will solve out your problem,
    PARAMETERS: key TYPE i .
    TYPES: BEGIN OF t_test,
      s_no TYPE i,
      name(15),
      END OF t_test.
    DATA: it_test TYPE STANDARD TABLE OF t_test WITH HEADER LINE.
    DO 10 TIMES.
      it_test-s_no = sy-index.
      it_test-name = 'SDN'.
      APPEND it_test TO it_test.
    ENDDO.
    READ TABLE it_test INTO it_test WITH KEY key.
    IF sy-subrc = 0.
      WRITE: 'sy-subrc = ' , sy-subrc,
             /1 it_test-s_no, 15 it_test-name.
    ELSE.
      WRITE: 'sy-subrc = ' , sy-subrc,
             / 'Sorry there is no Records with this Key'.
    ENDIF.
    Kind Regards,
    Faisal
    Edited by: Faisal Altaf on Feb 7, 2009 6:59 PM

  • Read Table : Error Stating mandt field is not filled.

    Dear members,
    I am get syntax error when using Read table statement saying mandt field is not filled, however if I remove the KEY field. it is working fine.
    please let me know, where I am doing mistake. thank you.
    Data : spfli_tab like STANDARD TABLE OF spfli with HEADER LINE.
    SELECT *
           FROM spfli
           INTO TABLE spfli_tab
           WHERE carrid = 'LH'.
    READ TABLE spfli_tab
               WITH TABLE KEY carrid = 'LH'
                                           connid = '2402'.
    IF sy-subrc = 0.
    ENDIF.

    Hi...
    As Eric Said there are two ways...
    For your case use WITH KEY...
    SELECT *
    FROM spfli
    INTO TABLE spfli_tab
    WHERE carrid = 'LH'.
    READ TABLE spfli_tab
    WITH KEY carrid = 'LH'
    connid = '2402'.
    IF sy-subrc = 0.
    WRITE : 'DONE'.
    ENDIF.
    If u specify WITH TABLE KEY then u will hv to pass all key fields mentioned in DDIC...
    Hope it will solve your problem..
    Thanks & Regards
    ilesh 24x7

  • Regarding the internal table data by using read table it_mard into wa_mard

    hi,
    i am reading the internal table it_mard with key matnr .
    my code is like this.
    *loop at it_final into wa_final.*
    *wa_second-matnr  = wa_final-matnr.*
      wa_second-bwart = wa_final-bwart.
    wa_second-bwtar = wa_final-bwtar.
    *read table it_mard into wa_mard with key matnr = wa_final-matnr*
                                                                              *binary search.*
    *if sy-subrc = 0.*
    *wa_second-labst = wa_mard-labst.*
    *endif.*
    *append wa_second to it_second.*
    clear :wa_final.
    *endloop.*
    final internal table haveing duplicate values because this table it_final having movement types
    so that i am not using delete statement .
    is there any logic for handling the duplicate values inside the loop statement
    by using read table statement.
    could u plz explain clearly  \[removed by moderator\]
    Edited by: Jan Stallkamp on Jul 11, 2008 2:11 PM

    this is my code could u plz explain  regarding duplicate material number .
    LOOP AT IT_MSEG INTO WA_MSEG.
        WA_FINAL-MBLNR = WA_MSEG-MBLNR.
        WA_FINAL-MATNR = WA_MSEG-MATNR.
        WA_FINAL-BWART = WA_MSEG-BWART.
        WA_FINAL-BWTAR = WA_MSEG-BWTAR.
        WA_FINAL-MENGE = WA_MSEG-MENGE.
        WA_FINAL-SOBKZ = WA_MSEG-SOBKZ.
        COLLECT WA_FINAL INTO IT_FINAL.
        CLEAR WA_FINAL.
      ENDLOOP.
      LOOP AT IT_FINAL INTO WA_FINAL.
        READ TABLE IT_MARD INTO WA_MARD WITH KEY MATNR = WA_FINAL-MATNR
                                                                                    BINARY SEARCH.
    this is reading the duplicate records i need to control duplicate records here .
    the   labst       value is repeating the number of times because of the meterial number duplication
    how can i restrict plz explain
        IF SY-SUBRC = 0.
          WA_FINAL-LABST = WA_MARD-LABST.
        ENDIF.
        READ TABLE IT_MKPF INTO WA_MKPF WITH KEY MBLNR = WA_FINAL-MBLNR
                                                                                    BINARY SEARCH.
        IF SY-SUBRC = 0.
          WA_FINAL-BUDAT = WA_MKPF-BUDAT.
        ENDIF.
        MODIFY IT_FINAL FROM WA_FINAL.
        CLEAR WA_FINAL.
      ENDLOOP.
      LOOP AT IT_FINAL INTO WA_FINAL.
        WA_SECOND-BWTAR = WA_FINAL-BWTAR.
        IF WA_FINAL-BWART = '101' OR WA_FINAL-BWART = '501' OR WA_FINAL-BWART = '561'.
          WA_SECOND-MENGE11 = WA_FINAL-MENGE.
        ENDIF.
        IF WA_FINAL-BWART = '201'.
          WA_SECOND-MENGE12 = WA_FINAL-MENGE.
        ENDIF.
        IF WA_FINAL-BWART = '541' AND WA_FINAL-SOBKZ = 'O' .
          WA_SECOND-MENGE13 = WA_FINAL-MENGE.
        ENDIF.
        IF WA_FINAL-BWART = '601'.
          WA_SECOND-MENGE14 = WA_FINAL-MENGE.
        ENDIF.
        IF WA_FINAL-BWART = '543'.
          WA_SECOND-MENGE15 = WA_FINAL-MENGE.
        ENDIF.
        IF WA_FINAL-BWART = '702'.
          WA_SECOND-MENGE16 = WA_FINAL-MENGE.
        ENDIF.
        IF WA_FINAL-BWART = '313'.
          WA_SECOND-MENGE17 = WA_FINAL-MENGE.
        ENDIF.
        IF WA_FINAL-BWART = '315'.
          WA_SECOND-MENGE18 = WA_FINAL-MENGE.
        ENDIF.
        IF WA_FINAL-BWART = '122' OR WA_FINAL-BWART = '161'.
          WA_SECOND-MENGE19 = WA_FINAL-MENGE.
        ENDIF.
        COLLECT WA_SECOND INTO IT_SECOND.
        CLEAR WA_SECOND.
      ENDLOOP.

  • Read Table with condition

    Hi,
    can i write a Read table like for example,
    read table itab into wa_itab with key matnr ne '4'.
    as its giving me an error.
    can suggest any other way to write the Read Table statement.
    Thanks in advance.
    Robert

    Hi,
    it is not possible.
    try this way..
    "delete the material which is not equal to 4 ..now itab contains values matnr ne4
    delete table itab where matnr ne '4'.
    or
    loop at itab into wa_itab wher matnr ne '4'.
    "move to another table
    endloop.
    or
    loop at itab into wa_itab .
    if wa_itab-matnr ne '4'.
    continue
    "move to another table
    else.
      delete itab index sy-tabix.
    endif.
    endloop.
    prabhudas

  • Read table and checking condition in PAI

    Hi,
    I have a requirement where I need to check and compare with (Custom table) Bankn with Partner Bank`s bankn.
    I have wrote a code in PAI like this.
    MODULE CHECK_BANKN INPUT.
       Data: l_bankn like (Custom table)-bankn.
       select bankn from (Custom Table) into l_bankn
           where recno = g_recno.
       IF NOT g_head-bankn IS INITIAL.
      Read table i_bvtyp with key bankn = i_bvtyp-bankn .
         IF l_bankn <> i_bvtyp-bankn.--------->" Comparison of (custom table) Bankn with internal table I_BVTYP-BANKN
           MESSAGE w022 WITH text-w06.
         ENDIF.
       ENDIF.
    ENDMODULE.
    My Read Table statement is seems to be wrong and my checking condition is also wrong.
    So, how to resolve this?
    regards,
    Kiran

    Hi Kiran,
    If you observe your read statement, you are comparing the field with it's own table field.
       Read table i_bvtyp with key bankn = i_bvtyp-bankn .
    Untill unless you read I_BVTYP, i_bvtyp-bankn will be initial and you cannot find the matching record with Null-Value.
    So, I think you need compare with l_bankn.
       Read table i_bvtyp with key bankn = i_bankn .
    Then you can directly raise a message using SY-SUBRC value.
       Read table i_bvtyp with key bankn = i_bankn
          if SY-SUBRC <> 0 .
              <MESSAGE>    
         endif.
    Regards,
    Vijay

  • Doubts with control break statements on internal table loops (AT/ENDAT)

    Hi, i've had a couple of doubts for a long while which I hope someone can clarify today:
    1) I know how to use the AT statements, however, i'm not sure I get correctly what this part of help regarding this commands means:
    <i>"The control level structure with internal tables is static. It corresponds exactly to the sequence of columns in the internal table (from left to right). In this context, the criteria according to which you sort the internal table are unimportant."</i>
    I've always sorted the internal table before the control break and it works that way. For example:
    SORT ITAB BY EBELN EBELP.
    LOOP AT ITAB.
      AT NEW EBELN.
    *   Code for the order header
      ENDAT.
    ENDLOOP.
    If I <b>don't</b> sort the internal table, it doesn't work! (i get dupplicated processing). In the example, if i have more than one register with the same EBELN and they're not consecutive, the header gets processed twice. I really don't get that part of the help text.
    2) I know this: <i>"At the start of a new control level (i.e. immediately after AT), the following occurs in the output area of the current LOOP statement:
    All character type fields (on the right) are filled with "*" after the current control level key.
    All other fields (on the right) are set to their initial values after the current control level key."</i>
    My doubt is: WHY is that this way? Because sometimes (most times) I need those fields INSIDE the statement! So when that happened i've solved it in one of three ways:
    LOOP AT ITAB INTO WA_ITAB.
      WA_ITAB_AUX = WA_ITAB.
      AT NEW FIELD.
        WA_ITAB = WA_ITAB_AUX.
    *   ...Rest of the code for the first register
      ENDAT.
    ENDLOOP.
    LOOP AT ITAB INTO WA_ITAB.
      AT NEW FIELD.
        READ TABLE ITAB INDEX SY-TABIX INTO WA_ITAB.
    *   ...Rest of the code for the first register
      ENDAT.
    ENDLOOP.
    * (Without AT)
    LOOP AT ITAB INTO WA_ITAB.
      IF WA_ITAB-FIELD <> FIELD_AUX.
        FIELD_AUX = WA_ITAB_FIELD.
    *   ...Rest of the code for the first register
      ENDIF.
    ENDLOOP.
    Is there any problem with this way of coding? Can be done better?
    Thank you very much in advance.

    Hi..,
    1)
    See if u sort the table on a field on which u r using AT ENDAT .. then all the records which are having the same value for that field will form a group or those reocrds will be at one place.. so when u sort the table for all the records  AT ENDAT  will get executed onli once..
    If u dont sort this table on this field then all these records will be at different places and in between there may be records with different value for this field.. so this AT ENDAT will get executed for each record !!
    2)
    No u cannot use the Right hand fields of the field in the table .. Because these AT events work as Group based operations... So till that field on which AT ENDAT is working it breaks that record into two groups.. One is the left hand fields including that field.. and right hand fields as another group.. and makes the right hand group as stars ****.  Thats y u can observe that even any one field in the left hand group changes the AT ENDAT will get executed  !!!!
    Hope u understood !!!
    regards,
    sai ramesh

  • I have doubt in Read statement

    Hi All.
    I have doubt in Read statement .i need to convert following select statement  as read statement .how can i change help me.
    IF p_field1 IS  INITIAL
         AND p_field2 IS INITIAL
         AND p_field3 IS INITIAL
         AND p_field4 IS INITIAL
         AND p_field5 IS INITIAL.
        SELECT *
              FROM zdbt
               INTO TABLE itab
               WHERE field5 = p_field5
               ORDER BY PRIMARY KEY.
        IF sy-subrc <> 0.
          MESSAGE s035.
        ENDIF.
      ENDIF.
    regards,
    Jay.

    hi
    The READ statement is as below:
    When u have a table already with values and to improve the performance u need to use this.
    Reading Lines of Tables
    To read a single line of any table, use the statement:
    READ TABLE <itab> <key> <result>.
    For the statement to be valid for any kind of table, you must specify the entry using the key and
    not the index. You specify the key in the <key> part of the statement. The <result> part can
    specify a further processing option for the line that is retrieved.
    If the system finds an entry, it sets SY-SUBRC to zero, if not, it takes the value 4, as long as it is
    not influenced by one of the possible additions. If the internal table is an index table, SY-TABIX
    is set to the index of the line retrieved. If the table has a non-unique key and there are duplicate
    entries, the first entry is read.
    Thanks
    Shiva

Maybe you are looking for