Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Re: ALV oops

Former Member
0 Likes
653

Hi Experts,

I want to disply alv report using oopps, i need one example.

actuallyi have gone through some examples but in all examples again they used module programming consepts i know that procedure...

but i want to display the grid on selecteion-screen.

I saw some exapmes in that they used again they created one screen after they created one container , in that container they attached grid,,i dont want that

procedure...

please give me any expmle for that...

if it is helpful i will reward you.

Thanks

Srinath Reddy P

5 REPLIES 5
Read only

Former Member
0 Likes
611

Hi Srinath,

Below link might answer your Question. It contains example of both types....

http://scn.sap.com/thread/682400

Regards...

Sultana

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
611

Use a docking container to display the ALV in selection screen itself. Didn't your search hit this link http://zevolving.com/2008/10/display-alv-report-output-in-the-same-selection-screen/ ??

Read only

manish_shankar
Participant
0 Likes
611

Hi Srinath,

You can check the standard program: SALV_DEMO_*

Go through This code and debug it:

*&---------------------------------------------------------------------*
*& Report  ZMALV_SALV01
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZMALV_SALV01 .                                     
                                                             " Check Program : SALV_DEMO_*
TABLES : sflight .

DATA : it_sflight TYPE TABLE OF sflight .
DATA : color TYPE lvc_s_colo .
DATA : layout_key TYPE salv_s_layout_key .

DATA : oref_table TYPE REF TO cl_salv_table ,
        oref_function TYPE REF TO cl_salv_functions ,             " For Standard Functions
        oref_display TYPE REF TO cl_salv_display_settings ,       " For Header
        oref_fcats TYPE REF TO cl_salv_columns_table ,            " For FieldCat
        oref_fcat  TYPE REF TO cl_salv_column_table ,             " Coloring
        oref_sorts TYPE REF TO cl_salv_sorts ,                    " Sorting & SubTotal
        oref_subtotal TYPE REF TO cl_salv_aggregations ,          " Aggregate (Total)
        oref_filter TYPE REF TO cl_salv_filters ,                 " Filters
        oref_layout TYPE REF TO cl_salv_layout ,                  " Layout
        oref_font type ref to cl_salv_item .                      " Font

START-OF-SELECTION .
SELECT * FROM sflight INTO TABLE it_sflight .

   cl_salv_table=>factory( " EXPORTING list_display = if_salv_c_bool_sap=>true "false     " For List Display
                           IMPORTING R_SALV_TABLE = oref_table
                           CHANGING  T_TABLE = it_sflight ) .

   oref_function = oref_table->get_functions( ) .                 " To Add Standard ALV Buttons
   oref_function->set_all( 'X' ) . " OR ( abap_true ) OR ( IF_SALV_C_BOOL_SAP=>TRUE ).

   oref_display = oref_table->get_display_settings( ) .           " For Header
   oref_display->set_striped_pattern( cl_salv_display_settings=>true ) .
   oref_display->set_list_header( 'alv for sflight table' ) .

   oref_fcats = oref_table->get_columns( ).                       " For Fieldname
   oref_fcat ?= oref_fcats->get_column( 'CARRID' ) .
   oref_fcat->set_long_text( 'Carrier ID Med Txt' ) .
   oref_fcat->set_output_length( 25 ) .
   oref_fcat->set_icon( EXPORTING value = IF_SALV_C_BOOL_SAP=>TRUE ) .
   oref_fcat->set_key( 'X' ) .

*  oref_fcats->set_optimize( 'X' ) .
*  oref_fcat ?= oref_fcats->get_column( 'CARRID' ) .
*
*  oref_fcats->set_optimize( 'X' ) .
*  oref_fcat ?= oref_fcats->get_column( 'CONNID' ) .



   oref_fcats = oref_table->get_columns( ).
   oref_fcat ?= oref_fcats->get_column( 'CURRENCY' ).
   oref_fcat->set_tooltip( 'ToolTip' ).
*  oref_fcat->set_cell_type( cl_salv_column_table=>if_salv_c_cell_type~checkbox_hotspot ). " CheckBox and HotSpot
   oref_fcat->set_output_length( 10 ).
   oref_fcat->set_visible( 'X' ).
   oref_fcats->set_optimize( 'X' ) .


   oref_fcat ?= oref_fcats->get_column( 'SEATSMAX' ) .               " Coloring
   color-col = '6' .
   color-int = '1' .
   color-inv = '0' .
   oref_fcat->set_color( color ) .

   oref_sorts = oref_table->get_sorts( ) .                        " Sorting
   oref_sorts->add_sort( EXPORTING columnname = 'CONNID'
                                   subtotal   = 'X'        "  or  ABAP_TRUE  or  IF_SALV_C_BOOL_SAP=>true  ) .
                                   SEQUENCE   = IF_SALV_C_SORT=>SORT_DOWN ) .

   oref_subtotal = oref_table->get_aggregations( ) .              " Aggregate (Total of a field)
   oref_subtotal->add_aggregation( EXPORTING COLUMNNAME = 'PRICE' ) .

*  oref_filter = oref_table->get_filters( ) .                      " Filters
*  oref_filter->add_filter( EXPORTING columnname = 'CARRID'
*                                     low        = 'ZZ' ) .

   oref_layout = oref_table->get_layout( ) .
   layout_key-report = sy-repid .
   oref_layout->set_key( layout_key ) .
   oref_layout->set_save_restriction( EXPORTING value = IF_SALV_C_LAYOUT=>RESTRICT_NONE ) .




   CALL METHOD oref_table->display( ) .              " Displays the alv

- Regards,

Manish Shankar.

Message was edited by: Manish Shankar

Read only

Former Member
0 Likes
611

This message was moderated.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
611

Just a small sample of report with an ALV grid on (under actually) a selection-screen

REPORT z_grid_at_selectionscreen.

TABLES: mara.

DATA: go_cont TYPE REF TO cl_gui_docking_container,

      go_alv  TYPE REF TO cl_gui_alv_grid,

      gt_mara TYPE TABLE OF mara,

      gv_repid TYPE sy-repid,

      gv_dynnr TYPE sy-dynnr.

SELECT-OPTIONS matnr FOR mara-matnr.

AT SELECTION-SCREEN OUTPUT.

  IF go_alv IS INITIAL.

    gv_repid = sy-repid.

    gv_dynnr = sy-dynnr.

    CREATE OBJECT go_cont

      EXPORTING

        repid     = gv_repid

        dynnr     = gv_dynnr

        extension = 90

        side      = cl_gui_docking_container=>dock_at_bottom.

    CREATE OBJECT go_alv

      EXPORTING

        i_parent = go_cont.

    go_alv->set_table_for_first_display(

      EXPORTING

        i_structure_name              = 'MARA'

      CHANGING

        it_outtab                     = gt_mara ).

  ELSE.

    go_alv->refresh_table_display( ).

  ENDIF.

AT SELECTION-SCREEN ON matnr.

  SELECT * INTO TABLE gt_mara

    FROM mara UP TO 100 ROWS

    WHERE matnr IN matnr.

Regards,

Raymond