How to delete a row in table control(accepts only input)?

Hi All,
I have an empty table control which is only use for data input(this data will then be use to store information to a custom table). I have two buttons, Create Entry and Delete Entry.
In my screenPainter for the table control, I have the checkbox w/SelColumn ticked and assign variable T_DATA-MARK on it.
Please see the actual screenshots and code below:
The aim of the table control is just to accept inputs, so the internal table in the PBO is always empty.
Table Control Screen Painter ScreenShot and Actual SAP Output:
http://img710.imageshack.us/img710/4751/tablecontrolrowdelete.jpg
PBO
PROCESS BEFORE OUTPUT.
  LOOP WITH CONTROL TC_ID.
    MODULE LOAD_TABLECTRL.
  ENDLOOP.
module LOAD_TABLECTRL output.
  READ TABLE T_ID_CHECK INTO WA_ID_CHECK INDEX TC_ID-current_line.
  IF SY-SUBRC EQ 0.
    MOVE-CORRESPONDING T_ID_CHECK TO TC_ID.
  ELSE.
      "EXIT FROM STEP-LOOP.
      CLEAR ZQID_CHECK.
  ENDIF.
PAI
PROCESS AFTER INPUT.
   LOOP WITH CONTROL TC_ID.
     CHAIN.
      MODULE CHECK_ENTRIES     ON CHAIN-INPUT.     
      MODULE MODIFY_T_ID_CHECK ON CHAIN-INPUT.
      MODULE DELETE_ROW        ON CHAIN-INPUT
     ENDCHAIN.
   ENDLOOP.
module CHECK_ENTRIES input.
  CASE ok_code.
    WHEN 'DEL'.
        PERFORM F_FILL_ITABCREATE USING ZQID_CHECK-MATNR
                                        ZQID_CHECK-LICHA
                                        ZQID_CHECK-LIFNR.
  ENDCASE.
endmodule.    
form F_FILL_ITABCREATE  using    us_zqid_check_matnr LIKE MARA-MATNR
                                 us_zqid_check_licha LIKE MCHA-LICHA
                                 us_zqid_check_lifnr LIKE LFA1-LIFNR.
  MOVE: us_zqid_check_matnr TO WA_ID_CHECK-MATNR,
        us_zqid_check_licha TO WA_ID_CHECK-LICHA,
        us_zqid_check_lifnr TO WA_ID_CHECK-LIFNR.
  APPEND WA_ID_CHECK TO T_ID_CHECK.
  CLEAR WA_ID_CHECK.
endform.
module MODIFY_T_ID_CHECK input.
DATA W_TEMPMARK(1) TYPE C.
  MOVE: T_ID_CHECK-MARK TO W_TEMPMARK,
        W_TEMPMARK TO T_ID_CHECK-MARK.
MODIFY T_ID_CHECK INDEX SY-TABIX TRANSPORTING MARK.
endmodule.
module DELETE_ROW input.
  LOOP AT T_ID_CHECK WHERE MARK EQ 'X'.
    DELETE T_ID_CHECK.
  ENDLOOP.
endmodule.   
Edited by: Jaime Cabanban on Jan 7, 2010 8:46 PM

Debugging the PBO part after deletion will help you know why the rows are getting deleted
This is the sap doc answer for you question regarding LINE.
Controls the scroll bar of the table control. At LOOP without internal table, LINES has the initial value zero and must be set in the program so that the scroll bar can be used. At LOOP AT <itab> the system sets this component to the number of rows of the internal table, whenever the table control is processed for the first time. The initialization event of a table control is not determined uniquely. If the corresponding internal table is not fully created at this event, then the LINES variable receives an incorrect value. If LINES in the LOOP loop is smaller as the number of rows of the internal table, then the table control contains blank rows at the end.
Therefore you should always set the LINES component explicitly in the ABAP program, including at LOOP AT <itab>. In this way you have full control over the dimensions of the vertical scroll bar and so can control the number of rows that are ready for input. Initialization should usually occur at PBO directly before the LOOP statement for the table control.

Similar Messages

  • How to delete the row in table control with respect to one field in module pool programming?

    Hi,
    Can I know the way to delete the row in table control with respect to one field in module pool programming
    Regards
    Darshan MS

    HI,
    I want to delete the row after the display of table control. I have created push button as delete row. If I click on this push button, the selected row should get deleted.
    I have written this code,
    module USER_COMMAND_9000 input.
    DATA OK_CODE TYPE SY-UCOMM.
    OK_CODE = SY-UCOMM.
    CASE OK_CODE.
         WHEN 'DELETE'.
            LOOP AT lt_source INTO ls_source WHERE mark = 'X'.
                APPEND LS_SOURCE TO LT_RESTORE.
                DELETE TABLE LT_SOURCE FROM LS_SOURCE.
                SOURCE-LINES = SOURCE-LINES - 1.
            ENDLOOP.
    But I'm unable to delete the selected rows, It is getting deleted the last rows eventhough I select the other row.
    So I thought of doing with respect to the field.

  • How to delete a row in table control?

    Hi All,
    I have a empty table control which is only use for data input(this data will then be use to store information to a custom table).  I have two buttons, Create Entry and Delete Entry.
    In my screenPainter for the table control, I have the checkbox w/SelColumn ticked and assign variable T_DATA-MARK on it.
    In my code:
    TOP Include
    CONTROLS: tc_data      TYPE TABLEVIEW USING SCREEN 9001.
    PBO
    PROCESS BEFORE OUTPUT.
      LOOP WITH CONTROL TC_ID.
        MODULE LOAD_TABLECTRL.
      ENDLOOP.
    module LOAD_TABLECTRL output.
      READ TABLE T_DATA INTO WA_DATA INDEX TC_DATA-current_line.
      IF SY-SUBRC EQ 0.
        MOVE-CORRESPONDING T_DATA TO WA_DATA.
      ENDIF.
    endmodule. 
    PAI
    PROCESS AFTER INPUT.
       LOOP WITH CONTROL TC_ID.
       ENDLOOP.
    MODULE GET_USER_ACTION.
    module GET_USER_ACTION input.
      WHEN 'DEL'.
        LOOP AT T_DATA INTO WA_DATA WHERE MARK EQ 'X'.
          DELETE T_DATA.
        ENDLOOP.
    In my debug, the internal table T_DATA-MARK does not have any value(s) even if I selected a particular row in my table control. 
    Am I missing something here?
    Thanks

    Hi All,
    Please see the actual screenshots and code below:
    The aim of the table control is just to accept inputs, so the internal table in the PBO is always empty.
    Table Control Screen Painter ScreenShot and Actual SAP Output: http://img710.imageshack.us/img710/4751/tablecontrolrowdelete.jpg
    PBO
    PROCESS BEFORE OUTPUT.
      LOOP WITH CONTROL TC_ID.
        MODULE LOAD_TABLECTRL.
      ENDLOOP.
    module LOAD_TABLECTRL output.
      READ TABLE T_ID_CHECK INTO WA_ID_CHECK INDEX TC_ID-current_line.
      IF SY-SUBRC EQ 0.
        MOVE-CORRESPONDING T_ID_CHECK TO TC_ID.
      ELSE.
          "EXIT FROM STEP-LOOP.
          CLEAR ZQID_CHECK.
      ENDIF.
    PAI
    PROCESS AFTER INPUT.
       LOOP WITH CONTROL TC_ID.
         CHAIN.
          MODULE CHECK_ENTRIES     ON CHAIN-INPUT.     
          MODULE MODIFY_T_ID_CHECK ON CHAIN-INPUT.
          MODULE DELETE_ROW        ON CHAIN-INPUT
         ENDCHAIN.
       ENDLOOP.
    module CHECK_ENTRIES input.
      CASE ok_code.
        WHEN 'DEL'.
            PERFORM F_FILL_ITABCREATE USING ZQID_CHECK-MATNR
                                            ZQID_CHECK-LICHA
                                            ZQID_CHECK-LIFNR.
      ENDCASE.
    endmodule.    
    module MODIFY_T_ID_CHECK input.
    DATA W_TEMPMARK(1) TYPE C.
      MOVE: T_ID_CHECK-MARK TO W_TEMPMARK,
            W_TEMPMARK TO T_ID_CHECK-MARK.
    MODIFY T_ID_CHECK INDEX SY-TABIX TRANSPORTING MARK.
    endmodule.
    module DELETE_ROW input.
      LOOP AT T_ID_CHECK WHERE MARK EQ 'X'.
        DELETE T_ID_CHECK.
      ENDLOOP.
    endmodule.   
    form F_FILL_ITABCREATE  using    us_zqid_check_matnr LIKE MARA-MATNR
                                     us_zqid_check_licha LIKE MCHA-LICHA
                                     us_zqid_check_lifnr LIKE LFA1-LIFNR.
      MOVE: us_zqid_check_matnr TO WA_ID_CHECK-MATNR,
            us_zqid_check_licha TO WA_ID_CHECK-LICHA,
            us_zqid_check_lifnr TO WA_ID_CHECK-LIFNR.
      APPEND WA_ID_CHECK TO T_ID_CHECK.
      CLEAR WA_ID_CHECK.
    endform.
    In my debug, I can now delete the internal table that has a 'X' mark on its respective row but on the SAP screen output, all of my entries are being deleted contrary to what the ABAP debugger is telling me.
    Thanks

  • How to delete a row from table control

    I have created a push button on the screen for delete.
    its getting stored in ok_code.
    'FLAG' is the name of the mark on the table control.
    I am getting probs in this line.
    I am not getting anything in mark_field.
    ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
    The code is:
    MODULE tablctrl2_user_command INPUT.
      PERFORM user_ok_tc USING    'TABLCTRL2'
                                  'I_ZSKILLEMP'
                                  'FLAG'
                         CHANGING ok_code.
    ENDMODULE.
    FORM user_ok_tc USING    p_tc_name TYPE dynfnam
                             p_table_name
                             p_mark_name
                    CHANGING p_ok      LIKE sy-ucomm.
    -BEGIN OF LOCAL DATA----
      DATA: l_ok              TYPE sy-ucomm,
            l_offset          TYPE i.
    -END OF LOCAL DATA----
    Table control specific operations                                    *
      evaluate TC name and operations                                    *
      SEARCH p_ok FOR p_tc_name.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
      l_offset = strlen( p_tc_name ) + 1.
      l_ok = p_ok+l_offset.
    execute general and TC specific operations                           *
      CASE l_ok.
        WHEN 'INSR'.                      "insert row
          PERFORM fcode_insert_row USING    p_tc_name
                                            p_table_name.
          CLEAR p_ok.
        WHEN 'DELE'.                      "delete row
          PERFORM fcode_delete_row USING    p_tc_name
                                            p_table_name
                                            p_mark_name.
          CLEAR p_ok.
    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.
      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'.
          DELETE <table> INDEX syst-tabix.
          IF sy-subrc = 0.
            <tc>-lines = <tc>-lines - 1.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.

    Hi...
    i got the same prob...but got the solution too...
    you have to take an internal table of same type of dbase table..and maintain a flag in it...which will be get filled automatically with 'X'.
    here is the code..go throug it..
    REPORT  YH642_DIALOG_TABLECONTROL.
    CALL SCREEN 999.
    DATA:
      W_INDEX TYPE I.
    DATA:
      W_UCOMM LIKE SY-UCOMM.
    ***&SPWIZARD: DATA DECLARATION FOR TABLECONTROL 'TAB'
    *&SPWIZARD: DEFINITION OF DDIC-TABLE
    TABLES:   YH642_RAM.
    DATA:
      BEGIN OF DDTAB,
        TAB_FLAG  TYPE C,
        MANDT  LIKE YH642_RAM-MANDT,
        EID    LIKE YH642_RAM-EID,
        ENAME  LIKE YH642_RAM-ENAME,
        MOBILE LIKE YH642_RAM-MOBILE,
      END OF DDTAB.
    *&SPWIZARD: TYPE FOR THE DATA OF TABLECONTROL 'TAB'
    TYPES: BEGIN OF T_TAB,
             TAB_FLAG TYPE C,
             MANDT LIKE YH642_RAM-MANDT,
             EID LIKE YH642_RAM-EID,
             ENAME LIKE YH642_RAM-ENAME,
             MOBILE LIKE YH642_RAM-MOBILE,
           END OF T_TAB.
    *&SPWIZARD: INTERNAL TABLE FOR TABLECONTROL 'TAB'
    DATA:     G_TAB_ITAB   TYPE T_TAB OCCURS 0,
              H_TAB_ITAB   TYPE T_TAB OCCURS 0,
              G_TAB_WA     TYPE T_TAB. "work area
    DATA:     G_TAB_COPIED.           "copy flag
    *&SPWIZARD: DECLARATION OF TABLECONTROL 'TAB' ITSELF
    CONTROLS: TAB TYPE TABLEVIEW USING SCREEN 0999.
    *&SPWIZARD: LINES OF TABLECONTROL 'TAB'
    DATA:     G_TAB_LINES  LIKE SY-LOOPC.
    DATA:     OK_CODE LIKE SY-UCOMM.
    *&SPWIZARD: OUTPUT MODULE FOR TC 'TAB'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: COPY DDIC-TABLE TO ITAB
    MODULE TAB_INIT OUTPUT.
      IF G_TAB_COPIED IS INITIAL.
    *&SPWIZARD: COPY DDIC-TABLE 'YH642_RAM'
    *&SPWIZARD: INTO INTERNAL TABLE 'g_TAB_itab'
        SELECT * FROM YH642_RAM
           INTO CORRESPONDING FIELDS
           OF TABLE G_TAB_ITAB.
        G_TAB_COPIED = 'X'.
        H_TAB_ITAB[] = G_TAB_ITAB[].
        REFRESH CONTROL 'TAB' FROM SCREEN '0999'.
      ENDIF.
    ENDMODULE.                    "TAB_INIT OUTPUT
    *&SPWIZARD: OUTPUT MODULE FOR TC 'TAB'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: MOVE ITAB TO DYNPRO
    MODULE TAB_MOVE OUTPUT.
      MOVE-CORRESPONDING G_TAB_WA TO DDTAB.
    ENDMODULE.                    "TAB_MOVE OUTPUT
    *&SPWIZARD: OUTPUT MODULE FOR TC 'TAB'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: GET LINES OF TABLECONTROL
    MODULE TAB_GET_LINES OUTPUT.
      G_TAB_LINES = SY-LOOPC.
    ENDMODULE.                    "TAB_GET_LINES OUTPUT
    *&SPWIZARD: INPUT MODULE FOR TC 'TAB'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: MODIFY TABLE
    MODULE TAB_MODIFY INPUT.
      MOVE-CORRESPONDING DDTAB TO G_TAB_WA.
      MODIFY G_TAB_ITAB
        FROM G_TAB_WA
        INDEX TAB-CURRENT_LINE.
    ENDMODULE.                    "TAB_MODIFY INPUT
    *&SPWIZARD: INPUT MODULE FOR TC 'TAB'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: PROCESS USER COMMAND
    MODULE TAB_USER_COMMAND INPUT.
      OK_CODE = SY-UCOMM.
      PERFORM USER_OK_TC USING    'TAB'
                                  'G_TAB_ITAB'
                                  'TAB_FLAG'
                         CHANGING OK_CODE.
      SY-UCOMM = OK_CODE.
    ENDMODULE.                    "TAB_USER_COMMAND INPUT
      INCLUDE TABLECONTROL_FORMS                                         *
    *&      Form  USER_OK_TC                                               *
    FORM USER_OK_TC USING    P_TC_NAME TYPE DYNFNAM
                             P_TABLE_NAME
                             P_MARK_NAME
                    CHANGING P_OK      LIKE SY-UCOMM.
    &SPWIZARD: BEGIN OF LOCAL DATA----
      DATA: L_OK              TYPE SY-UCOMM,
            L_OFFSET          TYPE I.
    &SPWIZARD: END OF LOCAL DATA----
    *&SPWIZARD: Table control specific operations                          *
    *&SPWIZARD: evaluate TC name and operations                            *
      SEARCH P_OK FOR P_TC_NAME.
      IF SY-SUBRC <> 0.
        EXIT.
      ENDIF.
      L_OFFSET = STRLEN( P_TC_NAME ) + 1.
      L_OK = P_OK+L_OFFSET.
      L_OK = 'DELE'.
    *&SPWIZARD: execute general and TC specific operations                 *
      CASE L_OK.
        WHEN 'INSR'.                      "insert row
          PERFORM FCODE_INSERT_ROW USING    P_TC_NAME
                                            P_TABLE_NAME.
          CLEAR P_OK.
        WHEN 'DELE'.           "delete row
         MESSAGE 'Are you really going to delete??' type 'I'.
          PERFORM FCODE_DELETE_ROW USING    P_TC_NAME
                                            P_TABLE_NAME
                                            P_MARK_NAME.
          CLEAR P_OK.
        WHEN 'P--' OR                     "top of list
             'P-'  OR                     "previous page
             'P+'  OR                     "next page
             'P++'.                       "bottom of list
          PERFORM COMPUTE_SCROLLING_IN_TC USING P_TC_NAME
                                                L_OK.
          CLEAR P_OK.
        WHEN 'L--'.                       "total left
          PERFORM FCODE_TOTAL_LEFT USING P_TC_NAME.
        WHEN 'L-'.                        "column left
          PERFORM FCODE_COLUMN_LEFT USING P_TC_NAME.
        WHEN 'R+'.                        "column right
          PERFORM FCODE_COLUMN_RIGHT USING P_TC_NAME.
        WHEN 'R++'.                       "total right
          PERFORM FCODE_TOTAL_RIGHT USING P_TC_NAME.
        WHEN 'MARK'.                      "mark all filled lines
          PERFORM FCODE_TC_MARK_LINES USING P_TC_NAME
                                            P_TABLE_NAME
                                            P_MARK_NAME   .
          CLEAR P_OK.
        WHEN 'DMRK'.                      "demark all filled lines
          PERFORM FCODE_TC_DEMARK_LINES USING P_TC_NAME
                                              P_TABLE_NAME
                                              P_MARK_NAME .
          CLEAR P_OK.
        WHEN 'SASCEND'   OR
             'SDESCEND'.                  "sort column
          PERFORM FCODE_SORT_TC USING P_TC_NAME
                                      l_ok.
      ENDCASE.
    ENDFORM.                              " USER_OK_TC
    *&      Form  FCODE_INSERT_ROW                                         *
    FORM FCODE_INSERT_ROW
                  USING    P_TC_NAME           TYPE DYNFNAM
                           P_TABLE_NAME             .
    &SPWIZARD: BEGIN OF LOCAL DATA----
      DATA L_LINES_NAME       LIKE FELD-NAME.
      DATA L_SELLINE          LIKE SY-STEPL.
      DATA L_LASTLINE         TYPE I.
      DATA L_LINE             TYPE I.
      DATA L_TABLE_NAME       LIKE FELD-NAME.
      FIELD-SYMBOLS <TC>                 TYPE CXTAB_CONTROL.
      FIELD-SYMBOLS <TABLE>              TYPE STANDARD TABLE.
      FIELD-SYMBOLS <LINES>              TYPE I.
    &SPWIZARD: END OF LOCAL DATA----
      ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: 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
    *&SPWIZARD: get looplines of TableControl                              *
      CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_LINES_NAME.
      ASSIGN (L_LINES_NAME) TO <LINES>.
    *&SPWIZARD: get current line                                           *
      GET CURSOR LINE L_SELLINE.
      IF SY-SUBRC <> 0.                   " append line to table
        L_SELLINE = <TC>-LINES + 1.
    *&SPWIZARD: set top line                                               *
        IF L_SELLINE > <LINES>.
          <TC>-TOP_LINE = L_SELLINE - <LINES> + 1 .
        ELSE.
          <TC>-TOP_LINE = 1.
        ENDIF.
      ELSE.                               " insert line into table
        L_SELLINE = <TC>-TOP_LINE + L_SELLINE - 1.
        L_LASTLINE = <TC>-TOP_LINE + <LINES> - 1.
      ENDIF.
    *&SPWIZARD: set new cursor line                                        *
      L_LINE = L_SELLINE - <TC>-TOP_LINE + 1.
    *&SPWIZARD: insert initial line                                        *
      INSERT INITIAL LINE INTO <TABLE> INDEX L_SELLINE.
      <TC>-LINES = <TC>-LINES + 1.
    *&SPWIZARD: set cursor                                                 *
      SET CURSOR LINE L_LINE.
    ENDFORM.                              " FCODE_INSERT_ROW
    *&      Form  FCODE_DELETE_ROW                                         *
    FORM FCODE_DELETE_ROW
                  USING    P_TC_NAME           TYPE DYNFNAM
                           P_TABLE_NAME
                           P_MARK_NAME   .
    &SPWIZARD: BEGIN OF LOCAL DATA----
      DATA L_TABLE_NAME       LIKE FELD-NAME.
      FIELD-SYMBOLS <TC>         TYPE CXTAB_CONTROL.
      FIELD-SYMBOLS <TABLE>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <WA>.
      FIELD-SYMBOLS <MARK_FIELD>.
    &SPWIZARD: END OF LOCAL DATA----
      ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: 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
    *&SPWIZARD: delete marked lines                                        *
      DESCRIBE TABLE <TABLE> LINES <TC>-LINES.
      LOOP AT <TABLE> ASSIGNING <WA>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
        ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
        IF <MARK_FIELD> = 'X'.
          W_INDEX = SYST-TABIX.
          DELETE <TABLE> INDEX SYST-TABIX.
          IF SY-SUBRC = 0.
            <TC>-LINES = <TC>-LINES - 1.
          ENDIF.
        ENDIF.
      ENDLOOP.
      READ TABLE H_TAB_ITAB INDEX W_INDEX INTO G_TAB_WA.
      IF SY-SUBRC EQ 0.
        MOVE-CORRESPONDING G_TAB_WA TO YH642_RAM.
        DELETE YH642_RAM.
      ENDIF.
    ENDFORM.                              " FCODE_DELETE_ROW
    *&      Form  COMPUTE_SCROLLING_IN_TC
          text
         -->P_TC_NAME  name of tablecontrol
         -->P_OK       ok code
    FORM COMPUTE_SCROLLING_IN_TC USING    P_TC_NAME
                                          P_OK.
    &SPWIZARD: BEGIN OF LOCAL DATA----
      DATA L_TC_NEW_TOP_LINE     TYPE I.
      DATA L_TC_NAME             LIKE FELD-NAME.
      DATA L_TC_LINES_NAME       LIKE FELD-NAME.
      DATA L_TC_FIELD_NAME       LIKE FELD-NAME.
      FIELD-SYMBOLS <TC>         TYPE CXTAB_CONTROL.
      FIELD-SYMBOLS <LINES>      TYPE I.
    &SPWIZARD: END OF LOCAL DATA----
      ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get looplines of TableControl                              *
      CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_TC_LINES_NAME.
      ASSIGN (L_TC_LINES_NAME) TO <LINES>.
    *&SPWIZARD: is no line filled?                                         *
      IF <TC>-LINES = 0.
    *&SPWIZARD: yes, ...                                                   *
        L_TC_NEW_TOP_LINE = 1.
      ELSE.
    *&SPWIZARD: no, ...                                                    *
        CALL FUNCTION 'SCROLLING_IN_TABLE'
             EXPORTING
                  ENTRY_ACT             = <TC>-TOP_LINE
                  ENTRY_FROM            = 1
                  ENTRY_TO              = <TC>-LINES
                  LAST_PAGE_FULL        = 'X'
                  LOOPS                 = <LINES>
                  OK_CODE               = P_OK
                  OVERLAPPING           = 'X'
             IMPORTING
                  ENTRY_NEW             = L_TC_NEW_TOP_LINE
             EXCEPTIONS
                 NO_ENTRY_OR_PAGE_ACT  = 01
                 NO_ENTRY_TO           = 02
                 NO_OK_CODE_OR_PAGE_GO = 03
                  OTHERS                = 0.
      ENDIF.
    *&SPWIZARD: get actual tc and column                                   *
      GET CURSOR FIELD L_TC_FIELD_NAME
                 AREA  L_TC_NAME.
      IF SYST-SUBRC = 0.
        IF L_TC_NAME = P_TC_NAME.
    *&SPWIZARD: et actual column                                           *
          SET CURSOR FIELD L_TC_FIELD_NAME LINE 1.
        ENDIF.
      ENDIF.
    *&SPWIZARD: set the new top line                                       *
      <TC>-TOP_LINE = L_TC_NEW_TOP_LINE.
    ENDFORM.                              " COMPUTE_SCROLLING_IN_TC
    *&      Form  FCODE_TC_MARK_LINES
          marks all TableControl lines
         -->P_TC_NAME  name of tablecontrol
    FORM FCODE_TC_MARK_LINES USING P_TC_NAME
                                   P_TABLE_NAME
                                   P_MARK_NAME.
    &SPWIZARD: EGIN OF LOCAL DATA----
      DATA L_TABLE_NAME       LIKE FELD-NAME.
      FIELD-SYMBOLS <TC>         TYPE CXTAB_CONTROL.
      FIELD-SYMBOLS <TABLE>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <WA>.
      FIELD-SYMBOLS <MARK_FIELD>.
    &SPWIZARD: END OF LOCAL DATA----
      ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: 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
    *&SPWIZARD: mark all filled lines                                      *
      LOOP AT <TABLE> ASSIGNING <WA>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
        ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
        <MARK_FIELD> = 'X'.
      ENDLOOP.
    ENDFORM.                                          "fcode_tc_mark_lines
    *&      Form  FCODE_TC_DEMARK_LINES
          demarks all TableControl lines
         -->P_TC_NAME  name of tablecontrol
    FORM FCODE_TC_DEMARK_LINES USING P_TC_NAME
                                     P_TABLE_NAME
                                     P_MARK_NAME .
    &SPWIZARD: BEGIN OF LOCAL DATA----
      DATA L_TABLE_NAME       LIKE FELD-NAME.
      FIELD-SYMBOLS <TC>         TYPE CXTAB_CONTROL.
      FIELD-SYMBOLS <TABLE>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <WA>.
      FIELD-SYMBOLS <MARK_FIELD>.
    &SPWIZARD: END OF LOCAL DATA----
      ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: 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
    *&SPWIZARD: demark all filled lines                                    *
      LOOP AT <TABLE> ASSIGNING <WA>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
        ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
        <MARK_FIELD> = SPACE.
      ENDLOOP.
    ENDFORM.                                          "fcode_tc_mark_lines
    *&      Module  STATUS_0999  OUTPUT
          text
    MODULE STATUS_0999 OUTPUT.
      SET PF-STATUS 'SS_STD'.
      SET TITLEBAR 'TITLE'.
    ENDMODULE.                 " STATUS_0999  OUTPUT
    *&      Module  USER_COMMAND_0999  INPUT
          text
    MODULE USER_COMMAND_0999 INPUT.
      DATA:
        H_TAB_WA LIKE G_TAB_WA.
      CASE W_UCOMM.
        WHEN 'BACK'.
          LEAVE PROGRAM.
        WHEN 'TAB_MODI' OR 'SAVE'.
          LOOP AT G_TAB_ITAB INTO G_TAB_WA.
          FORMAT   INPUT OFF.
            MOVE-CORRESPONDING G_TAB_WA TO YH642_RAM.
            READ TABLE H_TAB_ITAB WITH KEY EID = G_TAB_WA-EID INTO H_TAB_WA.
            IF SY-SUBRC EQ 0.
              IF G_TAB_WA NE H_TAB_WA.
                MODIFY YH642_RAM.
              ENDIF.
            ELSE.
              INSERT  YH642_RAM.
            ENDIF.
          ENDLOOP.
    SORT  G_TAB_ITAB.
      ENDCASE.
    *CALL SCREEN 700.
    ENDMODULE.                 " USER_COMMAND_0999  INPUT

  • How to delete selected row in table control

    Hi all,
    here is my coding for deleting selected row.
    But it is not working correctly.
    I am not able to delete seleced row.
    If i press delete button it automatically delete from beginning instead of selected rows.
    Can anyone can help me plz...
    CONTROLS rowdeleting TYPE TABLEVIEW USING SCREEN 100.
    TABLES zdetails.
    data : begin of itab occurs 0,
    NAME TYPE ZDETAILS-NAME,
    ADDRES TYPE ZDETAILS-ADDRES,
    CONTACTNO TYPE ZDETAILS-CONTACTNO,
    INIT TYPE C,
    end of itab .
    DATA OK_CODE LIKE SY-UCOMM.
    CALL SCREEN 100.
    MODULE STATUS_0100 OUTPUT.
    SET PF-STATUS 'BACK'.
    IF ITAB-INIT IS INITIAL.
    SELECT NAME ADDRES CONTACTNO FROM ZDETAILS
    INTO CORRESPONDING FIELDS OF TABLE ITAB.
    DESCRIBE TABLE ITAB LINES rowdeleting-LINES.
    ITAB-INIT = 'X'.
    ENDIF.
    ENDMODULE. " STATUS_0100 OUTPUT
    MODULE CHANGE_SDYN_CONN OUTPUT.
    READ TABLE itab INTO ZDETAILS INDEX rowdeleting-current_line.
    ENDMODULE. " CHANGE_SDYN_CONN OUTPUT
    MODULE READ_TABLE_CONTROL INPUT.
    IF ITAB-INIT = 'X' AND OK_CODE = 'DELETE'.
    DELETE ITAB index rowdeleting-current_line ."FROM ZDETAILS.
    DESCRIBE TABLE ITAB LINES rowdeleting-LINES.
    ENDIF.
    ENDMODULE. " READ_TABLE_CONTROL INPUT
    MODULE USER_COMMAND_0100 INPUT.
    CASE OK_CODE.
    WHEN 'BACK'.
    LEAVE PROGRAM.
    WHEN 'DELETE'.
    IF ITAB-INIT = 'X' AND OK_code = 'DELETE'.
    DELETE ITAB index rowdeleting-current_line .
    ENDIF.
    ENDCASE.
    ENDMODULE.
    regards ,
    ranjith.

    Hi,
    Check the following code:
    CONTROLS TABLE_CONTROL TYPE TABLEVIEW USING SCREEN 100.
    TABLES SDYN_SDW4.
    DATA SDYN_ITAB LIKE STANDARD TABLE OF SDYN_SDW4.
    DATA INIT.
    DATA OK_CODE LIKE SY-UCOMM.
    DATA SAVE_OK LIKE SY-UCOMM.
    DATA MARK.
    DATA  COL TYPE CXTAB_COLUMN.
    CALL SCREEN 100.
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'GRUND'.
      SET TITLEBAR '100'.
      IF INIT IS INITIAL.
    Datenbeschaffung
       SELECT CARRID CONNID CITYFROM AIRPFROM CITYTO AIRPTO DEPTIME ARRTIME
                DISTANCE DISTID
                FROM SPFLI
                INTO CORRESPONDING FIELDS OF TABLE SDYN_ITAB.
        DESCRIBE TABLE SDYN_ITAB LINES TABLE_CONTROL-LINES.
        INIT = 'X'.
      ENDIF.
    ENDMODULE.                             " STATUS_0100  OUTPUT
    *&      Module  FILL_TABLE_CONTROL  OUTPUT
          text
    MODULE CHANGE_SDYN_CONN OUTPUT.
    you can change the content of current table control line via
    sdyn_conn
    READ TABLE sdyn_itab INTO sdyn_conn INDEX table_control-current_line.
    ENDMODULE.                             " FILL_TABLE_CONTROL  OUTPUT
    *&      Module  READ_TABLE_CONTROL  INPUT
          text
    MODULE READ_TABLE_CONTROL INPUT.
    Check input values
      IF MARK = 'X' AND SAVE_OK = 'DELETE'.
        DELETE TABLE SDYN_ITAB FROM sdyn_sdw4.
        DESCRIBE TABLE SDYN_ITAB LINES TABLE_CONTROL-LINES.
      ENDIF.
    ENDMODULE.                             " READ_TABLE_CONTROL  INPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
      SAVE_OK = OK_CODE.
      CLEAR OK_CODE.
      CASE SAVE_OK.
        WHEN 'SORT'.
          DATA: FLDNAME(100),HELP(100).
          READ TABLE TABLE_CONTROL-COLS INTO COL WITH KEY SELECTED = 'X'.
          SPLIT COL-SCREEN-NAME AT '-' INTO HELP FLDNAME.
          SORT SDYN_ITAB BY (FLDNAME).
      ENDCASE.
    ENDMODULE.                             " USER_COMMAND_0100  INPUT
    *&      Module  EXIT  INPUT
          text
    MODULE EXIT INPUT.
    LEAVE PROGRAM.
    ENDMODULE.                 " EXIT  INPUT
    Regards,
    Bhaskar

  • 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.

  • Unable to delete a row in table control

    Hi,
    I'm unable to delete a row in table control.
    I have defined a selection column for my table control but it is not getting value 'X' when i'm selecting a row for deletion.
    Also, when I press enter, some of the columns in table control are getting initialized. I'm passing these values to the internal table along with other columns.
    Please help.
    Regards,
    Manasee
    Message was edited by: Manasee Chandorkar

    hi,
    kindly chk this.
    PROCESS BEFORE OUTPUT.
    MODULE status_9010.
    LOOP WITH CONTROL tab_control.
    MODULE move_data_to_table.
    ENDLOOP.
    PROCESS AFTER INPUT.
    LOOP WITH CONTROL tab_control.
    MODULE move_data_from_table.
    ENDLOOP.
    *& Module move_data_to_table OUTPUT
    This is to move the data from the internal table to the table control
    MODULE move_data_to_table OUTPUT.
    This is to move the data from the internal table to the table control
    zmpets_mode-modecode,zmpets_range-rangeid,zmpets_servfacto-factor are column name of table control
    READ TABLE int_factor INDEX tab_control-current_line.
    IF sy-subrc = 0.
    zmpets_mode-modecode = int_factor-modecode.
    zmpets_range-rangeid = int_factor-rangeid.
    zmpets_servfacto-factor = int_factor-factor.
    ENDIF.
    ENDMODULE. " move_data_to_table OUTPUT
    *& Module move_data_from_table INPUT
    Date is moved from the table control to the Internal Table
    MODULE move_data_from_table INPUT.
    To move the data from the table control to internal table 'INT_FACTOR'.
    int_factor-modecode = zmpets_mode-modecode.
    int_factor-rangeid = zmpets_range-rangeid.
    int_factor-factor = zmpets_servfacto-factor.
    int_factor-chk = line.
    *here if the data is there, it will modify
    MODIFY int_factor INDEX tab_control-current_line.
    IF sy-subrc NE 0. "data not exixting in table control . ie new data, then append it
    APPEND int_factor.
    CLEAR int_factor.
    ENDIF.
    ENDMODULE. " move_data_from_table INPUT
    *delete a line from table control
    MODULE user_command_9010 INPUT.
      CASE sy-ucomm.
    When an entry is deleted, and the entry is removed from the table
    control.
        WHEN 'DELETE'.
          PERFORM f_del_frm_tab_cntrl.
      ENDCASE.
    ENDMODULE.
    FORM f_del_frm_tab_cntrl .
      LOOP AT int_factor WHERE chk = 'X'.
        DELETE int_factor WHERE chk = 'X' .
        CONTINUE.
      ENDLOOP.
      CLEAR int_factor.
    ENDFORM.
    for any clarifiaction pls mail me.
    pls reward points, if this helped u.
    regards,
    anversha.
    [email protected]
    Message was edited by: Anversha s

  • How to select perticular row in table control for BDC

    Hi all
    I want to select perticular row in table control for deletion through BDC. My transaction is CA02, My input is  material no and plant , then it display table control with work center. Now i want to select W999 cost center and delete through BDC.
    Please Suggest me. it urgent.
    Thanks& Regards,
    RP

    Hi all
    I want to select perticular row in table control for deletion through BDC. My transaction is CA02, My input is  material no and plant , then it display table control with work center. Now i want to select W999 cost center and delete through BDC.
    Please Suggest me. it urgent.
    Thanks& Regards,
    RP

  • How to delete a row of table in Word using powershell.

    I want to search for a word which is present in Table. If that word is present than I want to delete that row from table.
    Can anybody help me with that. The script I am using is:
    $objWord = New-Object -ComObject word.application
    $objWord.Visible = $True
    $objDoc = $objWord.Documents.Open("C:\temp\Recipe.docx")
    $FindText = "DP1"
    $objSelection.Find.Execute($FindText)
    $objWord.Table.Cells.EntireRow.Delete()
    $objDoc.SaveAs("C:\Temp\P.docx")
    $Doc.Close()

    Maybe try this:
    $objWord = New-Object -ComObject word.application
    $objWord.Visible = $True
    $objWord.Documents.Open("C:\temp\Recipe.docx")
    $FindText = "DP1"
    $objWord.Selection.Find.Execute($FindText) | Out-Null
    $objWord.Selection.SelectRow()
    $objWord.Selection.Cells.Delete()
    $objWord.Documents.SaveAs("C:\Temp\P.docx")
    $objWord.Close()
    $objWord.Quit()
    [System.Runtime.InteropServices.Marshal]::ReleaseComObject([System.__ComObject]$objWord) | Out-Null
    This definitely assumes the text you're trying to find only exists in a table, per your specified requirements.  If it exists anywhere else, or in multiple tables, the code above is inadequate.
    I hope this post has helped!

  • How to delete certain rows from Table view

    Hi Experts,
    I need to display result on the basis of certain process type. So i have used code like below.
           lv_iterator =   me->typed_context->searchresult->collection_wrapper->get_iterator( ).
           lv_entity = lv_iterator->get_first( ).
           WHILE lv_entity IS BOUND.
             CLEAR:lv_object.
             lv_object = lv_entity->get_property_as_string( iv_attr_name = 'PROCESS_TYPE' ).
             IF lv_object <> 'XXX'.
               lr_entity ?= lv_entity.
              me->typed_context->searchresult->collection_wrapper->remove( lv_entity ).
              lr_entity->delete( ).
             ENDIF.
             lv_entity = lv_iterator->get_next( ).
           ENDWHILE.
    But only some of the entities from the collection are getting removed. Still some wrong entities exists which i cant even able to delete it by using ,
              me->typed_context->searchresult->collection_wrapper->remove( lv_entity ).
              lr_entity->delete( ).
    Am i missing anything here?
    Regards,
    Santhosh

    Hi Santhosh,
    Maybe that is happening because you're removing elements from an object (collection_wrapper) inside your loop.
    Can you try to create an collection wrapper copy by using GET_COPY method, and then use and loop the iterator on your copied object, and remove the unwanted entities on your main object?
    Kind regards,
    Garcia

  • How to Delete certain rows from table view collection

    Hi Experts,
    I need to display result on the basis of certain process type. So i have used code like below.
           lv_iterator =   me->typed_context->searchresult->collection_wrapper->get_iterator( ).
           lv_entity = lv_iterator->get_first( ).
           WHILE lv_entity IS BOUND.
             CLEAR:lv_object.
             lv_object = lv_entity->get_property_as_string( iv_attr_name = 'PROCESS_TYPE' ).
             IF lv_object <> 'XXX'.
               lr_entity ?= lv_entity.
              me->typed_context->searchresult->collection_wrapper->remove( lv_entity ).
              lr_entity->delete( ).
             ENDIF.
             lv_entity = lv_iterator->get_next( ).
           ENDWHILE.
    But only some of the entities from the collection are getting removed. Still some wrong entities exists which i cant even able to delete it by using ,
              me->typed_context->searchresult->collection_wrapper->remove( lv_entity ).
              lr_entity->delete( ).
    Am i missing anything here?
    Regards,
    Santhosh

    Hi Santhosh,
    Maybe that is happening because you're removing elements from an object (collection_wrapper) inside your loop.
    Can you try to create an collection wrapper copy by using GET_COPY method, and then use and loop the iterator on your copied object, and remove the unwanted entities on your main object?
    Kind regards,
    Garcia

  • To delete multiple entries in table control in module pool

    Hi,
    Please help me out to know , <b>how to delete multiple entries from table control</b> when multiple lines in table control are selected.
    Regards,
    Irfan Hussain

    hai,
        you can do it inthis way.
    in the PAI event.
    loop at <table control name>
      module del_itab.
    endloop.
    in the nodule,write the folowing code.
    if <tablecontrol>-fieldname = 'X'.
    delete <tablecontrol-itab>
    endif.
    cheers

  • How to use PF status in Table Control?

    I have made 1 table control. Now I need to use three buttons like SELECT, DESELECT, DELETE the rows of table control using PF STATUS.  Can you plz help with the Code.

    Hi.
    Refer this code.
    The following example processes a table control with LOOP with parallel loop using an internal table. By using function codes you can sort columns and delete rows from the internal table. The ready for input status of the table control fields is controlled using a function code.
    REPORT demo_dynpro_tabcont_loop_at.
    CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
    DATA: cols LIKE LINE OF flights-cols,
          lines TYPE i.
    DATA: ok_code TYPE sy-ucomm,
          save_ok TYPE sy-ucomm.
    DATA: itab TYPE TABLE OF demo_conn.
          TABLES demo_conn.
    SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE itab.
    LOOP AT flights-cols INTO cols WHERE index GT 2.
      cols-screen-input = '0'.
      MODIFY flights-cols FROM cols INDEX sy-tabix.
    ENDLOOP.
    CALL SCREEN 100.
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'SCREEN_100'.
      DESCRIBE TABLE itab LINES lines.
      flights-lines = lines.
    ENDMODULE.
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.
    MODULE read_table_control INPUT.
      MODIFY itab FROM demo_conn INDEX flights-current_line.
    ENDMODULE.
    MODULE user_command_0100 INPUT.
      save_ok = ok_code.
      CLEAR ok_code.
      CASE save_ok.
        WHEN 'TOGGLE'.
          LOOP AT flights-cols INTO cols WHERE index GT 2.
            IF  cols-screen-input = '0'.
              cols-screen-input = '1'.
            ELSEIF  cols-screen-input = '1'.
              cols-screen-input = '0'.
            ENDIF.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDLOOP.
        WHEN 'SORT_UP'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
            cols-selected = ' '.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'SORT_DOWN'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
            cols-selected = ' '.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'DELETE'.
          READ TABLE flights-cols INTO cols
                                  WITH KEY screen-input = '1'.
          IF sy-subrc = 0.
            LOOP AT itab INTO demo_conn WHERE mark = 'X'.
              DELETE itab.
            ENDLOOP.
          ENDIF.
      ENDCASE.
    ENDMODULE.
    Reward all helpfull answers.
    Regards.
    Jay

  • How can I insert, modify and delete entries on my table control?

    Hi,
    I already have build a table control. Now I want to make manipulations on it. Therefore I have created 3 buttons, insert, modify and delete. But how can I get actions on table control.
    This is my code for the internal table:
    BEGIN OF its OCCURS 0,
    mark TYPE C VALUE ' ',
    artikel_nr TYPE ZARTIKEL-ARTIKEL_NR,
    artikel_typ TYPE ZARTIKEL-TYPE,
    bezeichnung TYPE ZARTIKEL-BEZEICHNUNG,
    preis TYPE ZARTIKEL-PREIS,
    mwst TYPE ZARTIKEL-MWST,
    END OF its.
    and this is the code which i wanted to  delete a row in my table control:
    WHEN 'DELETE'.
    LOOP AT its WHERE mark EQ 'X'.
    DELETE its WHERE mark = 'X'.
    MOVE its TO ZARTIKEL.
    ENDLOOP.
    ENDCASE.
    ENDMODULE:
    and my PBO and PAI:
    PROCESS BEFORE OUTPUT.
    LOOP AT its INTO ZARTIKEL WITH CONTROL ARTIKEL.
    ENDLOOP.
    PROCESS AFTER INPUT.
    MODULE EXIT.
    LOOP AT its.
    MODULE V1.
    ENDLOOP.
    MODULE user_command_1060.
    But if I now open my table control and mark the line that I wanted to delete, nothing happens, not on my internal table and the data even not deleted on my table ZARTIKEL. Have you an idea what I did wrong??

    Hi,
    In the attributes of table control take the SELCOL as wa_zekpo-flag
    And in the internal table and work area add a field as flag(1) TYPE c
    Refer:
    At screen logic:-
    PROCESS BEFORE OUTPUT.
      MODULE status_8002.
      LOOP WITH CONTROL po_tab.
        MODULE pass_data.
      ENDLOOP.
    PROCESS AFTER INPUT.
      MODULE user_command_8002.
      LOOP WITH CONTROL po_tab.
        MODULE modify_data.
      ENDLOOP.
      MODULE function.
    In PBO,
    MODULE status_8002 OUTPUT.
      SET PF-STATUS 'ZTG_SELTB'.
      DATA : line_count TYPE i.
      DESCRIBE TABLE it_ekpo
      LINES line_count.
      po_tab-lines = line_count + 5.
    ENDMODULE.                 " STATUS_8002  OUTPUT
    *&      Module  PASS_DATA  OUTPUT
    MODULE pass_data OUTPUT.
      READ TABLE it_ekpo into wa_ekpo INDEX po_tab-current_line.
    ENDMODULE.                 " PASS_DATA  OUTPUT
    In PAI,
    *&      Module  USER_COMMAND_8002  INPUT
    MODULE USER_COMMAND_8002 INPUT.
      OK_CODE = SY-UCOMM.
      CASE OK_CODE.
        WHEN 'BACK'.
          LEAVE TO SCREEN 8001.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_8002  INPUT
    *&      Module  MODIFY_DATA  INPUT
    MODULE DISPLAY_DATA INPUT.
      MODIFY IT_EKPO INDEX PO_TAB-CURRENT_LINE FROM WA_EKPO.
    ENDMODULE.                 " MODIFY_DATA  INPUT
    *&      Module  FUNCTION  INPUT
    MODULE FUNCTION INPUT.
      OK_CODE = SY-UCOMM.
      CASE OK_CODE.
        WHEN 'SELECT'. "<--select all records
          LOOP AT IT_EKPO INTO WA_EKPO.
            WA_EKPO-FLAG = 'X'.
            MODIFY IT_EKPO FROM WA_EKPO.
          ENDLOOP.
        WHEN 'DESEL'. "<--deselect all records
          LOOP AT IT_EKPO INTO WA_EKPO.
            WA_EKPO-FLAG = ' '.
            MODIFY IT_EKPO FROM WA_EKPO.
          ENDLOOP.
        WHEN 'DELETE'.
          DELETE FROM it_ekpo WHERE flag = 'X'.
      ENDCASE.
    ENDMODULE.                 " FUNCTION  INPUT
    Regards,
    Tarun

  • How to insert row in table control and save the data in tables

    Hi,
    I have one table control i am displaying data into table control ,
    my problem is : i want to display data into read mode in table control.
    but when i click on insert button on the same screen i want one blank line should inserted into table control , then i want to insert some data into table control on that row , when i click the save button . the new data inserted into the table control is insert that data into ztable ,
    please give me solution
    main problen is  how can know inserted line in table control and pass that data into ztable.

    Hi,
    Follow the below logic,
    PROCESS BEFORE OUTPUT.
      MODULE STATUS_0001.
      MODULE POPULATE_TABLE_CONTROL. --> Get the data from table store in 
                                                                          ITAB
      LOOP AT GT_CTRL_LP_D516 INTO GS_WA_CTRL_LP_D516
           WITH CONTROL CTRL_LP_D516
           CURSOR CTRL_LP_D516-CURRENT_LINE.
      The following module moves data to control
        MODULE MOVE_TO_CONTROL.--> Move data from ITAB to table control
      ENDLOOP.
    PROCESS AFTER INPUT.
      LOOP AT GT_CTRL_LP_D516.
      ENDLOOP.
      MODULE EXIT AT EXIT-COMMAND.
      MODULE USER_COMMAND_0001.  --> Here you have to take out the values from table control and update database table
    Reward points if helpful.
    Thanks and regards,
    Mallareddy Rayapureddy,
    Munich, Germany.

Maybe you are looking for