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

Grid ALV List Viewer: Display table



 
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 15, 2007 8:34 pm    Post subject: Grid ALV List Viewer: Display table Reply with quote

This tiny program just displays the T001 table using grid control and all its default features.
Used object:
  • cl_gui_alv_grid

Screen 100 is the same as in List of Programs.

Code:
program z_display_table.

*---------------------------------------------------------------------*
*       Constants                                                     *
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
*       Types                                                         *
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
*       Data                                                          *
*---------------------------------------------------------------------*
* It is important: this internal table MUST be declared as global
*                  data (not in the fill_grid method), otherwise
*                  some cl_gui_alv_grid buttons will not work.
* ...I don't know why...
    data it_t001 type table of t001.
*---------------------------------------------------------------------*
*       Classes                                                       *
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
*       Definitions                                                   *
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
class screen_init definition create private.
  public section.
    class-methods  init_screen.
    methods        constructor.
  private section.
    data           grid     type ref to cl_gui_alv_grid.
    methods        fill_grid.
endclass.
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
*       Implementations                                               *
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
class screen_init implementation.
  method init_screen.
    data screen type ref to screen_init.
    create object screen.
  endmethod.
  method constructor.
    create object grid exporting i_parent = cl_gui_container=>screen0.
    call method  me->fill_grid.
  endmethod.
  method fill_grid.
    select * from t001 into table it_t001.
    call method grid->set_table_for_first_display
         exporting i_structure_name = 'T001'
         changing  it_outtab        = it_t001.
  endmethod.
endclass.
*---------------------------------------------------------------------*

*---------------------------------------------------------------------*
*       Program execution                                             *
*---------------------------------------------------------------------*
load-of-program.
  call screen 100.

*---------------------------------------------------------------------*
*       Dialog Modules PBO                                            *
*---------------------------------------------------------------------*
module status_0100 output.
  set pf-status 'SCREEN_100'.
  set titlebar 'TIT_100'.
  call method screen_init=>init_screen.
endmodule.
*---------------------------------------------------------------------*
*       Dialog Modules PAI                                            *
*---------------------------------------------------------------------*
module cancel input.
  leave program.
endmodule.
*----------------------------------------------------------------------*

Source: http://www.geocities.com/victorav15/sapr3/utilities/zvvooa_alv1.txt
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.