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.

Similar Messages

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

  • 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 grid?

    Hi all,
    I define a structure in the ABAP dictionary. I declare a table of that type in my program. I populate the table with records. I then display the table of data in an ALV grid. I hide three fields in the grid when I build the field catalog. When I run the program the fields are hidden. When my user runs the program the fields are not hidden...but are displayed on the end of the ALV grid. How do I correct? And why the difference in views?
    Mat

    I agree with Frisoni
    Also what you can do is , when you display your ALV, in the application tool bar of ALV you can see the option of
    Change Variant..
    check any existing variants are there or not..I am sure user might have created such varaint.
    if this is not the case , and there is no varaint , check with user whether he has created any variant..
    also check your filedcat and Layout.

  • Fixed Columns in ALV

    hi,
    Please let me know how to fix a first column when the output is display in ALV, So if we scroll towards right side the first column should be fixed there itself when we reach last field in the output.
    Regards
    Vinay.

    Hi,
    How to hide a column in an ALV
    *---- This is the code to hide column in ALV
    LOOP AT IT_FIELDCAT INTO X_FIELDCAT.
      IF X_FIELDCAT-FIELDNAME = 'VBELN'.
        X_FIELDCAT-NO_OUT = 'X'.
        MODIFY IT_FIELDCAT FROM X_FIELDCAT.
      ENDIF.
    ENDLOOP.
    Regards,
    Vijay

  • 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 data of any column in ALV Display

    Hi ,
    I  am displaying  an  ALV in which i have to display subtotal  of each column but want to hide the data of  that column(only data is to hide ) column should be visiable,.
    Please let me know i any one have worked with this situation.
    Thanks in advance.

    Hi,
    In field Catlog set field no_out eq 'X'.
    No_out (field in field list): This parameter is used to remove certain fields from the output during initial display.  The user can however interactively choose the field for output from the field list in the display variant.
                       'X' = field is not displayed in the current list.
            Value set: SPACE, 'X'.
    Thanks & regards,
    ShreeMohan

  • 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

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

  • ALV  hide  column when no values

    Hi friends,
          Is it possible to hide a column in ALV  when there is no value for that column
    Thanks
    Chandra

    Yes by using the FM ALV_OPTIMIZE_OUTPUT you can acheive it
    ALV_OPTIMIZE_OUTPUT   :  Suppress Blank Columns in ALV Output
    Execute SE37 enter FM name
    Check the Function Module Documentation for more details

  • ALV (hide column)

    Hi,
    Is there any method in ALV grid to hide a column with quantity and display only the subtotals along with the line items displayed.
    for example.
    customer
    a
    a(subtotal-22)
    b
    b
    b(subtotal-26)
    The quantity column is hidden.
    please send your suggestions,
    Rajesh.

    Hi ,
    as per my knowledge there is no such option to hide column, So what u can do is try to make use of SORT+FIELD MERGE Fms to get only Subtotals.
    check
    fcat-no_out =  'X'.---> not for display
    Regards
    Prabhu

  • 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

Maybe you are looking for

  • Sharing photo's, two users on one computer

    Hi, I have two user's on my computer, both with different log on's etc. How can another user look at my photo's that are currently in aperture with out having to move folders around. Is there an easier way then just making multiple copies and saving

  • IOS 7 glitch: Music app keys not working in lockscreen. Using iPhone 5. iOS version - 7.0.2

    the music keys next, prev and play/pause not working in lock screen. I have already reset my iphone twise. reset all settings also. It worked for 2 days and today morning also the same issue. WHich is really annoying. iOS 6.1.4 never had such kinda i

  • Excise duty at duty free plant ie EOU

    HI expert I have duty free plant ie EOU, where at the time of Procurement i dont pay duty for material and some the same material i will use for export basis. Now my scenario is. 1.for the same material now i use it for local sale purpose, so now i h

  • ISE and WLC 5508 IP and MAc address

    Hi! Is it possible that we recibe IP address and Mac address Client at the same time in ISE ? The wlc permits choose radius Call station ip type MAC or IP, but not both. Thanks you,

  • Making A New Paragraph Out of an Existing One

    Say I'm trying to make a new paragraph and I space a group of words to another line so that I can start a new paragraph with those groups of words and sentences...the problem I'm having is that once I space all those words to the next line to make a