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: 

Selection Screen on ALV Report

Former Member
0 Kudos

Hello,

Is there any way to display Selection screen fields details of the program on top of the ALV report?

Ryan

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Ryan,

Try ALV  OOPs with following code.

DATA:

lv_selname          TYPE rsscr_name.

*Get the list of selection parameters

  v_prog_name = sy-repid.

  CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'

    EXPORTING

      curr_report     = v_prog_name

    TABLES

      selection_table = lt_seltab

    EXCEPTIONS

      not_found       = 1

      no_report       = 2.

  IF sy-subrc <> 0.

    "Do nothing

  ENDIF.

* Read Selection Texts

  READ TEXTPOOL v_prog_name LANGUAGE sy-langu INTO lt_pool.

* Loop through the selection parameters & print
  LOOP AT lt_seltab INTO lwa_seltab.
*   Write out only the filled parameters (This can be changed, if needed)
*     Selection Parameter Name
      IF lv_selname NE lwa_seltab-selname.
        CLEAR: lwa_pool.
        READ TABLE lt_pool INTO lwa_pool WITH KEY key = lwa_seltab-selname.
        IF sy-subrc EQ 0.
          lv_sel_option    = lwa_pool-entry+8.
        ELSE.
          lv_sel_option    = lwa_seltab-selname.
        ENDIF.
        lv_selname = lwa_seltab-selname.
      ENDIF.
*     Selection Parameter Value
      lv_sel_option+40    = lwa_seltab-sign.
      lv_sel_option+45    = lwa_seltab-option.
      lv_sel_option+50    = lwa_seltab-low.
      lv_sel_option+70    = lwa_seltab-high.
      CALL METHOD rt_obj_dyndoc->new_line.
      CALL METHOD rt_obj_dyndoc->add_text
        EXPORTING
          text = lv_sel_option.
    ENDIF.
  ENDLOOP.

  PERFORM display_sel_scr_details.

*&---------------------------------------------------------------------*
*&      Form  display_sel_scr_details
*&---------------------------------------------------------------------*
FORM display_sel_scr_details .
* Display the selection screen info into top window.
* Creating html control
  IF g_r_html_ctrl IS INITIAL.
    CREATE OBJECT g_r_html_ctrl
      EXPORTING
        parent = g_r_parent_top.
  ENDIF.

  CALL METHOD g_r_dd_document->merge_document.

  g_r_dd_document->html_control = g_r_html_ctrl.

* Display document
  CALL METHOD g_r_dd_document->display_document
    EXPORTING
      reuse_control      = 'X'
      parent             = g_r_parent_top
    EXCEPTIONS
      html_display_error = 1.

  IF sy-subrc NE 0.
    "title could not be displayed
  ENDIF.

ENDFORM.                    " display_sel_scr_details

Regards,

nimz

1 REPLY 1

Former Member
0 Kudos

Ryan,

Try ALV  OOPs with following code.

DATA:

lv_selname          TYPE rsscr_name.

*Get the list of selection parameters

  v_prog_name = sy-repid.

  CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'

    EXPORTING

      curr_report     = v_prog_name

    TABLES

      selection_table = lt_seltab

    EXCEPTIONS

      not_found       = 1

      no_report       = 2.

  IF sy-subrc <> 0.

    "Do nothing

  ENDIF.

* Read Selection Texts

  READ TEXTPOOL v_prog_name LANGUAGE sy-langu INTO lt_pool.

* Loop through the selection parameters & print
  LOOP AT lt_seltab INTO lwa_seltab.
*   Write out only the filled parameters (This can be changed, if needed)
*     Selection Parameter Name
      IF lv_selname NE lwa_seltab-selname.
        CLEAR: lwa_pool.
        READ TABLE lt_pool INTO lwa_pool WITH KEY key = lwa_seltab-selname.
        IF sy-subrc EQ 0.
          lv_sel_option    = lwa_pool-entry+8.
        ELSE.
          lv_sel_option    = lwa_seltab-selname.
        ENDIF.
        lv_selname = lwa_seltab-selname.
      ENDIF.
*     Selection Parameter Value
      lv_sel_option+40    = lwa_seltab-sign.
      lv_sel_option+45    = lwa_seltab-option.
      lv_sel_option+50    = lwa_seltab-low.
      lv_sel_option+70    = lwa_seltab-high.
      CALL METHOD rt_obj_dyndoc->new_line.
      CALL METHOD rt_obj_dyndoc->add_text
        EXPORTING
          text = lv_sel_option.
    ENDIF.
  ENDLOOP.

  PERFORM display_sel_scr_details.

*&---------------------------------------------------------------------*
*&      Form  display_sel_scr_details
*&---------------------------------------------------------------------*
FORM display_sel_scr_details .
* Display the selection screen info into top window.
* Creating html control
  IF g_r_html_ctrl IS INITIAL.
    CREATE OBJECT g_r_html_ctrl
      EXPORTING
        parent = g_r_parent_top.
  ENDIF.

  CALL METHOD g_r_dd_document->merge_document.

  g_r_dd_document->html_control = g_r_html_ctrl.

* Display document
  CALL METHOD g_r_dd_document->display_document
    EXPORTING
      reuse_control      = 'X'
      parent             = g_r_parent_top
    EXCEPTIONS
      html_display_error = 1.

  IF sy-subrc NE 0.
    "title could not be displayed
  ENDIF.

ENDFORM.                    " display_sel_scr_details

Regards,

nimz