Application Development 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: 

Display/Print the Selection criteria entered by USER on the ALV Report o/p?

Former Member
0 Kudos

Hi Experts,

I hv a requirement of to print/display the Selection criteria entered by user in the selection screen.........on the top portion of the ALV report output lay out.

There is a FM for this purpose, but, I forgot its name!!

So, let me know the FM or FMs, so that, will choose, which is best one,

or the piece of code, which covers all select-option entries..........appreciated.

thanq

Edited by: SAP ABAPer on Sep 3, 2008 6:35 PM

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

Use the Function RS_REFRESH_FROM_SELECTOPTIONS get the selection details, now format the data accordingly in the TOP_OF_PAGE using the calss CL_DD_DOCUMENT.

Check the below mention code.

REPORT  ztest_page.
 
TABLES: sflight.
DATA : it_flight TYPE TABLE OF sflight WITH HEADER LINE.
DATA BEGIN OF it_sel_opt OCCURS 0.
        INCLUDE STRUCTURE rsparams.
DATA END   OF it_sel_opt.
SELECT-OPTIONS: s_carrid FOR sflight-carrid.
 
START-OF-SELECTION.
 
  SELECT * FROM sflight INTO TABLE it_flight
   WHERE carrid IN s_carrid.
 
END-OF-SELECTION.
 
  CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
    EXPORTING
      curr_report     = sy-repid
    TABLES
      selection_table = it_sel_opt
    EXCEPTIONS
      not_found       = 01
      no_report       = 02.
 
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program          = sy-repid
      i_callback_html_top_of_page = 'TOP_OF_PAGE'
      i_structure_name            = 'SFLIGHT'
    TABLES
      t_outtab                    = it_flight
    EXCEPTIONS
      program_error               = 1
      OTHERS                      = 2.
 
*&---------------------------------------------------------------------*
*&      Form  top_of_page
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->DOCUMENT   text
*----------------------------------------------------------------------*
FORM top_of_page USING document TYPE REF TO cl_dd_document.
  DATA : dl_text(255) TYPE c.  "Text
 
* Add new-line
  CALL METHOD document->new_line.
 
  CALL METHOD document->new_line.
 
  CLEAR : dl_text.
* program ID
  dl_text = 'Program Name :'.
  CALL METHOD document->add_gap.
  CALL METHOD document->add_text
    EXPORTING
      text         = dl_text
      sap_emphasis = cl_dd_area=>heading
      sap_color    = cl_dd_area=>list_heading_int.
 
  CLEAR dl_text.
  dl_text = sy-repid.
  CALL METHOD document->add_text
    EXPORTING
      text         = dl_text
      sap_emphasis = cl_dd_area=>heading
      sap_color    = cl_dd_area=>list_negative_inv.
 
* Add new-line
  CALL METHOD document->new_line.
  CLEAR : dl_text.
 
  dl_text = 'Selection Criteria'.
  CALL METHOD document->add_gap
    EXPORTING
      width = 34.
  CALL METHOD document->add_text
    EXPORTING
      text         = dl_text
      sap_emphasis = cl_dd_area=>heading
      sap_color    = cl_dd_area=>list_negative_inv.
 
* Add new-line
  CALL METHOD document->new_line.
 
  CLEAR : dl_text.
  CONCATENATE 'SELECT Option' 'SIGN' 'OPTION' 'LOW' 'HIGH'
  INTO dl_text SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
 
  CALL METHOD document->add_gap
    EXPORTING
      width = 34.
  CALL METHOD document->add_text
    EXPORTING
      text         = dl_text
      sap_emphasis = cl_dd_area=>heading
      sap_color    = cl_dd_area=>list_negative_inv.
 
* Add new-line
  CALL METHOD document->new_line.
  LOOP AT it_sel_opt.
 
    CLEAR : dl_text.
    CONCATENATE it_sel_opt-selname  it_sel_opt-sign
     it_sel_opt-option it_sel_opt-low it_sel_opt-high
    INTO dl_text SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
 
    CALL METHOD document->add_gap
      EXPORTING
        width = 34.
    CALL METHOD document->add_text
      EXPORTING
        text         = dl_text
        sap_emphasis = cl_dd_area=>heading
        sap_color    = cl_dd_area=>list_negative_inv.
 
* Add new-line
    CALL METHOD document->new_line.
 
  ENDLOOP.
 
ENDFORM.                    "top_of_page

3 REPLIES 3

Former Member
0 Kudos

Hi,

Try this...

In the TOP_OF_PAGE event of the ALV call the function module PRINT_SELECTIONS with your program name..

Thanks

Naren

0 Kudos

THANQ

urs is working for classical reports, NOT for ALV.

but, am looking for ALVs.

thanq

former_member188685
Active Contributor
0 Kudos

Use the Function RS_REFRESH_FROM_SELECTOPTIONS get the selection details, now format the data accordingly in the TOP_OF_PAGE using the calss CL_DD_DOCUMENT.

Check the below mention code.

REPORT  ztest_page.
 
TABLES: sflight.
DATA : it_flight TYPE TABLE OF sflight WITH HEADER LINE.
DATA BEGIN OF it_sel_opt OCCURS 0.
        INCLUDE STRUCTURE rsparams.
DATA END   OF it_sel_opt.
SELECT-OPTIONS: s_carrid FOR sflight-carrid.
 
START-OF-SELECTION.
 
  SELECT * FROM sflight INTO TABLE it_flight
   WHERE carrid IN s_carrid.
 
END-OF-SELECTION.
 
  CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
    EXPORTING
      curr_report     = sy-repid
    TABLES
      selection_table = it_sel_opt
    EXCEPTIONS
      not_found       = 01
      no_report       = 02.
 
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program          = sy-repid
      i_callback_html_top_of_page = 'TOP_OF_PAGE'
      i_structure_name            = 'SFLIGHT'
    TABLES
      t_outtab                    = it_flight
    EXCEPTIONS
      program_error               = 1
      OTHERS                      = 2.
 
*&---------------------------------------------------------------------*
*&      Form  top_of_page
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->DOCUMENT   text
*----------------------------------------------------------------------*
FORM top_of_page USING document TYPE REF TO cl_dd_document.
  DATA : dl_text(255) TYPE c.  "Text
 
* Add new-line
  CALL METHOD document->new_line.
 
  CALL METHOD document->new_line.
 
  CLEAR : dl_text.
* program ID
  dl_text = 'Program Name :'.
  CALL METHOD document->add_gap.
  CALL METHOD document->add_text
    EXPORTING
      text         = dl_text
      sap_emphasis = cl_dd_area=>heading
      sap_color    = cl_dd_area=>list_heading_int.
 
  CLEAR dl_text.
  dl_text = sy-repid.
  CALL METHOD document->add_text
    EXPORTING
      text         = dl_text
      sap_emphasis = cl_dd_area=>heading
      sap_color    = cl_dd_area=>list_negative_inv.
 
* Add new-line
  CALL METHOD document->new_line.
  CLEAR : dl_text.
 
  dl_text = 'Selection Criteria'.
  CALL METHOD document->add_gap
    EXPORTING
      width = 34.
  CALL METHOD document->add_text
    EXPORTING
      text         = dl_text
      sap_emphasis = cl_dd_area=>heading
      sap_color    = cl_dd_area=>list_negative_inv.
 
* Add new-line
  CALL METHOD document->new_line.
 
  CLEAR : dl_text.
  CONCATENATE 'SELECT Option' 'SIGN' 'OPTION' 'LOW' 'HIGH'
  INTO dl_text SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
 
  CALL METHOD document->add_gap
    EXPORTING
      width = 34.
  CALL METHOD document->add_text
    EXPORTING
      text         = dl_text
      sap_emphasis = cl_dd_area=>heading
      sap_color    = cl_dd_area=>list_negative_inv.
 
* Add new-line
  CALL METHOD document->new_line.
  LOOP AT it_sel_opt.
 
    CLEAR : dl_text.
    CONCATENATE it_sel_opt-selname  it_sel_opt-sign
     it_sel_opt-option it_sel_opt-low it_sel_opt-high
    INTO dl_text SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
 
    CALL METHOD document->add_gap
      EXPORTING
        width = 34.
    CALL METHOD document->add_text
      EXPORTING
        text         = dl_text
        sap_emphasis = cl_dd_area=>heading
        sap_color    = cl_dd_area=>list_negative_inv.
 
* Add new-line
    CALL METHOD document->new_line.
 
  ENDLOOP.
 
ENDFORM.                    "top_of_page