on 02-22-2011 10:20 PM
Hi,
My requirement is to enable/disable the input on Input Fields on a std. sap WD screen. The approach that I followed --
-- Create an enhancement for the WD application.
-- Make change to the UI element property in the post-exit of WDDOMODIFYVIEW.
The problem is that I am not too sure of the code that I need to put in there in WDDOMODIFYVIEW..
I tried putting in the following code to modify attributes of input field 'COUNTRY'--
data: l_input type ref to cl_wd_input_field.
l_input ?= view->get_element( 'COUNTRY' ).
l_input->set_read_only( abap_true ).
But for some reasons this does not work. I get a dump related to READ ONLY .
Is there anything else which I need to do?
Thanks-
Harmeet.
Hi Harmeet ,
Try using the method set_enable() of class CL_WD_INPUT_FIELD to enalbe/disable the UI element.
Also post some details of the dump you are getting.
Thanks,
Aditya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aditya,
Using set_enabled() did solve my problem. Thanks for that. However, I am still wondering why set_read_only does not work.
I get the following dump when I use set_read_only() --
UNCAUGHT_EXCEPTION
Could not find attribute COUNTRY:READ_ONLY
Method: IF_WD_CONTEXT_NODE_INFO~GET_ATTRIBUTE of program CL_WDR_CONTEXT_NODE_INFO======CP
Method: IF_WD_CONTEXT_ELEMENT~SET_ATTRIBUTE of program CL_WDR_CONTEXT_ELEMENT========CP
Method: IF_WD_DATA_CONTAINER~SET_VALUE of program CL_WDR_DATA_CONTAINER=========CP
Method: SET_READ_ONLY of program CL_WD_ABSTRACT_INPUT_FIELD====CP
Method: PST4KXMI8SQG7W8CQ5JLARV8GQVR of program /1BCWDY/HKJZNBFJXTJO5PQ8RYVP==CP
Method: IF_WDR_VIEW_DELEGATE~WD_DO_MODIFY_VIEW of program /1BCWDY/HKJZNBFJXTJO5PQ8RYVP==CP
Method: DO_MODIFY_VIEW of program CL_WDR_DELEGATING_VIEW========CP
Method: MODIFY_VIEW of program CL_WDR_VIEW===================CP
Method: DO_MODIFY_VIEW of program CL_WDR_CLIENT_COMPONENT=======CP
Method: DO_MODIFY_VIEW of program CL_WDR_CLIENT_COMPONENT=======CP
Hi,
If your requirement just needs to enable/disable the input fields,then rather than coding it you can go into input field's properties and uncheck "enable" which will disable input field on wd screen but will show the field.But if you uncheck the attribute's property(read only) at component controller context which will not only disable it rather will effect all the other views which are using this attribute getting disabled.So better go and uncheck enable property at view level itself.It has to work ,and if you want to change it in coding way go for "DashAbhilash" process as mentioned above,even that works based upon your requirement.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Why use a code based enhancement for such a change. You could have used component configuration or administrative personalizatoin to enable/disable or hide input fields without making any code changes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thomas,
In my particular example, the input field I wanted to open up was an input field of a table column within a SAP standard component. The input field has it's read-only attribute set to "Bind to the property of the selected attribute" with property set to "Read Only". This context cannot be changed through customer enhancement directly in view layout maintenance.
Application CONFIGURE_COMPONENT for the input field within the table column only allows option Read-Only Access to be set to Yes, or Not Personalised, there isnt a NO option.
Hence needing the code to amend this SAP standard setting as far as I can see.
Kind regards,
JP.
Edited by: Jon-Paul Boyd on Apr 8, 2011 5:38 PM
Hi Harmeet,
For enabling or disabling input for input fields you can try the following.
1. Bind a context variable of type " WDY_BOOLEAN" to read only property of input field.
2. Set the value of context variable to ' X ' for enable and ' ' for disable.
write the code in wdDoModifyView method.
Try this because i used this process for my customized webDynpro and it worked. Same way you can also hide buttons.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thought set_enabled() solved the issue. Still I am wondering why set_read_only does not work.
Dynpro Application -- /SAPSRM/WDC_UI_DO_SHIPTO
View -- V_DODC_SHIPTO
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Harmeet ,
Can u please post the name of the Standard WD component?
Some components dont allow to some functionalites..
For Eg: I tried to hide the 'Next' and 'Previous' buttons of FPM component , FPM_GAF_COMPONENT and I got a very similar dump saying 'Could not find the attribute Visibility '
I then learnt that , its not possible to hide the buttons.
Thanks,
Aditya.
Hi Harmeet,
I found a solution to this. Like you I was getting a dump. The SAP standard input field element I was trying to open up into edit mode was set to read only mode via read only attribute bound to the property of the selected attribute with read only. I created a dummy boolean in my enhancement called INPUT_VOLUME_READ_ONLY and passed as per below. The field is now open for input, as method bind_read_only removes the existing binding.
DATA: lr_input_field TYPE REF TO cl_wd_input_field.
lr_input_field ?= view->get_element( id = 'INP_VOLUME' ).
lr_input_field->bind_read_only( 'INPUT_VOLUME_READ_ONLY' ).
Hope this helps,
JP.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.