Skip to Content

Objective:

The article is written to illustrate the use of Assistance class in WebDynpro ABAP.

About Assistance Class:

For each Web Dynpro component, a uniquely assigned assistance class can be created. Creating an assistance class for a component provides the following benefits:

●    We can store coding there that is required within the component, but is not linked directly with the layout or with the function of a controller. Method calls of the assistance class are much better from a performance point of view than calls of methods of a Web Dynpro controller.

●    The second important function of the assistance class is the management of dynamic texts. Texts that are combined at runtime only and/or contain variables can be stored in the text pool of the assistance class as text symbols.

The assistance class is automatically instantiated when a component is called. The instance is available to each controller of the component through the attribute WD_ASSIST.

Web Dynpro ABAP: Creating Assistance class

Prerequisites

Consultants should have basic knowledge of creating and using class/methods. They should have basic WebDynpro ABAP knowledge. Refer the link given in reference section for detailed step by step explanation for creating select-option.In this article, we are going to create Assistance class with a method which will retrieve the details for group of employees and the same will be called from WebDynpro.

Steps to create class:

Step 1:

Go to SE24 and create class ZZZ_CL_JAYTEST.

Assistant_Class1.JPG

Step 2:

Declare the below in types.

  Assistant_Class2.JPG

Use the arrow on the right side to define the following.

Assistant_Class3.JPG

Step 3: Define Method Get_Empdetails.

Assistant_Class4.JPG

Place the cursor in the method GET_EMPDETAILS and choose parameters to add the below.

Assistant_Class5.JPG

Steps to create WebDynpro

Create an Web Dynpro component (say zzz_jaytest20). In properties, mention the name of the class which we created now in Assistance class and then include WDR_SELECT_OPTIONS component in Used Components section as shown below.

Assistant_Class6.JPG

Assistant_Class7.JPG

Assistant_Class8.JPG

Code:

Detailed step by step explanation is given in the article mentioned in the reference for creating select-option.Write the below coding in WDDOINIT method of VIEW Main to create select-option.

Assistant_Class9.JPG

Mention the type name as P_PERNR and search help as PREM(we can find it from Tcode PA20->F1 help->Technical Information of personnel number.

Assistant_Class10.JPG

Assistant_Class12.JPG

Assistant_Class13.JPG

Window:

In the window (Say ZZZ_JAYTEST20), embed the select-option as below.

Assistant_Class14.JPG

Create Web Dynpro Application(say zzz_jaytest20).

Test:

Enter the employee range.

Assistant_Class15.JPG

Reference:

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/103e43d5-fdb8-2d10-90ab-b5e8532cbc04

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/43/1f6442a3d9e72ce10000000a1550b0/content.htm

To report this post you need to login first.

2 Comments

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

  1. Kenneth Moore

    I know select-options was not the main topic here, but that helped me with select-options for the PERNR field.  I couldn’t figure out the search help part!  Thanks!

    (0) 

Leave a Reply