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 OnCreateHandler Script Button to Run At Page Load

SAP Screen Personas developers use script button at OnCreateHandler property of a flavor to set initial values of displayed controls on page at start automatically. Programmers can think of OnCreateHandler as a page event triggering at flavor load which enables automatic execution of predefined script button actions.

I have created a SAP Screen Personas flavor for VA01 transaction initial screen. But I want to populate below empty fields automatically when the page is load.

SAP Screen Personas sales order entry screen

In fact, if I had the chance to use pure Javascript, I would use Javascript onLoad event of the web page.

ABAP developers who create SAP Screen Personas transaction screens can use OnCreateHandler property to run a specific Script button code when the Personas flavor is displayed in front of the SAP user.

First add a Script button on to the SAP Personas flavor.

add script button to SAP Screen Personas flavor

Give a meaningful name to your Script button like "Create Handler Script" We will fill the script steps later in this SAP Personas tutorial.

Click on Show/Hide Properties icon which is on the right.

Show/Hide Properties

Then click on an empty area on the flavor layout.
You will be selecting the control with ID ses[0]/wnd[0]/usrUSRAREA
You will see the OnCreateHandler property.

OnCreateHandler

On SAP Screen Personas developers can use the OnCreateHandler attribute to run a script button automatically when a Personas layout is loaded. Adding steps to the script button enables the developer to customize what is to run automatically when the page is load.

Copy the Script button ID and paste into the OnCreateHandler attribute
To copy the Script button control id, click on script button. When properties screen is displayed click on the top area containing text which is like a GUID. When you click on that text, it is automatically copied into clipboard.

copy SAP Screen Personas control id

Paste the script button id into OnCreateHandler event of the SAP Personas flavor.

SAP Personas script button to run with onCreateHandler event

ABAP developer can now edit the script button details to add new steps that will populate input textboxes with predefined values.

To simplify the SAP Personas tutorial, I used "Enter Value" action. Then I selected the control on the SAP Screen Personas flavor. I also entered the values I wanted to see on the screen.

SAP Screen Personas: define script button properties

Save and exit your flavor development.

OnCreateHandler script button on SAP Screen Personas layout

You can hide the script button for a better GUI desing, there is no need to show it on the screen to the SAP users.

hide or unhide controls on SAP Personas flavor






SAP Tutorials

SAP Tutorial

SAP Forums

SAP Tools

SAP Transaction Codes Table






Related Articles and Tutorials(http://www.kodyaz.com/sap-abap/personas-oncreatehandler-script-button-at-page-load.aspx)
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
How SAP Screen Personas Improve Business Value
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