Displaying split menu containing check boxes in struts

How to display a split menu containing check boxes ,in the first a list of all families should be displayed and when we click on a family ,then in the second menu it should display list of check boxes of all the members . If the check box of a family is checked then all members of that family have to be in checked state .

* Menu_Demo.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Menu_Demo extends JFrame {
    public Menu_Demo() {
        initComponents();
    private void initComponents() {
        setTitle("Menu Demo");
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setSize(400,300);
        setLocationRelativeTo(null);
        //create menu components
        menubar = new JMenuBar();
        families = new JMenu();
        family1Select = new JCheckBoxMenuItem();
        family2Select = new JCheckBoxMenuItem();
        members = new JMenu();
        family1 = new JMenu();
        member11 = new JCheckBoxMenuItem();
        member12 = new JCheckBoxMenuItem();
        family2 = new JMenu();
        member21 = new JCheckBoxMenuItem();
        member22 = new JCheckBoxMenuItem();
        //init families menu
        ItemListener listener = new ItemListener() {
            public void itemStateChanged(ItemEvent evt) {
                familyStateChanged(evt);
        families.setText("Families");
        family1Select.setText("Family 1");
        family1Select.addItemListener(listener);
        families.add(family1Select);
        family2Select.setText("Family 2");
        family2Select.addItemListener(listener);
        families.add(family2Select);
        menubar.add(families);
        //init family members menu
        members.setText("Members");
        family1.setText("Family 1");
        family1.setVisible(false);
        member11.setText("Member 11");
        family1.add(member11);
        member12.setText("Member 12");
        family1.add(member12);
        members.add(family1);
        family2.setText("Family 2");
        family2.setVisible(false);
        member21.setText("Member 21");
        family2.add(member21);
        member22.setText("Member 22");
        family2.add(member22);
        members.add(family2);
        members.setEnabled(false);
        menubar.add(members);
        setJMenuBar(menubar);
    private void familyStateChanged(ItemEvent evt) {
        JCheckBoxMenuItem family = (JCheckBoxMenuItem)evt.getSource();
        //find corresponding family members menu
        JMenu familyMembers = null;
        if( family.getText().equalsIgnoreCase("Family 1") ){
            familyMembers = family1;
        }else{
            familyMembers = family2;
        //set visiblility and selection
        boolean selection = family.isSelected();
        familyMembers.setVisible( selection );
        Component[] membersArray = familyMembers.getMenuComponents();
        for( int i=0; i<membersArray.length; i++ ){
            ((JCheckBoxMenuItem)membersArray).setSelected(selection);
//enable family members menu only if there is at least one family selected
members.setEnabled(false);
Component[] familiesArray = families.getMenuComponents();
for( int i=0; i<familiesArray.length; i++ ){
if( ((JCheckBoxMenuItem)familiesArray[i]).isSelected() ){
members.setEnabled(true);
break;
public static void main(String args[]) {
new Menu_Demo().setVisible(true);
private JMenuBar menubar;
private JMenu families, members, family1, family2;
private JCheckBoxMenuItem family1Select, family2Select, member11, member12, member21, member22;

Similar Messages

  • Display text fields from check box?

    Hi
    Is there a way to display hidden text fields in a form
    whenever the check
    box is clicked?
    For example I have an option which asks how may we be of
    service to you?
    One option is 'estimates on conveyancing' , once this is
    clicked I need to
    display further text fields (estate agent, name of property,
    price of
    property etc)
    Thanks for any help

    Nope.
    First, I had trouble figuring how to apply the Form Calc to the Button, as opposed to the Button List.
    I actually had to edit the first line in the Script Editor, which seems pretty lame.
    That is to say, I just don't see how to get to the radio button, not the Object named RadioButtonList
    BUT, I can't UNCHECK the field once it's been checked. That is, if I click "on" the Radio Button, it won't revert to unchecked if I try to click it "off".
    In other words, if the person unchecks the Radio button due to some error, I need it to click off and the TextFiled to go back to being hidden.
    Like I said, this can't be that hard, or maybe I'm just missing what you're trying to explain. Any other ideas?
    Steve

  • When saving a fill-in form that contains check boxes, the filled in check boxes do not show up on the new PDF. How do I fix this?

    Basically, I have a form that comes over from a vendors that is Pre filled. I may have to manually answer some of the check boxes. Either way, when I go to save the form to put in our system, the checkboxes on the newly save PDF are now blank. How do I stop this from happening

    I use windows 7 and I current have Adobe Reader XI 11.0.09. The document is transmitted from a vendor to our AWD system, when I open it, it opens in Adobe for viewing and corrections

  • Single or multiple check box values displayed in a text field

    My apologies, this may be a duplicate discussion.
    I'm using the following script to display the values of check boxes in a text field.  I would like the word "and" to separate the values if two check boxes are selected. If more than two boxes are selected I want the values to be separated by a comma and then the last value be separated by "and".  Example of two check boxes selected:  A and B.  Example of two or more: A, B, C, and D.  Can this be done?
    form1.page1.page1SF.programs::calculate - (JavaScript, client)
    //displays the values of check boxes named programCB
    var aChkBx = [];
    var vChecks = programCB.all;
    for (var a=0; a<vChecks.length;a++){
    if(!vChecks.item(a).isNull) {
    aChkBx.push(vChecks.item(a).rawValue);
    this.rawValue = aChkBx.join(", ");

    My apologies, this may be a duplicate discussion.
    I'm using the following script to display the values of check boxes in a text field.  I would like the word "and" to separate the values if two check boxes are selected. If more than two boxes are selected I want the values to be separated by a comma and then the last value be separated by "and".  Example of two check boxes selected:  A and B.  Example of two or more: A, B, C, and D.  Can this be done?
    form1.page1.page1SF.programs::calculate - (JavaScript, client)
    //displays the values of check boxes named programCB
    var aChkBx = [];
    var vChecks = programCB.all;
    for (var a=0; a<vChecks.length;a++){
    if(!vChecks.item(a).isNull) {
    aChkBx.push(vChecks.item(a).rawValue);
    this.rawValue = aChkBx.join(", ");

  • Single or multiple check box values displayed in a textbox

    Hi Experts!
    I'm using the following script to display the values of check boxes in a text field.  I would like the word "and" to separate the values if two check boxes are selected. If more than two boxes are selected I want the values to be separated by a comma and then the last value be separated by "and".  Example of two check boxes selected:  A and B.  Example of two or more: A, B, C, and D.  Can this be done?
    form1.page1.page1SF.programs::calculate - (JavaScript, client)
    //displays the values of check boxes named programCB
    var aChkBx = [];
    var vChecks = programCB.all;
    for (var a=0; a<vChecks.length;a++){
    if(!vChecks.item(a).isNull) {
    aChkBx.push(vChecks.item(a).rawValue);
    this.rawValue = aChkBx.join(", ");

    So, the way I see it, you actually have four scenarios. Nothing is checked, one item is checked, two items are checked, and three or more items are checked.
    Here's how I did it.
    I have four checkboxes all with the same name, cb. (You could have many more, and it wouldn't matter as long as they're all named the same thing.) I'm presuming that you will use the captions from the checkboxes as the text you want to enter. I called my text area where I enter the information tfSentence. (It's not a text field, it's just called "Text" in the Object Library.)
    //we need to count how many boxes are checked
    var checked = 0;
    for (i=0; i<=cb.length; i++){
      if (xfa.resolveNode("cb["+i+"]").rawValue == 1) checked ++;
    //create a string variable to store our sentence
    var str = "";
    //look at the checked variable and choose our case from that
    switch(checked){
      case 0:
        //you may want to do more than just type out a sentence here, like a message box
        tfSentence.rawValue = "Nothing was selected";
        break;
      case 1:
        //you can set text that will appear before your list of items here
        //str = "preliminary text";
        for (i=0; i<=cb.length; i++){
          if (xfa.resolveNode("cb["+i+"]").rawValue == 1) str += xfa.resolveNode("cb["+i+"].caption.value.#text").value;
        //you can set text to appear after your list of items here
        //str += "ending text";
        tfSentence.rawValue = str;
        break;
      case 2:
        //str = "preliminary text";
        for (i=0; i<=cb.length; i++){
          if (xfa.resolveNode("cb["+i+"]").rawValue == 1){
            if (checked == 1) str += " and " + xfa.resolveNode("cb["+i+"].caption.value.#text").value;
            else str += xfa.resolveNode("cb[+i+"].caption.value.#text").value;
            checked--;
        //str+= "ending text";
        tfSentence.rawValue = str;
        break;
      default:
        //str = "preliminary text";
        for (i=0; i<=cb.length; i++){
          if (xfa.resolveNode("cb["+i+"]").rawValue == 1){
            if (checked == 1) str += "and " + xfa.resolveNode("cb["+i+"].caption.value.#text").value;
            else str += xfa.resolveNode("cb["+i+"].caption.value.#text").value + ", ";
            checked--;
        //str += "ending text";
        tfSentence.rawValue = str;
        break

  • Basic example on Check-boxes using AS3.0 in flash

    Hi all,
    I need a basic example containing 3 or 5 check-boxes and
    should display the names of check-boxes which are
    selected in a text-box.
    Thanx a lot...

    Go to the help subject "CheckBox class" and click "view
    examples": The example is an exact answer to your question :-)

  • How to Create Check Box in Dynamic Table

    Hi Friends,
    I've Created one Dynamic Table there i want to display 2 columns as Check Box.
    How to Add this check box as column cell variant.
    Looping the columns. In this One method SET_TABLE_CELL_EDITOR is ter. But i'm getting how to use this method. Kindly help in this Issue.
    Regards,
    jack.

    Hi upendra
    There are slight changes in the sivas code.Where is the data coming into the table.If its from a Model Node then iterate each element of the source node get that value compare and set the corresponding value in the element of the node binded to table.
    Create a boolean attribute "select" in the table node and bind it to checked property of the check box.
    for(int i=0;i<wdContext.node<tablenode>()..size();i++)
    if(wdContext.node<tablenode>().get<tablenode>ElementAt(i).select())
    wdContext.node<tablenode>().get<tablenode>ElementAt(i).set<yourattribute>(true);
    else
    wdContext.node<tablenode>().get<tablenode>ElementAt(i).set<yourattribute>(false);
    See the attribute is boolean so pass true or false as a values in setter methods.
    Regards
    Kalyan

  • Check Box functionally lost when visiblity is turned off then back on

    Please pardon my attempt to ask a coherent question for I am new to Oracle Forms!
    I have created a canvas using the layout wizard against an Oracle table. I needed to provide the means to select mulitple records for DELETION; so, I created a check box item beside the database items to allow the ability to select records to delete. I also allow the user to query this table in query mode against a couple of columns to help isolate records to be deleted. So far, I have gotten the expected functionality from the check box on the initial query of this form.
    Now, heres my problem!
    When I try to reduce the query result while in "ENTER_QUERY" (F7) mode, I intentionally make my check box item invisible. The thought being "I should not allow users opportunity select records for deletion while in the process of querying the table to fetch the records you will be deleting from!" Once I press F8 to execute the my query, I issue the following statements in my KEY-EXEQRY trigger:
    set_item_property( 'EFIS_EMAIL_QUEUE.SELECTTODELETE', VISIBLE, PROPERTY_TRUE );
    set_item_property( 'EFIS_EMAIL_QUEUE.SELECTTODELETE', ENABLED, PROPERTY_TRUE );
    My results are displayed along with the check box to select records for deletion!
    At thsi point, the functionally of the check box no longer works!
    I get a forms error "(FRM-40200) Field is protected against update."
    I look in the Property Palette under the Physical section and the Visible attribute is set to "Yes"!
    Can someone tell me why turning the visible attribute "OFF*" and then back "*ON*" caused the lost functionity?*
    What must I do to get this functionally back without abandoning this design premise?+
    Is there some other attribute settings I must reset in addition to the two set_item_property issued above?+
    Thanks in advance!
    Les

    Add to your code following statement
    set_item_property( 'EFIS_EMAIL_QUEUE.SELECTTODELETE', UPDATE_ALLOWED, PROPERTY_TRUE );
    and hopefully that should take care of your problem.

  • Grid with check box.

    Hi,
    I want to make a grid with check box. I want to have two column in the grid. One column of the grid will show some column name of a table and the other column will contain check box. If I tick the check box of a the selected row of the grid then the value (e.g. Y or N) will store in the particulr table.
    I have written some code regardig this. But I am not getting my problem solved. I am sending the code sample below.
    oNewItem = oOrderForm.Items.Add("MyGrid", SAPbouiCOM.BoFormItemTypes.it_GRID)
            oNewItem.Left = 20
            oNewItem.Top = 30
            oNewItem.Width = 198
            oNewItem.Height = 130
    oGrid = oNewItem.Specific
    Dim str As String
            str = "SELECT COLUMN_NAME AS FACILITIES, '' AS TICK FROM PIONEER.INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'OITM' AND ORDINAL_POSITION BETWEEN 102 AND 165"
            oOrderForm.DataSources.DataTables.Add("MyDataTable")
            oOrderForm.DataSources.DataTables.Item(0).ExecuteQuery(str)
            oGrid.DataTable = oOrderForm.DataSources.DataTables.Item("MyDataTable")
            ' Set columns size
            oGrid.Columns.Item(0).Width = 270
            oGrid.Columns.Item(0).Editable = False
            oGrid.Columns.Item(1).Width = 70
            oGrid.Columns.Item(1).Type.gct_CheckBox.GetValues()
    From The last line I am getting problem. Please any one can help me for this problem.
    Thank you
    Amit Kumar Shai

    Hi
    The last line should read like this
    oGrid.Columns.Item(1).Type = SAPbouiCOM.BoGridColumnType.gct_CheckBox

  • Capturing check box value into internal table

    Hi all,
    I am displaying the output including check box through following internal table.
    The checkbox is displayed before every record.
      <b>LOOP AT it_qals.
        WRITE:/  it_qals-t_val  AS CHECKBOX,
               5 it_qals-werk,
              12 it_qals-prueflos,
              30 it_qals-matnr,
              50 it_qals-charg,
              62 it_qals-lagortchrg.
        hide: it_qals .
      ENDLOOP.</b>
    I selected some of the records through check the checkboxes. when i click the <b>PUSHBUTTON TRANSFER</b>, those selected records only should transfer. i don't know how to modify the internal table with latest checkbox values. Initially checkbox values are blank.
    Is there any solution except Function Module.
    i would appreciate an earlier reply.
    Regards
    Prabhu

    Hello,
    Create one more table and transfer your entries into new table.
    I have attached my code for you.
    Regards,
    Naimesh
    REPORT ZTEST_NP NO STANDARD PAGE HEADING.
    TABLES: MARA, MAKT.
    DATA: BEGIN OF IT_MARA OCCURS 0,
          MATNR LIKE MARA-MATNR,
          MAKTX LIKE MAKT-MAKTX,
          SEL,
          END   OF IT_MARA.
    DATA: IT_MARA1 LIKE IT_MARA OCCURS 0 WITH HEADER LINE.
    START-OF-SELECTION.
      SET PF-STATUS 'ZTEST'.
      PERFORM GET_DATA.
      PERFORM WRITE_DATA.
    TOP-OF-PAGE.
      PERFORM HEADER.
    AT USER-COMMAND.
      CASE SY-UCOMM.
      WHEN 'SELECT'.
        PERFORM GET_DATA_SELECTED.
        PERFORM WRITE_DATA_SELE.
      WHEN 'SELALL'.
        PERFORM SELECT_ALL.
        SY-LSIND = 0.
        PERFORM HEADER.
        PERFORM WRITE_DATA.
      WHEN 'DESEL'.
        PERFORM DESELECT_ALL.
        SY-LSIND = 0.
        PERFORM HEADER.
        PERFORM WRITE_DATA.
      ENDCASE.
    *&      Form  GET_DATA
    FORM GET_DATA.
      SELECT MATNR
             INTO TABLE IT_MARA
             FROM MARA
             WHERE MATNR LIKE 'IN10020%'.
      LOOP AT IT_MARA.
        SELECT SINGLE MAKTX
               INTO   IT_MARA-MAKTX
               FROM   MAKT
               WHERE  MATNR = IT_MARA-MATNR
               AND    SPRAS = SY-LANGU.
        MODIFY IT_MARA.
        CLEAR  IT_MARA.
      ENDLOOP.
    ENDFORM.                    " GET_DATA
    *&      Form  WRITE_DATA
    FORM WRITE_DATA.
      ULINE /(50).
      LOOP AT IT_MARA.
        WRITE: / '|' NO-GAP,   IT_MARA-SEL AS CHECKBOX NO-GAP,
                 '|' NO-GAP, (10) IT_MARA-MATNR NO-GAP,
                 '|' NO-GAP, (35) IT_MARA-MAKTX NO-GAP,
                 '|' NO-GAP.
      ENDLOOP.
      ULINE /(50).
    ENDFORM.                    " WRITE_DATA
    *&      Form  HEADER
    FORM HEADER.
      ULINE /(50).
      WRITE: / '|' NO-GAP, (1) ' ' NO-GAP,
               '|' NO-GAP, (10) 'Material'    NO-GAP,
               '|' NO-GAP, (35) 'Description' NO-GAP,
               '|' NO-GAP.
    ENDFORM.                    " HEADER
    *&      Form  GET_DATA_SELECTED
    FORM GET_DATA_SELECTED.
      DATA:  L_CNT TYPE I.
      DO.
        L_CNT = L_CNT + 1.
        READ LINE L_CNT FIELD VALUE IT_MARA-MATNR INTO IT_MARA1-MATNR
                                    IT_MARA-MAKTX INTO IT_MARA1-MAKTX
                                    IT_MARA-SEL   INTO IT_MARA1-SEL.
        IF SY-SUBRC = 0.
          IF IT_MARA1-SEL = 'X'.
            APPEND IT_MARA1.
            CLEAR  IT_MARA1.
          ENDIF.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.                    " GET_DATA_SELECTED
    *&      Form  WRITE_DATA_SELE
    FORM WRITE_DATA_SELE.
      PERFORM HEADER.
      ULINE /(50).
      LOOP AT IT_MARA1.
        WRITE: / '|' NO-GAP,   IT_MARA1-SEL AS CHECKBOX,
                 '|' NO-GAP, (10) IT_MARA1-MATNR NO-GAP,
                 '|' NO-GAP, (35) IT_MARA1-MAKTX NO-GAP,
                 '|' NO-GAP.
      ENDLOOP.
      ULINE /(50).
    ENDFORM.                    " WRITE_DATA_SELE
    *&      Form  SELECT_ALL
    FORM SELECT_ALL.
      LOOP AT IT_MARA.
        IT_MARA-SEL = 'X'.
        MODIFY IT_MARA.
        CLEAR  IT_MARA.
      ENDLOOP.
    ENDFORM.                    " SELECT_ALL
    *&      Form  DESELECT_ALL
    FORM DESELECT_ALL.
      LOOP AT IT_MARA.
        IT_MARA-SEL = ' '.
        MODIFY IT_MARA.
        CLEAR  IT_MARA.
      ENDLOOP.
    ENDFORM.                    " DESELECT_ALL

  • Check box in alv grid

    Hi Gurus,
    I developed one alv(grid) report. the grid having first three columns are with check boxes. Now my requirement  is if I tick or on tick those check boxes I need to track which records check boxes are modiried.
    But I canot tracking the  modified records . after ticking or unticking those check boxs values are not modified in intrnal table.
    plese help this is very urgent.
    Regards,
    Shashikumar.G

    Hi Kiran,
    I displayed internal table with check boxes that is ok.
    after displaying the internal table if i tick or un tick the records  those are not modified in internal table but I need to track the records which are modified.
    please give me repply urgently.
    Regards,
    Shashikumar.G

  • Zapf dingbat to check box

    I've exported from InDesign CS4 to Acrobat Pro 9 a file that's more or less a catalog, where you would check beside the item you want.
    In ID CS4, I used the "q" in zapf dingbats to get the empty-box-with-shadow character, hoping the form field recognition function in Acrobat would pick it up as a checkbox. But nooooooo.
    As there's probably 300 of those characters, I'm not interested in drawing a checkbox in Acrobat.
    What can I do?

    can't you while Forms menu select Check box the click on it or them  a choose properties and have it show the outlines?
    If you hold down the Command key you can select individual items but they will stay selected (as long as as you hold command key down -- Mac only)
    Once you have all saved then double click menu should pop up (or right click) choose Properties. should be able to show outlines of the boxes.

  • SE16N - Maintain entries check box

    Hi Gurus,
    I would like to know why the "Maintain entries" check box in SE16N is disabled. How to enable it permanantly?
    I know we can mark it by using &SAP_EDIT. But I would like to know how to enable it permanantly?
    Regards,
    Siva

    In the maintenance flag for the table is maintained as "Display/maintenance allowed" the check-box "Maintain Entries" will be checked.
    For the other 2 options this option will be disabled.

  • Missing check box data

    I imported a pdf form containing check box fields and distributed the form by email.  In responses, all the data is complete.  However, when I download a response as a pdf form, the check box fields are never checked.  Why?

    I’m sorry.  I just realized that the check box fields are ok when downloaded.  It’s an Acrobat 9 Pro issue. 
    FYI … After downloading the pdf form, I “Insert” a 2nd form to have the downloaded fields populate the 2nd form.  Upon inserting the 2nd form, all the fields in the 2nd form are populated as expected, except the check box fields, which then are all unchecked, even if they had been checked before the Insert.
    Any insight?

  • Check box with alv

    hi
    i am displaying  list alv with check boxes, now i want to select few check boxes and doing some operation, after this operation i need to disable thoese check box.
    can u pls guide me.
    thanks.

    Hi,
    using styles it is possible.
    first you need to declare the one extra field in the internal table..
    1. HANDLE_STYLE TYPE LVC_T_STYL.
    DECLARE work area,and table
    2.  DATA: LS_EDIT TYPE LVC_S_STYL,
            LT_EDIT TYPE LVC_T_STYL.
    changing the style...
    3.
    LOOP AT IT_FINAL INTO LS_OUTTAB WHERE FLAG = 'X'.
        V_INDEX = SY-TABIX.
        LS_EDIT-FIELDNAME = 'MATNR'.
        LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED.
        LS_EDIT-STYLE2 = SPACE.
        LS_EDIT-STYLE3 = SPACE.
        LS_EDIT-STYLE4 = SPACE.
        LS_EDIT-MAXLEN = 8.
        INSERT LS_EDIT INTO TABLE LT_EDIT.
        LS_EDIT-FIELDNAME = 'VBELN'.
        LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENAABLED.
        LS_EDIT-STYLE2 = SPACE.
        LS_EDIT-STYLE3 = SPACE.
        LS_EDIT-STYLE4 = SPACE.
        LS_EDIT-MAXLEN = 8.
        INSERT LS_EDIT INTO TABLE LT_EDIT.
        LS_EDIT-FIELDNAME = 'POSNR'.
        LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED.
        LS_EDIT-STYLE2 = SPACE.
        LS_EDIT-STYLE3 = SPACE.
        LS_EDIT-STYLE4 = SPACE.
        LS_EDIT-MAXLEN = 8.
        INSERT LS_EDIT INTO TABLE LT_EDIT.
        INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
        MODIFY IT_FINAL INDEX V_INDEX FROM LS_OUTTAB  TRANSPORTING
                                          HANDLE_STYLE .
      ENDLOOP.
    assigning the style to Layout..
    4.   GS_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
    REUSE_ALV_GRID_DISPLAY_LVC. you can do the same with CL_GUI_ALV_GRID also.
    REPORT ZTESTALV.
    TYPE-POOLS: SLIS.
    *- Fieldcatalog
    DATA: IT_FIELDCAT  TYPE LVC_T_FCAT,
          IT_FIELDCAT1  TYPE SLIS_T_FIELDCAT_ALV..
    *- For Events
    DATA:IT_EVENTS TYPE SLIS_T_EVENT.
    DATA:  X_FIELDCAT  TYPE LVC_S_FCAT,
            X_FIELDCAT1  TYPE SLIS_FIELDCAT_ALV.
    DATA:X_LAYOUT TYPE LVC_S_LAYO.
    "{ FOR DISABLE
    DATA: LS_EDIT TYPE LVC_S_STYL,
          LT_EDIT TYPE LVC_T_STYL.
    "} FOR DISABLE
    DATA: BEGIN OF IT_VBAP OCCURS 0,
          VBELN LIKE VBAP-VBELN,
          POSNR LIKE VBAP-POSNR,
          HANDLE_STYLE TYPE LVC_T_STYL, "FOR DISABLE
          BUTTON(10),
         END OF IT_VBAP.
    DATA: LS_OUTTAB LIKE LINE OF IT_VBAP.
    SELECT VBELN
           POSNR
           UP TO 10 ROWS
          INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
          FROM VBAP.
    DATA:L_POS TYPE I VALUE 1.
    CLEAR: L_POS.
    L_POS = L_POS + 1.
    X_FIELDCAT-SELTEXT = 'VBELN'.
    X_FIELDCAT-FIELDNAME = 'VBELN'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    *X_FIELDCAT-EDIT = 'X'.
    X_FIELDCAT-OUTPUTLEN = '10'.
    x_fieldcat-ref_field = 'VBELN'.
    x_fieldcat-ref_table = 'VBAK'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_POS = L_POS + 1.
    X_FIELDCAT-SELTEXT = 'POSNR'.
    X_FIELDCAT-FIELDNAME = 'POSNR'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    *X_FIELDCAT-EDIT = 'X'.
    X_FIELDCAT-OUTPUTLEN = '5'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_POS = L_POS + 1.
    "{FOR DISABLE HERE 6ROW IS DISABLED
    SY-TABIX = 6.
    LS_EDIT-FIELDNAME = 'VBELN'.
    LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
    LS_EDIT-STYLE2 = SPACE.
    LS_EDIT-STYLE3 = SPACE.
    LS_EDIT-STYLE4 = SPACE.
    LS_EDIT-MAXLEN = 10.
    INSERT LS_EDIT INTO TABLE LT_EDIT.
    LS_EDIT-FIELDNAME = 'POSNR'.
    LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
    LS_EDIT-STYLE2 = SPACE.
    LS_EDIT-STYLE3 = SPACE.
    LS_EDIT-STYLE4 = SPACE.
    LS_EDIT-MAXLEN = 6.
    INSERT LS_EDIT INTO TABLE LT_EDIT.
    INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
    MODIFY IT_VBAP INDEX SY-TABIX FROM LS_OUTTAB  TRANSPORTING
                                      HANDLE_STYLE .
    X_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
    "} UP TO HERE
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
      EXPORTING
        I_CALLBACK_PROGRAM = SY-REPID
        IS_LAYOUT_LVC      = X_LAYOUT
        IT_FIELDCAT_LVC    = IT_FIELDCAT
      TABLES
        T_OUTTAB           = IT_VBAP[]
      EXCEPTIONS
        PROGRAM_ERROR      = 1
        OTHERS             = 2.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    The above code i am modifying the 6 record . you can place your condition.using loop and endloop. you can disable many records/check box also.
    Follow the next steps:
    1. Add the following fields in the internal table:
    checkbox TYPE c,
    celltab TYPE lvc_t_styl,
    2. Define a table and a work-area:
    DATA: wa_celltab TYPE lvc_s_styl,
    ta_celltab TYPE lvc_t_styl.
    3. Update the internal table BEFORE display :
    LOOP AT ta_data INTO wa_data.
    h_tabix = sy-tabix.
    Update field CHECKBOX (enable/disable INPUT)
    REFRESH ta_celltab.
    wa_celltab-fieldname = 'CHECKBOX'.
    IF NOT wa_data-xxxxx IS INITIAL.
    wa_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
    ELSE.
    wa_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
    ENDIF.
    INSERT wa_celltab INTO TABLE ta_celltab.
    INSERT LINES OF ta_celltab INTO TABLE wa_data-celltab.
    Update internal table
    MODIFY ta_data FROM wa_data INDEX h_tabix.
    ENDLOOP.
    4. Define CHECKBOX in fieldcatalog
    CLEAR wa_catalog.
    wa_catalog-fieldname = 'CHECKBOX'.
    wa_catalog-col_pos = 9.
    wa_catalog-coltext = 'Checkbox'.
    wa_catalog-checkbox = 'X'.
    wa_catalog-edit = 'X'.
    APPEND wa_catalog TO ta_catalog.
    5. Call ALV
    CREATE OBJECT h_custom_container
    EXPORTING container_name = h_container.
    CREATE OBJECT h_grid
    EXPORTING i_parent = h_custom_container.
    CALL METHOD h_grid->set_table_for_first_display
    EXPORTING
    it_toolbar_excluding = wa_toolbar
    is_layout = wa_layout
    CHANGING
    it_outtab = ta_kntkn
    it_fieldcatalog = ta_catalog
    it_sort = ta_sort.
    CALL METHOD h_grid->set_ready_for_input
    EXPORTING i_ready_for_input = 1.
    Regards
    vasu

Maybe you are looking for

  • Old exchange server 2007 accounts conflicting with Office365 accounts after migration to the cloud

    Good day, We migrated over a month ago from Exchange 2007 to office 365 We have to offices in two different continents, under one single domain. Office in central America, has it's own IMAP web service hosted on 42inc (jondoe@ cenamer .com), Office i

  • Buffer Table not up to date error while accessing Catalogs

    Hello, I am getting Buffer table not up-to-date error while accessing ARIBA Procurement Catalogs. Initially, my Test system was pointing to Production Catalogs but now, when I changed the settings in "Define External Web Services" and pointed it to D

  • Accessing WSDL gives problem..........

    Hi all, I'm using NWDS SP12. I'm trying to create deployable proxy out of one WSDL file, which is residing in the server that needs authentication to access that. So, when I give URL to that particular WSDL when generating proxy, I'm not able to do s

  • How can i sync apple tv with my ipad

    how can i sync apple tv with my ipad? Thanks

  • CS4 audio sync problems

    Hi all, sorry if this question is old hat - I've searched the forums and can't seem to get a clear answer (most refer to CS3 and before) so thought I'd ask anew. My preview in Premiere CS4 is fine, as is the preview in Encore CS4. The video was captu