Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
4,490


Over in my Personas idioms document I mention the concept of "transaction free lookup", that is being able to lookup data in an SAP system without ever leaving the SAP home screen. The example I give there is of taking a purchase order number and looking up some of the details of the PO and displaying them directly on the home screen and not having to see ME23N at all. For this blog I want to take a simpler example. We use Service Management in ERP6 to manage the maintenance of our campus. One thing our users often want to do is lookup a functional location code to check they have the right one. Like this:



 

This is done with a simple script that calls transaction IL03, feeds it the value from the "Location" field on the home screen, copies the location description and then navigates back to the home screen before pasting the description in the appropriate place. Like this:

 







 

You can take this process a little further by providing fuzzy matching. For example, what if I know part of what the building is called and want to find the location code? Like this:

 



 

Here you can see the search finds two locations with "university" in the description and you can choose which you want just by selecting the line. The corresponding details are copied back to the home screen. This uses a technique described by tobias.queck in the document SAP Screen Personas - How to access the selected row in a grid for managing data presented in a grid. In summary, you need to use a JavaScript action in a script to access the selected line of the grid. The rest is standard Personas scripting. Here's a detailed walkthrough.

 

The first thing to note is that there are two scripts involved, one on the home screen "Find" button which navigates to the search transaction and one on the search transaction that copies data back to the home screen. The first script is straightforward:

 





 

The only tricky thing here is step 3 - a little piece of Javascript to prepend and append "*" characters to the search term so that we do a wildcard search. Otherwise this is a simple script to run transaction IH11 to search for functional locations by description. It leads us to this IH11 screen (with an appropriate flavor):

 



 

Now the fun starts! First note that there's a hidden script button on this screen that does all the hard work. This button is linked to the GridView via the view's properties, and in particular the PushOnClick property:



 

The script on this button is quite short:

 





 

The clever stuff is in the first three steps. Step 1 grabs the whole table from the GridView. Step 2 takes the functional location code from the second column and step 3 takes the description from the third. The column number is in the brackets after "args.table" and columns are numbered from 0. The code "parseInt(args.row)+1" represents the selected row number. After that we simply navigate back to the home screen and paste the values into the appropriate text fields.

 

These techniques, along with the ability to call WebRFCs for lookup (Calling RFCs from a Personas script) or update (Using WebRFC for update in a Personas script) mean that via Personas you can give a user access to a lot of functionality in an ERP system without ever being aware of running an actual transaction.

6 Comments