on 01-17-2011 3:28 PM
Hello Experts,
I created an enhancement for a standard WD application and created post exit for WDDOMODIFYVIEW method.
There are multiple inputfields in layout. Some of which has their read_only property bound to a context attribute of type wdy_boolean , I was abel to make these fields read only using SET_ATTRIBUTE method.
There are some input fields which do not have the read_only property bound to any context attribute.
How to make such fields read only?
I can not create binding for these input fields since its a standard component and I can not modify the view.
Thanks,
Anubhav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
One way i think of is to get the reference of the input fields which you want to control (enable/disable).
Loop through them and set the property.
For example you can define the string_table consisting the Input field id's. Get the reference of the view in domodifyview at first time flag.
based on your requirement loop through the string_table and fetch the input_element using if_wd_view->get_element( )
down cost to the input field and set_enabled( ).
Hi Sarbjeet,
The logic works great but the only issue is it also makes the label for that inputfield grayed out.
Any chance to avoid that?
If i use
data lr_inputfield TYPE REF TO cl_wd_input_field.
lr_inputfield ?= view->get_element( 'C_O_NAME' ).
lr_inputfield->SET_READ_ONLY( abap_false ).
I get an exception
UNCAUGHT_EXCEPTION
Could not find attribute C_O_NAME:READ_ONLY
Method: IF_WD_CONTEXT_NODE_INFO~GET_ATTRIBUTE of program
CL_WDR_CONTEXT_NODE_INFO==========================CP
.
.
.
.
.
.
.
.
.
.
Method: DO_MODIFY_VIEW of program CL_WDR_VIEW
Its a very long exception....that i could not copy and paste .
Any inputs on this issue?
Many thanks for the help,
Anubhav
>
> The logic works great but the only issue is it also makes the label for that inputfield grayed out.
> Any chance to avoid that?
I think the reason for that might be that the labels are associated with the UI element enable property. Since the input elements are disabled the labels are also inactive. I am afraid you cannot do anything about this. Personally i would not change this behavior as it would me an inconsistent look and feel with other SAP standard screens.
> I get an exception
> UNCAUGHT_EXCEPTION
> Could not find attribute C_O_NAME:READ_ONLY
> Method: IF_WD_CONTEXT_NODE_INFO~GET_ATTRIBUTE of program
> CL_WDR_CONTEXT_NODE_INFO==========================CP
Probably you already know that. a) C_O_NAME is not exists in the view as input element-id or b) you have some piece of code trying to set the context_ attribute_property for a non existing attribute c_o_name.
I think it is to do with a).
Edited by: Baskaran Senthivel on Jan 17, 2011 9:13 PM
>
> Hi Sarbjeet,
>
> The logic works great but the only issue is it also makes the label for that inputfield grayed out.
> Any chance to avoid that?
>
> If i use
>
data lr_inputfield TYPE REF TO cl_wd_input_field. > > lr_inputfield ?= view->get_element( 'C_O_NAME' ). > > lr_inputfield->SET_READ_ONLY( abap_false ).
>
> I get an exception
>
UNCAUGHT_EXCEPTION > Could not find attribute C_O_NAME:READ_ONLY > Method: IF_WD_CONTEXT_NODE_INFO~GET_ATTRIBUTE of program > CL_WDR_CONTEXT_NODE_INFO==========================CP > . > . > . > . > . > . > . > . > . > . > Method: DO_MODIFY_VIEW of program CL_WDR_VIEW
> Its a very long exception....that i could not copy and paste .
>
> Any inputs on this issue?
>
> Many thanks for the help,
> Anubhav
HI
the code is fine.
check the ID of the input field once again.
and i guess that is also correct other wise "access null error" would have come.
here i guess problem is somewhere you are trying to access the attribute C_O_NAME which is not existing.
search for it and correct the code there.
otherwise readonly code that you have written will work.
thanks
sarbjeet
hi anubhav,
you wrote....
The logic works great but the only issue is it also makes the label for that inputfield grayed out.
Any chance to avoid that?
just check the enabled property of the label....is the checkbox clicked ....if not just click the checkbox ...your label wont be grayed out.
regards,
sahai.s
Hi Anubhav,
Its seems to me no issue with your code , sarbjeet is right.Just check the ID of the input field once again.
I have used used the same code written by you and its working fine even the lebel is not grayed out.
data lr_inputfield TYPE REF TO cl_wd_input_field.
lr_inputfield ?= view->get_element( 'INP_JOB_ID_CP' ).
lr_inputfield->SET_READ_ONLY( ABAP_TRUE ).
Thanks & Regards,
Monishankar C
hi ,
check out this class in se24 cl_wd_input_field.....
you will see a property set_enabled ..using this i hope you will be able to solve this problem.
data i_field type ref to cl_wd_input_field.
i_field ?= view->get_element( 'I_field' ).
i_field->set_enabled( abap_false ).
above is the piece of code you can use
regards,
sahai.s
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.