Skip to Content

So called One-Click Actions (OCA later on in the text) are dedicated to table list processing. They offer immediate and discrete operations on any row of a table in a view. In the SAP CRM Web UI, the OCA can be represented by an Icon or a text, they are often used to delete or edit a row. The purpose of this blog is to provide you with a quick introduction on the use of OCA via a case study.

Please consider the following statement from Tim Back & Nadine Beigel (SAP Corp) in a paper on OCA published on August 2009:

“Rules on OCA apply only in case you are using table/cellerator view configuration. The THTMLB table/cellerator view tag itself does not support any One Click Actions.”



In our previous blog, How to adapt CRM Web UI descriptions in the runtime … we approached a case where a Web UI application was built from scratch to meet a particular customer requirement regarding the mass maintainance of business documents. We will keep this sample case to illustrate the use of OCA. The application enables the user to updates the informations regarding the status and the partner profiles, then saves all document at once.
We consequently expect all documents to be successfully saved with the updated information, but circumstances may lead to a situation where several documents cannot be saved. The logical unit of work is the document, meaning each document is saved disregardless of what happens with the other documents.
In this context, the idea about the use of OCA came up with a need to get a status of the processing for each document. An icon is shown besides each row where a problem occurred. Clicking on the icon provides the user with a description of the error encountered, this information is embedded into popup window.



In the Web UI Infrastructure, the Table list is handled as a Context node of type table. Though the definition of the OCA in terms of look, feel and action is location on the context node class, the event it triggers is handled on the level of the Controller like other classical view events.

1. Context node setup

. We focus on the class handling the table, here the context node class is ZL_Z01_DEMO__MASSMAINTAIN0_CN00

. Firstly modify the method GET_TABLE_LINE_SAMPLE where you declare a new attribute thtmlb_oca. The attribute will appear on your context node. Please bear in mind there’s one unique OCA attribute required to declare all possible OCA’s.

. Create the Getter method GET_THTMLB_OCA for your new field (take any Getter method as a sample).

. Create the Property method GET_P_THTMLB_OCA (copy the template method _GET_P_XYZ). Feed the method with the code below. This method declares the behaviour of the new Attribute THTMLB_OCA as a One-click Action and also specifies the releted Controller Event to call.

. Once an Attribute is declared as a One-click Action, an OCA Getter is systematically called to further define its properties. This extra getter method GET_OCA_T_TABLE is already available on the Context node class. We redefine the method to specify the Icon or Text of any OCA and the associated Id used to identify which OCA is hit by the user. Extra settings include the Tooltips, and the (de)activation of the OCA. This method offers an Index parameter IV_INDEX to locate the row currently processed. In the sample code below, we stored all errors in a global attribute table GT_MessageBoard, the method checks whether a message is available for our row and displays the icon accordingly.

2. Controller setup

. We now define the processing of the Event, that is, what happens once the user hits the icon. What happens here is up to your imagination (which most of the time is constrained by your customer’s requirements). In this case study, as explained above, the event displays a popup window to show the message collected on the processing of the row. At the declaration of the OCA attribute above, we assigned the event _ONE_CLICK_ACTION, we now create an Event Handler method EH_ON_ONE_CLICK_ACTION with the sample code provided hereafter. The logic retrieves the Icon Id (which Icon hit) and the row index (which row considered) from the available HTMLB import parameter (HTML Business Java).

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

Leave a Reply