Hiding a Column with CL_SALV_TABLE


REPORT zsalv_table_diaplay.

CLASS sales_order_disp DEFINITION.

  PUBLIC SECTION.

    DATA o_salv TYPE REF TO cl_salv_table.

    METHODS build_salesorder,

                        disp_salesorder.

  PRIVATE SECTION.

    DATA lt_vbak TYPE TABLE OF vbak.

ENDCLASS.

CLASS sales_order_disp IMPLEMENTATION.

  METHOD build_salesorder.

    SELECT FROM vbak INTO TABLE lt_vbak UP TO 50 ROWS.

  ENDMETHOD.

  METHOD disp_salesorder.

    DATA o_cols TYPE REF TO cl_salv_columns_table,

               o_col  TYPE REF TO cl_salv_column_table.

    TRY.

        cl_salv_table=>factory(

          IMPORTING

            r_salv_table   o_salv    ” Basis Class Simple ALV Tables

          CHANGING

            t_table        lt_vbak

        ).

      CATCH cx_salv_msg.  

    ENDTRY.

**********START OF HOT SPOT ON ***************

    o_cols o_salv->get_columns).

    TRY.

        o_col ?= o_cols->get_column‘VBELN’ )” sales reder number

      CATCH cx_salv_not_found.

    ENDTRY.

    o_col->set_cell_typeif_salv_c_cell_type=>hotspot ).

*   o_col->set_cell_type( value =  5 ).

**********END OF HOT SPOT ON ****************

**********START OF HIDING A COLUMN ***************

    TRY.

        o_col ?= o_cols->get_column‘ERZET’ )” Entry time

      CATCH cx_salv_not_found.

    ENDTRY.

    o_col->set_visiblevalue if_salv_c_bool_sap=>false ).

**********END OF HIDING A COLUMN ****************

    o_salv->display).

  ENDMETHOD.

ENDCLASS.

START-OF-SELECTION.

  DATAo_salesord TYPE REF TO sales_order_disp.

  CREATE OBJECT o_salesord.

  o_salesord->build_salesorder).

  o_salesord->disp_salesorder).


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s