To insert a new row in a table control without affecting the other rows

Halo experts,
I have a Table control TCTRL in a program .
The lt_tab contains two cols A and B
In change mode of the transaction Col A is in display mode and Col B is in change mode
When i press the + button to insert a new blank entry .I need a blank row with both col A and col B input enabled w/o affecting the display of above and below rows of table control
In PBO module of subscreen 101
LOOP AT lt_tab  WITH CONTROL tctrl.
MODULE tctrl_status.
endloop.
In the user command of 0101
i am writn
When 'INS'.
INSERT INITIAL LINE INTO itab.
Inside MODULE tctrl_status.
IF lt_tab IS INITIAL.
    LOOP AT SCREEN.
      IF screen-name = 'COLA'.
      screen-input = 1.
  ENDIF.
    ENDLOOP.
      MODIFY SCREEN.
endif.
but the problem here is still the Col A is in display mode and Col B is in change mode after output
.Here modify statement is happening but it does not update the TCTRL-COLS-Screen structure for the col A ( which I have set statically while designing the screen ).I dont want to make the entire row in edit mode only the inserted row ( for both Col A and Col B) and the rest shud remain as it is
Thanks
Kallu

hi Naveen
I have made my tctrl input disabled for both the columsn and
I have a module before the PBO loop where I set the like
module set_tctrl_status.
IF gv_ok_code NE gc_disp.
    LOOP AT tctrl-cols INTO gs_cols.
      IF gs_cols-screen-name = 'ColB'.
        gs_cols-screen-input = 1.
        MODIFY tctrl-cols FROM gs_cols INDEX sy-tabix.
      ENDIF.
    ENDLOOP.
This is just to set the Col B in edit mode when in change and create status.
But if i press the INS button for that change i am coding inside the loop endloop of the pBO like
if itab is initial.
LOOP AT tctrl-cols INTO gs_cols.
gs_cols-screen-input = 1.
MODIFY tctrl-cols FROM gs_cols INDEX sy-tabix.
endloop.
But the problems i it is setting the enite rows as input enabled . I want tos et only that row inpur enabled

Similar Messages

  • Need to get the row selected in table control without ay action

    Dear Team,
    I have a requirement in which I need to pass the row selected of a table control to a variable.
    Here I need to get the row selected with out any other action
    then the action of selection of a row.
    Is it possible to read table control values using FM DYNP_VALUES_READ.
    thanks in advance,
    regards,
    Sai

    HI,
    Sai Kumar Potluri
    I tried in IDES it working.
    Here is the code.
    REPORT  ZPRA_TC_D.
    TABLES : SCARR.
    CONTROLS TC TYPE TABLEVIEW USING SCREEN 1.
    DATA : SELLINE TYPE I,
           SELINDEX TYPE I.
    DATA : ACT LIKE SCARR-CARRID,
           ANT LIKE SCARR-CARRNAME.
    DATA : ITAB LIKE SCARR OCCURS 0 WITH HEADER LINE.
    CALL SCREEN 1.
    *&      Module  STATUS_0001  OUTPUT
    *       text
    MODULE STATUS_0001 OUTPUT.
      SET PF-STATUS 'ME'.
    *  SET TITLEBAR 'xxx'.
    SELECT * FROM SCARR INTO TABLE ITAB.
    ENDMODULE.                 " STATUS_0001  OUTPUT
    *&      Module  MOV  OUTPUT
    *       text
    MODULE MOV OUTPUT.
      MOVE-CORRESPONDING ITAB TO SCARR.
    ENDMODULE.                 " MOV  OUTPUT
    *&      Module  USER_COMMAND_0001  INPUT
    *       text
    MODULE USER_COMMAND_0001 INPUT.
    CASE SY-UCOMM.
    WHEN 'BACK' OR 'UP' OR 'EXIT'.
      LEAVE PROGRAM.
    WHEN 'SEL'.
      GET CURSOR FIELD SCARR-CARRID LINE SELLINE.
      SELINDEX = TC-TOP_LINE + SELLINE - 1.
      READ TABLE ITAB INDEX SELINDEX.
      ACT = ITAB-CARRID.
      ANT = ITAB-CARRNAME.
    ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0001  INPUT
    In Flow Logic.
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0001.
    LOOP AT ITAB WITH CONTROL TC.
      MODULE MOV.
    ENDLOOP.
    PROCESS AFTER INPUT.
    LOOP AT ITAB.
    ENDLOOP.
    MODULE USER_COMMAND_0001.

  • Can you select the row in a table view without highlighting the cell?

    I have an an app with a table view which is presented modally. Cell selections in this table are saved in the parent controller so that they can be reselected if the table is reloaded after being dismissed.
    When the cell is first highlighted, I want to momentarily highlight the cell and have it fade out, which I do by unselecting the cell from the modal view controller's didSelectRowAtIndexPath by calling setSelected:animated on the table view cell.
    However, when I present the table view controller modally again and want to display the previously selected cell as selected, I don't want the cell background to be highlighted, and I'm having trouble doing this.
    In order to make sure the table view knows the cell is selected, I am calling selectRowAtIndexPath. I need to make sure the cell is selected so that I can set/unset the cell's accessoryType. However, this has the sideeffect of highlighting the cell too, which looks weird and confusing to the user.
    I've tried things like temporarily setting the cell's selection style to none, but while that stops the cell background from highlighting? I've tried setting the selectionStyle to UITableViewSelectionStyleNone, but while this prevents the cell background from highlighting, the cell text still changes to white, so it the text is invisible against the white background.
    Is there a easy way of setting a cell to selected in the table view without also changing the highlight and text colour of the actual cell? Immediately setting the cell to be unselected still makes the highlight visible for a split second.

    I tried that, but setting the highlighted property doesn't seem to affect it.
    I figured out how what I was doing wrong though. I was setting selection style UITableViewSelectionStyleNone, selecting the cell, then setting the selection style back to whatever it had previously been. This causes the background not to draw highlighted, but the text and accessory type to still draw highlighted.
    In order to fix this, I moved the code to set the cell selection style to whatever it had previously been to the didDeselectRowAtIndexPath method.

  • ABAP WD, Multiple Row selection in table control without using Crtl key

    Hi all,
    I am displaying the records using the table control, i have to select the multiple records in the list <b>without using Crtl key</b>.
    How do i solve this?
    Thanks

    Hi,
    you should set the table parameter selectionMode to multi or multinolead
    than you can select multiple records,
    these you can retrieve: lt_selected_elements = node->get_selected_elements( ).
    also see this <a href="https://forums.sdn.sap.com/click.jspa?searchID=4209200&messageID=3544158">thread</a> for info
    grtz,
    Koen

  • Can I sort a column in Numbers without affecting the associate rows?

    I have a schedule with date columns and lists of names. I would like to sort the names alphabetically in each column, but the rows are tied to the column. Is there a way to sort each column without effecting the entire table?

    SJRiis wrote:
    Thanks, This seems like a serious flaw to me. I want to like Numbers, but keep finding reasons to go back to Excel.
    Why would you put data in different columns of the same row that don't have any relationship to each other? The purpose of a row is to create a record of related data. The Apple guys are sticklers about things like this. If that bothers you, reverting to Excel is your best option.
    Jerry

  • Table Control - Input Enabling/Diabling of Rows based on Condition.

    Hi,
    In the TC, I want to Input Enable/Disable the rows based on Conditions. The First row is input enabled always. But the other rows, (2nd onwards) need to be Input Enabled/Disabled based on some conditions. It is possible to make this working. Can you please provide me a suitable solution for this?
    Appreciate Your Help.
    Thanks,
    Kannan

    Hi Kannan...
    If we are talking about "Rows"...
    then identify based on some conditions the row numbers and in PBO...loop at screen with screen name..set thier input properties and modify screen (make them input only)
    If we are taking into consideration "columns"
    There is an internal structure COLS where we can identify column number of screen name ...or we can take except for one particular column..
    if some condition satisfied....
    loop at screen where screen-name <> "Column which is input'.
    Loop at screen...and make other columns display only.
    modify screen
    endif.
    Regards
    Byju

  • Insert row in a table control

    Hi,
    I have a requirement to insert a new row and delete an existing row from a table control.
    Please help me how to proceed with this.
    Thanks in advance.
    Suresh

    Hi,
    Sorry for wrongly framed question.
    The question is
    I have a requirement to insert a new <b>column</b> and delete an existing <b>column</b> from a table control.
    Thanks,
    Suresh

  • Insert row and delete row in a table control

    Hi Experts,
    I am using a table control in module pool programming, How can I Insert row and delete row in a table control?
    Thanks in Advance....

    Santhosh,
    Iam using this code..
    FORM fcode_delete_row
                  USING    p_tc_name           TYPE dynfnam
                           p_table_name
                           p_mark_name   .
    -BEGIN OF LOCAL DATA----
      DATA l_table_name       LIKE feld-name.
    data: p_mark_name type c.
      FIELD-SYMBOLS <tc>         TYPE cxtab_control.
      FIELD-SYMBOLS <table>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <wa>.
      FIELD-SYMBOLS <mark_field>.
    -END OF LOCAL DATA----
      ASSIGN (p_tc_name) TO <tc>.
    get the table, which belongs to the tc                               *
      CONCATENATE p_table_name '[]' INTO l_table_name. "table body
      ASSIGN (l_table_name) TO <table>.                "not headerline
    delete marked lines                                                  *
      DESCRIBE TABLE <table> LINES <tc>-lines.
      LOOP AT <table> ASSIGNING <wa>.
      access to the component 'FLAG' of the table header                 *
        ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
    if <MARK_FIELD> = 'X'.
        PERFORM f_save_confirmation_9101.
        IF gv_answer EQ '1'.
          DELETE <table> INDEX syst-tabix.
          IF sy-subrc = 0.
            <tc>-lines = <tc>-lines - 1.
          ENDIF.
          ELSE.
          ENDIF.
        ENDIF.
      ENDLOOP.
    in this code   ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
    if <MARK_FIELD> = 'X'.
    this code is not working...

  • Update row in a table based on join on multiple rows in another table

    I am using SQL Server 2005. I have the following update query which is not working as desired.
    UPDATE DocPlant
    SET DocHistory = DocHistory + CONVERT(VARCHAR(20), PA.ActionDate, 100) + ' - ' + PA.ActionLog + '. '
    FROM PlantDoc PD INNER JOIN PlantAction PA on PD.DocID = PA.DocID AND PD.PlantID = PA.PlantID 
    For each DocID and PlantID in PlantDoc table there are multiple rows in PlantAction table. I would like to concatenate ActionDate and ActionLog information into DocHistory column of DocPlant table. But the above update query is considering only one row from
    PlantAction table even though there are multiple rows that match with DocID and PlantID.
    DocHistory column is of type NVARCHAR(MAX).
    How do I fix my query to achieve what I want ? Thanks for the help.

    UPDATE DocPlant
    SET DocHistory = DocHistory + CONVERT(VARCHAR(20), PA.ActionDate, 100) + ' - ' + PA.ActionLog + '. '
    FROM PlantDoc PD INNER JOIN PlantAction PA on PD.DocID = PA.DocID AND PD.PlantID = PA.PlantID 
    We do not use the old Sybase UPDATE..FROM.. syntax. Google it and learn how it does not work. We do not use the old Sybase CONVERT() string function. You are still writing 1950's COBOL with string dates instead of temeproal data types. 
    You also did not post DDL, so we have to guess about everything. Does your boss make you work without DDL? How do you do it? 
    >> For each DocID and PlantID in PlantDoc table there are multiple rows in PlantAction [singular name?] table. I would like to concatenate ActionDate and ActionLog information into DocHistory column of DocPlant table. <<
    Why? What does this new data element mean? This is like dividing Thursday by Red and expecting a reasonable answer. Now, non-SQL programmers who are still writing COBOL will violate the tiered architecture rule about doing display formatting in the database.
    If you will follow forum rules, we can help you. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Insert,  Delete and Update options in Table control

    Experts,
    I have writen code for Insert,  Delete and Update options in Table control. They are not working properly...
    can any one send the code for the above please...
    Thanks in advance..

    Hi,
    Following steps will help you.
    1.TOP-INCLUDE
    DATA: ITAB1 LIKE KNA1 OCCURS 0 WITH HEADER LINE.
    DATA: ITAB2 LIKE KNA1 OCCURS 0 WITH HEADER LINE.
    DATA: WA LIKE KNA1.
    DATA: ANT TYPE I,CUR TYPE I.
    DATA: OK_CODE TYPE SY-UCOMM.
    CONTROLS: TABCTRL TYPE TABLEVIEW USING SCREEN 100.
    IN FLOWLOGIC
    PROCESS BEFORE OUTPUT.
    LOOP AT ITAB1 CURSOR CUR WITH CONTROL TABCTRL.
    ENDLOOP.
    PROCESS AFTER INPUT.
    MODULE CLEAR_DATA.
    LOOP AT ITAB1.
    MODULE MOVE_DATA.
    ENDLOOP.
    ADD “OK_CODE” IN ELEMENT LIST. CLICK ON LAYOUT AND  ADD TABLE CONTROL(name it as TABCTRL) AND PUSHBUTTONS AS FOLLOWS.
    SELECT THE FIELDS FROM PROGRAM. SAVE CHECK AND ACTIVATE.
    CLICK ON FLOWLOGIC EDITOR FROM APPLICATION TOOL BAR.
    DOUBLE CLICK ON MODULE “CLEAR_DATA”.
    write the in this module as below.
    CLEAR ITAB2. REFRESH ITAB2.
    DOUBLE CLICK ON MODULE “MOVE_DATA”.
    write the code in this module as below.
    APPEND ITAB1 TO ITAB2.
    ACTIVATE PAI AND WRITE THE CODE AS BELOW.
    CASE OK_CODE.
    WHEN 'FETCH'.
    SELECT * FROM KNA1 INTO TABLE ITAB1 UP TO 20 ROWS.
    TABCTRL-LINES = SY-DBCNT.
    WHEN 'ADD'.
    GET CURSOR LINE CNT.
    CNT = TABCTRL-TOP_LINE + CNT - 1.
    CLEAR WA.
    INSERT WA INTO ITAB1 INDEX CNT.
    WHEN 'MODIFY'.
    GET CURSOR LINE CNT.
    READ TABLE ITAB2 INDEX CNT.
    LOOP AT ITAB2.
    MODIFY KNA1 FROM ITAB2.
    ENDLOOP.
    SELECT * FROM KNA1 INTO TABLE ITAB1.
    WHEN 'EXIT'.
    LEAVE PROGRAM.
    ENDCASE.
    SAVE,CHECK AND ACTIVATE ALL.
    CREATE TCODE AND EXECUTE.
    contact if u hv any issues regarding this code.
    reward points,if it is useful.
    Thanks,
    Chandu.

  • Editable columns in table don't select the whole row

    I am new to the forums and posted this to the wrong one the first time and I am not sure how to move it so I am just reposting it here. Sorry.
    I have a table with 7 columns. 2 of them are non-editable and the rest are either radio buttons or check boxes. When I click on the 2 non-editable columns, the whole row gets highlighted. When I click on any of the editable columns, the button is selected, but the whole row is not highlighted. If I made the editable columns non-editable then the whole row gets highlighted when the column is clicked on. I want the button selected and the row highlighted when the editable columns are clicked on. Here is some relevant code:
    class PackageTable extends JPanel
        public PackageTable(String pathfile)
           fieldsok = true;
           errorfield = new JTextField(250);
           startfield = new JTextField(250);
           stopfield = new JTextField(250);
           tableModel = new MyTableModel();
           table = new JTable(tableModel)
             public Component prepareRenderer(TableCellRenderer renderer, int rowIndex, int vColIndex)
               Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
               if (vColIndex == 0)
                 c.setBackground(new Color(238,238,238));
               else
                 c.setBackground(new Color(255,255,255));
               boolean selected = isRowSelected(rowIndex);
               if (selected)
                 c.setBackground(Color.yellow);
               return c;
           table.setPreferredScrollableViewportSize(new Dimension(300, 1000));
           table.setRowSelectionAllowed(true);
           table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
           TableColumn column = null;
           for (int col = 0; col < 7; col++)
              column = table.getColumnModel().getColumn(col);
              if (col == 0)
                column.setPreferredWidth(30);
              else if (col == 1)
                column.setPreferredWidth(300);
              else if (col == 2)
                column.setPreferredWidth(10);
                column.setCellRenderer(new RadioButtonRenderer());
                column.setCellEditor(new RadioButtonEditor(new JCheckBox()));
              else if (col == 3)
                column.setPreferredWidth(10);
                column.setCellRenderer(new RadioButtonRenderer());
                column.setCellRenderer(new RadioButtonRenderer());
                column.setCellEditor(new RadioButtonEditor(new JCheckBox()));
              else if (col == 4)
                column.setPreferredWidth(10);
                column.setCellRenderer(new RadioButtonRenderer());
                column.setCellEditor(new RadioButtonEditor(new JCheckBox()));
              else if ((col == 5) || (col == 6))
                column.setPreferredWidth(10);
      class RadioButtonRenderer implements TableCellRenderer
        public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column)
          if (isSelected)
            setForeground(table.getSelectionForeground());
            setBackground(table.getSelectionBackground());
          else
            setForeground(table.getForeground());
            setBackground(table.getBackground());
          if (value == null)
            return null;
          return (Component) value;
      class RadioButtonEditor extends DefaultCellEditor implements ItemListener
        private JRadioButton button;
        public RadioButtonEditor(JCheckBox checkBox)
          super(checkBox);
        public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
          if (value == null)
            return null;
          button = (JRadioButton) value;
          button.addItemListener(this);
          return (Component) value;
        public void addCellEditorListener(CellEditorListener listener)
          listenerList.add(CellEditorListener.class, listener);
        public void removeCellEditorListener(CellEditorListener listener)
          listenerList.remove(CellEditorListener.class, listener);
        protected void fireEditingStopped()
          CellEditorListener listener;
          Object[] listeners = listenerList.getListenerList();
          for (int i = 0; i < listeners.length; i++)
            if (listeners[i] == CellEditorListener.class)
              listener = (CellEditorListener)listeners[i+1];
              listener.editingStopped(changeEvent);
        protected void fireEditingCanceled()
          CellEditorListener listener;
          Object[] listeners = listenerList.getListenerList();
          for (int i = 0; i < listeners.length; i++)
            if (listeners[i] == CellEditorListener.class)
              listener = (CellEditorListener)listeners[i+1];
              listener.editingCanceled(changeEvent);
        public void cancelCellEditing()
          fireEditingCanceled();
        public boolean stopCellEditing()
          fireEditingStopped();
          return true;
        public Object getCellEditorValue()
          return button;
        public boolean isCellEditable(EventObject event)
          return true;
        public boolean shouldSelectCell(EventObject event)
          return true;
        public void itemStateChanged(ItemEvent e)
          super.fireEditingStopped();
      class MyTableModel extends AbstractTableModel
        String[] columnNames = {"","Configuration Files","Sorts","Plots","Both","Print","Alerts"};
        public MyTableModel() { }
        public int getColumnCount()
          return columnNames.length;
        public int getRowCount()
          return totaldata.size();
        public String getColumnName(int col)
          return columnNames[col];
        public Object getValueAt(int row,int col)
          return(((Vector)totaldata.get(row)).get(col));
        public Class getColumnClass(int c)
          return getValueAt(0, c).getClass();
        public boolean isCellEditable(int row, int col)
          if ((col == 0) || (col == 1))
            return false;
          else
            return true;
        public void setValueAt(Object value, int row, int col)
          Vector v1 = new Vector();
          v1 = (Vector)totaldata.get(row);
          v1.set(col,value);
          if (col == 1)
             if (((String)value).indexOf("/") == -1)
               JOptionPane.showMessageDialog(pdsframe, "The CONFIG file that was entered on line " + (row+1) + " is not valid.");
               v1.set(col,(Object)"");
               return;
          fireTableCellUpdated(row, col);
          fireTableChanged(new TableModelEvent(this));
        public void addNewRow(Vector newRow)
          totaldata.add(newRow);
          fireTableRowsInserted(totaldata.size()-1, totaldata.size()-1);
        public void deleteRow(int Row)
          totaldata.remove(Row);
          fireTableRowsDeleted(totaldata.size()-1, totaldata.size()-1);
      }I have searched forever to try to find how to do this and I can't seem to get it right. If all the radiobuttons in one column are selected and I click on one of those rows in one of those columns, then the whole row is highlighted.
    Can anyone help me out?
    Thanks.
    esk3 {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Sorry. I didn't know that I had to provide something that could be executed. I am going to try to put enough in so that it can. This is part of a larger program and this frame is called from another frame. Here it is. I hope it works.
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.Dimension.*;
    import java.util.*;
    import java.text.*;
    // Java extension packages
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.border.*;
    import javax.swing.table.*;
    import javax.swing.JTable.*;
    import javax.swing.JScrollPane.*;
      private JFrame     pdsframe;
      private String printchecked;
      private String alertschecked;
      private JTextField cb;
      private JTextField pf;
      private JScrollPane scrollpane;
      private JTable table;
      private MyTableModel tableModel;
      private Vector totaldata;
      private JLabel startlabel;
      private JLabel stoplabel;
      private JTextField startfield;
      private JTextField stopfield;
      private JTextField errorfield;
      private boolean fieldsok;
      class MyTableModel extends DefaultTableModel
        String[] columnNames = {"","Configuration Files","Sorts","Plots","Both","Print","Alerts"};
        public MyTableModel() { }
        public int getColumnCount()
          return columnNames.length;
        public int getRowCount()
          return totaldata.size();
        public String getColumnName(int col)
          return columnNames[col];
        public Object getValueAt(int row,int col)
          return(((Vector)totaldata.get(row)).get(col));
        public Class getColumnClass(int c)
          return getValueAt(0, c).getClass();
        public boolean isCellEditable(int row, int col)
          if ((col == 0) || (col == 1))
            return false;
          else
            return true;
        public void setValueAt(Object value, int row, int col)
          Vector v1 = new Vector();
          v1 = (Vector)totaldata.get(row);
          v1.set(col,value);
          if (col == 1)
             if (((String)value).indexOf("/") == -1)
               JOptionPane.showMessageDialog(pdsframe, "The CONFIG file that was entered on line " + (row+1) + " is not valid.");
               v1.set(col,(Object)"");
               return;
          fireTableCellUpdated(row, col);
          fireTableChanged(new TableModelEvent(this));
        public void addNewRow(Vector newRow)
          totaldata.add(newRow);
          fireTableRowsInserted(totaldata.size()-1, totaldata.size()-1);
        public void deleteRow(int Row)
          totaldata.remove(Row);
          fireTableRowsDeleted(totaldata.size()-1, totaldata.size()-1);
      class RadioButtonRenderer implements TableCellRenderer
        public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column)
          if (isSelected)
            setForeground(table.getSelectionForeground());
            setBackground(table.getSelectionBackground());
          else
            setForeground(table.getForeground());
            setBackground(table.getBackground());
          if (value == null)
            return null;
          return (Component) value;
      class RadioButtonEditor extends DefaultCellEditor implements ItemListener
        private JRadioButton button;
        public RadioButtonEditor(JCheckBox checkBox)
          super(checkBox);
        public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
          if (value == null)
            return null;
          button = (JRadioButton) value;
          button.addItemListener(this);
          return (Component) value;
        public void addCellEditorListener(CellEditorListener listener)
          listenerList.add(CellEditorListener.class, listener);
        public void removeCellEditorListener(CellEditorListener listener)
          listenerList.remove(CellEditorListener.class, listener);
        protected void fireEditingStopped()
          CellEditorListener listener;
          Object[] listeners = listenerList.getListenerList();
          for (int i = 0; i < listeners.length; i++)
            if (listeners[i] == CellEditorListener.class)
              listener = (CellEditorListener)listeners[i+1];
              listener.editingStopped(changeEvent);
        protected void fireEditingCanceled()
          CellEditorListener listener;
          Object[] listeners = listenerList.getListenerList();
          for (int i = 0; i < listeners.length; i++)
            if (listeners[i] == CellEditorListener.class)
              listener = (CellEditorListener)listeners[i+1];
              listener.editingCanceled(changeEvent);
          }      fireEditingStopped();
          return true;
        public Object getCellEditorValue()
          return button;
        public boolean isCellEditable(EventObject event)
          return true;
        public boolean shouldSelectCell(EventObject event)
          return true;
        public void itemStateChanged(ItemEvent e)
          super.fireEditingStopped();
      class PackageTable extends JPanel
        public PackageTable(String pathfile)
           fieldsok = true;
           errorfield = new JTextField(250);
           startfield = new JTextField(250);
           stopfield = new JTextField(250);
           tableModel = new MyTableModel();
           table = new JTable(tableModel)
             public Component prepareRenderer(TableCellRenderer renderer, int rowIndex, int vColIndex)
               Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
               if (vColIndex == 0)
                 c.setBackground(new Color(238,238,238));
               else
                 c.setBackground(new Color(255,255,255));
               boolean selected = isRowSelected(rowIndex);
               if (selected)
                 c.setBackground(Color.yellow);
               return c;
           table.setPreferredScrollableViewportSize(new Dimension(300, 1000));
           table.setRowSelectionAllowed(true);
           table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
           TableColumn column = null;
           for (int col = 0; col < 7; col++)
              column = table.getColumnModel().getColumn(col);
              if (col == 0)
                column.setPreferredWidth(30);
              else if (col == 1)
                column.setPreferredWidth(300);
              else if (col == 2)
                column.setPreferredWidth(10);
                column.setCellRenderer(new RadioButtonRenderer());
                column.setCellEditor(new RadioButtonEditor(new JCheckBox()));
              else if (col == 3)
                column.setPreferredWidth(10);
                column.setCellRenderer(new RadioButtonRenderer());
                column.setCellEditor(new RadioButtonEditor(new JCheckBox()));
              else if (col == 4)
                column.setPreferredWidth(10);
                column.setCellRenderer(new RadioButtonRenderer());
                column.setCellEditor(new RadioButtonEditor(new JCheckBox()));
              else if ((col == 5) || (col == 6))
                column.setPreferredWidth(10);
          JScrollPane scrollPane = new JScrollPane(table);
          scrollPane.setBounds(20,180,1000,300);
          JLabel pflabel = new JLabel("Package File: ");
          pf = new JTextField(pathfile);
          cb = new JTextField(250);
          startlabel = new JLabel("START_TIME = ");
          stoplabel = new JLabel("STOP_TIME = ");
          JLabel typelabel = new JLabel("TYPE OF FORMAT TO OUTPUT");
          JButton savebutton = new JButton("Save and Run");
          JButton jbtAddRow = new JButton("Add New Row");
          JButton jbtUpdateRow = new JButton("Update Row");
          JButton jbtDeleteRow = new JButton("Delete Row");
          JButton cancelbutton = new JButton("Cancel");
          cb.setEditable(false);
          cb.setBounds(130,230,100,30);
          cb.setEnabled(false);
          cb.setVisible(false);
          pflabel.setBounds(20,20,100,30);
          pf.setEditable(false);
          pf.setBounds(130,20,300,30);
          startlabel.setBounds(20,90,100,30);
          startfield.setEditable(false);
          startfield.setBackground(new Color(255,255,255));
          startfield.setBounds(130,90,300,30);
          stoplabel.setBounds(20,120,100,30);
          stopfield.setEditable(false);
          stopfield.setBackground(new Color(255,255,255));
          stopfield.setBounds(130,120,300,30);
          typelabel.setBounds(525,150,400,30);
          savebutton.setBounds(130,500,130,30);
          jbtAddRow.setBounds(280,500,130,30);
          jbtUpdateRow.setBounds(430,500,130,30);
          jbtDeleteRow.setBounds(580,500,130,30);
          cancelbutton.setBounds(730,500,130,30);
          add(scrollPane);
          add(pflabel);
          add(pf);
          add(startlabel);
          add(stoplabel);
          add(startfield);
          add(stopfield);
          add(typelabel);
          add(jbtAddRow);
          add(jbtUpdateRow);
          add(jbtDeleteRow);
          add(savebutton);
          add(cancelbutton);
      public void createAndShowGUI() {
        //Create and set up the window.
        pdsframe = new JFrame("PDS Batch Parameters");
        pdsframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        totaldata = new Vector();
        //Create and set up the content pane.
        PackageTable newContentPane = new PackageTable(pathfile);
        newContentPane.setOpaque(true); //content panes must be opaque
        pdsframe.setContentPane(newContentPane);
        //Display the window.
        pdsframe.setLayout(null);
        pdsframe.setSize(1100,700);
        pdsframe.setLocationRelativeTo(null);
        pdsframe.setFocusableWindowState(true);
        pdsframe.setVisible(true);
        pdsframe.show();
        pdsframe.setAlwaysOnTop(true);
        pdsframe.requestFocus();
    public void main()
        Toolkit.getDefaultToolkit().beep();
        createAndShowGUI();
    }Does this help? I hope it works. These are the relevant parts. Thanks.
    esk3

  • How to increase row height in table control?

    Hi experts,
    We have a push button in table control created using screen painter. Since this is a touch screen transaction, the default height is very small for the worker in the plant to click on a specific row, i would like to know if there is any way to increase the row height in the table control. There is no attribute in Screen painter for increasing row height in table control. I did try "import dynpro", hoping to increase the row height and export the dynpro, but that doesn't seem to have row height attributes. Any help in this regard is highly appreciated. Thanks,
    Raj

    Using a new technology means you have to recreate your screen: you may create an HTML using CL_DD_* classes (that's called "Dynamic Documents"). See [SAP Library - DD programming guide|http://help.sap.com/saphelp_nw2004s/helpdata/en/13/12284b019511d4a73e0000e83dd863/frameset.htm]. Demos are provided in SDYNAMICDOCUMENTS package. Or I think you may create web dynpro and define a CSS style to enlarge objects.
    If you don't want to create everything, maybe you can find out a workaround with GuiXT, for example creating a big button in each row (for example, with BUTTONSIZE, but don't know if it changes the height of rows but that's worth trying).
    Well, [Synactive documentation about table controls|http://www.synactive.com/docu_e/specials/tables.html] does not seem to allow that.
    Maybe you can move your question to the "scripting" forum and ask about how to do it with GuiXT...

  • How to delete and add rows in a table control

    Hi
      how to delete rows and add new rows in a tbale control
    Sathya

    Hi,
    In the PAI write this code
    PROCESS AFTER INPUT.
    LOOP AT itab.
    ENDLOOP.
    MODULE MODIFY_TC.
    MODULE MODIFY_TC.
    To add a row
      DESCRIBE TABLE itab LINES tc_tab-lines.
      tc_tab-lines = tc_tab-lines + 1.
    To delete a row if check box is ticked
       DELETE itab WHERE check = c_x.
    To delete a row depending on tabix
       DELETE itab index l_tabix.
    ENDMODULE.
    Make sure that you put a if condition in the above module inorder to ensure addition or deletion of a row.
    Best regards,
    Prashant

  • How to add new fields  to a table control in a standard transaction JHA3X

    Hi All,
            We have a requirement where we have to add two new fields  to  a table control
            in a standard transaction JHA3X .
           We don't want any changes into our standard code and also we don't have any USER EXIT for that
           screen.
           Please provide with some solutions for the same .
           Thanks in advance .

    You will need add this to the /var/clientlibs/libs/cq/security/widgets.js and add the field under the 'CQ.security.UserProperties'.  For example, if you wanted to add a field to show the 'Middle Name' under the 'First Name' field, you can try adding the following:
                "items":[{
                        "xtype":"textfield",
                        "fieldLabel":CQ.I18n.getMessage("Login"),
                        "anchor":"100%",
                        "disabled":true,
                        "allowBlank":false,
                        "name":"rep:userId"
                        "xtype":"textfield",
                        "fieldLabel":CQ.I18n.getMessage("First Name"),
                        "anchor":"100%",
                        "name":"givenName"
                        "xtype":"textfield",
                        "fieldLabel":CQ.I18n.getMessage("Middle Name"),
                        "anchor":"100%",
                        "name":"middleName",
                        "xtype":"textfield",
                        "fieldLabel":CQ.I18n.getMessage("Last Name"),
                        "anchor":"100%",
                        "name":"familyName",
                        "allowBlank":false
    Hope this helps.
    -Ron

  • Get the count of rows in a table control

    Hi Experts,
      How do I get the count of the rows in a table control during run time.
    I am developing a BDC in which I have to check all entries in a table control.
    My requirement is to get the total number of rows in a table control dynamically.
    Thanks
    Kumar

    Hi,
    Use a variable when u r passing the records from the internal table to the screen fields
    and display the same.
    I think this idea may help u.
    And pls explain me ur requirement clearly.
    Refer to the following link this may help u.
    http://sapabapnotes.blogspot.com/2008/03/working-with-ecatt-extended-computer.html
    Reward if helpful.
    Jagadish

Maybe you are looking for