Skip to Content
author's profile photo Former Member
Former Member

Class available to handle table control

Hi Experts..

Is there any class available to handle table control ...

as there is class for grid control - CL_GUI_ALV_GRID

if yes what is the name and how to handle it...

Also like to know where i can get list of all classes and documentation related to it

..

Thanks

..Ashish

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 04, 2008 at 02:09 PM

    Hi

    Try to use class CL_TABLECONTROL. I never used it, but method names and descriptions to them makes me think that table control is handled by this class.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 04, 2008 at 08:34 PM

    Hello Ashish

    I have neither known nor used this class before. Therefore, I tried to write a small sample report which shows how to get the marked rows from a table control with MARK row (see FORM execute_tabctrl_methods ).

    Screen '0100' flow logic (I used the table control wizard):

    
    PROCESS BEFORE OUTPUT.
      MODULE status_0100.
    
    
    *&SPWIZARD: MODULE TABCTRL1_CHANGE_TC_ATTR.
    *&SPWIZARD: MODULE TABCTRL1_CHANGE_COL_ATTR.
      LOOP AT   gt_outtab
           INTO gs_outtab
           WITH CONTROL tabctrl1
           CURSOR tabctrl1-current_line.
    *&SPWIZARD:   MODULE TABCTRL1_CHANGE_FIELD_ATTR
        MODULE tabctrl1_move.
        MODULE tabctrl1_get_lines.
      ENDLOOP.
    
    
    
    
    *
    PROCESS AFTER INPUT.
    *&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TABCTRL1'
      LOOP AT gt_outtab.
        CHAIN.
          FIELD knb1-mandt.
          FIELD knb1-kunnr.
          FIELD knb1-bukrs.
          FIELD knb1-pernr.
          FIELD knb1-erdat.
          FIELD knb1-ernam.
          FIELD knb1-sperr.
          FIELD knb1-loevm.
          FIELD knb1-zuawa.
          FIELD knb1-busab.
          FIELD knb1-akont.
          MODULE tabctrl1_modify ON CHAIN-REQUEST.
        ENDCHAIN.
      ENDLOOP.
      MODULE tabctrl1_user_command.
    *&SPWIZARD: MODULE TABCTRL1_CHANGE_TC_ATTR.
    *&SPWIZARD: MODULE TABCTRL1_CHANGE_COL_ATTR.
    
      MODULE user_command_0100.
    

    Screen '0100' contains table control TABCTRL1 with some fields of KNB1.

    The ok-code field is assigned to GD_OKCODE.

    " Element list:
    TABCTRL1
    KNB1-MANDT
    KNB1-KUNNR
    KNB1-BUKRS
    KNB1-PERNR
    KNB1-ERDAT
    KNB1-ERNAM
    KNB1-SPERR
    KNB1-LOEVM
    KNB1-ZUAWA
    KNB1-BUSAB
    KNB1-AKONT  " all text fields
    MARK             " MARK column
    KNB1-MANDT " I/O fields
    KNB1-KUNNR
    KNB1-BUKRS
    KNB1-PERNR
    KNB1-ERDAT
    KNB1-ERNAM
    KNB1-SPERR
    KNB1-LOEVM
    KNB1-ZUAWA
    KNB1-BUSAB
    KNB1-AKONT
    GD_OKCODE " ok-code field
    

    Sample report ZUS_SDN_TABLECONTROL:

    *&---------------------------------------------------------------------*
    *& Report  ZUS_SDN_TABLECONTROL
    *&
    *&---------------------------------------------------------------------*
    *& Thread: Class available to handle table control
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1074146"></a>
    *&---------------------------------------------------------------------*
    
    REPORT  zus_sdn_tablecontrol.
    
    TYPE-POOLS: abap.
    
    TYPES: BEGIN OF ty_s_outtab.
    TYPES:  mark TYPE abap_bool.
    INCLUDE TYPE knb1.
    TYPES: END OF ty_s_outtab.
    TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                          WITH DEFAULT KEY.
    
    DATA: gt_outtab    TYPE ty_t_outtab,
          gs_outtab    TYPE ty_s_outtab.
    
    DATA:
      gd_okcode        TYPE ui_func,
      gd_repid         TYPE syrepid.
    
    
    
    ***&SPWIZARD: DATA DECLARATION FOR TABLECONTROL 'TABCTRL1'
    *&SPWIZARD: DEFINITION OF DDIC-TABLE
    TABLES:   knb1.
    
    
    *&SPWIZARD: DECLARATION OF TABLECONTROL 'TABCTRL1' ITSELF
    CONTROLS: tabctrl1 TYPE TABLEVIEW USING SCREEN 0100.
    
    *&SPWIZARD: LINES OF TABLECONTROL 'TABCTRL1'
    DATA:     g_tabctrl1_lines  LIKE sy-loopc.
    
    
    DATA: go_tabctrl    TYPE REF TO cl_tablecontrol,
          go_tc_data    TYPE REF TO cl_satt_tc_data.
    
    
    
    PARAMETERS:
      p_bukrs      TYPE bukrs  DEFAULT '2000'  OBLIGATORY.
    
    
    
    START-OF-SELECTION.
    
      SELECT  * FROM  knb1 INTO CORRESPONDING FIELDS OF TABLE gt_outtab
        UP TO 20 ROWS
             WHERE  bukrs  = p_bukrs.
    
    
    
      TRY.
          CREATE OBJECT go_tc_data
            EXPORTING
              i_t_values  = gt_outtab
              i_markfield = 'MARK'.
    
          CREATE OBJECT go_tabctrl
            EXPORTING
              i_tc     = tabctrl1
              i_table_data = go_tc_data
              i_mode   = 'C'
    *        i_empty_lines = 15
    *        i_ok_delete_row = 'satt14'
    *        i_ok_deselect_all = 'satt02'
    *        i_ok_first_page = 'satt06'
    *        i_ok_insert_multiple_lines = 'satt12'
    *        i_ok_insert_row = 'satt13'
    *        i_ok_last_page = 'satt09'
    *        i_ok_next_page = 'satt08'
    *        i_ok_previous_page = 'satt07'
    *        i_ok_select_all = 'satt01'
    *        i_ok_sort_down = 'satt10'
    *        i_ok_sort_up = 'satt11'
    *        i_ok_system_copy = 'satt04'
    *        i_ok_system_cut = 'satt03'
    *        i_ok_system_paste = 'satt05'
    *        i_ok_undo = 'satt15'
            EXCEPTIONS
              canceled = 1
              error    = 2
              OTHERS   = 3.
          IF sy-subrc <> 0.
    *     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    
        CATCH cx_satt_wrong_fieldname .
        CATCH cx_satt_error .
      ENDTRY.
    
    
    * ok-code field = GD_OKCODE
      CALL SCREEN '0100'.
    
    
    END-OF-SELECTION.
    
    *&---------------------------------------------------------------------*
    *&      Module  STATUS_0100  OUTPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    
    **      CALL METHOD go_grid1->refresh_table_display
    ***        EXPORTING
    ***          IS_STABLE      =
    ***          I_SOFT_REFRESH =
    **        EXCEPTIONS
    **          FINISHED       = 1
    **          others         = 2
    **              .
    **      IF sy-subrc <> 0.
    ***       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    ***                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    **      ENDIF.
    
    ENDMODULE.                 " STATUS_0100  OUTPUT
    
    *&---------------------------------------------------------------------*
    *&      Module  USER_COMMAND_0100  INPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE user_command_0100 INPUT.
    
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
    
    
    
        WHEN OTHERS.
          PERFORM execute_tabctrl_methods.
    
      ENDCASE.
    
      CLEAR: gd_okcode.
    
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    
    
    *&---------------------------------------------------------------------*
    *&      Form  EXECUTE_TABCTRL_METHODS
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *  -->  p1        text
    *  <--  p2        text
    *----------------------------------------------------------------------*
    FORM execute_tabctrl_methods .
      DATA: lt_marked_rows    TYPE satt_tabix_t.
    
      break-point.
      TRY.
          CALL METHOD go_tabctrl->get_marked_rows
            RECEIVING
              e_t_index = lt_marked_rows.
    
        CATCH cx_satt_error .
      ENDTRY.
    
    ENDFORM.                    " EXECUTE_TABCTRL_METHODS
    
    
    
    
    *&SPWIZARD: OUTPUT MODULE FOR TC 'TABCTRL1'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: MOVE ITAB TO DYNPRO
    MODULE tabctrl1_move OUTPUT.
      MOVE-CORRESPONDING gs_outtab TO knb1.
    ENDMODULE.                    "TABCTRL1_MOVE OUTPUT
    
    *&SPWIZARD: OUTPUT MODULE FOR TC 'TABCTRL1'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: GET LINES OF TABLECONTROL
    MODULE tabctrl1_get_lines OUTPUT.
      g_tabctrl1_lines = sy-loopc.
    ENDMODULE.                    "TABCTRL1_GET_LINES OUTPUT
    
    *&SPWIZARD: INPUT MODULE FOR TC 'TABCTRL1'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: MODIFY TABLE
    MODULE tabctrl1_modify INPUT.
      MOVE-CORRESPONDING knb1 TO gs_outtab.
      MODIFY gt_outtab
        FROM gs_outtab
        INDEX tabctrl1-current_line.
    ENDMODULE.                    "TABCTRL1_MODIFY INPUT
    
    
    *----------------------------------------------------------------------*
    *   INCLUDE TABLECONTROL_FORMS                                         *
    *----------------------------------------------------------------------*
    

    Regards

    Uwe

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 06, 2008 at 06:03 AM

    Can You send me link related to table control class documentation

    Add a comment
    10|10000 characters needed characters exceeded

    • Hello Ashih

      Actually I was hoping that you are taking my little input to dig deeper into this class and share your knowledge and experiences with us (SDN members).

      As I said I have never used this class before and it is unlikely that I will use in the future because I basically cannot program table controls anymore. I will always replace them by editable ALV grids which are much more powerful.

      Regards

      Uwe

  • author's profile photo Former Member
    Former Member
    Posted on Nov 11, 2008 at 08:43 AM

    Answered

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.