Selection Screen in SAP

Share on Facebook16Share on LinkedIn10Tweet about this on TwitterShare on Google+1
Please Share!!

Selection Screen is the first interface for the users to interact with the reports/transactions designed by developers. This is often the first component which the developers design in the whole application. Truely, this is the first impression which you can give your business or end users.

In this article, we have jotted down some of the common requirements in actual projects and how we can achieve them. You can treat it as a reference document.

1. Multiple Elements in a Selection Screen Line

Sometimes we have specific requirements while designing a selection screen. We may have to place more than one Parameter (or Select Option or Radio Button). This can be easily done by using the selection screen BEGIN OF LINE / END OF LINE statements.
The following code extract will help you in designing such a selection screen.

Let’s check how the output looks.

Selection screen elements in one line

Please note: Instead of Parameters, you can easily have other elements like Radio Buttons or Select Options. The important thing here is that you need to keep the correct spacing and position or else you can get a selection screen generation error during activating the code, even if your code is syntactically correct.

2. Restricting Range entry for Select-Option

Sometime it is required to restrict range input for a select option. SAP provides an extension which is generally used for this is NO INTERVALS. But, is it adequate?

Apparently it seem that requirement is met but if someone presses Select Ranges tab, user can enter the range.

With just NO INTERVALS command. After pressing Select Ranges tab you can enter range value.

No interval in select option

How to really restrict the range? We need to use FM ‘SELECT_OPTIONS_RESTRICT’ as shown below.

In addition to NO INTERVALS,  after restricting with the function module, you cannot enter range value now. This would be a robust solution.

NO INTERVAL

There are other option available in this function module. Explore and enjoy 🙂

[adToAppearHere]

3. Select-Options in a module pool screen

Method 1
a) Create a subscreen area in your screen layout where you want to create the select options.
b) In the top include of your module pool program declare a selection screen as a subscreen e.g.

c) In the PBO and PAI of the main screen where the select options need to be created do a call subscreen of the above screen (100).

This call subscreen statement is necessary for transport of values between screen and program.

Note: All validations of the selection screen fields e.g. the s_matnr field created above should be done in selection screen events like AT SELECTION-SCREEN etc and not in PAI. These selection screen validations etc should be done in the top include only.

Method 2
a) Create 2 separate fields in your screen layout – one for the low value and one for the high value. Insert an icon beside the high value which will call the multiple selections popup screen on user command. Use function module ‘COMPLEX_SELECTIONS_DIALOG’ to achieve this.

You can use the return table rng_kunnr to populate your own internal range table with the values entered by the user. Basically, here you are just simulating the work of a select-options parameter by module pool screen elements.

Also Read: ‘SY-ABCDE in SAP’

4. Displaying the Selection Screen value in report automatically

Value entered in the selection screen can be displayed automatically by the function modules ‘RS_REFRESH_FROM_SELECTOPTIONS’ and ‘RS_LIST_SELECTION_TABLE’ is nice tabular fashion. Very helpful when the selection screen is huge having a lot of parameters and select options.

Check the image below. All the values of selection screen input are printed in the report.

selection screen output report

5. Dynamic Selection Screen

Selection screen is the first thing which user can see when he/she executes a program or transaction. For basic need, we can create a selection screen only by using ABAP commands and we do not have to go for a module pool programming.

There are some extensions which can be used with select option to meet the requirement.

Please check F1 for the extensions and their effects.

Sometime it is required to populate a default value in the selection screen. There is an ABAP command which can be used for this.

Eg. SELECT-OPTIONS: matn FOR mara-matnr DEFAULT ‘AA’.

Sometimes the default value needs to be calculated at run-time. Use INITIALIZATION Event or AT SELECTION-SCREEN OUTPUT Event.

Dynamic Selection Screen: You can activate a field or can disable input to a certain field depending on some criteria at your will. The following code may help you to make a dynamic screen. There are several other option in SCREEN structure. Explore and you can impress some user by producing a flashy selection screen. Remember selection screen is the first impression of your program. 🙂

dynamic selection screen parameters

Also, check our Web Dynpro Series.

6. Search Help from the values in Internal table

Sometimes the requirement is such that search help is required from the values obtained at run time or from constant values. In such cases, you can use the FM ‘F4IF_INT_TABLE_VALUE_REQUEST‘ to meet your purpose. The basic logic is that it uses data from the internal table to show in the F4 search help.

Example: Here an internal table is populated with some constants. This program is just for concept.

Check the Search Help is from our custom internal table. Isn’t it useful in real projects?

F4 Help from internal table

If you want to get such practical issues and resolutions straight to your inbox, please SUBSCRIBE. We respect your privacy and take protecting it seriously.

If you liked this post, please hit the share button.

Thank you very much for your time!!

 

 

Image source: www.neontommy.com(modified)

Share on Facebook16Share on LinkedIn10Tweet about this on TwitterShare on Google+1
Please Share!!

14 Comments on "Selection Screen in SAP"

  1. vinay singh | January 15, 2016 at 2:07 pm |

    very well written and presented ***** read from me .

  2. Vipul kukal | January 24, 2016 at 1:26 pm |

    Very nicely explained

  3. Very Nice collection of Selection Screen examples.
    This will be helpful for all Beginners.
    Thanks

  4. This is exactly what I was looking for: CALL FUNCTION ‘SELECT_OPTIONS_RESTRICT’.
    Great post! Great post!
    Thanks!

  5. Krishnamraju | April 7, 2016 at 10:19 am |

    Restricting Range entry for Select-Option:-
    Hi Cant we use “no-extension” to select-options like:—

    select-options:so_matnr for mara-matnr No-extension.

    why u did’t discuss about this one…….

    • Dear Krishnamraju – No-Extension will allow you to enter a range. It would not allow you to enter multiple specific values. Say user wants to enter material number ‘110001’, ‘220002’ and ‘330003’. Can you do with No-Extension? 🙂 . You can just give an interval ‘110001’ to ‘330003’.

      Please write a dummy code with No-Extension and test it. Let us know, what you find.

      All the best.

      Regards,
      Team SAPyard.

  6. krishnamraju | April 14, 2016 at 3:21 pm |

    Thanks for ur clarification

Comments are closed.