Hide a column in ALV

How can I programmatically default a column to be hidden in ALV? But user can choose the field to be shown when he/she changes the layout of grid display.
Thanks!

in the fieldcatalog structure there is one field NO_OUT pass 'X' to that field.
wa_fcat-row  = 1.
wa_fcat-....
wa_fcat-....
<b>wa_fcat-no_out = 'X'.</b>
append wa_fcat to it_fcat.
Ramesh.

Similar Messages

  • Hide a Column in ALV Grid Output

    Hi,
    I want to hide a column in ALV Grid Output through program.
    I am using   lwa_fieldcat-NO_OUT = 'X'. to hide the column in output but it is not working, column in not hided in the output.
    Kindly suggest.

    It should work..
    see the code :
    d_fieldcat_wa-fieldname = 'MATNR'.
    d_fieldcat_wa-seltext_l = 'material number'.
    d_fieldcat_wa-no_out = 'X'. * hide particular field
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    if not please paste your code here.
    Thanks
    Seshu

  • How to hide ,unhide columns  in ALV List

    Hi all,
    How to hide ,unhide columns  in ALV List..
    Plz guide me.
    Thanks in advance..
    Albert

    Hi Joseph,
    Check the following thread:
    Hide Unhide columns of ALV grid Report.
    Regards,
    Archana

  • How to hide selection column from alv grid

    hi
    i want to hide selection columns form alv grid.. how can i do it.. Is there any fm for that?
    regards
    palak

    Hi,
    the ALV Grid Control allows you to directly hide key columns with NO_OUT (field KEY_SEL is not used).
    Field name:NO_OUT
    Comp. type:LVC_NOOUT
    Dtype(length):Char(1)
    SPACE, 'X'
    If you set this field, you hide the relevant column in the list. Nevertheless, the column is available in the field selection and can be interactively selected by the user as a display field. The ALV displays the contents of hidden fields on the detail screen for a row in the grid control.
    Regards,
    Neenu.
    Edited by: Neenu Jose on Oct 21, 2008 10:46 AM

  • Hide some columns in alv if no values are present for that columns ..

    Hi all,
    This looks like a wierd requirement ..In my ALV report, i am displaying around 30 fields. Among those , based on the input ,data will not be there for some  of the columns .. In the output we want to hide those columns
    eg:
    Matnr     Descr    Column3  Column4
    Mat1      Des1     (No data)  sfsfs
    Mat2      Des2     (No data)  (No data)
    The required output is :
    Matnr     Descr    Column4
    Mat1      Des1     sfsfs
    Mat2      Des2     (No data)
    How to do this in the most simplest / right way?
    Hope my question is clear .
    Thanking you in advance,
    Shankar

    Hi shankara,
    1. In the output we want to hide those columns
    For this,
      a) first we have to know/detect  by looping the table/logic
         that which fields contain no data / are to be hidden
       b) after that we have to use the field catalogue properties.
        c) We have to loop at the fieldcatalogue,
            and set the value fieldcat-NO_OUT = 'X'.
           for those fields.
        (In this manner, those fields/columns won't be shown)
    regards,
    amit m.

  • How to hide one column in Alv if it doesnt contain any value

    Hi,
      In alv Grid if one coulmn doesnt conatin any value.I doesnt want to display in ALV grid.Is dat possible. Plz help.

    Hello Anu
    When you prepare your fieldcatalog check the column of the output itab for its contents, e.g.:
    " Itab GT_FCAT contains fieldcatalog.
    " Itab GT_OUTTAB contains ALV list data.
    " Condition: column "MY_COLUMN" should contain at least single value > 0
      LOOP AT gt_outtab TRANSPORTING NO FIELDS
                     WHERE ( my_column > 0 ).
        EXIT.
      ENDLOOP.
      IF ( syst-subrc NE 0 ).  " Column "MY_COLUMN" contains no value > 0, then hide column
        READ TABLE gt_fcat INTO ls_fcat
                  WITH KEY fieldname = 'MY_COLUMN'.
        IF ( syst-subrc = 0 ).
          ls_fcat-no_out = 'X'.  " not displayed, but visible in layout
          ls_fcat-tech = 'X'.     " not displayed, not available in layout
          MODIFY GT_FCAT FROM ls_fcat INDEX syst-tabix.
        ENDIF.
      ENDIF.
    Regards
      Uwe

  • Hide column in alv grid

    Hi Everyone,
    I would like to know how to hide a column in alv grid. Is there any specific field to set in the field catalog.
    Thanks in advance,
    Prabs.

    Hello friends,
    I am using the following lines of code, but invisible of my column ( message ) is not working, would be nice if some one can give me any tip.
    Field-symbols: <lfs_fieldcat> TYPE lvc_s_fcat.
      LOOP AT pt_fieldcat ASSIGNING <lfs_fieldcat>.
        CASE <lfs_fieldcat>-fieldname.
          WHEN 'DUMMY'.
            <lfs_fieldcat>-coltext = 'Message'.
            <lfs_fieldcat>-no_out = 'X'.
        ENDCASE.
      ENDLOOP.
    I have also set the field catalog to no_out = 'X'.
    PS: Do I need to append the field catalog to internal table ??
    I am using the function
    CALL METHOD lalv->SET_TABLE_FOR_FIRST_DISPLAY
             EXPORTING I_STRUCTURE_NAME =  'abc'
                       IS_LAYOUT        = ps_layout
             CHANGING  IT_OUTTAB        = xyz.
    Do I have to implicit set the field catalog in ps_layout ??

  • Hiding empty columns in ALV

    Hi all,
    I want to hide some columns in ALV which are empty on display when calling
    cl_gui_alv_grid->set_table_for_first_display
    That is to say the internaltable will contain empty columns.
    I know that using the "no_out" attribute of field catalog we can hide columns.
    But the question is how to find these columns which are empty - should I have to loop through the itab to find it out OR
    Can we set it in ALV LAYOUT or field catalog attributes so that it wont display empty columns.
    any help is appreciated....
    Thanks
    P
    Edited by: pazzuzu on Mar 12, 2010 5:14 PM

    Hi,
    If i understood your question correctly,
    The you can try this
    TYPE-POOLS:slis,abap.
    TYPES:BEGIN OF ty,
          f1 TYPE c,
          f2 TYPE c,
          f3 TYPE c,
          f4 TYPE c,
          END OF ty.
    DATA:it TYPE TABLE OF ty,
         wa TYPE ty,
         wa_field TYPE slis_fieldcat_alv,
         i_fieldcat TYPE TABLE OF slis_fieldcat_alv,
         i_details TYPE abap_compdescr_tab,
         wa_comp TYPE abap_compdescr,
         ref_descr TYPE REF TO cl_abap_structdescr,
         lv_field TYPE abap_compname.
    FIELD-SYMBOLS:<fs>,
                  <fs1>.
    ref_descr ?= cl_abap_typedescr=>describe_by_data( wa ).
    i_details[] = ref_descr->components[].
    wa-f1 = 'A'.
    wa-f3 = 'C'.
    APPEND wa TO it.
    wa-f1 = 'X'.
    wa-f3 = 'Y'.
    APPEND wa TO it.
    if it[] is not initial.
    LOOP AT i_details INTO wa_comp.
      ASSIGN wa_comp-name TO <fs>.
      SORT it BY (<fs>) DESCENDING.
      CONCATENATE 'WA' '-' <fs> INTO lv_field .
      ASSIGN (lv_field) TO <fs1>.
        READ TABLE it INTO wa INDEX 1 transporting (<fs>).
      IF sy-subrc = 0 AND <fs1> IS NOT INITIAL.
        wa_field-fieldname = wa_comp-name.
        wa_field-seltext_m = wa_comp-name.
        APPEND wa_field TO i_fieldcat.
      ENDIF.
    ENDLOOP.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program = sy-repid
        it_fieldcat        = i_fieldcat[]
      TABLES
        t_outtab           = it[].
    endif.

  • Hideing a Column in ALV Table which is Displaying the POWL Query data

    Hi SDNers,
    I want to hide a column of ALV Table which is displaying my POWL Query data in it and hideing should be based on the Role as well. i.e few of the role the column shoudl be hidden and few of the roles should have the Column visible.
    waiting for the Valueble Answers.
    Thanks & Regards,
    Govindu

    Hai Kris,
        I took help from ur link and i declared a global attribute request_number.
    and i created an event handler ON_ALV_INSERT and did the follwing coding for giving default value wen ever am inserting new row.
    FIELD-SYMBOLS: <wa_row> LIKE LINE OF r_param->t_inserted_rows.
      DATA bill_details TYPE REF TO zdom_bill_detail.
      LOOP AT r_param->t_inserted_rows ASSIGNING <wa_row>.
        bill_details ?= <wa_row>-r_value.
        IF bill_details->REQ_NUMBER IS INITIAL.
      DATA lo_nd_bill_detail TYPE REF TO if_wd_context_node.
      DATA lo_el_bill_detail TYPE REF TO if_wd_context_element.
      DATA ls_bill_detail TYPE wd_this->Element_bill_detail.
    navigate from <CONTEXT> to <BILL_DETAIL> via lead selection
      lo_nd_bill_detail = wd_context->get_child_node( name = wd_this->wdctx_bill_detail ).
    lo_el_bill_detail = lo_nd_bill_detail->get_element( index = <wa_row>-index ).
          lo_el_bill_detail->set_attribute(
            EXPORTING
              name  = 'REQ_NUMBER'
              value = wd_comp_controller->request_number
    Wen am  setting the value of wd_comp_controller->request_number to my context attribute am getting NULL object ref error.
    lo_el_bill_detail->set_attribute(
        name =  `REQ_NUMBER`
        value = wd_comp_controller->request_number ).
    Pls give some suggestions,
    Thanks in Advance,
    Nalla.B

  • How to hide columns in ALV? (via cl_salv_table)

    Dear forumers,
    Is there a way for me to hide a few columns (or data fields) from being displayed in the ALV table, using the cl_salv_table method?
    FORM display_data_alv .
      TRY.
          CALL METHOD cl_salv_table=>factory
            IMPORTING
              r_salv_table = o_table
            CHANGING
              t_table      = i_ro_assets.
        CATCH cx_salv_msg.
      ENDTRY.
      o_functions = o_table->get_functions( ).
      o_functions->set_all( abap_true ).
      o_columns = o_table->get_columns( ).
      o_columns->set_optimize( abap_true ).
      PERFORM set_columns.
      o_events = o_table->get_event( ).
      CREATE OBJECT o_handle_events.
      SET HANDLER o_handle_events->on_double_click FOR o_events.
      o_table->display( ).
    ENDFORM.                    " DISPLAY_DATA_ALV
    FORM set_columns .
      TRY.
          o_column ?= o_columns->get_column( 'BUKRS' ).
          o_column->set_long_text( text-008 ).
        CATCH cx_salv_not_found.
      ENDTRY.
      TRY.
          o_column ?= o_columns->get_column( 'ANLN1' ).
          o_column->set_long_text( text-009 ).
        CATCH cx_salv_not_found.
      ENDTRY.
    ENDFORM.                    " SET_COLUMNS
    I have also tried to exclude some columns from the subroutine SET_COLUMNS, but they are still showing in the resulting ALV table. What can I do here next?
    Appreciate any help here.
    Thanks very much.

    You can use the method SET_COLUMN_TECHNICAL of the class CL_SALV_COLUMN  to hide the Column.
    data:
      ir_columns type ref to cl_salv_columns_table,
      lr_column type ref to cl_salv_column.
      try.
          lr_column = ir_columns->get_column( 'MANDT' ).
          lr_column->set_technical( if_salv_c_bool_sap=>true ).
        catch cx_salv_not_found.                            "#EC NO_HANDLER
      endtry.
    Check the report SALV_DEMO_TABLE_COLUMNS to know more about the Column processing in SALV model.
    Regards,
    Naimesh Patel

  • Hide columns for ALV list output in SAP Query SQ01/SQ02

    Hi All,
    I have a requirement to hide the columns which are empty in sap query SQ01 alv list output.
    Please let me know this functionality available in Query (SQ01) like normal reports
    Regards,
    Venkat

    Hi,
    We just can't make changes in this case as this are all system generated programs.
    WE have to write our own reports to make things flexible to match our requirements.
    Things you are asking is not possible.
    Regards,
    Suvendu

  • Hide columns in ALV

    Hello ,
    I have a problem in the ALV usage in abap webdrn pro.
    I have implemented the ALV by reusing the component SALV_WD_TABLE.
    In the interface controller usage, i mapped the DATA node to
    component context node, say, node1.
    Node1 is has a reference to a structure from data ditionary, say Struc1.
    and Stuc1 has some 20 elements.
    But in the Node1 i mapped only 10 elements of the structure Struc1 as its attributes.
    Now, when i map 'data' node to the Node1 from controller,
    My ALV shows all teh 20 columns.
    But i want only 10 of these columns to be displayed in the ALV.
    Please let me know if.
    I already know of referring to the ALV programmatically and hiding the columns.
    But my question is taht when the Node1 has only few elements, shouldnt the alv also display the same number of coloumns..
    Please let know if there is a way out here.
    regards,
    Kiran

    Hi,
    if you want to hide a column named OBJID and OBJTYP then implement following coding
    DATA:
    lr_comp_alv TYPE REF TO if_wd_component_usage,
    lr_comp_if_alv TYPE REF TO iwci_salv_wd_table,
    lr_config TYPE REF TO cl_salv_wd_config_table,
    lr_column TYPE REF TO cl_salv_wd_column,
    ls_column TYPE salv_wd_s_column_ref,
    lt_columns TYPE salv_wd_t_column_ref.
    data: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
    *... ALV Component Usage
    lr_comp_alv = wd_this->wd_cpuse_alv( ).
    IF lr_comp_alv->has_active_component( ) IS INITIAL.
    lr_comp_alv->create_component( ).
    ENDIF.
    lr_comp_if_alv = wd_this->wd_cpifc_alv( ).
    *... Configure ALV
    lr_config = lr_comp_if_alv->get_model( ).
    lr_config->if_salv_wd_table_settings~set_read_only( abap_false ).
    lr_config->if_salv_wd_std_functions~set_edit_insert_row_allowed( ).
    lr_config->if_salv_wd_std_functions~set_view_list_allowed( abap_false ).
    lr_config->if_salv_wd_std_functions~set_export_allowed( abap_true ).
    lt_columns = lr_config->if_salv_wd_column_settings~get_columns( ).
    lr_column = lr_config->if_salv_wd_column_settings~get_column('OBJID' ).
    *To hide particular coulmn
    LOOP AT lt_columns INTO ls_column.
    CASE ls_column-id.
    when 'OBJID'.
    ls_column-r_column->set_visible( value = '99' ).
    when 'OBJTP'.
    ls_column-r_column->set_visible( value = '99' ).
    ENDCASE.
    ENDLOOP.

  • Hide column in  alv

    how i can make column hide in alv report

    Set the NO_OUT parameter in the field catalog as X.
    no_out(1)      type c,        " (O)blig.(X)no out
    In the case it would not show the column in ALV list
    Message was edited by: Anurag Bankley

  • Hide a column in hierarchial alv

    hi,
    how can we hide a column in hirarchical alv, where factory table is used.
    i'm using cl_salv_hierarchical_alv.
    here how can we hide a column.

    Hi Srikanth,
    Can you paste the Function Module that you are using ...?
    Are using this function module REUSE_ALV_HIERSEQ_LIST_DISPLAY?
    Genrally, we use No_output....
    If we make it as X then it will not display that field.
    Y_WA_FCAT-COL_POS = 8. "+ DG1K902190
      Y_WA_FCAT-TABNAME = 'T_FINAL'.
      Y_WA_FCAT-FIELDNAME = 'CRTSP'.
      Y_WA_FCAT-NO_OUT = 'X'.
      Y_WA_FCAT-SCRTEXT_L = 'PROD CREATED ON'.
      Y_WA_FCAT-INTLEN = 20.
      APPEND Y_WA_FCAT TO Y_I_FCAT.
      CLEAR Y_WA_FCAT.
    This will not display the field CRTSP.
    Hope tihs will fix your isue.
    Regards,
    Kittu
    Edited by: Kittu on Mar 4, 2009 10:58 AM

  • How to hide headers for specified columns in ALV?

    Hallo guyes,
    is it possible to hide headers just for a few columns in ALV?
    Something like no_headers but just for defined columns...
    Is it also possible to define column description in two lines?
    Thanks.

    Hi,
    Check the below code
    codeFORM prep_fieldcat_xls USING lt_fieldcat_xls TYPE slis_t_fieldcat_alv.
    RANGES: lra_fieldname FOR field_ran.
    DATA: lwa_fieldcat_xls TYPE slis_fieldcat_alv.
    Build range for all unwanted columns:
    lra_fieldname-option = 'EQ'.
    lra_fieldname-sign = 'I'.
    lra_fieldname-low = 'EEP'.
    APPEND lra_fieldname.
    Remove the unwanted columns from the fieldcatalog:
    lt_fieldcat_xls] = lt_fieldcat[.
    LOOP AT lt_fieldcat_xls INTO lwa_fieldcat_xls
    if lwa_fieldcat_xls-fieldname = lra_fieldname-low. "Change here as it is
    lwa_fieldcat_xls-no_out = 'X'.
    endf.
    MODIFY lt_fieldcat_xls FROM lwa_fieldcat_xls INDEX sy-tabix.
    ENDLOOP.[/code]
    Regards,
    Raj.

Maybe you are looking for