SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

Set Default Single Values List for SAP Selection Screen Parameter


In this ABAP tutorial, SAP Selection Screen developers will learn how to set default single values list for a selection screen parameter.

This guide includes a simple SAP Selection Screen which can be used for a filter screen to set criterias for an ABAP report parameters. The sample ABAP codes includes SELECTION-SCREEN code block where nearly all parameters have default values identified with DEFAULT in Select-Options codes.

Only select option so_vmsta which is used to filter among material sales status using mvke-vmsta has not have a single default value. Assume that as a requirement ABAP developer wants to set a list of sales status values {E,G,GI,I,L,LA,LD,LE} to set as default values list for the target select option in the SAP selection screen.

This document shows how to set a list of values as default values in a SAP Selection Screen for a Select-Option.





Here is the SAP Selection-Screen ABAP code.
ABAP developers will realize how Default keyword is used to set default value for single values.

SELECTION-SCREEN BEGIN OF BLOCK 100 WITH FRAME TITLE text-101.
SELECT-OPTIONS:
 so_werks FOR t001w-werks DEFAULT '1061',
 so_lgort FOR t001l-lgort DEFAULT 'I001',
 so_vkorg FOR mvke-vkorg DEFAULT 'IT00',
 so_vtweg FOR mvke-vtweg DEFAULT '11',
 so_vmsta FOR mvke-vmsta. " Sales status
SELECTION-SCREEN END OF BLOCK 100.
Code

How can ABAP code developers set a values list as Default for a Select Option ?

In order to manage this task, right after the end of Selection Screen codes,
after END-OF-SELECTION statement line,
add INITIALIZATION statement which has following ABAP codes.

MOVE :
 'I' TO so_vmsta-sign,
 'EQ' TO so_vmsta-option,
 'E' TO so_vmsta-low.
APPEND so_vmsta.
MOVE 'G' TO so_vmsta-low.
APPEND so_vmsta.
MOVE 'GI' TO so_vmsta-low.
APPEND so_vmsta.
MOVE 'I' TO so_vmsta-low.
APPEND so_vmsta.
MOVE 'L' TO so_vmsta-low.
APPEND so_vmsta.
MOVE 'LA' TO so_vmsta-low.
APPEND so_vmsta.
MOVE 'LD' TO so_vmsta-low.
APPEND so_vmsta.
MOVE 'LE' TO so_vmsta-low.
APPEND so_vmsta.
Code

ABAP developers can see that the above sample code sets the Select Option sign as 'I' and option as 'EQ' means equal. The select option low value stores one item from default values list. When the property settings is completed append it to Select Option table.

When you repeat the same setting for each item in the Default Single Values list, our goal is reached.

You can see the default values for Selection Screen select option parameters in the following screenshot from an ABAP report.

selection-screen-with-default-parameter-range-value

It is possible to display the preselected values for a select option by pressing the arrow on the right side of the parameter. You see, the default value list is formed of a long list of single values valid for the Selection Screen select option so_vmsta.

selection-screen-with-default-single-values-for-parameter

Here is a closer look at the single value list as default criteria for select option so_vmsta.

selection-screen-with-default-single-values-for-parameter2

Add the ABAP codes that will execute after Selection Screen is displayed, right after START-OF-SELECTION.
Now it is possible to run the ABAP report with the desired default values assigned to Select Options in the SAP Selection Screen.



SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.