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 SAP ABAP Programming and HANA Database Tutorials
Development resources, articles, tutorials, samples, codes and tools for .Net, SQL Server, Windows, Windows Phone, SAP and ABAP, like SAP UI5, Screen Personas, etc.




CRM Companies List
Web Based CRM Software


SAP Screen Personas Set Default Selection in DropDown List

SAP Screen Personas tutorial shows how to set default selected value of a dropdown list control on a Personas flavor by using OnCreateHandler event using script button.

Although SAP Personas flavor dropdown list control is created with a predefined default selected value during execution the dropdown field is displayed as empty. To overcome this problem and show default value in the dropdown list control on the SAP Personas flavor, I will show developers how they can use script button and OnCreateHandler.

SAP Personas Flavor Layout with Dropdown List Control

I have used a dropdown list control on a SAP Screen Personas flavor. Although I have defined a value as default selection, unfortanetely the preselected value I have set is not displayed as I expected when I execute the flavor transaction.

SAP Screen Personas flavor dropdown list control

Here is the flavor control dropdown list configuration. On VA01 transaction flavor, I set the standart order as the default value of the dropdown list control.

control conversion for dropdown list from textbox

To set default value, normally checking the option box on the left side of the dropdown list item is enough. Unfortunately, in this case when the flavor is first displayed the default value is not displayed as the selected value. The default displayed value on the dropdown list is an empty value which we do not want.


Use OnCreateHandler for Dropdown List Default Value

In order to solve this problem which prevents displaying default selection of a dropdown list control on a SAP Personas flavor, first create a new Script by adding script button on the Personas layout.

Add the following user action into the steps of the script button which sets the selected value of the dropdown list.

SAP Personas Script Button actions

ABAP developer should replace the control "ses[0]/wnd[0]/usrUSRAREA/ctxtVBAKAUART" with the target dropdown list Personas layout control. Using "Enter Value" action, the selected item value of the dropdown list can be provided.

As last step, copy the id value of the script button control. Then paste the script button id into the OnCreateHandler attribute of the layout user area as seen in below screenshot. Finally, hide the script button since the execution will be controlled by the page load event of the Personas flavor.

set OnCreateHandler for default values of SAP Personas flavor

OnCreateHandler event of the Personas layout user area will enable SAP Screen Personas developers to execute a default script when on page load event of the layout automatically.

Afterwards, everytime the flavor is called or executed, the dropdown list will be shown with predefined value is selected by default as follows.

dropdown list with default value is set

On fortunately, if you have copies of this flavor for example for the purpose of different country implementations, etc all flavors should be updated manually for the target default values of the dropdown list flavor controls.






SAP Tutorials

SAP Tutorial

SAP Forums

SAP Tools

SAP Transaction Codes Table






Related Articles and Tutorials(http://www.kodyaz.com/sap-abap/sap-screen-personas-dropdown-default-value.aspx)
How SAP Screen Personas Improve Business Value
Activate SAP Personas 3.0 Services using SICF Transaction
Call WebRFC from SAP Personas Script Button for User Name and Data
How to Change Background in SAP Personas MainApp
SAP Personas Html Viewer Control for Table Data
Launch Transaction Code using SAP Personas Script Button
Display Whitelist URL using SAP Personas WebPage Launch Button
Hands-on SAP Personas Tutorial for Beginners
How to Create SAP Screen Personas Flavor, Remove and Delete it
How to Export and Import SAP Screen Personas Flavors
Launch Web URL using SAP Personas Script Button
clientaccesspolicy.xml crossdomain.xml is not configured
SAP Screen Personas OnCreateHandler Script Button to Run At Page Load
Press F Key on SAP Personas Script Button for F3
PushOnEnter Event on SAP Personas like OnKeyPress in Javascript
SAP Screen Personas Set Default Selection in DropDown List
Function module is not released for the Internet


Copyright © 2004 - 2017 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems