Values in loops

Hi. I have a while loop, that runs for some condition
in this loop, i'm adding as many buttons as the condition holds.
for each loop, i adds an action listener.
the problem is when i want to use the action listener. it, of corse, respond to the last button in the loop. how can i make all the buttons work? i dont know ho many loops there will be, ergo i don't know how many buttons there will be... I mean, i have to store each of the values for later use, but how?
read from file
while (file is not empty)
ImageButton = new ImageIcon (name from file);
theButton = new JButton(imageButton);
myPanel.add(theButton);
theButton.addActionListener(this);
buttonId = i++;
in the action listener
if (listener = theButton)
//do something

Hi. I have a while loop, that runs for some
condition
in this loop, i'm adding as many buttons as the
condition holds.
for each loop, i adds an action listener.
the problem is when i want to use the action
listener. it, of corse, respond to the last button in
the loop. how can i make all the buttons work? i dont
know ho many loops there will be, ergo i don't know
how many buttons there will be... I mean, i have to
store each of the values for later use, but how?[snip]
in the action listener
if (listener = theButton)
//do somethingWhat is "listener" and "theButton" here? If you are only doing something for one particular button then that's the only button that will produce any action. You need to do something more like:// Determine which button was pressed
// Do something (apologies if that's what you're doing already)
Good Luck
Lee

Similar Messages

  • Decrease sy-tabix value in Loop

    Hi Experts,
    I need to know that is it possible that we can decrease or change value of SY-TABIX.
    EXAMPLE:
    I am using a;
    loop at itab.  --> at this stage sy-tabix is 1.
    for instance current value of sy-tabix is changed to 4 and now I want to make it 3.
    in this case I want to read the 3 value in loop again.
    So is it possible that I can change my SY-TABIX value from 4 to 3 and read that 3rd record in the loop?
    endloop.
    can anyone let me know.
    thanks in advance.
    Regards,
    Yahya

    Hi
    this is not possible directly to change the values of system variables
    but the other way is there
    what you can do is to move the valuw of sy-tabix in a variable and then loop through the table to that value,
    like:
    lv_tabix like sy-tabix.
    loop at itab into wa where sy-tabix = lv_tabix.
    after loop statement.
    lv-tabix = sy-tabix.
    you code............
    before enloop .
    lv_tabix = sy-tabix - 1.
    endloop.
    I am not sure about the above code but you can try something like above.
    Thanks
    Lalit

  • Get Map values using loops

    Hi,
    With a vector I can have a loop and to get the values with a index.
    Vector vec = new Vector()
    for(int idx=0; idx>vec.size(); idx++){
        System.out.println(vec.get(idx).toString());
    }I can do something similar with a map ? in other words have a loop and get the map values.
    I know that the map a other java.util Collections don't have a
    public Object get(int index)
    method as Vector, but How I can simulate this in a map.
    Some idea ??
    thanks

    what about using an iterator?
    Iterator it = map.values.iterator();
    while (it.hasNext()) {
    Object o = it.next();
    hf,
    dani

  • How to fetch data from an internal table by comparing the a value in loop

    i have an internale table with two fields like parvw and vtext.
    acc to valuue in parvw in loop we sholud fetch the corresponding value of vtext.
    we should not use loop in loop .
    ex code
    select parvw vtext from tpart into table i_vtext where spras = sy-langu.
        LOOP AT I_OUTPUT.
          CASE I_OUTPUT-tabname.
            WHEN 'VBPA'.
              IF I_OUTPUT-fname = 'KUNNR' OR
                 I_OUTPUT-fname IS INITIAL.
                MOVE I_OUTPUT-tabkey TO vbpa.
               READ TABLE i_vtext WITH table KEY parvw = vbpa-*parvw .
                IF sy-subrc = 0.
                  REPLACE '&' WITH i_vtext-vtext INTO I_OUTPUT-indtext.
                ENDIF.
              ENDIF.
            WHEN 'VBAP'.
              IF I_OUTPUT-fname IS INITIAL.
                REPLACE '&' WITH 'item' INTO I_OUTPUT-indtext.
              ENDIF.
          ENDCASE.
          IF I_OUTPUT-indtext(1) EQ '&'.
            REPLACE '&' WITH I_OUTPUT-ftext(40) INTO I_OUTPUT-indtext.
          ENDIF.

    Loop the main ITAB
    and then use READ TABLE to fetch a row from the 2nd ITAB.
    sort the main itab abd use binary search option in READ to improve the performance
    Narendra

  • Convert values in loop to correct data types

    I need to convert the values in a loop to the correct data types. It compiles, but I get an error. It says,
    Exception in thread "main" java.lang.NumberFormat Excepton: A
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at ExtFile.main(ExtFile.java:22)
    Here is the code:
    import java.text.* ;
    import java.io.* ;
    class ExtFile
    public static void main (String args[]) throws IOException
    // Open the external file whose file name was provided as a
    // command line program invocation argument.
    ExternalFile dataFile = new ExternalFile(args[0]);
    String dataLine = dataFile.getLine();
    char candidate;
    int curPrecinct;
    String precinctIn;
    while (!dataFile.havehitEOF())
    precinctIn = dataFile.getLine();
    candidate = dataLine.charAt(0);
    curPrecinct = Integer.parseInt(dataFile.getLine());
    // Get data line to process
    dataLine = dataFile.getLine();
    System.out.println(dataLine);
    } // EndWhile
    // Close the data file
    dataFile.close();
    } // EndMain
    } // Endclass ExtFile
    What does this exception mean and how might I fix it??

    Hello,
    The line of code:
    curPrecinct = Integer.parseInt(dataFile.getLine());accepts a String (stored in a file) and produces an int (an integer representation of the String). However, if you pass it a String which doesn't represent a integer an exception is thrown. For example, if you want to obtain an integer from the String "123a", an exception will arise because you can not parse "123a" into an int because 123a is not an int, that is, it has a letter 'a' in it - and ints do not.
    To correct this you must pass (make the line in the file) represent an int.
    I hope this works.

  • Using drop down list to set values in looped form

    I've got a form which loops through (currently) 10 copies of an input form for assets
    <form>
    <input name="assetModel[1]" type="text">
    <input name="assetSerial[1]" type="text">
    <cfselect name="assetRoom[1]">
    <input name="assetModel[2]" type="text">
    <input name="assetSerial[2]" type="text">
    <cfselect name="assetRoom[2]">
    <input name="assetModel[3]" type="text">
    <input name="assetSerial[3]" type="text">
    <cfselect name="assetRoom[3]">
    </form>
    I'm after a way to be able to set assetModel[all] = "51" (which shouldn't be too difficult) but also to set [1] = 46, [2]=35, [3]=42 etc.
    Current thinking is that I want to have a drop down box where I can select my all options and another to set where I want to copy the list of assets from another room as default values on this form.
    There are approx 20 fields on each iteration of the field and I'll probably have about 10 fields at the top to set the values I'm after some ofthese affecting multiple form fields.
    Thanks
    Mi-ul

    I've got a form which loops through (currently) 10 copies of an input form for assets
    <form>
    <input name="assetModel[1]" type="text">
    <input name="assetSerial[1]" type="text">
    <cfselect name="assetRoom[1]">
    <input name="assetModel[2]" type="text">
    <input name="assetSerial[2]" type="text">
    <cfselect name="assetRoom[2]">
    <input name="assetModel[3]" type="text">
    <input name="assetSerial[3]" type="text">
    <cfselect name="assetRoom[3]">
    </form>
    I'm after a way to be able to set assetModel[all] = "51" (which shouldn't be too difficult) but also to set [1] = 46, [2]=35, [3]=42 etc.
    Current thinking is that I want to have a drop down box where I can select my all options and another to set where I want to copy the list of assets from another room as default values on this form.
    There are approx 20 fields on each iteration of the field and I'll probably have about 10 fields at the top to set the values I'm after some ofthese affecting multiple form fields.
    Thanks
    Mi-ul

  • Layer 3 TTL value and loop

    Hi 
    If the TTL value in the ip header  will stop ip looping , why the same  not implmented in the frame ?
    Thanks 

    Disclaimer
    The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.
    Liability Disclaimer
    In no event shall Author be liable for any damages whatsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.
    Posting
    Consider Ethernet Coax.  If you physically loop it, what's going to decrement a counter in the frame?
    Consider compatibility.  If you add a new "TTL" counter to the frame, older equipment may not understand the frame format.
    BTW, TTL won't avoid a loop, it would just keep the frame from looping endlessly.

  • Hidde database values when looping through jsp:useBean collection

    <jsp:useBean id="categories" scope="request" class="java.util.Collection"/>
    <c:forEach var="dto" items="${categories}">               
    <td width="375px" class="categoryContentTD">${dto.categoryName}</td>
    <td width="75px" class="categoryContentTD">${dto.categoryStatus}</td>
    <td width="75px" class="categoryContentTDEdit" align="center">
    edit
    </td>
    </c:forEach>
    When I view source I can see the values in my database. Is there anyway to hide these from view source?

    You can use an alias for the key values. For example, if you have a list of personIDs for your list as follows:
    325244,32156,51255 that you dont want on the displayed page, you can store those numbers in a two dimentional array in the user's session scope back on the server as follows:
    1 325244
    2 32156
    3 51255
    Now, you send 1,2,3 to the JSP page. When you get back 1,2, or 3, you use that two dimentional array to convert the number back to personID. Now you have personID you can use in your datbase sql statements.
    You can use a simliar array if you dont want to display the database table column names in the JSP page (so user's dont know info about your database schema).

  • How to put entries in a for loop without hard coding the values

    I have a below pl/sql block that needs to flag a claim based on claim number values given that I have in an excel sheet. Is there a way to capture those 500 claims efficiently in the select statement in the pl/sql without hardcoding these from value 1 ...to value 500 (as listed below)???
    DECLARE
       ln_ctr   NUMBER := 0;
    BEGIN
       FOR lrecclaimnumber
       IN ( SELECT   entityid claimnumber
             FROM   mpi_fnx.wfTokenEntity wte
            WHERE   wte.entityid IN
                          ('Value1','Value2',....'Value 500')
    LOOP
       mpi_fnx.pkgSaveClaimData.spMarkClaimInvalid (pivClaimNumber          => lrecclaimnumber.claimnumber,
                                                    pininvalidreasonid      => 304,
                                                    pinuserid               => 4999
       ln_ctr := ln_ctr + 1;
       END LOOP;
       DBMS_OUTPUT.put_line ('Total Entries Processed: ' || ln_ctr);
    END;
    /

    DECLARE
       ln_ctr   NUMBER := 0;
    BEGIN
       FOR lrecclaimnumber
       IN ( SELECT   entityid claimnumber
             FROM   mpi_fnx.wfTokenEntity wte
            WHERE   wte.entityid IN
                          (select 'Value '|| level as col_name from dual  connect by level <=500)
    LOOP
       mpi_fnx.pkgSaveClaimData.spMarkClaimInvalid (pivClaimNumber          => lrecclaimnumber.claimnumber,
                                                    pininvalidreasonid      => 304,
                                                    pinuserid               => 4999
       ln_ctr := ln_ctr + 1;
       END LOOP;
       DBMS_OUTPUT.put_line ('Total Entries Processed: ' || ln_ctr);
    END;
    / bye
    TPD

  • Confusion in loop inside loop

    Hi Experts,
    i have some confution in below code:
    here am trying to calculate  Actual Billing and Planned Revenue. but here for each value am looping it_final table inside the main loop.
    but the prob is if i loop it_final for one value it is giving value, but if i try to loop 2 times for 2 values, it is not giving first value also.  
    i.e if i comment loop for Planned Revenue then Actual Billing is displaying, if i try for 2 values, then its giving zeros for 2 values.
    so could anyone check is there any mistake i did.
    CLEAR: it_prps, it_final, wa_final, wa_it_prps.
      LOOP AT it_prps.
        CASE month.
          WHEN '08'.
      ACTUAL BILLING
            LOOP AT it_final INTO wa_final
             WHERE posid = it_prps-posid
                AND wrttp = c_04
                AND beltp = c_02
                AND versn = c_0
                AND ( vorga = c_coin OR vorga = c_rku2 ).
              CLEAR act_billing.
              IF sy-subrc IS INITIAL.
                MOVE wa_final-wlp08 TO t_act_billing.
                act_billing = act_billing + t_act_billing.
              ENDIF.
              CLEAR: it_prps, it_final.
            ENDLOOP.
    *************PLANNED REVENUE
            LOOP AT it_final INTO wa_final
                             WHERE posid = it_prps-posid
                             AND wrttp = c_01
                             AND beltp = c_02
                             AND versn = c_0
                             AND ( vorga = c_sdor OR vorga = c_rkp5 ).
              CLEAR plan_rev.
              IF sy-subrc IS INITIAL.
                MOVE wa_final-wlp08 TO t_plan_rev.
                plan_rev = plan_rev + t_plan_rev.
              ENDIF.
              CLEAR: it_prps, it_final.
            ENDLOOP.
    ENDCASE.
    ENDLOOP.
    WRITE:/10 'Actual Billing is',act_billing.
    WRITE:/20 'Actual Cost is........', actu_cost.
    Thanks in advace,
    sudharsan.

    Hi SUDHARSAN RAO
    U r clearing the headers and tables. So u cannot use the values on the nested loops  as u have cleared the values. There wont be anything in the workare ur using in where clause.
    Please see the below comments that I kept.
    LOOP AT it_prps.
    ACTUAL BILLING
    LOOP AT it_final INTO wa_final
    WHERE posid = it_prps-posid
    AND wrttp = c_04
    AND beltp = c_02
    AND versn = c_0
    AND ( vorga = c_coin OR vorga = c_rku2 ).
    CLEAR act_billing.
    IF sy-subrc IS INITIAL.
    MOVE wa_final-wlp08 TO t_act_billing.
    act_billing = act_billing + t_act_billing.
    ENDIF.
    CLEAR: it_prps, it_final.
    Here IT_FINAL is cleared by u... should not be cleared
    ENDLOOP.
    *************PLANNED REVENUE
    LOOP AT it_final INTO wa_final
    WHERE posid = it_prps-posid
    AND wrttp = c_01
    AND beltp = c_02
    AND versn = c_0
    AND ( vorga = c_sdor OR vorga = c_rkp5 ).
    CLEAR plan_rev.
    IF sy-subrc IS INITIAL.
    MOVE wa_final-wlp08 TO t_plan_rev.
    plan_rev = plan_rev + t_plan_rev.
    ENDIF.
    Again ur clearing both tables.
    CLEAR: it_prps, it_final.
    ENDLOOP.
    ENDCASE.
    ENDLOOP.
    WRITE:/10 'Actual Billing is',act_billing.
    WRITE:/20 'Actual Cost is........', actu_cost.

  • LOOP DOUBT INSIDE  PACKAGE

    CREATE PACKAGE EMP_PKG AS
    CURSOR EMP_CUR IS
    SELECT EMPNO,DEPTNO,SAL,HIREDATE
    FROM EMP
    WHERE DEPTNO=30;
    PROCEDURE P_EMP;
    PROCEDURE P_GET_SAL(V_EMPNO NUMBER);
    PROCEDURE P_GET_LOC(V_EMPNO NUMBER);
    Now inside my Package Body
    INSIDE THE MAINPROCEDURE P_EMP
    I WILL BE CALLING THE BELOW TWO PROCEDURES
    PROCEDURE P_EMP
    BEGIN
    FOR I IN EMP_CUR LOOP
    P_GET_SAL(I.EMPNO);-- DO I NEED TO LOOP AGAIN IN P_GET_SAL PROC?
    P_GET_LOC(I.DEPTNO);
    END LOOP;
    END;
    NOW WHAT IAM DOING IS
    in my P_GET_SAL Procedure is
    PROCEDURE P_GET_SAL(V_EMPNO NUMBER)
    V_SAL EMP.SAL%TYPE;
    BEGIN
    FOR I IN EMP_CUR LOOP
    SELECT SAL INTO V_SAL FROM EMP
    WHERE EMPNO=I.EMPNO --DOUBT HERE
    END;
    I WANT TO KNOW WHETHER I NEED TO LOOP AGAIN
    HERE OR INSTEAD OF THAT
    PROCEDURE P_GET_SAL(V_EMPNO NUMBER)
    V_SAL EMP.SAL%TYPE;
    BEGIN
    SELECT SAL INTO V_SAL FROM EMP
    WHERE EMPNO =V_EMPNO;
    END;
    SINCE iam calling V_EMPNO WITH CURSOR FROM MY
    MAINPROCEDURE ..
    WILL THE PROCEDURE USES THE CURSOR VALUES
    AND LOOP ITSELF FOR EVERY EMPLOYEE TO
    GET THE SALALRY ?
    PLEASE LET ME KNOW SINCE MY PACKAGE IS MORE THAN 3000
    LINES I cant proceed unless its confirmed i can
    do so ..

    Hi all,
    Thanks for Looking into my Problem
    I Got answer by MySelf ..i dont need to loop again my sub procedures
    if i try to do that iam getting the error
    ERROR at line 1:
    ORA-06511: PL/SQL: cursor already open
    Thank you all once again ..

  • Any way to use cursor values inside other cursor by bulk collect?

    hi,
    Is there any way to use cursor get_tables value insdide loop get column if i am using bulk collect in both cursors?
    I tried a lot but i am nt able to do it.kindly help...
    create or replace procedure MULTIPLE_CURSORS_PROC is
    v_owner varchar2(40);
    v_table_name varchar2(40);
    v_column_name varchar2(100);
    cursor get_tables is
    select distinct tbl.owner, tbl.table_name
    from all_tables tbl
    where tbl.owner = 'SYSTEM';
    cursor get_columns is
    select distinct col.column_name
    from all_tab_columns col
    where col.owner = v_owner
    and col.table_name = v_table_name;
    begin
    open get_tables;
    loop
    fetch get_tables into v_owner, v_table_name;
    open get_columns;
    loop
    fetch get_columns into v_column_name;
    end loop;
    close get_columns;
    end loop;
    close get_tables;
    end ;

    hi there
    Refer this
    CREATE OR REPLACE PROCEDURE MULTIPLE_CURSORS_PROC
    IS
       TYPE scol IS VARRAY (10000) OF VARCHAR2 (32767);
       v_table_name    scol;
       v_column_name   scol;
       TYPE curtyp IS REF CURSOR;
       get_columns     curtyp;
       CURSOR get_tables
       IS
          SELECT   DISTINCT tbl.table_name
            FROM   all_tables tbl
           WHERE   tbl.owner = 'SYSTEM';
    BEGIN
       OPEN get_tables;
       LOOP
          FETCH get_tables BULK COLLECT INTO   v_table_name;
          FOR indx IN v_table_name.FIRST .. v_table_name.LAST
          LOOP
             SELECT   DISTINCT col.column_name
               BULK   COLLECT
               INTO   v_column_name
               FROM   all_tab_columns col
              WHERE   col.table_name = v_table_name (indx);
             FOR ind IN v_column_name.FIRST .. v_column_name.LAST
             LOOP
                DBMS_OUTPUT.put_line (v_column_name (ind));
             END LOOP;
          END LOOP;
          EXIT WHEN get_tables%NOTFOUND;
       END LOOP;
       CLOSE get_tables;
    END MULTIPLE_CURSORS_PROC;regards
    Hitesh

  • I want to generate value for parameter

    Hi experts,
    I write one code to generate employee id automatic based on the previous fields in selection screen. ID is generated successfully but I am not able to appear it selection at run time. Please help here is my code.
    REPORT  ZSELECT_TOP.
    TYPE-POOLS: VRM.
    DATA: NAME  TYPE VRM_ID,
          LIST  TYPE VRM_VALUES,
          VALUE LIKE LINE OF LIST.
    data: id1(4) type c VALUE 'ACEN'.
    data: dep like ZACENTIQ_PAGE1-sno.
    data: slno(13) TYPE c.
    DATA:WA33 TYPE ZACENTIQ_PAGE1.
    PARAMETERS:UserName(20) type C ,
                Password(10) type C .
    PARAMETERS:Depart(15) AS LISTBOX VISIBLE LENGTH 17.
    PARAMETERS: Emp_ID(13) TYPE c DEFAULT slno.
    AT SELECTION-SCREEN OUTPUT.
    NAME = 'DEPART'.
       VALUE-KEY = 'DEV'.
       VALUE-TEXT = 'DEVELOPMENT'.
       APPEND VALUE TO LIST.
       VALUE-KEY = 'MARK'.
       VALUE-TEXT = 'MARKETING'.
       APPEND VALUE TO LIST.
       VALUE-KEY = 'CRM'.
       VALUE-TEXT = 'CRM'.
       APPEND VALUE TO LIST.
       CALL FUNCTION 'VRM_SET_VALUES'
         EXPORTING
           ID     = NAME
           VALUES = LIST.
       SELECT * FROM ZACENTIQ_PAGE1 INTO wa33 UP TO 1 ROWS ORDER BY sno DESCENDING.
      dep = wa33-sno.
    ENDSELECT.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
       EXPORTING
         INPUT         = dep
      IMPORTING
        OUTPUT        = dep
       CONCATENATE id1 '/' depart '/' dep into slno.
    *----------------------------- At selection screen -------------------------------------
       AT SELECTION-SCREEN.
    Message was edited by: Manish Kumar : Moderator message: I have edited your post to correct spelling mistakes, all CAPS (shouting) and applied fixed-width font on code for readability. Good formatting can yield better responses.

    I allready used it in At-SELECTION-SCREEN OUTOUT BUT STILL NOT COMING.
    HERE IS MY CODE
    TYPE-POOLS: VRM.
    DATA: NAME  TYPE VRM_ID,
           LIST  TYPE VRM_VALUES,
           VALUE LIKE LINE OF LIST.
    data: id1(4) type c VALUE 'ACEN'.
    data: dep like ZACENTIQ_PAGE1-sno.
    data: slno(13) TYPE c.
    DATA:WA33 TYPE ZACENTIQ_PAGE1.
    DATA INT(3)  TYPE I.
    PARAMETERS:UserName(20) type C ,
                Password(10) type C .
    PARAMETERS:Depart(15) AS LISTBOX VISIBLE LENGTH 17 DEFAULT 'DEV'.
    PARAMETERS: Emp_ID(13) TYPE c  MODIF ID g1.
    AT SELECTION-SCREEN OUTPUT.
    NAME = 'DEPART'.
       VALUE-KEY = 'DEV'.
       VALUE-TEXT = 'DEVELOPMENT'.
       APPEND VALUE TO LIST.
       VALUE-KEY = 'MARK'.
       VALUE-TEXT = 'MARKETING'.
       APPEND VALUE TO LIST.
       VALUE-KEY = 'CRM'.
       VALUE-TEXT = 'CRM'.
       APPEND VALUE TO LIST.
       CALL FUNCTION 'VRM_SET_VALUES'
         EXPORTING
           ID     = NAME
           VALUES = LIST.
    loop at screen.
        IF SCREEN-NAME = 'EMP_ID' AND screen-group1 = 'G1'.
    SELECT * FROM ZACENTIQ_PAGE1 INTO wa33 UP TO 1 ROWS ORDER BY sno DESCENDING.
      dep = wa33-sno.
    ENDSELECT.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
       EXPORTING
         INPUT         = DEP
      IMPORTING
        OUTPUT        = dep.
    CONCATENATE id1 '/' depart '/' DEP into slno.
    EMP_ID = slno.
       MODIFY SCREEN .
       ENDIF.
       ENDLOOP.
    *----------------------------- At selection screen -------------------------------------
       AT SELECTION-SCREEN.
       INITIALIZATION.
       START-OF-SELECTION.

  • Dynamic query in where clause while looping in an internal table.

    Hi,
    Had a small question : How can i make a dynamic query for the WHERE clause while looping at an internal table.
    i want to implement a dynamic where clause query for the below example.
    it_cfx_col is an internal table and wa_cfx_col is a work area for it_cfx_col
      DATA :
      i_cfx_col TYPE TABLE OF cfx_col,
      wa_cfx_col LIKE LINE OF i_cfx_col.
    DATA : count TYPE i VALUE 0.
    DATA : l_where_clause TYPE string,
             l_where_clause2 TYPE string,
             l_name type string.
    l_name = 'NANDANOM'.
    l_scenario = 'collaboration'.
    LOOP AT it_cfx_col INTO wa_cfx_col
    WHERE CREATED_BY = l_name
    AND SCENARIO = l_scenario.
    count = count + 1.
    some business logic implemented using the work area wa_cfx_col
    endloop.
    Now i want to write a dynamic query for the where clause.
    DATA : count TYPE i VALUE 0.
      DATA : l_where_clause TYPE string,
             l_where_clause2 TYPE string,
             l_name type string.
    l_name = 'NANDANOM'.
    l_scenario = 'collaboration'.
      l_where_clause = 'CREATED_BY = l_name'.
      l_where_clause2 = 'AND SCENARIO = l_scenario'.
    if l_scenario is not initial.
      CONCATENATE  l_where_clause l_where_clause2
      INTO l_where_clause SEPARATED BY space.
    endif.
    LOOP AT i_cfx_col INTO wa_cfx_col
    WHERE (l_where_clause).
    count = count + 1.
    some business logic implemented using the work area wa_cfx_col
    endloop.
    when i compile this i get an error message as { Statement concluding with "...(l_where_clause)" ended unexpectedly}
    Even i changed the initilization of the variable  l_where_clause2 to [ l_where_clause2 = 'AND SCENARIO = l_scenario.'. ]
    added the end of line demarkation ".", but still i got the same error message.
    Is it a limtation in ABAP that i cannot write a dynamic query for the where clause while looping at an internal table?
    Regards,
    om

    Hi savita,
    there in no such 1 limitaion in abap for dynamic query .. i think the  error meassge is only beacuse of your synatx delcartaion.
    >> LOOP AT i_cfx_col INTO wa_cfx_col
       WHERE (l_where_clause).
       count = count + 1.
    some business logic implemented using the work     area    wa_cfx_col
       endloop.
    afted delclarataion also , in the where statement you should specify both the field name and value bname
       LOOP AT i_cfx_col INTO wa_cfx_col
       WHERE l_where_clause = 'CREATED_BY = l_name' .
       count = count + 1.
    hope it helps.
    regads
    priya.

  • How to set field checkbox values based on another field

    I'm trying to provide the user with the ability to check one box "Check All" which would then set the check boxes for a section to the same value as shown in the example.  Anyone know how I can accomplish this?
    Thank you.
    Example
    General Category A     [  ] Check All
         [  ]  Item 1
         [  ]  Item 2
         [  ]  Item 3
         [  ]  Item 4
    If user selects "Check All", all the Items in the list for "General Category A" are then checked automatically.

    You can create a document level function to check a series of check fiels as long as they all have the same checked value.
    // document level function that can be used for many sections
    function CheckAll(aFields, sChecked) {
    // test to see Check All box for being checked
    // and if checked set to aFields to checked value
    // otherwise clear fields
    if(this.getField(event.target.name).value == 'Off') {
    // field unchecked
    this.resetForm(aFields); // clear the fields
    // end box not checked
    } else {
    // check all box has been checked
    // loop through the fields to check
    for (i = 0; i < aFields.length; i++) {
    // all fields are assumed to have a value of 'Yes' when selected
    var f = this.getField(aFields[i]); // get field for element i
    f.value = sChecked; // set to checked value
    } // end loop to check
    // end checked
    } // end unchecked
    } // end CheckAll function
    // end document level function
    You can then add a mouse up aciton for the check all check box:
    // mouse up action for check all check box
    // define array of check box fields to process
    var aSecFields = new Array('Item 1', 'Item 2', 'Item 3', 'Item 4');
    // call CheckAll function
    // passing the array list of field names and checked value
    CheckAll(aSecFields, 'Yes');
    or you can use 1 line of executable code:
    // mouse up action for check all check box
    // call CheckAll function
    // passing the array list of field names and checked value
    CheckAll(['Item 1', 'Item 2', 'Item 3', 'Item 4'], 'Yes');

Maybe you are looking for