web dynpro abap_ using assistance class in web dynpro abap

Download Web Dynpro ABAP_ Using Assistance Class in Web Dynpro Abap

Post on 30-Oct-2014

52 views

Category:

Documents

5 download

Embed Size (px)

TRANSCRIPT

11/5/12Share 0

Web Dynpro ABAP: Using Assistance Class in web dynpro abapMore Next Blog Create Blog Sign In

Web Dynpro ABAPTUESDAY, MAY 31, 2011

Using Assistance Class in web dynpro abapAssistance Class in web dynpro Abap :- Assistance class is a way of writing a separate class and using the functionality or logic defined in its method within your web dynpro application. It is useful where you have some piece of logic which is reusable at many places. plus Assistance class is also used in internationalization of the WD application. You can declare the text in the assistance class and then afterwards can use it in your WD application. Concept is almost straight forward and easy. You declare a class with some methods having the required functionality. and can declare some text elements also if you want to use them. and you have to make this class subclass of a class CL_WD_COMPONENT_ASSISTANCE. However this is not a mandatory steps but declaring this class as superclass makes services available in web dynpro framework work. WD_ASSIST attribute will be getting created automatically in each of the controllers in the web dynpro component. Now lets have one step by step example of working with this feature of assistance class. 1. Go to txn se24 and create a class . give a relevant name and press on create.

learnwdabap.blogspot.in/2011/05/using-assistance-class-in-web-dynpro.html

1/19

11/5/12and click on save.

Web Dynpro ABAP: Using Assistance Class in web dynpro abap

2. Go to the methods tab and create methods. In the current case, I am creating a method name 'Get Name' and with one import and one export parameter. functionality of the method is to give name of the dealer based on the ID.

learnwdabap.blogspot.in/2011/05/using-assistance-class-in-web-dynpro.html

2/19

11/5/12

Web Dynpro ABAP: Using Assistance Class in web dynpro abap

learnwdabap.blogspot.in/2011/05/using-assistance-class-in-web-dynpro.html

3/19

11/5/12

Web Dynpro ABAP: Using Assistance Class in web dynpro abap

3. Save and activate the class.

learnwdabap.blogspot.in/2011/05/using-assistance-class-in-web-dynpro.html

4/19

11/5/12

Web Dynpro ABAP: Using Assistance Class in web dynpro abap

4. You can test the functionality of the method by using the TEST option as shown below.

learnwdabap.blogspot.in/2011/05/using-assistance-class-in-web-dynpro.html

5/19

11/5/12

Web Dynpro ABAP: Using Assistance Class in web dynpro abap

5. ON the properties tab you can find one field called super class there give the name CL_WD_COMPONENT_ASSISTANCE. save and activate the class.

learnwdabap.blogspot.in/2011/05/using-assistance-class-in-web-dynpro.html

6/19

11/5/12

Web Dynpro ABAP: Using Assistance Class in web dynpro abap

6. Go to SE80 and open the WD component where you want to use the assistance class. give the name of the class in the assistance class field.

learnwdabap.blogspot.in/2011/05/using-assistance-class-in-web-dynpro.html

7/19

11/5/12

Web Dynpro ABAP: Using Assistance Class in web dynpro abap

7. Automatically the attribute WD_ASSIST of type instance of class will be created in the component controller and view controller.

learnwdabap.blogspot.in/2011/05/using-assistance-class-in-web-dynpro.html

8/19

11/5/12

Web Dynpro ABAP: Using Assistance Class in web dynpro abap

8. In the view we will use the assistance class method "GET_NAME". for that i have created

learnwdabap.blogspot.in/2011/05/using-assistance-class-in-web-dynpro.html

9/19

11/5/12

Web Dynpro ABAP: Using Assistance Class in web dynpro abapsome context attribute and then in the view layout, have designed two input fields and one button. we will enter dealer id and then click on submit button. In the eventhandler of the button we will call the method GET_NAME of the assistance class using the attribute WD_ASSIST and fetch the name form the database after passing ID.

learnwdabap.blogspot.in/2011/05/using-assistance-class-in-web-dynpro.html

10/19

11/5/12

Web Dynpro ABAP: Using Assistance Class in web dynpro abap

9. Create an application and test it .

learnwdabap.blogspot.in/2011/05/using-assistance-class-in-web-dynpro.html

11/19

11/5/12

Web Dynpro ABAP: Using Assistance Class in web dynpro abap

learnwdabap.blogspot.in/2011/05/using-assistance-class-in-web-dynpro.html

12/19

11/5/12

Web Dynpro ABAP: Using Assistance Class in web dynpro abap10. Now lets check out the other usage of assistance class. i.e. declaring the text elements in the class and then using it for translation according to the language chosen. Here we will have one page with one simple text view translated according to the language chosen. go to se24 and open the class and Goto-> Text elements.

11. declare the text elements here and after that save it and then Goto->Translation

learnwdabap.blogspot.in/2011/05/using-assistance-class-in-web-dynpro.html

13/19

11/5/12

Web Dynpro ABAP: Using Assistance Class in web dynpro abap

12. Select the from and to language and then give the translated texts for each of the text elements. Save it and activate the class again.

13. Go to SE80 and open the web dynpro component and the view where you want the text. I have used one text view which is bound to one context attribute of type string.

learnwdabap.blogspot.in/2011/05/using-assistance-class-in-web-dynpro.html

14/19

11/5/12

Web Dynpro ABAP: Using Assistance Class in web dynpro abap

14. Then in wddoinit have used the WD_ASSIST->IF_WD_COMPONENT_ASSISTANCE~GET_TEXT( KEY = ' '). method of the interface for getting the data. it will give the text according to the language selected in the application.

learnwdabap.blogspot.in/2011/05/using-assistance-class-in-web-dynpro.html

15/19

11/5/12

Web Dynpro ABAP: Using Assistance Class in web dynpro abap

15. Test the application and we can see the text got automatically translated according to the language selected.

learnwdabap.blogspot.in/2011/05/using-assistance-class-in-web-dynpro.html

16/19

11/5/12

Web Dynpro ABAP: Using Assistance Class in web dynpro abap

learnwdabap.blogspot.in/2011/05/using-assistance-class-in-web-dynpro.html

17/19

11/5/12

Web Dynpro ABAP: Using Assistance Class in web dynpro abap

Thanks :) thanks gill

Posted by gill at 6:03 AM Recommend this on Google

2 comments:KARTHICK R March 23, 2012 3:00 AM Refer below link also ..... http://theabap.blogspot.in/2012/02/message-handling-assistance-step-1-go.html Reply

AzzuSyd May 20, 2012 10:53 PM xlnt thanks gud work Reply

Etryu cmet. ne or omn..

Comment as: Google Account Publish Preview

Newer Post Subscribe to: Post Comments (Atom)

Home

Older Post

BLOG ARCHIVE

FOLLOWERS

2011 (4) June (2) May (2) Using Assistance Class in web dynpro abap Creating a Simple Web Dynpro App with ALV

learnwdabap.blogspot.in/2011/05/using-assistance-class-in-web-dynpro.html

18/19

11/5/12

Web Dynpro ABAP: Using Assistance Class in web dynpro abapJoin this siteCOUNTER w ith Google Friend Connect

Members (5)

Already a member? Sign in

TOTAL PAGEVIEWS

5,889Simple template. Template images by gaffera. Powered by Blogger.

learnwdabap.blogspot.in/2011/05/using-assistance-class-in-web-dynpro.html

19/19