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

Similar Messages

  • 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 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.

  • 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 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

  • 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

  • Switch statement problem

    I am doing a question in which I have to make a simple ATM program that can withraw and deposit money as many times as the user wants. To exit the program the user has to hit "x". I have to use a switch statement. Im getting incompatible type errors after compiling it. Can anyone help me? Sorry if the formattings not too good.
    //ATM.java
    //This program reads in a user's opening balance and performs a withdrawal or a deposit at the request of the user
    import java.text.*;
         public class ATM
         public static void main(String args[])
              int      balance;
              char      withdrawal, deposit, choice;
              //Ask for the opening balance
              System.out.print("Please enter your opening balance");
              balance=UserInput.getInt();
              //Find out what the user wants done
              System.out.print("What would you like to do? (Withdrawal, Depositor Exit(x))");
              choice=UserInput.getChar();
                                                                          switch(choice){     
    case "w":
                                                                          while(balance>0)
                                                                                              System.out.print("How much would you like to withdraw?");
                                                                                              withdrawal=UserInput.getChar();
                                                                                              balance=balance-withdrawal;
                                                                                              System.out.print("Your remaining balance is " + balance);
                                                                                              break;
    case "d":     
    while(balance>0)
                                                                                              System.out.print("How much do you wish to deposit?");
                                                                                              deposit=UserInput.getChar();
                                                                                              balance=balance+deposit;
                                                                                              System.out.print("Your new balance is " + balance);
                                                                                              break;
    case "x":          
                                                                System.out.print("Goodbye and thank you for using this program");
                                                                                              break;
    default:     
                                                                     System.out.print("We were not able to process your request, please try again");
                                                                                              break;
    }

    Type a reply to the topic using the form below. When finished, you can optionally preview your reply by clicking on the "Preview" button. Otherwise, click the "Post" button to submit your message immediately.
    Subject:
    Click for bold      Click for italics      Click for underline           Click for code tags      
      Formatting tips
    Message:
    Add topic to Watchlist:
    Original Message:
    Switch statement problem
    Xivilai Registered: Mar 3, 2007 9:52 AM      Mar 3, 2007 10:06 AM
    I am doing a question in which I have to make a simple ATM program that can withraw and deposit money as many times as the user wants. To exit the program the user has to hit "x". I have to use a switch statement. Im getting incompatible type errors after compiling it. Can anyone help me? Sorry if the formattings not too good.
    //ATM.java
    //This program reads in a user's opening balance and performs a withdrawal or a deposit at the request of the user
    import java.text.*;
    public class ATM
    public static void main(String args[])
    int balance;
    char withdrawal, deposit, choice;
    //Ask for the opening balance
    System.out.print("Please enter your opening balance");
    balance=UserInput.getInt();
    //Find out what the user wants done
    System.out.print("What would you like to do? (Withdrawal, Depositor Exit(x))");
    choice=UserInput.getChar();
    switch(choice){
    case 'w':
    while(balance>0)
    System.out.print("How much would you like to withdraw?");
    withdrawal=UserInput.getChar();
    balance=balance-withdrawal;
    System.out.print("Your remaining balance is " + balance);
    break;
    case 'd':
    while(balance>0)
    System.out.print("How much do you wish to deposit?");
    deposit=UserInput.getChar();
    balance=balance+deposit;
    System.out.print("Your new balance is " + balance);
    break;
    case 'x':
    System.out.print("Goodbye and thank you for using this program");
    break;
    default:
    System.out.print("We were not able to process your request, please try again");
    break;
    }

  • 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.

  • 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???

  • Read Statement Issue

    HI,
    I am facing problem with read statement, please find below my code and provide the solution.
    My Internal Tables.
    TYPES: BEGIN OF TYP_BSAK,
    BUKRS TYPE BSAK-BUKRS,
    LIFNR TYPE BSAK-LIFNR,
    AUGDT TYPE BSAK-AUGDT,
    GJAHR TYPE BSAK-GJAHR,
    BELNR TYPE BSAK-BELNR,
    BUZEI TYPE BSAK-BUZEI,
    BUDAT TYPE BSAK-BUDAT,
    BLART TYPE BSAK-BLART,
    DMBTR TYPE BSAK-DMBTR,
    SGTXT TYPE BSAK-SGTXT,
    AUGBL TYPE BSAK-AUGBL,
    HKONT TYPE BSAK-HKONT,
    END OF TYP_BSAK.
    DATA : IT_BSAK TYPE STANDARD TABLE OF TYP_BSAK WITH HEADER LINE,
    WA_BSAK TYPE TYP_BSAK.
    READ STATEMENT :
    LOOP AT IT_BSIS INTO WA_BSIS.   -> I am getting data in wa_BSIs
       READ TABLE IT_BSAK INTO WA_BSAK  -> I am Getting record in IT_BSAK bu the same is not populated in WA_BSAK
       WITH KEY BUKRS = S_BUKRS.
       IF SY-SUBRC = 0.
          WA_OUTPUT-SAPSYS    = 'PROBE'.
          WA_OUTPUT-BUKRS     = WA_BSAK-BUKRS.
          WA_OUTPUT-BUKRS     = WA_BSAK-BUKRS.
          WA_OUTPUT-BELNR     = WA_BSAK-BELNR.
          WA_OUTPUT-SGTXT     = WA_BSAK-SGTXT.
          WA_OUTPUT-BUDAT     = WA_BSAK-BUDAT.
          WA_OUTPUT-AUGBL     = WA_BSAK-AUGBL.
          WA_OUTPUT-LIFNR     = WA_LFA1-LIFNR.
          WA_OUTPUT-NAME1     = WA_LFA1-NAME1.
          WA_OUTPUT-STRAS     = WA_LFA1-STRAS.
          WA_OUTPUT-ORT01     = WA_LFA1-ORT01.
          WA_OUTPUT-REGIO     = WA_LFA1-REGIO.
          WA_OUTPUT-PSTLZ     = WA_LFA1-PSTLZ.
          WA_OUTPUT-STCD2     = WA_LFA1-STCD2.
         ENDIF.
    APPEND WA_OUTPUT TO IT_OUTPUT.
       ENDLOOP.
    Thanks and Regards
    VB

    Hi,
    I hope You have use below code solved your problem.
    LOOP AT IT_BSIS INTO WA_BSIS
    READ TABLE IT_BSAK INTO WA_BSAK
    WITH KEY BUKRS = WA_BSIS-BUKRS.
    IF SY-SUBRC = 0.
    WA_OUTPUT-SAPSYS = 'PROBE'.
    WA_OUTPUT-BUKRS = WA_BSAK-BUKRS.
    WA_OUTPUT-BUKRS = WA_BSAK-BUKRS.
    WA_OUTPUT-BELNR = WA_BSAK-BELNR.
    WA_OUTPUT-SGTXT = WA_BSAK-SGTXT.
    WA_OUTPUT-BUDAT = WA_BSAK-BUDAT.
    WA_OUTPUT-AUGBL = WA_BSAK-AUGBL.
    WA_OUTPUT-LIFNR = WA_LFA1-LIFNR.
    WA_OUTPUT-NAME1 = WA_LFA1-NAME1.
    WA_OUTPUT-STRAS = WA_LFA1-STRAS.
    WA_OUTPUT-ORT01 = WA_LFA1-ORT01.
    WA_OUTPUT-REGIO = WA_LFA1-REGIO.
    WA_OUTPUT-PSTLZ = WA_LFA1-PSTLZ.
    WA_OUTPUT-STCD2 = WA_LFA1-STCD2.
    ENDIF.
    APPEND WA_OUTPUT TO IT_OUTPUT.
    ENDLOOP.
    Thanks
    Regards
    I.Muthukumar.
    Edited by: I.Muthukumar on Jun 25, 2010 12:43 PM

  • Dynamic read statement

    Hi Everyone,
    Here is my problem..
    I am dynamically creating an internal table based on select-option 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

    Hi,
    This is the form of read statement upto 10 keyfields,
    You can read some std tables/FM to get the key fields of a table.
    Later you can assign the key fields field symbols  as shown:-
    * Loop to assign fieldnames & values to READ TABLE keyfields
             LOOP AT li_keyfields INTO work_area WHERE keyfield EQ 'X' .
               l_index = l_index + 1.
               CASE l_index.
                 WHEN 1.
                   ASSIGN COMPONENT work_area-fieldname OF STRUCTURE work_area TO <fs_c1>.
                   MOVE work_area-fieldname  TO l_key1.
                 WHEN 2.
                   ASSIGN COMPONENT work_area-fieldname OF STRUCTURE work_area TO <fs_c2>.
                   MOVE work_area-fieldname  TO l_key2.
                 WHEN 3.
                   ASSIGN COMPONENT work_area-field OF STRUCTURE work_area TO <fs_c3>.
                   MOVE work_area-fieldname  TO l_key3.
                 WHEN 10.
                   ASSIGN COMPONENT work_area-fieldname OF STRUCTURE work_area TO <fs_c10>.
                   MOVE work_area-fieldname TO l_key10.
               ENDCASE.
             ENDLOOP.
    READ TABLE <fs_itab> ASSIGNING <fs_wa>
                 WITH KEY (l_key1) = <fs_c1>
                          (l_key2) = <fs_c2>
                          (l_key10) = <fs_c10>.

  • How to use read statement on a select options

    Hi all,
    I am trying to read the all the values on user selection screen select options.
    I have an internal table loaded with data.
    So while looping this internal table, I need to check the table certain tank field (lgort) against the select options tank values entered by user.
    It is fine when user uses the multiple values on the select options since I use the "READ" statement on the select options and get the matching values.
    Example: when user uses the multiple value selection on a select-options to enter values A554 and A555
    The select-options table will be:
    sign   option    low         high
    I          EQ       A554
    I          EQ       A555
    LOOP AT gt_output_location INTO gw_output.
      READ TABLE s_lgort INTO gw_lgort WITH KEY low = gw_output-lgort.
        IF sy-subrc = 0.
        * append row to another table.
        ENDIF.
    ENDLOOP.
    Problem:
    Example: when user uses range on a select-options to enter values A554 and A555
    sign   option    low         high
    I          BT      A554       A555
    The read statement can only get matching value A554.  
    LOOP AT gt_output_location INTO gw_output.
      READ TABLE s_lgort INTO gw_lgort WITH KEY low = gw_output-lgort.
        IF sy-subrc = 0.
        * append row to another table.
        ENDIF.
    ENDLOOP.
    Anyone have any idea on this?? Thanks!!

    Hi all, I need to consider each and every lines of the gt_output_location as there are other fields need to consider also. Basically I am checking each and every lines of this table to see which lines I need to append to another table.
    That is why I did not use  "LOOP AT gt_output_location INTO gw_output WHERE lgort IN s_lgort"
    The full gt_output_location:
    LOOP AT gt_output_location INTO gw_output.
    *      IF p_lgort = space AND p_umlgo = space.
           IF gv_lines_lgort = 0 AND gv_lines_umlgo = 0.
    *       only append those from tank <> to tank
             IF gw_output-lgort <> gw_output-umlgo.
               APPEND gw_output to gt_output.
               CLEAR gw_output.
             ELSE. "from tank == to tank
    *         append those from plant <> to plant
               IF gw_output-werks <> gw_output-umwrk.
                 APPEND gw_output to gt_output.
                 CLEAR gw_output.
               ENDIF.
             ENDIF.
    *      ELSEIF p_lgort = space AND p_umlgo <> space.
           ELSEIF gv_lines_lgort = 0 AND gv_lines_umlgo > 0.
    *        IF gw_output-umlgo = p_umlgo.
             READ TABLE s_umlgo INTO gw_umlgo WITH KEY low = gw_output-umlgo.
             IF sy-subrc = 0.
    *         only append those from tank <> to tank
               IF gw_output-lgort <> gw_output-umlgo.
                 APPEND gw_output to gt_output.
                 CLEAR gw_output.
               ELSE. "from tank == to tank
    *           append those from plant <> to plant
                 IF gw_output-werks <> gw_output-umwrk.
                   APPEND gw_output to gt_output.
                   CLEAR gw_output.
                 ENDIF.
               ENDIF.
             ENDIF.
    *      ELSEIF p_umlgo = space AND p_lgort <> space.
           ELSEIF gv_lines_umlgo = 0 AND gv_lines_lgort > 0.
    *        IF gw_output-lgort = p_lgort.
             READ TABLE s_lgort INTO gw_lgort WITH KEY low = gw_output-lgort.
             IF sy-subrc = 0.
    *         only append those from tank <> to tank
               IF gw_output-lgort <> gw_output-umlgo.
                 APPEND gw_output to gt_output.
                 CLEAR gw_output.
               ELSE. "from tank == to tank
    *           append those from plant <> to plant
                 IF gw_output-werks <> gw_output-umwrk.
                   APPEND gw_output to gt_output.
                   CLEAR gw_output.
                 ENDIF.
               ENDIF.
             ENDIF.
           ELSE.
    *        IF gw_output-lgort = p_lgort AND gw_output-umlgo = p_umlgo.
             READ TABLE s_lgort INTO gw_lgort WITH KEY low = gw_output-lgort.
             IF sy-subrc = 0.
    *         only append those from tank <> to tank
               IF gw_output-lgort <> gw_output-umlgo.
                 APPEND gw_output to gt_output.
                 CLEAR gw_output.
               ELSE. "from tank == to tank
    *           append those from plant <> to plant
                 IF gw_output-werks <> gw_output-umwrk.
                   APPEND gw_output to gt_output.
                   CLEAR gw_output.
                 ENDIF.
               ENDIF.
             ENDIF.
             READ TABLE s_umlgo INTO gw_umlgo WITH KEY low = gw_output-umlgo.
             IF sy-subrc = 0.
    *         only append those from tank <> to tank
               IF gw_output-lgort <> gw_output-umlgo.
                 APPEND gw_output to gt_output.
                 CLEAR gw_output.
               ELSE. "from tank == to tank
    *           append those from plant <> to plant
                 IF gw_output-werks <> gw_output-umwrk.
                   APPEND gw_output to gt_output.
                   CLEAR gw_output.
                 ENDIF.
               ENDIF.
             ENDIF.
           ENDIF.
           CLEAR gw_lgort.
           CLEAR gw_umlgo.
         ENDLOOP.

  • Mail sometimes does not sync read state?

    Mail sometimes does not sync read state? If I read the mail from OSX it's not marked as read on my ipad. It's random so sometimes it does sometimes it doesnt. It's really annoying, how to fix?

    When you guys say turn ON and OFF, are you referring to "show in IMAP" checkbox in the "Labels" tab in gmail?  As superwhatever mentioned, Apple initially told me to make sure these are showing so that Mail.app picks them up.  If I uncheck "All Mail" and "Important" wont that just mkae Mail.app skip downloading thosemessages that are in Important and All Mail?  Instead shouldn't Mail.app's "Inbox" be set to also incorporate those message that are in Important and All Mail?  This was so much of a headach for me back when the original problem surface that I just stopped using Mail.app and purchased Mailmate.  Since then though, I'm missing certain key functions that Mail.app has and want to take another stab at resolving this.
    On my iphone it shows that I have 18 unread messages for my company account, while in Mail.app it shows only 2 unread.  The other 16 are found in "Important."  how does this get fixed?

Maybe you are looking for

  • Create a dynamic view

    Hi, We have two schema's with exact same table TABLEXYZ (A.TABLEXYZ and B.TABLEXYZ). Now we need to create a view (VIEW1) that reference either one of the schema's depending on a condition. Example: If the datetime is between 1PM to 4PM, view should

  • Windows Vista does not see my Ipad but it always did prior to this attempt

    Windows Vista does not see my Ipad, this is a new problem and I have not made any major changes to either my computer or to my Ipad.  I am running Vista 64 as an operating system.  I get the message that windows has an unrecognized USB device.  I che

  • TCS Dedaction on Customer invoice

    Hi All, I try to apply TCS deduction at the time of invoice, But my client is paid TDS/TCS at behalf of customer. At the time of invoice they post entry -- Customer A/c Dr.                  1000 Sales of scrap A/c Cr.                  900 TDS/TCS A/c

  • Dynamic query in reports region(multiple condition)

    Hi I have this sql query in the report region. And everytime I will run the report and choose to put a value on :P3_REQUESTID and the rest of the variables to null.It doesnt display the report.The same goes to other variables except for :P3_OOTSELECT

  • How to put "Issue Tracking" Demo HTML DB application in my development site

    I have set up Oracle 10g DB and HTML DB 1.5 on my Windows/XP machine. I also downloaded issue_tracker-3rd demo to my machine. I am new to HTML DB. Can someone tell me how to put issue_tracker into my HTML DB environment and test running it? Many Than