SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Hiding Columns in ALV-Grid



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ALV Grid / ALV Tree / ALV List
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sat Sep 22, 2007 7:23 pm    Post subject: Hiding Columns in ALV-Grid Reply with quote

Print a line of table MAKT (material description) and hide column language (field SPRAS).

Code:
REPORT ztest .

* Material description
TABLES : makt.

* Type
TYPES: BEGIN OF ty_table.
        INCLUDE STRUCTURE makt.
TYPES: END OF ty_table.

* Internal structure
DATA : is_table TYPE ty_table.
DATA : is_catalog     TYPE lvc_s_fcat.

* Internal table
DATA : it_table TYPE STANDARD TABLE OF ty_table.
DATA : it_catalog TYPE STANDARD TABLE OF lvc_s_fcat.

* Data for ALV grid
DATA : w_docking  TYPE REF TO cl_gui_docking_container.
DATA : w_alv_grid TYPE REF TO cl_gui_alv_grid.
DATA : ok_code(4) TYPE c.

* Fill table with data
SELECT * FROM makt.
  MOVE-CORRESPONDING makt TO is_table.
  APPEND is_table TO it_table.
  EXIT.
ENDSELECT.

* Hide column "Language"
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
     EXPORTING
          i_structure_name = 'MAKT'
     CHANGING
          ct_fieldcat      = it_catalog.

LOOP AT it_catalog INTO is_catalog
WHERE fieldname = 'SPRAS'.
  is_catalog-no_out = 'X'.
  MODIFY it_catalog FROM is_catalog.
ENDLOOP.


* Call ALV grid screen
CALL SCREEN 1000.

*&---------------------------------------------------------------------*
*&      Module  alvgrid_output  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE alvgrid_output OUTPUT.

  IF w_docking IS INITIAL.
    PERFORM sr_display_alv_grid.
  ENDIF.

  PERFORM sr_display_alv_grid_new.

ENDMODULE.                 " alvgrid_output  OUTPUT
*&---------------------------------------------------------------------*
*&      Form  sr_display_alv_grid
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM sr_display_alv_grid.

  CREATE OBJECT w_docking
        EXPORTING
          ratio                     = 95.

  CREATE OBJECT w_alv_grid
    EXPORTING
      i_parent          = w_docking.

ENDFORM.                    " sr_display_alv_grid
*&---------------------------------------------------------------------*
*&      Form  sr_display_alv_grid_new
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM sr_display_alv_grid_new.

* Display ALV grid
  CALL METHOD w_alv_grid->set_table_for_first_display
        EXPORTING
        i_structure_name              = 'MAKT'
       CHANGING
        it_outtab                     = it_table
        it_fieldcatalog               = it_catalog.

ENDFORM.                    " sr_display_alv_grid_new

For info, the flow logic : Code:
Code:
PROCESS BEFORE OUTPUT.

  MODULE alvgrid_output.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ALV Grid / ALV Tree / ALV List All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.