cancel
Showing results for 
Search instead for 
Did you mean: 

How to move an itab from one view to another??

Former Member
0 Kudos

Hi,

Quick. I retrieve a range from select option in one view? How can i move this range table to another view?

Currently, this is what I am trying,

ASSIGN RT_CARRID->* TO <FS_CARRID>.

RANGE = WD_CONTEXT->GET_CHILD_NODE( NAME = 'TEST' ).

RANGE->BIND_ELEMENTS( <FS_CARRID> ).

In the contexts of the two view involved and the component controller i have a node 'TEST' with an attribute range that is declared type ref to data.

No syntax error, but when i read the context node 'TEST' in the other view, the value is initial.

Thanks for your quick responses and bright ideas!!

ALI

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi

good

go through this link

/people/thomas.szcs/blog/2006/02/22/dynamic-programming-in-web-dynpro-abap--part-iii-aggregations-and-ddic-binding-of-viewelements

/people/thomas.szcs/blog/2006/07/24/basic-concepts--selection-vs-leadselection

THANKS

MRUTYUN^

Former Member
0 Kudos

Hi Mrutyun,

I went through the blogs. No where did I find methods to pass data between views. Simply, how do we pass data between views? To my knowledge, using the contexts of the views and the component context. Suppose, if I had to pass a range table from one view to another how will I do it? I assign the range table to a field symbol for dynamicity, how to pass this data through the contexts? What attribute do i declare in the context? And do I use the norma bind element method?

Thanks

Ali

thomas_szcs
Active Contributor
0 Kudos

Hi Muhammad,

My suggestion is to save the value inside of the assistance class. It is accessible from each view of a controller. There, a range table can be defined using the standard ABAP syntax:

data my_range_table type range table of my_type.

Using the context is ok as well, but since you don't display the data directly, using it as a means of transporting data between views seems to be a bit to complicated - especially as range table types are not supported natively as types for attributes.

Best regards,

Thomas

Former Member
0 Kudos

Hi Thomas.

Going through the code as posted above? What attribute should be created in the node?

XXX Type ref to Data ??

The bind method does not take reference as parameter so a field symbols has to be used.

Thanks

Ali

former_member183804
Active Contributor
0 Kudos

Hello Muhammad,

as the view controller context is private you cannot share it with another controller. You need to define any data to share in the component controller (or a custom controller) and to map it in your scenario to both views.

As Thomas already mentioned another option is to keep the select-option in the view context only and to copy it afterwards to some (component) controller property or the assistance class. This has the benefit to have a more lean context. As the context makes a poor container for general/mass data this might save some time and memory.

Regards,

Klaus

Former Member
0 Kudos

Hi Klaus,

Coould I get an example? How to do it? Any weblog?

Thanks

Ali

thomas_szcs
Active Contributor
0 Kudos

Hi Muhammad,

Just do the following:

1. Create an assistance class, if you haven't done so yet and attach it to your web dynpro component

2. In this assistance class create a public attribute my_range_table type range table of your_type.

3. In view A write wd_assist->my_range_table = local_range_table.

4. In view B access the previously saved range table by writing to_be_filled_range_table = wd_assist->my_range_table.

Best regards,

Thomas

Former Member
0 Kudos

Hi Thomas,

Here's what I did now. Created an assistance class 'ZCL_WD_COMPONENT_ASSISTANCE' derived from 'CL_WD_COMPONENT_ASSISTANCE' with an attribute, 'my_range_table type ref to data'.

I assign/attach this class 'ZCL_WD_COMPONENT_ASSISTANCE' to the webdynpro component, by inserting it as an attribute in the component controller. As follow:

<b>ZWD_ASSIST Type Ref To ZCL_WD_COMPONENT_ASSISTANCE</b>

Now in the view one I insert code.

<b> DATA: RT_CARRID TYPE REF TO DATA.

DATA: ZWD_ASSIST TYPE REF TO ZCL_WD_COMPONENT_ASSISTANCE.

CREATE OBJECT ZWD_ASSIST.

ZWD_ASSIST->MY_RANGE_TABLE = RT_CARRID.

</b>

In the view 2.

<b> DATA: WD_ASSIST TYPE REF TO ZCL_WD_COMPONENT_ASSISTANCE.

create object wd_assist.

rt_carrid = wd_assist->my_range_table.

</b>

rt_carrid is still initial.

Please sort out, if I am not doing correctly.

Thanks.

Ali

rainer_liebisch
Contributor
0 Kudos

Hello Muhammad,

1) in se80 double-click on the name of your Web Dynpro component. In the thrid line there is a field for the assistance class. Enter the class name there

2) The attribute wd_assist is now present for all views and windows. You don't need any of the DATA elements to define this attribute. Delete them.

3) Don't use "create object", this creates a new instance of th class with initial settings. You want the data of an existing instance, not a new instance of the assistance class.

After these 3 steps the rest should be easy.

Regards,

Rainer

thomas_szcs
Active Contributor
0 Kudos

Hi Muhammad,

By creating separate instances of the same class, you will get two different objects. Of course, both don't share the same data.

Regarding the assistance class just define it at the component level. You don't need to perfom a "create object" for it. The system does it for you. Just use the predefined pointer wd_assist and write

wd_assist->my_range_table = rt_carrid

in view 1 and

rt_carrid = wd_assist->my_range_table

in view2.

Best regards,

Thomas

Former Member
0 Kudos

Thank You Guys !

I have a much better understanding now.

Points have been awarded !

Answers (0)