cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically Reterive contents of a tab

Former Member
0 Kudos

Hi,

We are desging an application in WEB Dynpro for ABAP. My application has a main view with area divided into header and detail. Header area has a tab strip with 3 tabs and detail areas has 7 tabs. For each tab I have one View element container.

Then I have designed separate views for each tab with the fields for which I need input. I have embeded the view beloning to the corresponding tab.

Now my requirement is to get the content of input fields whenever user tries to move from one tab to another tab. I have set the tab names in the global attribute of my main view.

I can get the tab using (tab) ?= view->get_element( tab ) in the method WDOMODIFVIEW of main view.

But how do i proceed from here to get the content of input fields.

Thanks in advance for the help.

Regards

Rohit Chowdhary.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thanks for the answer.

As suggested I have already defined those attributes in the Component controller and then mapped it to the views created for each tab. To be specific My header table has 40 fields and on tab 1 display 15 of the fields, on tab I display 20 fields and on tab 3 remaining fields.

I do not want to hard code the elements specified on the tab1/tab2 or tab3 for that matter. I want to get the attributes defined on the tab dynamically on selection of tab by the user. Hope this clarifies my requirement.

Regards

Rohit Chowdhary

Former Member
0 Kudos

Hi Rohit,

I dont follow what the issue is.

Fields take their values from the context.

All your fields are in the COmp Controller.

Each view maps the fields it requires.

So this is normal WDA use.

Is their more to problem ?

regards

Phil.

Former Member
0 Kudos

Yes there is more to the issue.

Assume I have a table A1 declared as node in component controller.

table A1 has following fields :

Field01, field02. till field 50.

I have defined main view with the following content on it :-

Group Header

under group a Tab Strip

under tab strip

tab1 / tab2 and tab3

On each tab I have placed one View Element container.

Then I define 3 more views Tab1_view, tab2_view and tab3_view.

On tab_1_view field01 to field20 of table A1 is binded using create container form.

On tab_2_view field20 to field 35 of table A1 is binded using create container form.

On tab_3_view field35 to field 50 of table A1 is binded using create container form.

Finally this views have been embded into Tab1 view container, tab2 view container and tab3 view container respectively. I hope this is clear so far.

Now the problem for me is that on execution of the application when user tries to move from tab1 to tab2. At this point I want to dynamically identify which are fields on tab1 and then do Mandatory attribute check, rather then using hard code values of fields I placed manually on the tab_1. I am able to get all the elements of the node using get_static_attributes_table(), but how does one check that a particular element is present on the view?

I hope my question is clear now.

Regards

Rohit Chowdhary

Former Member
0 Kudos

Hi Rohit,

I think I know what you want now.You need to know what fields are on a view.

I had trouble with this until Thomas Szuecs explained the CID constants trick.

On the view object , call method GET_ELEMENTS_BY_CID .

From memory this is the interface if_wd_view on class.

It is implemented by CL_WDR_VIEW.

The trick is to use the right constant when calling the method.

eg

See class CL_WD_INPUT_FIELD=>CID_INPUT_FIELD for input fields.

There is a different class and different CID constant for each type of object.

The constants are GUIDs. 1 per View element type.

Use the class attribute and dont hard code GUID.

This returns a table of all matching view elements

Cheers

Phil

Former Member
0 Kudos

Hi Phil,

Thanks for the answer. It works.. Great..

Regards

Rohit Chowdhary.

Message was edited by:

Rohit Chowdhary

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Rohit,

If these views are a part of the same WD component, you could define those attributes that are shared across the views in the component controller and access them in any of the views.

Otherwise update these attributes in a data class and read from that class in the other views.

Regards

Azad