Dynamic Parameter Texts in Selection Screen – 2

By | August 10, 2009 | Tricks | 9,286 | 5

Selection Screen Parameter Text by coding using Function Modules SELECTION_TEXTS_MODIFY.

In the last post Dynamic Parameter Texts in Selection Screen (which was so many weeks ago), we discussed how we can change the selection screen parameter by changing the values of some selection screen specific variables. Enno suggested to use the FM SELECTION_TEXTS_MODIFY to handle the selection screen parameters more easily and in standard way.

Some of the readers also left comment on the previous post about the use of this trick. One scenario I came in my mind: Certain Parameter Texts based on the Radio button selection. E.g. We have some radio buttons like Sales Order, Credit Memo, Debit Memo and so on. Based on this radiobutton selection, we want to display the Date’s parameter text.

This code snippet will realize this scenario using the FM SELECTION_TEXTS_MODIFY.


REPORT  ztest_np_helper.

* Selection Screen Class definition

      f_date_text TYPE char30.

          if_name TYPE char8
          if_type TYPE char1
          if_text TYPE char30,


      t_text TYPE STANDARD TABLE OF rsseltexts.

ENDCLASS.                    "lcl_selscr DEFINITION

*.... Selection Screen
            p_cre  RADIOBUTTON GROUP rd1,
            p_deb  RADIOBUTTON GROUP rd1.
PARAMETERSp_date TYPE datum.

*.... Initialization
  aaa 'Select an option to continue'.

*.... At Selection-Screen Output
* text for Radiobuttons
  lcl_selscr=>set_textif_name 'P_SO'
                        if_type 'P' if_text 'Sales Order' ).
  lcl_selscr=>set_textif_name 'P_CRE'
                        if_type 'P' if_text 'Credit memo' ).
  lcl_selscr=>set_textif_name 'P_DEB'
                        if_type 'P' if_text 'Debit memo' ).

* determine the text for the P_DATE
  CASE 'X'.
    WHEN p_so.    lcl_selscr=>f_date_text 'Sales Order Entry Date'.
    WHEN p_cre.   lcl_selscr=>f_date_text 'Credit Memo Entry Date'.
    WHEN p_deb.   lcl_selscr=>f_date_text 'Debit Memo Entry Date'.
  lcl_selscr=>set_textif_name 'P_DATE'
                        if_type 'P'
                        if_text lcl_selscr=>f_date_text ).

* Change the Selection Screen

*.... Start of selection
  WRITE'Date Text'lcl_selscr=>f_date_text.

* Selection Screen Class definition

  METHOD set_text.
    DATAla_text LIKE LINE OF t_text.

    la_text-name if_name.
    la_text-kind if_type.
    la_text-text if_text.
    APPEND la_text TO t_text.

  ENDMETHOD.                    "set_text

  METHOD change_screen.
        program  sy-cprog
        seltexts t_text.
  ENDMETHOD.                    "change_screen

ENDCLASS.                    "lcl_selscr IMPLEMENTATION

Like It? Share!!

Don't miss an Update

Get notified of the new post, right into your inbox

Naimesh Patel{273 articles}

I'm SAP ABAP Consultant for more than a decade. I like to experiment with ABAP especially OO. I have been SDN Top Contributor.
Follow :

Explore all of his 273 articles.

Load comments


  • HI Naimesh,
    I used this feature for several INCLUDES, which are in use in several different programs.
    If you use a parameter in an include, you will have to specify the parameter text in the program, not in the include.

    So I put into each INCLUDE:

    parameters: P_par1.

    clear $t_dtel.
    $s_dtel-name = 'P_PAR1'.
    $s_dtel-kind = 'P'.
    $s_dtel-datenelment = 'VBELN'.
    append $s_dtel to $t_dtel.
    exporting program = sy-cprog
    tables sel_dtel = $t_dtel
    exceptions others = 1.

    $t_dtel and $s_dtel have to be defined in another include.

    INITIALIZATION section can exist mor than one time in a program…

    so it helps me to have in every program the same parameters description.

    Only reasonable if there are many programs which need the same include…

  • thanks

  • hello… hapi blogging… have a nice day! just visiting here….

  • a litlle enhancement: The selection type will be retrieved by method itself:


      METHOD set_text.
        DATA: la_text LIKE LINE OF t_text.
        DATA lr_descr TYPE REF TO cl_abap_typedescr.
        FIELD-SYMBOLS <lfs_any> TYPE ANY.
        ASSIGN (if_name) TO <lfs_any>.
        lr_descr = cl_abap_datadescr=>describe_by_data( <lfs_any> ).
        CASE lr_descr->type_kind.
          WHEN cl_abap_datadescr=>typekind_struct1.
    *== Structure => SELECT-OPTIONS
            la_text-kind = 'S'.
          WHEN OTHERS.
    *== Others   => PARAMETERS        
            la_text-kind = 'P'.
        la_text-name = if_name.
        la_text-text = if_text.
        APPEND la_text TO t_text.
      ENDMETHOD.                    "set_text
  • Hello Enno,

    Thanks for adding the method to make it more dynamic :)

    Btw, when you use the ABAP_CODE short code, you don’t need to convert HTML symbols to its entity. The short code logic should be able to convert it properly.

    Naimesh Patel

Comments on this Post are now closed. If you have something important to share, you can always contact me.

You seem to be new here. Subscribe to stay connected.