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.
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.
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.
Then click on an empty area on the flavor layout.
You will be selecting the control with ID ses/wnd/usrUSRAREA
You will see the OnCreateHandler property.
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.
Paste the script button id into OnCreateHandler event of the SAP Personas flavor.
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.
Save and exit your flavor development.
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.