Read statement giving problem

Dear Experts,
I am making monthly consumption report, In which i am getting monthly data column wise for different month , here firstly i am fetching header mblnr  date according to date from mkpf then i am fetching data from mseg.....
I have same mblnr in both tables..... Now i am using read statement like this.......
sort lt_mkpf by mblnr.
SORT lt_mseg BY mblnr.
LOOP AT lt_mkpf INTO lw_mkpf.
READ TABLE lt_mseg INTO lw_mseg WITH KEY mblnr = lw_mkpf-mblnr
                                            mjahr = lw_mkpf-mjahr
                                                    BINARY SEARCH.
When I am debugging i am getting data in lw_mkpf but sy-subrc = 4 is coming  and getting wrong data in final table by using these above statements..........
where as if i am using loop like this:
SORT lt_mkpf BY mblnr.
SORT lt_mseg BY mblnr.
LOOP AT lt_mkpf INTO lw_mkpf.
v_mkpf = lw_mkpf-mblnr.
LOOP AT lt_mseg INTO lw_mseg WHERE mblnr EQ v_mkpf.
with this i am getting right data........ But it takes lot of time to execute..........
Can you please guide me am i using read statement by wrong method. which one is the correct method which one shoul be used.........

Hello Shelly,
To solve the issue of read table being failed, Sort the internal table by mblnr and mjahr. say sort lt_mseg by mblnr mjahr but read the internal table mseg will give you only one data. What about the other line items. MSEG is material document line item table. So for one record in MKPF there can be more than one record in MSEG. So to consider all the line items, you need to loop on the MSEG internal table instead of read table.
LOOP AT lt_mkpf INTO lw_mkpf.
v_mkpf = lw_mkpf-mblnr.
LOOP AT lt_mseg INTO lw_mseg WHERE mblnr EQ v_mkpf.
This statement will take time and create performance issue. So rewrite the statement as
LOOP AT lt_mseg INTO lw_mseg.
read table lt_mkpf with key lw_mkpf binary search.
Regards
Farzan

Similar Messages

  • Read statement giving sy-subrc = 4

    read table i_cdpos with key  OBJECTCLAS = i_cdhdr-OBJECTCLAS
                                 OBJECTID   = i_cdhdr-OBJECTID
                                 CHANGENR   = i_cdhdr-CHANGENR.
                                FNAME      = 'WAERS'.
    if sy-subrc = 0 .
    if i_cdpos-tabkey+0(6) = i_vbap-posnr .
    *itab-CURKY_NEW = i_cdpos-value_new .
    *itab-CURKY_OLD = i_cdpos-value_old .
    itab-kschl =  i_cdpos-tabkey+11(4).
    itab-CUKY_OLD = i_cdpos-CUKY_OLD.
    itab-CUKY_new = i_cdpos-CUKY_new .
    endif.
    endif.

    read table i_cdpos with key OBJECTCLAS = i_cdhdr-OBJECTCLAS
                                            OBJECTID = i_cdhdr-OBJECTID
                                            CHANGENR = i_cdhdr-CHANGENR.
    if it gives sy-subrc as 4,
    check the values in i_cdhdr-OBJECTCLAS, i_cdhdr-OBJECTID, CHANGENR = i_cdhdr-CHANGENR
    if this will be empty means, sy-subrc fails,
    check the data types of all the fields and its field values.. sometimes this will give sy-subrc fails...

  • Problem with READ Statement in the field routine of the Transformation

    Hi,
    I have problem with read statement with binary search in the field routine of the transformation.
    read statement is working well when i was checked in the debugging mode, it's not working properly for the bulk load in the background. below are the steps i have implemented in my requirement.
    1. I selected the record from the lookuo DSO into one internal table for all entried in source_packeage.
    2.i have read same internal table in the field routine for each source_package entry and i am setting the flag for that field .
    Code in the start routine
    select source accno end_dt acctp from zcam_o11
    into table it_zcam
    for all entries in source_package
    where source = source_package-source
         and accno = source_package-accno.
    if sy-subrc = 0.
    delete it_zcam where acctp <> 3.
    delete it_zcam where end_dt initial.
    sort it_zcam by surce accno.
    endif.
    field routine code:
    read table it_zcam with key source = source_package-source
                                                 accno  = source_package-accno
                                                 binary search
                                                 transportin no fields.
    if sy-subrc = 0.
    RESULT  = 'Y'.
    else.
    RESULT = 'N'.
    endif.
    this piece of code exist in the other model there its working fine.when comes to my code it's not working properly, but when i debug the transformation it's working fine for those accno.
    the problem is when i do full load the code is not working properly and populating the wrong value in the RESULT field.
    this field i am using in the report filter.
    please let me know if anybody has the soluton or reason for this strage behaviour.
    thanks,
    Rahim.

    i suppose the below is not the actual code. active table of dso would be /bic/azcam_o1100...
    1. is the key of zcam_o11 source and accno ?
    2. you need to get the sortout of if endif (see code below)
    select source accno end_dt acctp from zcam_o11
    into table it_zcam
    for all entries in source_package
    where source = source_package-source
    and accno = source_package-accno.
    if sy-subrc = 0.
    delete it_zcam where acctp 3.
    delete it_zcam where end_dt initial.
    endif.
    sort it_zcam by surce accno.
    field routine code:
    read table it_zcam with key source = source_package-source
    accno = source_package-accno
    binary search
    transportin no fields.
    if sy-subrc = 0.
    RESULT = 'Y'.
    else.
    RESULT = 'N'.
    endif.

  • READ statement problem-URGENT.

    hai experts,
    I am facing problem with read statement.
    <b>read table itab with key f1 = '10'."it works.</b>
    But,
    now i store value '<b>10'</b> in variable <b>f</b> and use it as follows.
    <b>read table itab with key f1 = f."it isn't working</b>.
    My requirement is as above.I have to read a particular record from a internal table with key value stored in a variable ,key should not be  hardcoded.
    Do any one have any idea abt this.
    Plz, help me. Its very urgent.
    Thanks & Regards.
    Shivaa

    Hi Shiva
                That isn't a way to access the internal table via variable. Please refer transaction ABAPDOCU to know more information querying internal table(or transparent table) via a Variable and many more..
    <b> Helpfull: Reward points </b>
    Thanks and Kind Regards
    Mohan

  • Problem in read statement

    hi,
    my code is ;
    select vbeln audat kunnr auart
            from vbak
            into table  t_vbak2
            for all entries in t_vbfa2
            where vbeln = t_vbfa2-vbelv
            and audat in r_daterange
            and kunnr = partner_number.
            if not t_vbak2[] is initial.
              sort t_vbak2 by vbeln audat auart.
            endif.
    now if i use read statement :
    read table t_vbak2 into wa_vbak2
            with key  vbeln = wa_vbfa1-vbelv
                      audat in r_daterange
                      kunnr = partner_number binary search.
    i get a syntax error.
    can any one help me with this..
    Thanks,
    Challa.

    You can't use the IN operator in your READ statement, only  =  as you are trying to read with key.  In your case, you must use the LOOP statement.
    Loop at t_vbak2 into wa_vbak2
              where vbeln = wa_vbfa1-vbelv
                 and audat in R_daterange
                 and kunnr = Partner_Number.
    * Do whatever you need to do
    Exit.   " This is so you only read one record.
    Endloop.
    Regards,
    RIch Heilman

  • Problem in writing a Read Statement

    Hi,
    In my Table control I have a POSITION button which is used to find the record in the table.
    I have written the following code.
      CALL FUNCTION 'POPUP_GET_VALUES'
        EXPORTING
    *   NO_VALUE_CHECK        = ' '
          popup_title           = 'Find the record'
    *   START_COLUMN          = '5'
    *   START_ROW             = '5'
    * IMPORTING
    *   RETURNCODE            =
        TABLES
          fields                = lt_tab
    EXCEPTIONS
       error_in_fields       = 1
       OTHERS                = 2
    I have five primary keys in my table, so that in the pop up I am getting all the five fields.
    The user will enter any of the five fields , I want to write a read statement based on the fields entered by the user.
    Could anybody help in writing the Read  statement.
    Or could any one help me in writing out the FIND functionality for a table control
    Regards
    Edited by: SAP LEARNER on Jun 15, 2010 1:40 PM

    Hi,
    I do not know what fields will be filled up.
    as there are 5 PK fields so 5! chances will be there for the where condition in the READ statement.
    How can I do it.
    I tried in the following way.
    I created a structure with the primary key fields and I filled the structure with the user filled values.
    Then I used it in the read statement as below, but it did not work.
        LOOP AT lt_tab .
          IF lt_tab-fieldname = 'SOCIEDAD'.
            lw_pk-sociedad = lt_tab-value.
          ENDIF.
          IF lt_tab-fieldname = 'NATURAL_YEAR'.
            lw_pk-natural_year = lt_tab-value.
          ENDIF.
          IF lt_tab-fieldname = 'CICLO_DE_VENTAS'.
            lw_pk-ciclo_de_ventas = lt_tab-value.
          ENDIF.
          IF lt_tab-fieldname = 'MODEL_VERSION'.
            lw_pk-model_version = lt_tab-value.
          ENDIF.
        ENDLOOP.
        DATA:lw_yrwbw010 TYPE ty_yrwbw010.
        READ TABLE t_yrwbw010 INTO lw_yrwbw010 WITH KEY lw_pk.
         IF sy-subrc = 0.
          table-top_line = sy-tabix.
         ENDIF.
      ENDIF.
    @Rob Burbank
    Could you please help me !! I could not find that in F1 help.
    @ Keshav.T         
    Could you please elaborate it please

  • Problem in using read statement.

    i am using the read statement as follows :
    read table tekpo with key werks = '1001'.
    it is not reading the corresponding record.
    though it reads or not it is returning the sy-subrc value 0.
    plz let me know why it is happening as soon as possible.
    points will be awarded.

    Hi Srinivas rao,
    You can use this example program and make the changes in your program as well:
    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
    I think you have satisfied.
    Thanks and regards
    Vipin Das

  • READ statement problem

    TYPES : BEGIN OF itab,
             matnr LIKE eban-matnr,
             menge LIKE eban-menge,
           END OF itab.
    TYPES : BEGIN OF itab2,
              maktx LIKE makt-maktx,
            END OF itab2.
    DATA : it_eban TYPE STANDARD TABLE OF itab.
    DATA : it_makt TYPE STANDARD TABLE OF itab2.
    DATA : wa_eban TYPE itab.
    DATA : wa_makt TYPE itab2.
    START-OF-SELECTION.
      SELECT matnr menge INTO CORRESPONDING FIELDS OF TABLE
                            it_eban FROM eban.
      SELECT maktx INTO  CORRESPONDING FIELDS OF TABLE
                           it_makt from makt.
    PERFORM display TABLES it_eban it_makt.
    FORM display TABLES eban_tab makt_tab.
    LOOP AT eban_tab INTO wa_eban.
      WRITE :/ wa_eban-matnr, wa_eban-menge.
      READ TABLE makt_tab with key matnr = wa_eban-matnr.
      "here I'm getting error like
      "the specified type has no structure and therefore no component called "MATNR"
      "How can I write READ statement here to read makt_tab.
    ENDLOOP.
    ENDFORM.

    Try that
    TYPES : BEGIN OF itab,
             matnr LIKE eban-matnr,
             menge LIKE eban-menge,
           END OF itab.
    TYPES : BEGIN OF itab2,
              <b>matnr like mara-matnr,</b>
              maktx LIKE makt-maktx,
            END OF itab2.
    DATA : it_eban TYPE STANDARD TABLE OF itab.
    DATA : it_makt TYPE STANDARD TABLE OF itab2.
    DATA : wa_eban TYPE itab.
    DATA : wa_makt TYPE itab2.
    START-OF-SELECTION.
      SELECT matnr menge INTO CORRESPONDING FIELDS OF TABLE
                            it_eban FROM eban.
      SELECT <b>matnr</b> maktx INTO  CORRESPONDING FIELDS OF TABLE
                           it_makt from makt.
    PERFORM display TABLES it_eban it_makt.
    FORM display TABLES eban_tab makt_tab.
    LOOP AT eban_tab INTO wa_eban.
      WRITE :/ wa_eban-matnr, wa_eban-menge.
      READ TABLE makt_tab into <b>wa_makt</b> with key matnr = wa_eban-matnr.
      "here I'm getting error like
      "the specified type has no structure and therefore no component called "MATNR"
      "How can I write READ statement here to read makt_tab.
    ENDLOOP.
    ENDFORM.
    Message was edited by:
            Jacek Slowikowski

  • SHARED MEMORY AND DATABASE MEMORY giving problem.

    Hello Friends,
    I am facing problem with EXPORT MEMORY and IMPORT MEMORY.
    I have developed one program which will EXPORT the internal table and some variables to the memory.This program will call another program via background job. IMPORT memory used in another program to get the first program data.
    This IMPORT command is working perfect in foreground. But  it is not working in background.
    So, I have reviewed couple of forums and I tried both SHARED MEMORY AND DATABASE MEMORY.  But no use. Still background is giving problem.
    When I remove VIA JOB  parameter in the SUBMIT statement it is working. But i need to execute this program in background via background job. Please help me . what should I do?
    pls find the below code of mine.
    option1
    EXPORT TAB = ITAB
           TO DATABASE indx(Z1)
                FROM   w_indx
                CLIENT sy-mandt
                ID     'XYZ'.
    option2
    EXPORT ITAB   FROM ITAB
      TO SHARED MEMORY indx(Z1)
      FROM w_indx
      CLIENT sy-mandt
      ID 'XYZ'.
       SUBMIT   ZPROG2   TO SAP-SPOOL
                      SPOOL PARAMETERS print_parameters
                       WITHOUT SPOOL DYNPRO
          *_VIA JOB name NUMBER number*_
                       AND RETURN.
    ===
    Hope every bidy understood the problem.
    my sincere request is ... pls post only relavent answer. do not post dummy answer for points.
    Thanks
    Raghu

    Hi.
    You can not exchange data between your programs using ABAP memory, because this memory is shared between objects within the same internal session.
    When you call your report using VIA JOB, a new session is created.
    Instead of using EXPORT and IMPORT to memory, put both programs into the same Function Group, and use global data objects of the _TOP include to exchange data.
    Another option, is to use SPA/GPA parameters (SET PARAMETER ID / GET PARAMETER ID), because SAP memory it is available between all open sessions. Of course, it depends on wich type of data you want to export.
    Hope it was helpful,
    Kind regards.
    F.S.A.

  • Logic behind read statement and material

    SORT IT_EKBEF BY EBELN EBELP.
    READ TABLE IT_EKBEF INTO WA_EKBEF
                     WITH KEY EBELN = WA_FINAL-EBELN
                              EBELP = WA_FINAL-EBELP BINARY SEARCH.
    IF SY-SUBRC = 0.
    WA_FINAL-MENGE = WA_EKBEF-MENGE.
    ENDIF.
    the above is my code............
    i am not able to read data frfom inetrnal table to WA_ekbef .......if i am not giving material in the selection screen.......
    If i give material for specific po then i am getting data........Pls solve this problem........
    how this read statement is linked with material........
    any suggetions pls??

    Hi,
    I am fetching data inTO  IT_EKBE..............
    FROM IT_EKBE I AM MOVING TO WA_EKBE.......
    FROM WA_EKBE  I AM MOVING TO IT_EKBEF..............
    THEN I AM USING READ STATEMENT WITH KEYWORDS EBELN, EBELP..........
    BUT WHEN I AM FETCHING IT_EKBE I AM FETCHING DATA BASED ON MATERIAL ALSO.........
    IS THAT THE PROBLEM???

  • Adobe reader keeps giving me an error message when trying to download.

    Adobe reader keeps giving me an erro message everytime I try and download something.

    Back up all data before making any changes. Please take each of the following steps until the problem is resolved.
    Step 1
    If Adobe Reader or Acrobat is installed, and the problem is just that you can't print PDF's displayed in Safari, you may be able to print by moving the cursor to the the bottom edge of the page, somewhere near the middle. A black toolbar may appear under the cursor. Click the printer icon.
    Step 2
    There should be a setting in its preferences of the Adobe application such as Display PDF in Browser. I don't use those applications myself, so I can't be more precise. Deselect that setting, if it's selected.
    Step 3
    If you get a message such as ""Adobe Reader blocked for this website," then from the Safari menu bar, select
    Safari ▹ Preferences... ▹ Security
    and check the box marked
    Allow Plug-ins
    Then click
    Manage Website Settings...
    and make any required changes to the security settings for the Adobe PDF plugin.
    Step 4
    Triple-click anywhere in the line of text below on this page to select it, the copy the selected text to the Clipboard by pressing the key combination command-C:
    /Library/Internet Plug-ins
    In the Finder, select
    Go ▹ Go to Folder
    from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
    From the folder that opens, move to the Trash any items that have "Adobe" or “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari.
    Step 5
    The "Silverlight" web plugin distributed by Microsoft can interfere with PDF display in Safari, so you may need to remove it, if it's present. The same goes for a plugin called "iGetter," and perhaps others — I don't have a complete list. Don't remove Silverlight if you use the "Netflix" video-streaming service.
    Step 6
    Do as in Step 4 with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari.

  • ABAP Loop/read statement

    Hello All-
    I'm writing a loop and a read statement between two tables.  What I am trying to do is flag certain records that exsist in one table but NOT in the other.  For example, I have table /BIC/PG_ICODE  which is the P table for Global ICODE and I also have a "z" table which hold all "valid" icodes. My logic is as follows: If an icode exsists in the P table AND also exsists in the "Z" table then I don't want to do anything with this record. But if it exsists in the P table but NOT in the "z" table then I want to insert this ICODE into an E_T_RANGE table.  What I have done here is created a FM which will be called in a QUERY that I have built.  The problem is that after the code is executed and I look at the records in the E_T_RANGE table, I find some icodes that exsist both in the P table and "z" table.  The E_T_RANGE table should only contain icodes that exsist in the P table and NOT the "z" table. Can someone please have a look at my code and tell me what I am doing wrong?
    DATA : L_S_RANGE LIKE E_T_RANGE,
           IT_ICODE TYPE standard table of /BIC/TG_ICODE,
           IT_PTABLE TYPE standard table of /BIC/PG_ICODE,
           it_ZVALID_ICODES TYPE standard table of   ZVALID_ICODES,
           wa_ZVALID_ICODES TYPE ZVALID_ICODES,
           l_sign type c value 'I',
           wa type /BIC/TG_ICODE,
           wa2 type /BIC/PG_ICODE.
    SELECT /BIC/G_ICODE FROM /BIC/PG_ICODE INTO
        CORRESPONDING FIELDS OF table IT_PTABLE where /BIC/G_ICODE like
    'I%'.
    sort IT_PTABLE by /BIC/G_ICODE.
    SELECT /BIC/G_ICODE FROM ZVALID_ICODES INTO
        CORRESPONDING FIELDS OF table IT_ZVALID_ICODES.
    sort IT_ZVALID_ICODES by /BIC/G_ICODE.
    loop at IT_PTABLE into wa2.
    read table IT_ZVALID_ICODES with key
    /BIC/G_ICODE = wa2-/BIC/G_ICODE into wa_ZVALID_ICODES.
    if sy-subrc ne 0.
            L_S_RANGE-LOW = wa_ZVALID_ICODES-/BIC/G_ICODE.
            L_S_RANGE-SIGN = l_sign.
            L_S_RANGE-OPT = 'EQ'.
    DELETE ADJACENT DUPLICATES FROM E_T_RANGE.
          APPEND L_S_RANGE TO E_T_RANGE.
    endif.
    endloop.
    ENDFUNCTION.

    Hi try the following code...
    DATA : L_S_RANGE LIKE E_T_RANGE,
    IT_ICODE TYPE standard table of /BIC/TG_ICODE,
    IT_PTABLE TYPE standard table of /BIC/PG_ICODE,
    it_ZVALID_ICODES TYPE standard table of ZVALID_ICODES,
    wa_ZVALID_ICODES TYPE ZVALID_ICODES,
    l_sign type c value 'I',
    wa type /BIC/TG_ICODE,
    wa2 type /BIC/PG_ICODE.
    SELECT /BIC/G_ICODE FROM /BIC/PG_ICODE INTO
    CORRESPONDING FIELDS OF table IT_PTABLE where /BIC/G_ICODE like
    'I%'.
    sort IT_PTABLE by /BIC/G_ICODE.
    DELETE ADJACENT DUPLICATES FROM IT_PTABLE.
    SELECT /BIC/G_ICODE FROM ZVALID_ICODES INTO
    CORRESPONDING FIELDS OF table IT_ZVALID_ICODES.
    sort IT_ZVALID_ICODES by /BIC/G_ICODE.
    DELETE ADJACENT DUPLICATES FROM IT_ZVALID_ICODES.
    loop at IT_PTABLE into wa2.
    read table IT_ZVALID_ICODES with key
    /BIC/G_ICODE = wa2-/BIC/G_ICODE into wa_ZVALID_ICODES
             binary search.
    if sy-subrc ne 0.
    L_S_RANGE-LOW = wa_ZVALID_ICODES-/BIC/G_ICODE.
    L_S_RANGE-SIGN = l_sign.
    L_S_RANGE-OPT = 'EQ'.
    APPEND L_S_RANGE TO E_T_RANGE.
    endif.
    endloop.
    sort e_t_range.
    DELETE ADJACENT DUPLICATES FROM E_T_RANGE.
    ENDFUNCTION.
    Regards,
    Suresh Datti

  • Reg : Read statement using Binary Search....

    I have an Internal Table as below
    Value           Description
    100               Product
    2008             Production Year
    05                 Production Month
    I am using Read statement with Binary Search for getting Production Month.
    Read table itab with key Description = 'Production Month' binary search.
    I am getting sy-subrc as 4 eventhough data is present in the table for Production Month.
    What may be the problem.

    Hi suganya,
    use
    sort table itab ascending by <production month>.    
    Read table itab with key description = <production month> binary search.
    Remember always, while using binary search always sort the internal table.
    Regards,
    Sakthi.

  • READ statement with binary search

    Hi friends,
    I know that while using the READ statement that we have to sort data and use BINARY SEARCH  for faster search.
    I have a situation
    following are internal table contents
    belnr          agent    action
    9000001   name1    BRW
    9000001   name1    API
    when i use READ statement with where condition (  ( belnr - 9000001 ) and  ( action = 'BRW' ) )  with binary search then the SY_SUBRC value is 4.
    if i remove the binary search then its giving SY-SUBRC value 0.
    Can anybody explain why BINARY SEARCH fails.
    Points will be rewarded for correct answers.
    Thanks and regards,
    Murthy

    try this i am not getting sy-subrc 4
    TYPES:BEGIN OF TY_ITAB,
    BELNR TYPE BELNR,
    AGENT(30),
    ACTION(5),
    END OF TY_ITAB.
    DATA:IT_TAB TYPE TABLE OF TY_ITAB,
         WA_TAB TYPE TY_ITAB.
    WA_TAB-BELNR = 9000001.
    WA_TAB-AGENT = 'name1'.
    WA_TAB-ACTION = 'BRW'.
    APPEND WA_TAB TO IT_TAB.
    CLEAR WA_TAB.
    WA_TAB-BELNR = 9000002.
    WA_TAB-AGENT = 'name 2'.
    WA_TAB-ACTION = 'API'.
    APPEND WA_TAB TO IT_TAB.
    loop at it_tab into wa_tab.
    read table it_tab into wa_tab with key belnr = wa_tab-belnr  binary search .
    write: sy-subrc, wa_tab-agent.
    endloop.

  • Read statement on dynamic internal tables

    Hello All,
    I have a dynamic internal table <G_T_ITAB> with fields F1, F2, F3 & F4 .
    I want to read the internal table <G_T_ITAB>. So im using the below code.
    LOOP AT G_T_DATA.
      READ TABLE <G_T_ITAB> INTO <G_R_ITAB> WITH KEY F1 = G_T_DATA-F1.
      IF SY-SUBRC <> 0.
      ELSE.
      ENDIF.
    ENDLOOP.
    But this is giving syntax error that F1 is not the field of <G_T_ITAB>. But the field is there in <G_T_ITAB>.
    Can you suggest me to solve this issue. Or is there any other approach to use READ statement on dynamic internal tables.
    Thanks in advance.
    Best Regards,
    Sasidhar Reddy Matli.

    Hi ,
    Read this way....
    FIELD-SYMBOLS:
    <fs_str> type any,
    <fs_lf_fval> type any,
    <fs_lt_result_rate> type any table,
    <fs_ls_result_rate> type any.
    DATA:
      lv_fname type string.
    lv_fname = 'MATNR'.
    assign component 'matnr' of structure <fs_str> to <fs_lf_fval>.
    READ TABLE <fs_lt_result_rate> INTO <fs_ls_result_rate>
                WITH KEY (lv_fname) = <fs_lf_fval>.
    Thanks,
    Shailaja Ainala.

Maybe you are looking for

  • SL server share mounting not working for 10.7.4 Mac Mini

    I'm running about seven Macs on a network with a 10.6.8 Mac Mini server. The older Macs (PPCs and 10.4.11) mount the share immediately. Newer Macs recently have had a problem. My 10.6.8 MBP can mount the share, from a dock icon, but it can take minut

  • Problem in the isNumeric rule in AlphaNumericRules Library

    The rule isNumeric present in AlphaNumericLibrary is an out of box rule. I have found that this rule returns '0' for all types of inputs (numeric/alphanumeric/alphabetic). On further investigation I found that the "append" does not work and is just r

  • Move files faster

    Do you know some trick to move files faster. I have an external hard drive using Firewire hard drive and I am trying to move files to a USB 2.0  drive, but it is very slow.

  • Need Business Area to be enabled in VA01 !

    Hi, I need to have Business Area enable in VA01, i have written the following code in EXIT_SAPMV45A_004 Data: w_auart like vbak-auart. Get parameter ID 'AAT' field w_auart.   if I_T180_AKTYP = 'H' or I_T180_AKTYP = 'V'.    message i001(zbusinessarea)

  • C3-01 screen blinking problem

    Whenever my phone(c3-01) mistakenly drops on the floor,its screen starts to blink,attimes it will last for less than 1week or more. If i switch off my phone at that point in time,and i try to turn it on,the screen will be blank(black),whereas its alr