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:
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:
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.