Quantcast
Channel: SCN : Document List - SAP GUI
Viewing all articles
Browse latest Browse all 253

SAP Screen Personas 2.0 - How to access the selected row in a grid

$
0
0

Note: This article is about SAP Screen Personas 2.0. If you are looking for more information about SAP Screen Personas 3.0, please go to the SAP Screen Personas 3.0 Portal.

 

This how to describes with an example the solution discussed at SAP Personas - dynamic selection of line from report. This example scenario requires some advanced SAP Screen Personas features like the execution of JavaScript snippets (more information at SAP Screen Personas 2.0 - How to go beyond the existing script actions), executing scripts and showing data on a different screen (more information at SAP Screen Personas 2.0 - How to execute a transaction and display the result) and finally the linking of a script button to an enter-key press event.

 

As an example, the transaction VA05N (List Sales Orders) has been chosen. On the first screen the user enters a search criteria and executes the search. The second screen shows a grid with all sales orders that meet the search criteria. Using Personas, we have extended the first screen with an additional display field which is to be automatically filled with the net value (column 18) of a sales order by a script that is executed on the 2nd screen. The script execution is started after the user selected a row in the grid an and the user pressed enter. The demo video shows, how to modify the screens and then two runs showing that the script works.

 

 

Step-by-step:

  1. Extend the first screen of VA05N
    1. Create some space for the new controls
    2. Add additional group box, label and text field
    3. Copy the id of the text field (temporarily paste into a text file)
    4. Save & Exit
  2. Execute the search with a sample search criteria (order number 0 to 5000)
  3. Switch into edit-mode
  4. Copy the id of the grid
  5. Add a script button
    1. Add a Copy Table action, as id use the previously copied grid id, as content define the variable name table
    2. Add a Calculate in JavaScript action that extracts the net value (column 18) from the currently selected row
      1. args.value = args.table[18][parseInt(args.row) + 1];
    3. Add a Push action for the button that brings the user back to the first screen
    4. Add a Paste Value action that pastes the content of the parameter value into the additionally created text field
  6. Bind the script button to the event of pressing enter while the grid is focused
    1. Open the Properties Editor
    2. Select the script button
    3. Copy its id (left click on the id)
    4. Select the grid
    5. Scroll until you see the property PushOnEnter
    6. Paste as value the id of the script button
  7. Save & Exit
  8. Test the script

 

Important: the parameter args.row is only available in the script when it is triggered by the press-enter event on a table or grid. If the script is executed by pressing the button, args.row is not defined, therefore,it is recommended to hide the button, so that it cannot be clicked.

 

As usual, if you want to learn more or discuss anything related to how to make your SAP GUI screens more functional using SAP Screen Personas, please start a discussion in the SAP GUI space on SCN.


Viewing all articles
Browse latest Browse all 253

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>