cancel
Showing results for 
Search instead for 
Did you mean: 

Web Dynpro for ABAP

Former Member
0 Kudos

Hi All,

I am new to Web Dynpro for ABAP.I have gone through the WDA but still have a few questions which are

1. Where to write the code for the Events ? Are there any standard event codes?If so then can we use them for any application?

2. Where and how to declare the Plugs?

3. How to call the Interface and View Controllers?

Any example will surely be helpful.

Thanks in advance.

Edited by: Shweta Kullkarni on Jan 14, 2010 5:18 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can find all demo scenarios for web dynpro in package SWDP_DEMO.

Regards

Manas Dua

Former Member
0 Kudos

Hi All,

Thanks for your replies.

Can you please tell me the following?

1.There are various Controllere ,that is,View Controller,Context Controller,Window Controller.So where shall I eaxactly write the code for events,Plugs,also for passing the data between different controllers and views?When do we need to call the Interface Controller ,View Controller?Do we need to call them in every Application?

2.Is it mandatory to use usage in ALV?

3.What exactly is View used for?Can you give me any example?

4.What is the use of UI Elements?How are the Texts for them assigned?

5.Do we use the UI Elements for the Dropdown list,Radiobutton,Selection Screen?If not then how are they implemented?Where do we write the code for the Userchoice on the Dropdown list,Radiobutton,Selection Screen?

Thanks in advance.

Edited by: Shweta Kullkarni on Jan 15, 2010 7:24 AM

Former Member
0 Kudos

Hi,

"""1.There are various Controllere ,that is,View Controller,Context Controller,Window Controller.So where shall I eaxactly write the code for events,Plugs,also for passing the data between different controllers and views?When do we need to call the Interface Controller ,View Controller?Do we need to call them in every Application?""

start with controller we have two types of controller

1. Component Controller(you can assume it as global.what ever context attribue u declare can be use glbally means accross the views)

2. View controller (what ever you declare here is remain local to this view)

now , suppose u have created a button in main view.

the requrement is that onclick of that button save the form data. so create an action 'SAVE'(which intern genrate the mehtod ONACTIONSAVE )write your code to save.

2.Is it mandatory to use usage in ALV?

No you can use TABLE UI Element of a view.

3.What exactly is View used for?Can you give me any example?

View is simple user view. what ever things you want user to see in output declare here in view.. suppose take an application form. you create many input fields and SAVE button.

5.Do we use the UI Elements for the Dropdown list,Radiobutton,Selection Screen?If not then how are they implemented?Where do we write the code for the Userchoice on the Dropdown list,Radiobutton,Selection Screen?

we have many SAP made componets you can find it from SE80 , searching with DEMO*

or in package SWDP_DEMO. it will be help full to undersatnd all UI elements

Former Member
0 Kudos

Hi Raj,

Thanks for the reply.

Please tell me If I want to fetch the data from the database table based on the User Input in the for of any Check box or Radiobutton then

1.Where do I write the code for the User Inputs in the form of Checkbox or Radiobutton?

2.Also,when do we need to pass the data from one View to the other or one Component to the other,how to do it and where to write the code for it?

3.Is it mandatory to Call the Interface controller ,View Controller?If not then when do we need to call the Interface Controller and View Controller?When and how to call the Interface View?

Thanks in advance.

Former Member
0 Kudos

Hi Shweta,

The things you are askin are very basic in nature, it would be good if you do some homework and look into some sample webdynpro components mentioned above in threads.

Or there are many threads like this in the forum you can just search them and find answers yourself.

Regards

Manas Dua

Former Member
0 Kudos

hi

But where to write this code forswitching between the views?In View Controller?

suppose u have two views V1 and V2 and on click of the Button in the view V1 , u want to navigate to V2 , so make a Action in OnAction of ur button and fire the plug in the OnActionEvent method as dtated earlier as well

Also, how to pass data between the two Views,Controllers and where to write the code for that in View Controller ,Window Controller or Context Controller?

refer this thread :

data flow between views

http://forums.sdn.sap.com/click.jspa?searchID=37048884&messageID=8305866

1.There are various Controllere ,that is,View Controller,Context Controller,Window Controller.So where shall I eaxactly write the code for events,Plugs,also for passing the data between different controllers and views?When do we need to call the Interface Controller ,View Controller?Do we need to call them in every Application?

u need to call the controllers , when u r need to use the already existing standard component , suppose u wish to use the ALV , then u have to use the component usage for ALV otherwise if u r building the independent component , u do not need any such usge .. hipe it is clear now

2.Is it mandatory to use usage in ALV?

it is mandatory only if u wish to use ALV table in ur component for SALV_WD_TABLE

3.What exactly is View used for?Can you give me any example?

view is used for graphical representation when u r bulding a page , simple go to Layout tab and right click on the RootElementContainer and choose insert elemnt

regards,

amit

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

To pass the data between two views.

Create a context node in component controller with attribute(type of attribute is same as the data u need it to hold).

Map this context node to both the views(i.e from where you are sending data and where u are recieving data).

Set the data to pass into the attribute in your sending view(you can generate code for this through wizard).

Now access the same attribute in recieving view , u will have the data that u sent .

There is also another way to pass data through plugs.

Cheers,

Aditya.

Former Member
0 Kudos

answered

Former Member
0 Kudos

hi ,

3. How to call the Interface and View Controllers?

to call the interface controller :

u wud have to do the component usage of that Web Dynpro component in ur used component ,in which u want to use the method of some other component.

In ur primary component , create a method in component controller, check the interface chech box. Now when you'll use this component in some other component, you be able to use this method.

refer this documentation on component usage :

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/2e71ce83-0b01-0010-11a4-98c28a33...

to be able to use the other component , specifically in ur view ..

u have to define the component usage first .Thn in ur view , go to the Property tab , click on the icon to create Controller usage ..

if u r beginner to ABAP WD :

http://help.sap.com/saphelp_nw2004s/helpdata/en/03/0048413e466e24e10000000a155106/content.htm

Main Topic Page:

http://sdn.sap.com/irj/sdn/nw-wdabap#section2

Tutorials for Beginners:

[original link is broken]

eLearning Videos:

/people/thomas.jung/blog/2006/06/20/web-dynpro-abap-demonstration-videos

regards,

amit

Former Member
0 Kudos

hi Shweta ,

1. Where to write the code for the Events ? Are there any standard event codes?If so then can we use them for any application?

Basically a event handler is executed when a view is initialised , ended or entered , when a UI element of view triggers an action.

In your Layout tab , when you right click on root element container and suppose u enter a Button UI.Now u want something to happen on click of that button . So u wud create a Action for that , and in the OnActionEvent method , u wud write the coding .

there is a property OnAction for UI .click on that , create a action for ur UI and write the appropriate code in corresponding method.

2 Where and how to declare the Plugs?

there r 2 kinds of plug. inbound plug is used for recieving and outbound plug for connecting to another view.

V1 and V2 are 2 views and you want to navigate between these 2 views

create FROM_V2 as inbound plug and TO_V2 as outbound plug in View V!. and same way create FROM_V1 and TO_V1 in view V2.

To move from one view to other:

Suppose you want to go from v1 to v2 view. On the action of the button ui elemnt in v1 view, just fire the outbound plug as


wd_this->fire_to_v2_plg(
).

see this documentation:

http://help.sap.com/saphelp_nw70/helpdata/en/47/455c6980f81962e10000000a114a6b/frameset.htm

regards,

amit

Former Member
0 Kudos

Hi Amit,

Thanks for the reply.

there r 2 kinds of plug. inbound plug is used for recieving and outbound plug for connecting to another view.
V1 and V2 are 2 views and you want to navigate between these 2 views
create FROM_V2 as inbound plug and TO_V2 as outbound plug in View V!. and same way create FROM_V1 and TO_V1 in view V2.

To move from one view to other:
Suppose you want to go from v1 to v2 view. On the action of the button ui elemnt in v1 view, just fire the outbound plug as 

wd_this->fire_to_v2_plg(
).

But where to write this code forswitching between the views?In View Controller?

Also, how to pass data between the two Views,Controllers and where to write the code for that in View Controller ,Window Controller or Context Controller?

Thanks in advance.

Former Member
0 Kudos

hi

But where to write this code forswitching between the views?In View Controller?

suppose u have two views V1 and V2 and on click of the Button in the view V1 , u want to navigate to V2 , so make a Action in OnAction of ur button

and fire the plug in the OnActionEvent method as dtated earlier as well

Also, how to pass data between the two Views,Controllers and where to write the code for that in View Controller ,Window Controller or Context Controller?

refer this thread :

data flow between views

http://forums.sdn.sap.com/click.jspa?searchID=37048884&messageID=8305866

1.There are various Controllere ,that is,View Controller,Context Controller,Window Controller.So where shall I eaxactly write the code for events,Plugs,also for passing the data between different controllers and views?When do we need to call the Interface Controller ,View Controller?Do we need to call them in every Application?

u need to call the controllers , when u r need to use the already existing standard component , suppose u wish to use the ALV , then u have to use the component usage for ALV

otherwise if u r building the independent component , u do not need any such usge ..

hipe it is clear now

2.Is it mandatory to use usage in ALV?

it is mandatory only if u wish to use ALV table in ur component for SALV_WD_TABLE

3.What exactly is View used for?Can you give me any example?

view is used for graphical representation when u r bulding a page , simple go to Layout tab and right click on the RootElementContainer and choose insert elemnt

4.What is the use of UI Elements?How are the Texts for them assigned?

it is basic .. u r bulding a application , u need to display using UI ..

u can give the text in TEXT property or assign OTR text

SOTR_EDIT : transaction for OTR texts creation

http://forumsa.sdn.sap.com/click.jspa?searchID=37049534&messageID=7690007

5.Do we use the UI Elements for the Dropdown list,Radiobutton,Selection Screen?If not then how are they implemented?Where do we write the code for the Userchoice on the Dropdown list,Radiobutton,Selection Screen?

there are UIs dropdown by index , drop down by key , radio buton , place these inside ur view

search the basic tutorials , as I had pointed in earlier thread begin the development , the things wud get clear

cheers:)

regards,

amit

Edited by: amit saini on Jan 15, 2010 7:50 AM

Former Member
0 Kudos

Hi Amit,

Thanks for the reply.

Correct me if I am wrong.I take the simple example below.

There sholud be two Radiobuttons Yes,No.After pressing Yes the Message "Yes" should be displayed similarly after pressing No message "No" should be displayed.For this the following shiould be created

1. 3 Views ,1 for displaying the Options Yes or No,1 for Yes,1 for No .

2.I should write the logic in the View Controller for the processing after pressing of the radiobuttons.

Now please tell me does Component Controler,Interface Controller should be used?If yes then for what ?

Thanks in advance.

Former Member
0 Kudos

hi

Now please tell me does Component Controler,Interface Controller should be used?If yes then for what ?

just make ur context node and the attributes under it in the component controller

no need for the interface controller here and refer the reply above ,

4.What is the use of UI Elements?How are the Texts for them assigned?

it is basic .. u r bulding a application , u need to display using UI .. u can give the text in TEXT property or assign OTR text SOTR_EDIT : transaction for OTR texts creation

refer the related threads:

http://forumsa.sdn.sap.com/click.jspa?searchID=37049534&messageID=7690007

5.Do we use the UI Elements for the Dropdown list,Radiobutton,Selection Screen?If not then how are they implemented?Where do we write the code for the Userchoice on the Dropdown list,Radiobutton,Selection Screen?

there are UIs dropdown by index , drop down by key , radio buton , place these inside ur view

search the basic tutorials , as I had pointed in earlier thread begin the development , the things wud get clear cheers:)

regards,

amit

Edited by: amit saini on Jan 15, 2010 8:07 AM

Former Member
0 Kudos

Hi Amit,

Thanks for the reply.

Can you give me any example for the passing data between two Views?

Also when do we need to Use Interface Controller and Context Controller?

If I need to mention the parameter for the Selection Screen screen then I need to mention it in the Context?For Example, I need to give Yes and No parameters which are from Table Tab then I need to create one node in the Context and need to mention these two parameters there.Is it?If so then Can we say that the Context itselt acts as the structure wherein we need to define the fields that are used in the Web Dynpro?

Thanks in advance.

Former Member
0 Kudos

hI,

nO NEED TO USE COMPONETN cONTROLER (as here you are not require to pass any data , you just need to navigate)

now interface controller is also not required as it is only use when u want to use any other Component.

So just create proper plugs,and u r done with this exersie..

better u take refrence from standard exmples given by SAP .

Search it with DEMO* in SE80

thanks

Former Member
0 Kudos

Hi Raj,

Thanks for the reply.

nO NEED TO USE COMPONETN cONTROLER (as here you are not require to pass any data , you just need to navigate)

now interface controller is also not required as it is only use when u want to use any other Component.

Means we use Component Controller if we need to pass the data to any other Component ?Is it?If not then Where do we need to use the Component Controller to pass the data to?

Is it possible to ransfer data from the Interace Controller to Component Controller and Vice Versa or between the View Controller and the Context Controller or Vice Versa?Id so ,when do we need to do that?

Thanks in advance.

Former Member
0 Kudos

Hi,

you are Geeting confused. see component controller is used to pass data between the views within that component.

and interface controller is the thing when u want to intract with any other component.

Go throgh WEBDYNPRO FOR ABAP Book you can easily find it ...in Eleaning

thanks

Former Member
0 Kudos

Hi Raj,

Thanks for the reply.

Can you please tell me the use of

1.Component Controller

2.Interface Controller

3.View Controller

4.Context Controller

5.If I need to mention the parameter for the Selection Screen screen then I need to mention it in the Context?For Example, I need to give Yes and No parameters which are from Table Tab then I need to create one node in the Context and need to mention these two parameters there.Is it?If so then Can we say that the Context itselt acts as the structure wherein we need to define the fields that are used in the Web Dynpro?

Thanks in advance.

Former Member
0 Kudos

Hi Saket,

Thanks for the reply.

Can you please tell me the following?

1.If I write the code for anything in the Component Controller instead of writing in any of the Web Dynpro Controllers will it work as Component Controller os the Global Controller?

2.If I need to mention the parameter for the Selection Screen screen then I need to mention it in the Context?For Example, I need to give Yes and No parameters which are from Table Tab then I need to create one node in the Context and need to mention these two parameters there.Is it?If so then Can we say that the Context itselt acts as the structure wherein we need to define the fields that are used in the Web Dynpro?

Thanks in advance.

Edited by: Shweta Kullkarni on Jan 15, 2010 8:59 AM

Edited by: Shweta Kullkarni on Jan 15, 2010 9:04 AM

Former Member
0 Kudos

hi

1.If I write the code for anything in the Component Controller instead of writing in any of the Web Dynpro Controllers will it work as Component Controller os the Global Controller?

if u write the create the context nodes in the component controller and map it in view , it can be accessible across the different views . Also a component controller method can be accessed across different view


wd_comp_controller->meth( ) .
// access method METH of comp controller from ur view

2.If I need to mention the parameter for the Selection Screen screen then I need to mention it in the Context?For Example, I need to give Yes and No parameters which are from Table Tab then I need to create one node in the Context and need to mention these two parameters there.Is it?If so then Can we say that the Context itselt acts as the structure wherein we need to define the fields that are used in the Web Dynpro?

yes , u wud create the context node and attributes under it .

If the cardianlity of the context node is 1..n , it acts as internal table

If the cardianlity of the context node is 1..1 , it acts as structure

refer SAP help :

http://help.sap.com/saphelp_nw04s/helpdata/EN/47/45641880f81962e10000000a114a6b/content.htm

I hope everything shud be clear now

regards,

amit

Former Member
0 Kudos

Hi Amit,

Thanks for the reply.

if u write the create the context nodes in the component controller and map it in view , it can be accessible across the different views . Also a component controller method can be accessed across different view

Means ,if I write all the Methods in the Component Contoller that I need in implementing the Web Dynpro instead of writing in either Veiw Controller or Interface Controller, then its right as the Component Controller is the Global Controller ?Is it?

Thanks in advance.

saket_abhyankar
Active Participant
0 Kudos

Hi,

1) I consider 'in any of the Web Dynpro Controllers' in your 1st question as view controller. If you create data (node, method etc.) in the component controller, it will be global and will be available to you everywhere in the same Web Dynpro for ABAP component. If you also want it to be available in other component (for component usage) you will need to make that node or method as 'Interface'.

2) Yes, you need to create attribute in the context node (or even without node) to hold the data entered by user on the view.

Regards,

Saket.

Former Member
0 Kudos

hi

refer this useful thread:

regards,

amit

Former Member
0 Kudos

1. Where to write the code for the Events ? Are there any standard event codes?If so then can we use them for any application?

If you open the controller you can see the methods like WDINIT(),WDEXIT() and all that when ever you declare an event corrosponding method auto matically genrated.at th occurance of that event corrosponding method will called so youu can write your code der.

2. Where and how to declare the Plugs?

there are two kind o plugs

1. in bound and 2.outbound . as the name suggest both they work to join the two differnt views. as an event you can declare it in view controller.