cancel
Showing results for 
Search instead for 
Did you mean: 

Transfer a parameter from one view to another

Former Member
0 Kudos

Hi,

Probably this question was asked many many times before, but then i probably use the wrong search criteria, because i can't find them.

My question is simple: I am on a header view and depending on an action which i perform there, i want to fill a certain variable. I need the value of this variable in the next screen, which is on item level.

What possibilities do I have to transfer this value? (I already tried with server->request->set_form_field and server->request->get_form_field/data, but this didn't work)

Regards,

Martijn.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thanks for your quick responses.

I didn't have a look at the custom controller option yet. Importants is that I don't want a value of a context node attribute transfered. I just want to create a simple variable (a boolean) which I can take to the other view.

It concerns the components BT114H_LAM (view OVViewSet) and BT138I_LAM (view OVViewSet).

Now what do I have to with the custom controllers? How do I determine which one I should use? I should create an attribute on one of the custom controllers, but this custom controller is not known in the second view I would guess? How do I read it there?

Regards,

Martijn.

Former Member
0 Kudos

Hi,

Well here there are 2 different components, so you will have to use component controller, using concept of component interface, component usage etc.

But it seems, you just want one flag - much simpler way is - just create a static variable in the view IMPL class, set it anywhere you want, then you can read in any other view.

Say Class1 has attribute1.

in View 2 in class 2 method, you can write:

value = class1=>attribute1.

I hope that is what you are looking for. Please take care that you clear the value when you are done using it.

Thanks,

Rohit

Former Member
0 Kudos

Hi Rohit,

But how do I get a reference to that class1 in class2?

Regards,

Martijn.

Former Member
0 Kudos

Hi Martinj,

Since the variable suggested by Rohit is static you can directly use the class name and the pick the variable value as suggested.

Thanks

Former Member
0 Kudos

Martijn,

We refer to static class attributes/methods by using operator =>

Say, class1 has attribute 'name1'.

You want to assign this to attribute 'name2' of class2 (or anywhere else) by writing:

name2 = class1=>name1.

Difference in static and instance variables in that for static variables you need not create object of that class every time to access that class. Same value exists in the session, whereas for instance variables there is a different value for each instance.

We create instance of a class by writing: Create Object lr_object type ref to <classname>.

This is not required for static attributes.

I hope it resolves your query.

Thanks,

Rohit

Former Member
0 Kudos

Ok thanks Rohit,

Thsi solved my problem. Because Iam in a hurry, I will use this, but the GDC concept also looks promising. Certainly will have a look at it. Thanks all!

Regards,

Martijn.

naval_bhatt4
Contributor
0 Kudos

Hi how did you set the value of the attribute ?

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

You can use the GDC parameter concept to achieve the same, please check my comment in the below thread.

Regards,

Shobhit

Former Member
0 Kudos

Hi,

It is not clear in which context you are talking about. Could you please specify the view names.

Server get form field etc are used in Core BSP applications generally.

For BSP Workbench based views in the components, to share data between views there is a custom controller, and concept of component controller to share data between different components.

All you have to do is:

1. for your view, check out which context node has the field you want in different view

2. create same context node in custom controller and same context node in second view

3. right click in view 1 context node, bind it to custom controller context node

4. right click in view 2 context node, bind it to custom controller context node

This way, data will automatically flow from one view to another.

Also, to get instance of custom controller anywhere in IMPL class, you can use method get_custom_controller.

I hope it helps.

Thanks,

Rohit

Former Member
0 Kudos

You can use custom controller. You can create attributes in custom controller class corresponding to your variables.