Alv Grids

1,423 views

Published on

ALV Grid example

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,423
On SlideShare
0
From Embeds
0
Number of Embeds
14
Actions
Shares
0
Downloads
66
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Alv Grids

  1. 1. ALV grids should be used when possible. They can be customized and ran in the background by creating a layout and setting it up. Ex.type-pools: slis.data: begin of gt_outtab occurs 0. include structure zorderdata. data: end of gt_outtab, gs_layout type slis_layout_alv, g_exit_caused_by_caller, gs_exit_caused_by_user type slis_exit_by_user, g_repid like sy-repid, w_set_status type slis_formname, w_user_command type slis_formname.call function 'REUSE_ALV_GRID_DISPLAY -OR-* create a custom container control for our ALV Control - this is also * create on the screen layout.CREATE OBJECT custom_containerCALL METHOD grid1->set_table_for_first_display* Create Object to receive events and link them to handler methods. * When the ALV Control raises the event for the specified instance * the corresponding method is automatically called.CREATE OBJECT event_receiver. SET HANDLER event_receiver->handle_top_of_page FOR grid1. SET HANDLER event_receiver->handle_double_click FOR grid1.* Controls are not integrated into the TAB-Order * Call quot;set_focusquot; if you want to make sure that 'the cursor' * is active in your control.CALL METHOD cl_gui_control=>set_focus EXPORTING control = grid1.Misc: Enqueue/dequeue function modules are automatically created when a lock object is created in SE11. You can use the function modules in your programs. Program for listing field contents of any structured record. This utility program is from Gordon Tobias. The program is really just a shell for 4 routines which are intended to be called from other programs. The first 2 routines can be called from any program with statements like: PERFORM list_record_fields(zlist_fields_rtti) USING p_any_rec. PERFORM list_fields_with_cols(zlist_fields_rtti) USING p_any_rec. The third routine accepts additional parms for restricting which fields to list. When I want to use this routine, I define 2 SELECT- OPTIONS parms in the calling program, which let me specify that I want to list specific field numbers (e.g. fields 1-5) or names (e.g. all fields whose names match *DAT*). The parm definitions look like: *- Definitions num3 and field_name needed for SELECT-OPTIONS below DATA: num3(3) TYPE n. DATA: field_name(30) TYPE c.
  2. 2. *- SELECT-OPTIONS parms to limit the fields reported upon SELECT-OPTIONS: so_fnum FOR num3, so_fname FOR field_name. And the call to the 3rd routine looks like PERFORM list_specific_fields IN PROGRAM zlist_fields_rtti TABLES so_fnum so_fname USING p_any_rec. The last routine converts any record to a CSV format. If you call it with the 2nd USING parm set to 'HDR', it will create a header line with the field titles. If that 2nd USING parm is blank, it creates a CSV record with the field contents. So the calls to the 4th routine look like: PERFORM convert_to_csv IN PROGRAM zlist_fields_rtti USING p_any_rec 'HDR' quot;Header flag: HDR or ' ' CHANGING w_csv_rec. TRANSFER w_csv_rec TO p_ofile. And PERFORM convert_to_csv IN PROGRAM zlist_fields_rtti USING p_any_rec space quot;Header flag: HDR or ' ' CHANGING w_csv_rec. TRANSFER w_csv_rec TO p_ofile.

×