cancel
Showing results for 
Search instead for 
Did you mean: 

how to modify view elements outside of the wddomodify method

Former Member
0 Kudos

Hi,

I got some issues while I was trying to modify the properties of view elements outside of the wddomodify method.

I read that this method was the only one where we had a reference to the view. But if we want to modify an element outside this method is it possible?

If it's not possible how to specify in the wddomodify method that there is a treatment that should happen only for one case ( cause we don't have the possibility to add parameters, and we don't want to use the context to store unnecessary information)

Thx for your help

Hamza

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

you can do this also in your event handlers, where you probably have the values

on which the addition of the ui-elements depend.

if you want the reference to your view in there,

create an attribute m_view type ref to if_wd_view in you view controller,

in wddomodifyview, you say

if first time is abap_true.

wd_this->m_view = view.

endif.

and now you can do exactly the same thing as in wddomodifyview in all your

evenhandler methods.

grtz,

Koen

Former Member
0 Kudos

Hi Koen,

If I understand what you propose, I have to add an attribute m_view into my view context, of the specified type. And then use the code :

if first time is abap_true.

wd_this->m_view = view.

endif.

But it doesn't work, it says that : M_view is unknow.

Do you know why?

Former Member
0 Kudos

Hi,

you should add it to the attributes (in the tab attributes)

grtz,

Koen

Former Member
0 Kudos

Hi Koen,

Your solutions seems to work in some cases but not for mine, I got a view that can be accessed from 2 plugs, if it comes from the first there is no treatement. For the second I have to set some fields in read only. The problem is that the method wd_domodifyview, that is meant to initialize our attribute wd_this->m_view is called after the event handler (of my inbound plug) method.

So it calls first the wd_doinit, followed by my event handler method (wich cause null reference due to the attribute non-initialized) and then the wd_domodify.

How can I initialize this attribute before that my event hanler method got called, or How can I attempt to my goal from an other way.

Thx in advance,

Hamza

Former Member
0 Kudos

hi hamza...........

in this case.... you set an attribute when the outbound plug2 gets triggered. so this attribute which is bound wiht hte attributes of the current view acts correspondingly. hence your fields will be made read only..... this condition must be checked in your wddoinit of the current view.

---regards,

alex b justin

Former Member
0 Kudos

Hi,

if in that view, you set your logic into

if first_time is abap_true.

...

endif.

and you set the guiding attributes into the attributes list,

you can act during the first screen generation on those attributes.

eg attribute calling view type string.

in the event handler you set it to 'from_viewa' or 'from_viewb'.

if first_time is abap_true.

case wd_this->calling_view.

when 'from_viewa'.

...

when 'from_viewb'.

when others.

endcase.

endif.

grtz,

Koen

Answers (1)

Answers (1)

Former Member
0 Kudos

hi hamza........

you can do this outside the wddomodify method.

consider youare having an input field and a button.

you need to disable the input field once the button isclicked.

in this case you can just write the coding in the 'onaction' part of the button. it automatically gets modified. you need not write it in the wddomodify method.

---regards,

alex b justin

Former Member
0 Kudos

Hi Alex,

Can you be a little more precise, how can I access my view elements in my event_handler without having any reference?

Former Member
0 Kudos

hi hamza........

coming to my previous scenario.....

you can map an attribute present inside a node, to the visibility of the input field.

in that case, you can know the name of the attribute.

so by simply passing the right value to the attribute,

the input field fields gets modified automatically.

it works fine....

---regards,

alex b justin