How to select One Check Box at a time

Dear All
I have 10 records in details blok and also I have 10 check boxes .
I want user can only check one check box at a time .
For example If first record I have checked and i am trying to check the last record then the first record UNCHECKED and the last record will checked .
Like how redio buttons work ..
How can i do that ..?
I have done like this :-
1st I have declare a global variable in PRE_FORM :GLOBAL.CNT := 'N';
Then
WHEN-CHECKBOX-CHANGED trigger
IF CHECKBOX_CHECKED(EMP.CHK') THEN
    IF :GLOBAL.CNT != N THEN
        :EMP.CHK := Null
   HERE what to write ???
        RAISE FORM_TRIGGER_FAILURE;
    ELSE
        :GLOBAL.CNT := Y;
    END IF;
ELSE
    :GLOBAL.CNT := N;
END IF;Edited by: LuKKa on Aug 29, 2012 1:12 PM
Edited by: LuKKa on Aug 29, 2012 1:13 PM

LuKKa,
An easier method would be to use a Calculated Field to summarize the value of your CHECKBOX Item. For example, add a non-table item (call it SUM_CHECKED) to your detail block and do not assign it to canvas - so it will not be displayed. Then set the following properties of the SIM_CHECKED item:
Database Item = No
Calculation Mode = Summary
Summary Function = Sum
Summarized Block = <YOUR DETAIL BLOCK>
Summarized Item = <YOUR CHECKBOX ITEM>
Next, you will need to change your Detail Block property Query All Records to YES (this is required for the Calulated Item).
Now, make sure your checkbox is data type NUMBER and has the following minimum properties set:
Data Type = Number
Maximum Length = 1
Initial Value = 0
Value when Checked = 1
Value when Unchecked = 0
Check Box Mapping of Other Values = Not Allowed or Unchecked
Now, in your Checkbox Item's When-Checkbox-Changed trigger add code similar to this:
IF ( CHECKBOX_CHECKED('YOUR_DETAIL_BLOCK.YOUR_CHECKBOX_ITEM') ) THEN
   IF ( :YOUR_DETAIL_BLOCK.SUM_CHECKED > 1 ) THEN
   --Reset the checkbox
   :YOUR_DETAIL_BLOCK.YOUR_CHECKBOX_ITEM := NULL;
   MESSAGE('You can only check one item.');
   Message(' ');
   RAISE Form_Trigger_Failure;
   END IF;
END IF;I have confirmed this method works and it is more efficient than looping through your records to see if other checkboxes are checked.
Hope this helps,
Craig B-)
If someone's response is helpful or correct, please mark it accordingly.

Similar Messages

  • How to disbale a group of checkboxes when i select one check box WEBDYNPRO

    Hi Friends,
    Can any body help me how to disbale a group of checkboxes when i select one check box WEBDYNPRO Abap
    Also can any body tell me how to handle chain endchain type of scenario in WEBDYNPRO Abap
    Thank you..
    Sai

    Hi
    In the context tab , create 2 context attributes ca_attr1 and ca_attr2   of type WDY_BOOLEAN under a context node cn_node
    now in ur Layout , bind the ENABLE property of CheckBoxGroup UI Element with this attribute ca_attr1
    bind the ENABLE property of CheckBox UI Element with this attribute ca_attr2
    create a action for ur Checkbox , for the OnToggle property of ur checkbox
    in OnactionToggle , check if ca_attr2 is 'X' , set ca_attr2 to ' ' ( for disable)
    this can be done by code wizard , press control +f7 and use read/set context attributes , use get_attribute and set_attribute methods
    // if ca_attr2 is 'X'
    DATA lo_nd_cn_node TYPE REF TO if_wd_context_node.
        DATA lo_el_cn_node TYPE REF TO if_wd_context_element.
        DATA ls_cn_node TYPE wd_this->element_cn_node .
        DATA lv_attr  LIKE ls_city-ca_attr2.
        lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_ca_attr).
    *   get element via lead selection
        lo_el_cn_node = lo_nd_cn_node->get_element(  ).
    *   get single attribute
        lo_el_cn_node->get_attribute(
          EXPORTING
            name =  `CA_ATTR2`
          IMPORTING
            value = lv_attr ).
    // if lv_attr2 is 'X' , use set_attribute method for ca_attr1
    IF lv_Attr EQ 'X' .
    DATA lo_nd_cn_node TYPE REF TO if_wd_context_node.
        DATA lo_el_cn_node TYPE REF TO if_wd_context_element.
        DATA ls_cn_node TYPE wd_this->element_cn_node .
        DATA lv_attr  LIKE ls_city-ca_attr.
    *   navigate from <CONTEXT> to <CN_VISIBLE> via lead selection
        lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_ca_attr).
    *   get element via lead selection
        lo_el_cn_node = lo_nd_cn_node->get_element(  ).
    *   set single attribute
        lo_el_cn_node->set_attribute(
          EXPORTING
            name =  `CA_ATTR1`
            value = ' ').
    ENDIF.
    regards,
    amit

  • How to Select each check box values in a group of records

    Hi,
    I have a requirement in forms 10g. In that form there are 10 records are displaying each record has one check box is there if i click the check box on record number one and record number three and do some changes in the text field(adjustment field is number data type) then finally I want to see the total on one field called total amount.
    In this my question is how to select particular records in a group of records? and finally these selected records are inserted into one table.
    Because I am not able to fetch these records at a time.
    Is there any Array to define a record group to fetch each of them individually for example Rec[1],Rec[2]...like that if yes please suggest me the steps how to do this.
    Thanks in advance
    Prasanna
    Edited by: user10315107 on Dec 17, 2008 11:44 PM

    I'm sorry, but i didn't get your requirement in detail.
    Do you want to do the summing of the selected records in forms ? Or do you just want to know which records are selected and then process them?
    If you want to process the selected records in sql you could use an object-type to store the list of id's (of whatever primary key you use), loop over the block to fill it, and then afterwards process them.
    For this approach, first create an object-type in the database:
    CREATE OR REPLACE TYPE ID_LIST AS TABLE OF NUMBER;
    /Then, in forms you could do something like this to fill a list of id's:
    DECLARE
      lIds ID_LIST:=ID_LIST();
    BEGIN
      GO_BLOCK('MYBLOCK');
      FIRST_RECORD;
      LOOP
        EXIT WHEN :SYSTEM.RECORD_STATUS='NEW';
        IF :BLOCK.CHECKBOXITEM="CHECKEDVALUE" THEN
          lIds.EXTEND(1);
          lIds(lIds.COUNT):=:BLOCK.PRIMARYKEYITEM;
        END IF;
        EXIT WHEN :SYSTEM.LAST_RECORD='TRUE';
        NEXT_RECORD;
      END LOOP;
      -- Now you can use the object-list in SQL like :
      INSERT INTO MYNEWTABLE (cols..)
      SELECT (cols..)
        FROM MYOLDTABLE
       WHERE ID IN (SELECT COLUMN_VALUE FROM TABLE(lIds));
    END;Edited by: Andreas Weiden on 18.12.2008 18:17

  • How to disable one check box when another is checked

    Hi, I'm a first time user.
    i am trying to make text fields appar and dissapaer when check boxes are ticked. but only alow one check box to be active at one time. 
    I am making a simple form in Acrobat pro 9,
    I have two check boxes Checkbox1 & Checkbox2.
    I have two text fields Textfield1 & Textfield2
    i have added actions to checkbox1 & checkbox2 to 'hide or show' the text fields.
    Action --> on focus (checkbox1) show/hide field (textfield1) is hide
    Action --> on focus (checkbox1) show/hide field (textfield2) is show
    oposite
    Action --> on focus (checkbox2) show/hide field (textfield2) is hide
    Action --> on focus (checkbox2) show/hide field (textfield1) is show
    problem 1 - how to disable checkbox1 when checkbox 2 is ticked.
    or disable checkbox2 when checkbox1 is ticked.  
    my other problem is that this action has the same effect for ticking or unticking the checkbox.
    thanks in advance to anyone who can help.
    can you please write your answer in simple terms. Basically this is the first time i have used acrobat pro so please dont assume any knowledge at all. thansk very much .

    First, I would experiment with just check boxes and learn their properties and how they can interact.
    Have you tried using the same name for 2 check boxes and assign a different "export value" to each check box.
    Have you looked at the values a check box or boxes have when checked or un-checked?
    Have you looked at how the various actions for a field work?

  • How to select the check box automatically

    Hi All,
    I'm using forms 6i.I have 3 check boxes.If i Select the 2nd and 3rd check box then the fist check box should be selected automatically.The 2nd and 3rd check boxes are mutliarray block attached to each other while the !st check box is not attached to them. while Can someone please tell me how to write the code for this?
    With Regards,
    Gowtham
    Message was edited by:
    Gowtham1232
    Message was edited by:
    Gowtham1232

    It's not very clear, but I think that having a WHEN-CHECKBOX-CHANGED trigger on checkbox2 and checkbox3 that says
    IF :checkbox2 = 'Y' and :checkbox3 = 'Y' THEN
      :checkbox1 := 'Y';
    ELSE
      :checkbox1 := 'N';
    END IF;assuming 'Y' is the checked value of each checkbox and 'N' the unchecked.

  • Select all check box at some time

    Hi all,
    I have a search display .jsp page, which have some checked box, allow the users to check the box and download data from database, righr now the use need to checked the checked the box one by one,
    bu tthey want to add other button, which allow them to select all the checked box by click the box, not ideal how to handle.
    any advise

    Hi ,
    thank you for the reply,
    I finally have time to finish this part
    the code is <script language="JavaScript" type="text/javascript">
    function checkAll(field)
    for (i = 0; i < field.length; i++)
    field.checked = true ;
    function uncheckAll(field)
    for (i = 0; i < field.length; i++)
    field[i].checked = false ;
    <input type="button" name="b1" value="Check All" onClick="checkAll(document.form1.mybox)">
    <input type="button" name="b12" value="Uncheck All" onClick="uncheckAll(document.form1.mybox)">
    </form>
    </script>

  • How to validate that only one check box is checked in detail block

    Hi All,
    I am using oracle Forms 10G on windows.
    I need help on how to validate that only one check box is checked in detail block. I have multiple records in the detail block and I have check boxes for each record in the detail block.
    I have a button to select the values from the detail records where the check box is checked. But I want to make sure that only one record is check not more than one.
    How do I validate this on a push button trigger?
    Thanks

    When I've done this kind of thing, I create a Form level variable of TYPE number and then add or subtract to this variable as I check and uncheck the checkboxes. If the value of the variable is 1, then you know that only one checkbox is selected. If the value is greater than 1, then you know the user has selected more than one check box. You could also add code to your When-Checkbox-Changed trigger to test the variable and instruct the user to un-check selected record before selecing a new record.
    With respect to the Form level variable, you can use a GLOBAL, PARAMETER or Program Unit package specification. I prefer to use the PU Package Spec as this method has a smaller memory footprint. For example, in the Program Unit node of the object navigator create the following;
    /* Form variables package spec */
    PACKAGE Form_Vars IS
      CheckBox_Cnt     NUMBER := 0;
    END;Now in your When-Checkbox-Changed trigger...
    BEGIN
       IF ( Form_Vars.CheckBox_Cnt = 0 ) THEN
          Form_Vars.CheckBox_Cnt  := Form_Vars.CheckBox_Cnt  + 1;
       ELSE
          /* it's assumed the value is greater than 0 */
          Message('Please uncheck selec ted record before choosing a new record.');
          RAISE Form_Trigger_Failure;
       END IF;
    END;Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.
    Edited by: CraigB on Feb 3, 2011 10:15 AM

  • Uncheck one check box when we select other check boxes

    Hi All,
    This might be very simple question for experts. I just want to unselect one check box (this check box is to select 'ALL' and this will be selected by default) when we select any other check box (for individual categories) on same region. Can any one please suggest me how to implement this?
    Thanks in advance.
    Regards,
    Hari

    Hi Shijesh,
    Thanks for you reply.
    I'm using two items (check boxs), like P1_ALL and P1_TEST. I want to unselect P1_ALL when we select P1_TEST check box.Both the check boxes contains single value in List of values. For this I wrote script like
    <script type="text/javascript">
    function uncheckAll(pthis)
    elm = document.getElementsByName('P1_ALL');
    if(pthis.checked)
    elm.checked = false;
    </script>
    And in HTML form element attribute of P1_TEST, I have 'onclick=uncheckAll(this)'. But for some reason when I select 'P1_TEST', P1_ALL check box not getting un-selected.
    I would be grateful if you suggest what needs to correct in this one.
    Regards,
    Hari

  • How to get a check box on the selection screen

    Hi all
    can any body tell me how to get a check box on the selection screen

    parameter: pa_check   as checkbox.
    To define the input field of a parameter as a checkbox, you use the following syntax:
    PARAMETERS <p> ...... AS CHECKBOX ......
    Parameter <p> is created with type C and length 1. In this case, you may not use the additions TYPE and LIKE. Valid values for <p> are ' ' and 'X'. These values are assigned to the parameter when the user clicks the checkbox on the selection screen.
    If you use the TYPE addition to refer to a data type in the ABAP Dictionary of type CHAR and length 1 for which 'X' and ' ' are defined as valid values in the domain, the parameter automatically appears as a checkbox on the selection screen.
    REPORT DEMO.
    PARAMETERS: A AS CHECKBOX,
    B AS CHECKBOX DEFAULT 'X'.

  • How to find the check box selected while using Class in ALV grid display

    hi,
    I am displaying the ALV report using Class 
    For Example: CALL METHOD MYGRID->SET_TABLE_FOR_FIRST_DISPLAY EXPORTING I_STRUCTURE_NAME = 'ACC1'
                                                             IS_VARIANT = GS_VARIANT
                                                             I_SAVE = 'A' "XSAVE
                                                             IS_LAYOUT  = LOUT
                                                     CHANGING  IT_FIELDCATALOG = IT_FIELD
                                                               IT_OUTTAB = ACC_NO[].
    In output i am getting 10 customer with check box, how do i find that customer number is selected.

    HI,
    Once user selects a check box, he would CLICK on a button ( say PROCESS )inorder to do the processing for the selected records. So in the PAI, under the EVENT ( OK CODE ) of the Button ( say PROCESS ), write the following code.
    CALL METHOD MYGRID->check_changed_data.
    Now,
    Loop at acc_no where check = `X`.
    Do the processing.
    endloop.
    Best regards,
    Prashant

  • How to name the Check Box as "Want Free Gift" using PARAMETERS statements

    Hi all,
    I am new to check boxes. I have a existing report where I have to add a check box to the selection screen.
    So i said
    PARAMETERS: p_cncldc AS CHECKBOX.
    everythibng is fine and I get the check box on the selection screen. when i execute the report i get the name of check box as p_cncldc. but i want the name of the check box as "Want Free Gift".
    How to name the check box as "Want Free Gift".
    if i am saying
    PARAMTERS: Want Free Gift AS CHECKBOX. it says a syntax error saying it canot be more that 8 chars.
    Some one please help. I am new to Check boxes
    Regards,
    Jessica Sam
    Edited by: jessica sam on Mar 31, 2009 10:37 PM

    Text on the Right hand side of check box.
    selection-screen begin of block b1.
    selection-screen begin of line.
    parameters: w_check as checkbox.
    selection-screen: comment  4(30) TEST .
      selection-screen end of line.
    selection-screen end of block b1.
    INITIALIZATION.
    test = 'Want Free Gift AS CHECKBOX'.
    Text on the Left hand side of check box.
    selection-screen begin of block b1.
    selection-screen begin of line.
    selection-screen: comment  2(30) TEST .
    parameters: w_check as checkbox.
      selection-screen end of line.
    selection-screen end of block b1.
    INITIALIZATION.
    test = 'Want Free Gift AS CHECKBOX'.
    OR:
    GOTO(Menubar)>Text Elements>Selection Texts
    Regards,
    Gurpreet

  • How to handle the check box in the alv tree display

    Hello,
    in my ALV Tree Report i have a check box in the output.
    I have one check box in the selection screen as select all .
    if this is selected then all the check boxes in the output must be selected that is (X).
    am using CL_GUI_ALV_TREE  for this.
    Please give me some input how to make that check boxes 'X' in the above mentioned case.
    With Regards,
    Sumodh.P

    Sumodh,
    check this
    Re: Select all checkbox in ALV tree
    please search before posting
    Thanks
    Bala Duvvuri

  • "Always Use Selected Format" check box in line items report

    Hi Experts,
    I have an issue in ECC 6.0.
    From the transaction code FBL1N (Vendor Line Items) I am trying to export the report to spreadsheet by selecting the option  List> Export>Spreadsheet  then I have selected "Always Use Selected Format" check box.  But if I execute the same report again I am not getting this option "Always Use Selected Format". Please let me how can we retrieve that option. Is there any possibility to get that option again either functionally or technically. I would like to know all the possible ways to get this option again.
    Please do the needful.

    Hello,
    In one my thread Mr. Frank has replied as follows. I believe he has solved this.
    Hope this may be really helpful.
    The problem with the spreadsheet download is at one point, users have selected their default file type.
    That said, SAPGUI is working as it should. (gui710)
    Question though is how do we reset the values so they get the ?Select Spreadsheet Format? popup again.
    The following steps should be performed :
    - Call transaction SE38, enter program SALV_BS_ADMIN_MAINTAIN, and press F8.
    - Follow the parameters below :
    - Select ?DELETE? on the Actions Group
    - Select ?DETAILED SELECTION? on the General Data :
    - On Client - your number
    - User : <user name>
    -Hit EXECUTE.
    -Press ENTER on the POPUP
    - If there is an entry in the report that will need to be deleted. Also, make sure that the entry you will delete (for the user) has a value of GUI_ALV_XML_VER on field ?Parameter? .
    - Select the line and hit the DELETE icon .
    - Press ?Y? to continue delete. Press ENTER on the popup.
    - Then EXIT all the way out of the program.
    NOTE : When you run program SALV_BS_ADMIN_MAINTAIN, make sure they are out of any program that they are using for download.
    Re: "Always Use Selected Format" check box in line items report
    Regards,
    Ravi
    Edited by: Ravi Sankar Venna on May 15, 2009 2:31 PM

  • How to make a check box non-updatable through personalization

    Hi All,
    I have a requirement where I need to make check box read only in a case when user select some values from the drop down list box. Is it possible through personalization?
    For example if there is a list box which contains 5 values and for three valuse one check box needs to be make as read only and where as for remaining it can be checked/un-checked.
    Please let me know if this can be acheived through personalization.
    Thanks,
    Sandeep

    If there is some event (e.g. fire partial action) present on selection of any value the drop down, then you can achive this using java script.
    Create a raw text item and in the text property put java script to handle this case.
    For sample java script code refer
    How to set particular segment value of key flex field in Controller
    -Anand

  • IF one checked box in the same PERNR is marked, mark the rest of them?

    Hi to everybody!
    I've an ALV with checked boxes, now, when the user check  one check box of one PERNR I need to mark all the check boxes of that PERNR...for example
    CHECKBOX                 PERNR                    DATA
          ◘                             12345                    555.74
          ◘                                                             5552
          ◘                                                           142,55
          ◘                              5214                       23
          ◘                                                             2522
    For example, when the user check the first box, (12345) the next check boxes until the PERNR change must be selected, How can I make this?
    Thanks a lot
    Regards,

    I did the same for VBELN, and it working for me, Only thing is you need to generate some action when you check the checkbox. press some button  and see how it works.
    REPORT ztest_alv_check MESSAGE-ID zz .
    TYPE-POOLS: slis.
    DATA: x_fieldcat TYPE slis_fieldcat_alv,
    it_fieldcat TYPE slis_t_fieldcat_alv,
    l_layout TYPE slis_layout_alv,
    x_events TYPE slis_alv_event,
    it_events TYPE slis_t_event.
    DATA: BEGIN OF itab OCCURS 0,
    vbeln LIKE vbak-vbeln,
    posnr LIKE vbap-posnr,
    chk(1),
    END OF itab.
    SELECT vbeln
    posnr
    FROM vbap
    UP TO 20 ROWS
    INTO TABLE itab.
    x_fieldcat-fieldname = 'CHK'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = 1.
    x_fieldcat-input = 'X'.
    x_fieldcat-edit = 'X'.
    x_fieldcat-checkbox = 'X'.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    x_fieldcat-fieldname = 'VBELN'.
    x_fieldcat-seltext_l = 'VBELN'.
    x_fieldcat-hotspot = 'X'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = 2.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    x_fieldcat-fieldname = 'POSNR'.
    x_fieldcat-seltext_l = 'POSNR'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = 3.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program      = sy-repid
        is_layout               = l_layout
        i_callback_user_command = 'USER_COMMAND'
        it_fieldcat             = it_fieldcat
      TABLES
        t_outtab                = itab
      EXCEPTIONS
        program_error           = 1
        OTHERS                  = 2.
    IF sy-subrc NE 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    *&      Form  USER_COMMAND
    *       text
    *      -->R_UCOMM      text
    *      -->RS_SELFIELD  text
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
      DATA: gd_repid LIKE sy-repid, "Exists
      ref_grid TYPE REF TO cl_gui_alv_grid.
      IF ref_grid IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = ref_grid.
      ENDIF.
      IF NOT ref_grid IS INITIAL.
        CALL METHOD ref_grid->check_changed_data .
      ENDIF.
      LOOP AT itab WHERE chk = 'X'.
        itab-chk = 'X'.
        MODIFY itab  TRANSPORTING chk WHERE vbeln = itab-vbeln .
      ENDLOOP.
      rs_selfield-refresh = 'X'.
      BREAK-POINT.
    ENDFORM. "USER_COMMAND

Maybe you are looking for

  • SQL: System locks up and runs slow after performing simple DML record insert

    SQL Version:  2008 R2 I am having a serious problem.  I ran the following code to perform a simple table record insert which ran successfully.  However, after running this code I could no longer access the related table.  I couldn't run a query again

  • Filemaker SMTP mail service setup

    I am using Filemaker server on Snow Leopard and need to setup a SMTP server. I need to use SMTP to send emails form the Filemaker server. Does anyone know how to set this up on Snow Leopard for Filemaker server 11.  Really could use the help.....

  • IPhoto's Pictures Forever Lost – Help!

    Hello to all, I am afraid that I have quite a sad and seemingly hopeless story to share with you, upon this cold and dreary Winter's day. My story begins some time ago, when I sold my 20" iMac and upgraded to a brand new 21". You might ask what sadne

  • Open Hub with step by step

    hi Can anybody tell me how a DTP can be used to transfer data from BI system to outside the BI system using Open hub. I need step by step. Regards, Wishva

  • File Vault Issue

    On an older iMac G4, File Vault was accidentally turned on by one user. Now, when trying to turn file vault off, an "error in copying" message consistently appears. I thought perhaps the problem was insufficient free space, but the individual uers's