How to Enable and Disable column in Table Control.

Hi all,
I want to make certain column of Table control as Enable or Disable on Button action.
Enable means ready for input and Disable means not ready for input.
Please send me sample code.
Thanks in advance.

Hi Vipin,
    You have to loop through the table columns to set the properties in the PBO of your screen.
Here is the sample solution.
delcare a workarea for the columns in the table control in your top include.
Table Control .
CONTROLS: TAB1 TYPE TABLEVIEW USING SCREEN '0100'.
DATA: WA_COLS LIKE LINE OF TAB1-COLS.
in your screen
PROCESS BEFORE OUTPUT.
  MODULE INTIALISE_100.
*&      Module  0100_INTIALISE  OUTPUT
MODULE INTIALISE_100 OUTPUT.
    LOOP AT TAB1-COLS INTO WA_COLS.
      WA_COLS-SCREEN-INPUT = 1.
      MODIFY TAB1-COLS FROM WA_COLS TRANSPORTING SCREEN-INPUT.
    ENDLOOP.
ENDMODULE.                 " 0100_INTIALISE  OUTPUT
modify the screen-input property as required for the table control columns.
Please provide points if helpfull.....
Thanks,
Karthik
Message was edited by: Karthik
        Karthikeyan K

Similar Messages

  • Disable columns in table control based on condition

    Hello Gurus,
         I am having a table control in my module pool program.Out of 25 columns , I am having 12 columns on months wise like (jan, feb, march....).Now my concern is based on current month I want to enable the column of month rest all months will be in disable mode.So that the user can enter his/her time of work.Could you please tell me any way.I tired to read tc-cols and stored in col with index but its not working I wrote this code for first month without any condition
    READ TABLE tC-COLS INTO col INDEX 22.
       col-SCREEN-INPUT = 0.
       MODIFY tC-COLS FROM col INDEX 22.
    but its not working.I wrote this code in PBO as well as i tried in PAI as wellstill my columns is in enable mode.Also when user clicks on button then only the table control required fields should start working like months enable/disable process.for eg. I am having 2 button one is Create and other is Search on both these buttons after click the condition for enable/disable months should work.
    Thanks
    Gaurav

    Hi,
    In my scenario, I have used months as radio buttons. A month is selected and "enable" button must be clicked so that only the corresponding column of the month turns into an editable mode.
    I have attached the output.
    The field can be disabled or enabled by using the line type of <table_control_name>-cols.
    It contains the screen elements. For disabling / enabling, use active element in screen.
    This must be written in PBO event of the corresponding screen containing the table control.
    Coding:
    * Type-Pools
    TYPE-POOLS: abap.
    *   Types
    TYPES: BEGIN OF ty_month_emp,
             jan   TYPE char30,
             feb   TYPE char30,
             mar   TYPE char30,
             apr   TYPE char30,
             may   TYPE char30,
             jun   TYPE char30,
             jul   TYPE char30,
             aug   TYPE char30,
             sep   TYPE char30,
             oct   TYPE char30,
             nov   TYPE char30,
             dec   TYPE char30,
             id    TYPE char10,
             name  TYPE char10,
             age   TYPE char10,
            END OF ty_month_emp,
            ty_t_month_emp TYPE STANDARD TABLE OF ty_month_emp.
    *   Data
    DATA: gs_month_emp  TYPE ty_month_emp,
           gt_month_emp  TYPE ty_t_month_emp,
           ok_code       TYPE sy-ucomm,
           r1            TYPE char1 VALUE abap_true,
           r2            TYPE char1,
           r3            TYPE char1,
           r4            TYPE char1,
           r5            TYPE char1,
           r6            TYPE char1,
           r7            TYPE char1,
           r8            TYPE char1,
           r9            TYPE char1,
           r10           TYPE char1,
           r11           TYPE char1,
           r12           TYPE char1.
    *   Table Controls
    CONTROLS: tc TYPE TABLEVIEW USING SCREEN 9000.
    *   Field-Symbols
    FIELD-SYMBOLS: <fs_cols> LIKE LINE OF tc-cols.
    *   Initialization
    INITIALIZATION.
       CALL SCREEN 9000.
    *&      Module  ENABLE_COLUMN  OUTPUT
    *       text
    MODULE enable_column OUTPUT.
       LOOP AT tc-cols ASSIGNING <fs_cols>.
         PERFORM enable_col USING: r1 'GS_MONTH_EMP-JAN' CHANGING <fs_cols>,
                                   r2 'GS_MONTH_EMP-FEB' CHANGING <fs_cols>,
                                   r3 'GS_MONTH_EMP-MAR' CHANGING <fs_cols>,
                                   r4 'GS_MONTH_EMP-APR' CHANGING <fs_cols>,
                                   r5 'GS_MONTH_EMP-MAY' CHANGING <fs_cols>,
                                   r6 'GS_MONTH_EMP-JUN' CHANGING <fs_cols>,
                                   r7 'GS_MONTH_EMP-JUL' CHANGING <fs_cols>,
                                   r8 'GS_MONTH_EMP-AUG' CHANGING <fs_cols>,
                                   r9 'GS_MONTH_EMP-SEP' CHANGING <fs_cols>,
                                  r10 'GS_MONTH_EMP-OCT' CHANGING <fs_cols>,
                                  r11 'GS_MONTH_EMP-NOV' CHANGING <fs_cols>,
                                  r12 'GS_MONTH_EMP-DEC' CHANGING <fs_cols>.
       ENDLOOP.
    *  LOOP AT tc-cols INTO ls_cols.
    *    IF r1 = 'X'.
    *      ls_cols-screen-active = 1.
    *    else.
    *      ls_cols-screen-active = 0.
    *    ENDIF.
    *    modify tc-cols FROM ls_cols INDEX sy-tabix.
    *  ENDLOOP.
    ENDMODULE.                 " ENABLE_COLUMN  OUTPUT
    *&      Form  ENABLE_COL
    *       text
    *      -->P_0170   text
    *      -->P_0171   text
    *      <--P_<FS_COLS>  text
    FORM enable_col  USING    p_radio              TYPE c
                               value(p_screen_name) LIKE screen-name
                      CHANGING pa_cols              LIKE LINE OF tc-cols.
       IF p_radio = abap_true.
         IF pa_cols-screen-name = p_screen_name.
           pa_cols-screen-active = 1.
         ELSE.
           pa_cols-screen-active = 0.
         ENDIF.
       ENDIF.
    ENDFORM.                    " ENABLE_COL
    Thanks & Regards,
    T. Prasanna Kumar

  • On basis of drop down by key values i want to enable and disable ui elements is wda

    How to enable and disable ui elements on basis of drop down by key values as i show in screen shot i have 3 values in drop down by key on basis of those values i need to enable and disable ui elements in webdynpro abap kindly reply back

    Hi Sreedhara,
    There are many tutorials on SCN for learning Web Dynpro ABAP. If the following steps don't make sense to you, please do a search for some tutorials and read through the tutorial materials. Hopefully the tutorials will help you to become familiar with some of the basics of Web Dynpro ABAP.
    Here is how to enable or disable a UI element upon selection from a DropDownByKey.
    In your view context, create a context attribute of type wdy_boolean. For now, let's call this attribute IS_ENABLED
    In your view layout, bind the enabled property of the UI element to the context attribute IS_ENABLED.
    In your view actions, create an action-- let's call it SET_ENABLED-- and bind this action to the DropDownByKey element's onSelect event in the view layout.
    In the event handler method for the SET_ENABLED action, use the Code Wizard to read the value of the DropDownByKey selected value, then use the Code Wizard again to set the value of context attribute IS_ENABLED to either true or false.
    Now when a value is selected from the DropDownByKey, the SET_ENABLED action will be triggered and the IS_ENABLED context attribute will be set to either true or false. Since your UI element's enabled property is bound to this true or false value via the context binding, the UI element will change to enabled or disabled.
    Good luck!
    Cheers,
    Amy

  • Not null and enable or disable  column in tabular form

    Hi,
    Using apex version 4.1 and working on tabular form.
    ACT_COA_SEGMENT_MAS is Master table
    and
    ACT_SEGMENT_VALUES_MAS is detail table
    I have entered 8 rows in master table and PARENT_SEGMENT_ID is column in master table which is null able. If i specified PARENT_SEGMENT_ID with value in master table then in detail table there is column PARENT_ID that should not be null and enable.
    How i can enable or disable column when in master table PARENT_SEGMENT_ID column is null then in detail table PARENT_ID column should disable and vice versa.
    I have created tabular form on Detail table. before insert into the tabular form Check in master table in first entry if PARENT_SEGMENT_ID is not null in first row of master table then in tabular form PARENT_ID should enable and not null able in corresponding to this first row id's lines in tabular form.
    Same should check for second row in master table if PARENT_SEGMENT_ID is not null then entered rows with PARENT_ID into tabular form corresponding to 2nd id in master table should not nullable and column should enable in tabular form.
    Thanks & Regards
    Vedant
    Edited by: Vedant on Jan 9, 2013 9:12 PM

    Vedant,
    You need to create you own manual tabular form and not use the wizard.
    Using APEX_ITEM api you should be build you own form and you will be able to control how you wan to display the rows. (See Link [Apex Item Help|http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_item.htm#CACEEEJE] )
    select case when PRIMARY_TABLE_COLUMN is null then APEX_ITEM.DISPLAY_AND_SAVE(3 , DETAIL_COLUMN ) else APEX_ITEM.TEXT(2,detail_column) end "ALIAS" from detail table
    Hope that help.
    Vivek

  • How to distinguish between enabled and disabled tasks in SSDT-BI 2012

    Hi,
    I've got SSDT-BI 2012 together with VS2012 installed. Simple questions: What is the difference between enabled and disabled tasks in control flow from the design/color point of view? I do see that the disabled tasks changes to grey (omg are you really kidding
    me????) from black. This could be a bad joke or dream however is not.
    So I'm kindly asking you to help me solve this problem. How can I change the color difference between these two options (enabled task vs disabled task)? I do not care whether the one will be yellow or pink, simply just need to be recognizable at first
    look and not under long and painful examination.
    Thanks for your reply. Hopefully it will be useful.
    Karol.

    Hi Karol,
    It’s true that it only changes the font color of the task name text to grey after disabling a task in SSDT 2012. In SSDT 2010, the whole task control including icon will turn grey after it is disabled; in BIDS, the background color of the task control will
    turn grey after it is disabled. These behaviors are by design. Personally, I agree with you that this behavior in SSDT 2012 is not very readable.
    If you have concerns, I would suggest you submitting a wish at
    https://connect.microsoft.com/sql.
    Connect site is a connection point between you and Microsoft, and ultimately the larger community. Your feedback enables Microsoft to make software and services the best that they can be, and you can learn about and contribute to exciting projects.
    Regards,
    Mike Yin
    If you have any feedback on our support, please click
    here
    Mike Yin
    TechNet Community Support

  • How I can delete add-in in windows 8.1 ,I see only enable and disable function but I don't see any add-in delete function

    hi,
    how I can delete  add-in applications in add-in applications section ,  I try to delete one but I don't see any delete function, I see only enable and disable function in the manage add-in applications wizard.
    thanks
    johan
    h.david

    Hi,
    If you want to remove the add-ins of Office 2010 programs, you need to remove it from control panel.
    For example, if you use Excel, please try to follow the link to delete the add-ins:
    http://office.microsoft.com/en-us/excel-help/add-or-remove-add-ins-HP010342658.aspx
    If I misunderstand something, please let me know.
    Regards,
    George Zhao
    TechNet Community Support

  • Table control enable and disable rows

    Hi,
    I want to keep the table control in disabled mode initially.
    When user press the add button,the row next to where data is already present should alone be enabled for data entry.
    In PBO event i was able to disable the entire table control.but when i could not find a way to identify the first blank line to enable it for data entry.
    Please help.
    Thanks
    Ambily

    Hi Ambily,
    follow the below steps
    declare a data : w_flag  type c. in the global
    and next write the code the PBO
    PROCESS BEFORE OUTPUT.
    * Module screen GUI-Screen&Status and Screen Logic
      MODULE status_<Screennum>.
    * Table control for OUTPUT
      LOOP AT <table-control> .
        MODULE Modify_screen.
      ENDLOOP.
    Module modify_screen output.
    * Table control reading values from input screen & displaying on screen
      READ TABLE <table>   INDEX <tablecontrol>-current_line.
    If w_flag is initial.
        LOOP AT SCREEN.
          IF screen-name = <Tablecontrol Line>.
            screen-input = 0.
          ENDIF.
          MODIFY SCREEN.
        ENDLOOP.
      ENDIF.
    wndif.
    Endmodule.
    "next in PAI mark the w_flag to 'X'
    Prabhudas

  • Disable sorting and resizing columns on table view

    Is there a way to disable sorting and resizing columns on table view?
    Thanks

    Use
    setSortable(false)
    setResizable(false)
    on each TableColumn

  • Disable some columns in table control?

    Hi
    How to disable some columns in table control.
    For Ex: Table contains 8 columns.
    In first row i want to disable first 4 columns.
    in second row i want to disable last 4 columns.
    In third row i want to disable first 2 and last 2 columns.  How can we achieve this?
    Cheers,
    Venkys.

    HI
    Create three attribute in the node which is bound to the table as data source.
    say pro1, pro2, and pro3 of type wdy_boolean.
    now bind the enabled property of first four column editors to pro1, last 4 to pro2, and pro3 to first 2 and last 2.
    then go to the eventhandler of the dropdown 's on select event and write the code to update the values of these attribute
    according to the selected value.
    here is the sample code.
    DATA lo_nd TYPE REF TO if_wd_context_node.
        DATA lo_el TYPE REF TO if_wd_context_element.
            DATA lv_VAL LIKE ls_dealer1-name.
        lo_nd = wd_context->get_child_node( name = 'DEALER1').
      lo_el = lo_nd->get_element(  ).
        lo_el->get_attribute(
          EXPORTING
            name =  `NAME`
          IMPORTING
            value = lv_VAL ).
         DATA PR1 TYPE WDY_BOOLEAN.
         DATA PR2 TYPE WDY_BOOLEAN.
         DATA PR3 TYPE WDY_BOOLEAN.
      PR1 = ABAP_TRUE.
    PR2 = ABAP_TRUE.
    PR3 = ABAP_TRUE.
    IF LV_VAL EQ 'A'.
    PR1 = ABAP_FALSE.
    PR2 = ABAP_TRUE.
    PR3 = ABAP_TRUE.
       ELSEIF LV_VAL EQ 'B'.
    PR1 = ABAP_TRUE.
    PR2 = ABAP_FALSE.
    PR3 = ABAP_TRUE.
    ELSEIF LV_VAL EQ 'C'.
      PR1 = ABAP_TRUE.
    PR2 = ABAP_TRUE.
    PR3 = ABAP_FALSE.
      ENDIF.
       LO_EL->SET_ATTRIBUTE(
       NAME = 'PRO1'
       VALUE = PR1
       LO_EL->SET_ATTRIBUTE(
       NAME = 'PRO2'
       VALUE = PR2
       LO_EL->SET_ATTRIBUTE(
       NAME = 'PRO3'
       VALUE = PR3
    thanks
    sarbjeet singh

  • Selection screen dynamic enable and disable

    HI all,
    I have one requirement like
    on selection of redio button my selection screen hould be enable and disable
    Like if i select rediobutton  tfile then my selection screen block B2 should enable and Block B3 hould be disable
    If redio button selscr is selected then my block B3 should be enable and Block B2 should disable
    my selection screen code is below
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-005.
    PARAMETERS: tfile  RADIOBUTTON GROUP g1 DEFAULT 'X'.
    PARAMETERS: selscr RADIOBUTTON GROUP g1.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_matnr FOR marc-matnr,
                                 s_fkdat FOR vbrk-fkdat OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-002.
    PARAMETERS : filename TYPE rlgrap-filename.
    SELECTION-SCREEN END OF BLOCK b3.
    How to do that.
    Help me here its urgent tnx in advance.

    Hi Lalit,
    Check the below code.
    TABLES: marc, vbrk.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-005.
    PARAMETERS: tfile RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND rusr.
    PARAMETERS: selscr RADIOBUTTON GROUP g1.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_matnr FOR marc-matnr  MODIF ID abc,
                     s_fkdat FOR vbrk-fkdat  MODIF ID abc.
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-002.
    PARAMETERS : filename TYPE rlgrap-filename MODIF ID def.
    SELECTION-SCREEN END OF BLOCK b3.
    AT SELECTION-SCREEN OUTPUT.
    *Note: To disable the fields use the below one.
      LOOP AT SCREEN.
        IF screen-group1 = 'DEF'. "Name field
          IF selscr = 'X'.
            screen-input = 1.
          ELSE.
            screen-input = 0.
          ENDIF.
          MODIFY SCREEN.
        ENDIF.
         IF screen-group1 = 'ABC'. "Name field
          IF selscr = 'X'.
            screen-input = 0.
          ELSE.
            screen-input = 1.
          ENDIF.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    *Note: To hide the screen use the below one.
    LOOP AT SCREEN.
       IF screen-group1 = 'DEF'. "Name field
         IF selscr = 'X'.
           screen-active = 1.
         ELSE.
          screen-active = 0.
         ENDIF.
         MODIFY SCREEN.
      ENDIF.
       IF screen-group1 = 'ABC'. "Name field
         IF  tfile = 'X'.
           screen-active = 1.
         ELSE.
          screen-active = 0.
        ENDIF.
         MODIFY SCREEN.
      ENDIF.
    ENDLOOP.

  • EBS-UM Enable and Disable

    Hi all,
    We have enable and disable tasks in EBS-UM.Can anyone say me how to check the enable and disable user in target?
    I wanted to know fnd_user is the table where we can check in target??

    Hi Skud,
    Indeed Jeff's answer is correct and handles the problem. I would like to mention another way,
    Edit the desired button >> Navigate to Conditions >> Pick ( Exists SQL query returns at least one row) >> In Expression 1 box, type code similar to this :
    select UPPER (:app_user) from dual where UPPER(:app_user) in ( 'FATEH', 'MARY')Best Wishes,
    Fateh

  • Enable/disable rows of Table control

    Hi,
    I am showing n number of records in a table control. These number of records may wary depending on a X condition.
    I have also created a button with which user can create a new record from the same tabkle control and t/f back that new value in the itab.
    Now, when table control is displayed it WILL have certain records in it. I want those records to be in the INPUT = '0' state and rest of the table control lines should  be INPUT = '1'.
    I am trying....
    PROCESS BEFORE OUTPUT.
      MODULE status_0101.
      LOOP AT ts_store WITH CONTROL tabc CURSOR tabc-current_line.
      module change_scr_attr.
      ENDLOOP.
    module change_scr_attr output.
      CASE ok_code.
        WHEN 'DISP'.
       Displays all the records in INPUT = '0' state.
          LOOP AT tabc-cols INTO cols WHERE index GT 0.
            cols-screen-input = '0'.
            MODIFY tabc-cols FROM cols INDEX sy-tabix.
          ENDLOOP.
        WHEN 'CREA'.
         if  *     * disable the CDC Column
        * disable Delete shortcut.
         REFRESH ts_store.
         LOOP AT tabc-cols INTO cols WHERE index GT 0.
             IF  ts_store-zstcdc_store IS INITIAL.
             cols-screen-input = '1'.
           ELSE.
             cols-screen-input = '0'.
           ENDIF.
           screen-active = '1'.
           MODIFY tabc-cols FROM cols INDEX sy-tabix.
         ENDLOOP.
         LOOP AT tabc-cols INTO cols WHERE index GT 0.
           IF  cols-screen-input = '0'.
             cols-screen-input = '1'.
           ELSEIF  cols-screen-input = '1'.
             cols-screen-input = '0'.
           ENDIF.
           MODIFY tabc-cols FROM cols INDEX sy-tabix.
         ENDLOOP.
         LOOP AT SCREEN.
           IF ts_store-zstcdc_store IS INITIAL.
             screen-input = '1'.
           ELSE.
             screen-input = '0'.
           ENDIF.
           MODIFY SCREEN.
         ENDLOOP.
      ENDCASE.
    endmodule.                 " change_scr_attr  OUTPUT
    I have waded thru few threads but I dont get it.
    Plz suggest!!
    ~Sid
    "Max points are assured"

    Hi....
       Actually.... our table control.. is by defalut make disable the empty rows... which are not having data...
    because... the process of dispaly table control like this...
    1.Fetching the records from database into one itab...
    2.Capturing the itab lines with following sytax...in the PBO module..
       > MODULE <TC>_CHANGE_TC_ATTR OUTPUT.
       > DESCRIBE TABLE ITAB LINES <TC>-lines.
       > ENDMODULE.  
    with this you are sizing the table control as for itab size...
    3. Filling or Attaching the itab with Table control...
    > LOOP AT   ITAB
    >      WITH CONTROL TC
    >      CURSOR TC-CURRENT_LINE.
    >   MODULE TC_GET_LINES.
    >  ENDLOOP.
    So in above module we can fill data and can disable and enable rows of certain condition...
    So the condition aplleid rows should be disable and remaining enable.. and important thing is empty rows should be defaultly disabled mode...
    But.. Here you want to appear empty rows should be in enable mode...
    For that in second step.... modify the code like this....
       > MODULE <TC>_CHANGE_TC_ATTR OUTPUT.
       > DESCRIBE TABLE ITAB LINES <TC>-lines.
       >  <TC>-lines = <TC>-lines + 4.
       > ENDMODULE.  
    So with this you can get 4 empty and enable lines...
    and if u are not having 2nd step in ur coding..  just write it now.. it will solve ur problem...
    Pleae get back to me if you want any further clarification...
    Thanks,
    Naveen.I
    Edited by: Naveen Inuganti on Jun 30, 2008 5:03 PM
    Edited by: Naveen Inuganti on Jun 30, 2008 5:50 PM

  • Reg:How to delete the column in table control also from database table.

    Hi Experts,
    Once again thank u all for giving the responses.
    one more doubt is how to delete the columns of table control and also the record shold delete from ztable.
    With Regards,
    Saroja.P.

    Hi,
    If you want to delete the rows in the table control and simultaneously delete it from the database table, then you can implement a 'DELETE' functionality specific to your table control. Have a MARK field (you will find that in the screen attributes of the table control -> give a name for the MARK field, you will find an additional MARK column at the beginning of your table control). You can check whatever rows you want to delete from the table control, call the delete module.
    "This portion of code inside the LOOP...ENDLOOP.
    IF sy-ucomm eq 'F_DELETE'.
       gt_itab2-check = mark.  " Store the MARK field status into your internal table's correspoding field 'check'
      MODIFY gt_itab INDEX tabcontrol-current_line.
    ENDIF.
    iF sy-ucomm eq 'DELETE1'.
      DELETE gt_itab WHERE check eq 'X'. "Your internal table does not have rows that you want to delete
    ENDIF.
    Now you can modify your database table using the MODIFY statement.
    MODIFY ZDB FROM TABLE gt_itab.

  • Validating enabled and disabled menu bar in JInternalFrame

    hi,
    everybody.
    i have created a main window using JInternalFrame and JDesktopPane. The window has a menu bar in which document menu is used for closing the main window, while employee menu is used for adding new frame for the employee. while the login frame is displayed when the application is executed.
    my problem is, i want to validate that before login process, employee menu should be disabled, and after login is performed employee menu is enabled.
    the following is my code.
    please reply me as i am stucked with it.
    waiting for the reply
    thanks in advance.
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.io.*;
    import java.util.*;
    public class InternalFrameDemo extends JFrame implements ActionListener
    JDesktopPane desktop;
    public InternalFrameDemo()
    super("InternalFrameDemo");
    int inset = 50;
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setBounds(inset, inset, screenSize.width - inset*2, screenSize.height - inset*2);
    desktop = new JDesktopPane();
    setContentPane(desktop);
    desktop.setBackground(Color.white);
    setJMenuBar(createMenuBar());
    desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
    createLogin();
    public JMenuBar createMenuBar()
    JMenuBar menuBar = new JMenuBar();
    JMenu menu = new JMenu("Document");
    menu.setMnemonic(KeyEvent.VK_D);
    menuBar.add(menu);
    JMenuItem menuItem = new JMenuItem("Quit");
    menuItem.setMnemonic(KeyEvent.VK_Q);
    menuItem.setAccelerator(KeyStroke.getKeyStroke( KeyEvent.VK_Q, ActionEvent.ALT_MASK));
    menuItem.setActionCommand("quit");
    menuItem.addActionListener(this);
    menu.add(menuItem);
    JMenu employee = new JMenu("Employee");
    employee.setMnemonic(KeyEvent.VK_E);
    employee.setActionCommand("employee");
    menuBar.add(employee);
    JMenuItem additem = new JMenuItem("Add");
    additem.setMnemonic(KeyEvent.VK_A);
    additem.setActionCommand("add");
    additem.addActionListener(this);
    employee.add(additem);
    return menuBar;
    public void actionPerformed(ActionEvent ae)
    String str = ae.getActionCommand();
    if(str.equals("add"))
    System.out.println("Employee Form Invoked");
    createEmployee();
    else if(str.equals("quit"))
    quit();
    public void createEmployee()
    MyEmployeeFrame employeeframe = new MyEmployeeFrame();
    employeeframe.setVisible(true);
    desktop.add(employeeframe);
    try
    employeeframe.setSelected(true);
    catch(Exception e)
    public void createLogin()
    MyLogin loginframe = new MyLogin();
    loginframe.setVisible(true);
    desktop.add(loginframe);
    try
    loginframe.setSelected(true);
    catch(Exception e){}
    public void quit()
    System.exit(0);
    private static void createAndShowGUI()
    JFrame.setDefaultLookAndFeelDecorated(true);
    InternalFrameDemo frame = new InternalFrameDemo();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(800,600);
    frame.setVisible(true);
    public static void main(String a[])
    createAndShowGUI();
    class MyEmployeeFrame extends JInternalFrame implements ActionListener
    JFrame employeeframe;
    JLabel labelfirstname;
    JLabel labellastname;
    JLabel labelage;
    JLabel labeladdress;
    JLabel labelcity;
    JLabel labelstate;
    JTextField textfirstname;
    JTextField textlastname;
    JTextField textage;
    JTextField textaddress;
    JTextField textcity;
    JTextField textstate;
    JButton buttonsave;
    FileOutputStream out;
    PrintStream p;
    String strfirstname,strlastname,strage,straddress,strcity,strstate;
    GridBagLayout gl;
    GridBagConstraints gbc;
    public MyEmployeeFrame()
    super("Employee Details",true,true,true,true);
    setSize(500,400);
    labelfirstname = new JLabel("First Name");
    labellastname = new JLabel("Last Name");
    labelage = new JLabel("Age");
    labeladdress = new JLabel("Address");
    labelcity = new JLabel("City");
    labelstate = new JLabel("State");
    textfirstname = new JTextField(10);
    textlastname = new JTextField(10);
    textage = new JTextField(5);
    textaddress = new JTextField(15);
    textcity = new JTextField(10);
    textstate = new JTextField(10);
    buttonsave = new JButton("Save");
    gl = new GridBagLayout();
    gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 1;
    gbc.gridy = 3;
    gl.setConstraints(labelfirstname,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 3;
    gbc.gridy = 3;
    gl.setConstraints(textfirstname,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 1;
    gbc.gridy = 5;
    gl.setConstraints(labellastname,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 3;
    gbc.gridy = 5;
    gl.setConstraints(textlastname,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 1;
    gbc.gridy = 7;
    gl.setConstraints(labelage,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 3;
    gbc.gridy = 7;
    gl.setConstraints(textage,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 1;
    gbc.gridy = 9;
    gl.setConstraints(labeladdress,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 3;
    gbc.gridy = 9;
    gl.setConstraints(textaddress,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 1;
    gbc.gridy = 11;
    gl.setConstraints(labelcity,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 3;
    gbc.gridy = 11;
    gl.setConstraints(textcity,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 1;
    gbc.gridy = 13;
    gl.setConstraints(labelstate,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 3;
    gbc.gridy = 13;
    gl.setConstraints(textstate,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 3;
    gbc.gridy = 17;
    gl.setConstraints(buttonsave,gbc);
    Container contentpane = getContentPane();
    contentpane.setLayout(gl);
    contentpane.add(labelfirstname);
    contentpane.add(textfirstname);
    contentpane.add(labellastname);
    contentpane.add(textlastname);
    contentpane.add(labelage);
    contentpane.add(textage);
    contentpane.add(labeladdress);
    contentpane.add(textaddress);
    contentpane.add(labelcity);
    contentpane.add(textcity);
    contentpane.add(labelstate);
    contentpane.add(textstate);
    contentpane.add(buttonsave);
    buttonsave.addActionListener(this);
    public void reset()
    textfirstname.setText("");
    textlastname.setText("");
    textage.setText("");
    textaddress.setText("");
    textcity.setText("");
    textstate.setText("");
    public void actionPerformed(ActionEvent ae)
    String str = ae.getActionCommand();
    System.out.println(str);
    if(str.equalsIgnoreCase("Save"))
    try
    out = new FileOutputStream("myfile.txt",true);
    p = new PrintStream( out );
    strfirstname = textfirstname.getText();
    strlastname = textlastname.getText();
    strage = textage.getText();
    straddress = textaddress.getText();
    strcity = textcity.getText();
    strstate = textstate.getText();
    p.print(strfirstname+"|");
    p.print(strlastname+"|");
    p.print(strage+"|");
    p.print(straddress+"|");
    p.print(strcity+"|");
    p.println(strstate);
    System.out.println("Record Saved");
    reset();
    p.close();
    catch (Exception e)
    System.err.println ("Error writing to file");
    class MyLogin extends JInternalFrame implements ActionListener
    JFrame loginframe;
    JLabel labelname;
    JLabel labelpassword;
    JTextField textname;
    JPasswordField textpassword;
    JButton okbutton;
    String name = "";
    FileOutputStream out;
    PrintStream p;
    Date date;
    GregorianCalendar gcal;
    GridBagLayout gl;
    GridBagConstraints gbc;
    public MyLogin()
    super("Login",true,true,true,true);
    setSize(400,300);
    gl = new GridBagLayout();
    gbc = new GridBagConstraints();
    labelname = new JLabel("User");
    labelpassword = new JLabel("Password");
    textname = new JTextField("",9);
    textpassword = new JPasswordField(5);
    okbutton = new JButton("OK");
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 1;
    gbc.gridy = 5;
    gl.setConstraints(labelname,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 2;
    gbc.gridy = 5;
    gl.setConstraints(textname,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 1;
    gbc.gridy = 10;
    gl.setConstraints(labelpassword,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 2;
    gbc.gridy = 10;
    gl.setConstraints(textpassword,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 1;
    gbc.gridy = 15;
    gl.setConstraints(okbutton,gbc);
    Container contentpane = getContentPane();
    contentpane.setLayout(gl);
    contentpane.add(labelname);
    contentpane.add(labelpassword);
    contentpane.add(textname);
    contentpane.add(textpassword);
    contentpane.add(okbutton);
    okbutton.addActionListener(this);
    public void reset()
    textname.setText("");
    textpassword.setText("");
    public void run()
    try
    String text = textname.getText();
    String blank="";
    if(text.equals(blank))
    System.out.println("First Enter a UserName");
    else
    if(text != blank)
    date = new Date();
    gcal = new GregorianCalendar();
    gcal.setTime(date);
    out = new FileOutputStream("log.txt",true);
    p = new PrintStream( out );
    name = textname.getText();
    String entry = "UserName:- " + name + " Logged in:- " + gcal.get(Calendar.HOUR) + ":" + gcal.get(Calendar.MINUTE) + " Date:- " + gcal.get(Calendar.DATE) + "/" + gcal.get(Calendar.MONTH) + "/" + gcal.get(Calendar.YEAR);
    p.println(entry);
    System.out.println("Record Saved");
    reset();
    p.close();
    catch (IOException e)
    System.err.println("Error writing to file");
    public void actionPerformed(ActionEvent ae)
    String str = ae.getActionCommand();
    if(str.equals("OK"))
    run();
    loginframe.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    }

    I realize this post is from a few days ago, but if you're still looking for help:
    This is my first thought on how to do this. Unfortunately, it's a bit messy. JMenuItems can be enabled and disabled but JMenus don't have this option...
    public class InternalFrameDemo extends JFrame implements ActionListener
        JDesktopPane desktop;
        JMenuBar menuBar;
        public InternalFrameDemo()
         setJMenuBar(createMenuBar());
         desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
         createLogin();
        public JMenuBar createMenuBar()
         menuBar = new JMenuBar();
         JMenu menu = new JMenu("Document");
         menu.setMnemonic(KeyEvent.VK_D);
         menuBar.add(menu);
         JMenuItem menuItem = new JMenuItem("Quit");
         menuItem.setMnemonic(KeyEvent.VK_Q);
         menuItem.setAccelerator(KeyStroke.getKeyStroke( KeyEvent.VK_Q, ActionEvent.ALT_MASK));
         menuItem.setActionCommand("quit");
         menuItem.addActionListener(this);
         menu.add(menuItem);
         JMenuItem additem = new JMenuItem("Add");
         additem.setMnemonic(KeyEvent.VK_A);
         additem.setActionCommand("add");
         additem.addActionListener(this);
         employee.add(additem);
         return menuBar;
        public void createLogin()
         MyLogin loginframe = new MyLogin( menuBar );
         loginframe.setVisible(true);
         desktop.add(loginframe);
         try
             loginframe.setSelected(true);
         catch(Exception e)
    class MyLogin extends JInternalFrame implements ActionListener
        JMenuBar menuBar;
        public MyLogin( JMenuBar menuBar1 )
         super("Login",true,true,true,true);
         menuBar = menuBar1;
        public void actionPerformed(ActionEvent ae)
         String str = ae.getActionCommand();
         if(str.equals("OK"))
             run();
             JMenu employee = new JMenu("Employee");
             employee.setMnemonic(KeyEvent.VK_E);
             employee.setActionCommand("employee");
             menuBar.add(employee);
             loginframe.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    }

  • How to add a column in table control

    Hi ,
       Can any one tell me how to add a column in table control? My requirement is to add two columns ( custom fields ) into table control ( It is a standard program). I have added the column in the table and also in the table control. But when I am running the standard program, The newly added column is not there. But I have added in the perticular screen. Change is not reflected.
       Can anyone help me on this please.
    Thanks in advance.
    Regards,
    Lakshmi.

    Hi,
    Ensure the following :
    1. After adjusting the database, you`ll have to use the database utility and activate the table.
    2. If you have changed the standard screen, in tcode se80 -- right click on the program and click activate all. This activates all objects related to that program.
    Now execute the program.
    Reward if helpful.
    Regards

Maybe you are looking for