cancel
Showing results for 
Search instead for 
Did you mean: 

How to make all the screen elements non editable.

santhosh_nagavalli
Participant
0 Kudos

Hi Friends,

                 I got requirement on following ...can anybody please let me know ,How to make all the screen elements non editable  if there are 20 screen elements in screen based on condition on same screen .Thanks in advance.

Regards.

santhosh

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Santhosh,

You can achieve you requirement as below


  • Create an attribute READ_ONLY of type WDY_BOOLEAN in your context and bind it to the property READONLY of 20 ui elements
  • Based on condition, set the value of attribute either to ABAP_TRUE( non editable ) or ABAP_FALSE ( editable ) by using method SET_ATTRIBUTE( )

     like,....

                   

     if sy-uname = 'xyz'.

     " Set ui elements as non editable

          lo_ctx_element->set_attribute(

                    exporting

                     name = 'READ_ONLY'

                     value = abap_true ).

     else.

     " Set ui elements as EDITABLE

          lo_ctx_element->set_attribute(

                    exporting

                     name = 'READ_ONLY'

                      value = abap_false ).

     endif.

Hope this helps you. Let me knwo if any further assistance is required.

Regards,

Rama

Message was edited by: Ramakrishnappa Gangappa

santhosh_nagavalli
Participant
0 Kudos

Thanks Ramakrishna for your quick response and your answer so helpful for me

ramakrishnappa
Active Contributor
0 Kudos

Hi Santhosh,

Its good that your issue is resolved.

Marking replies as helpul or correct answer is very important because in future if some one has same requirements they should not be wondering here n there for a correct answer.

pls mark the replies which helped you to resolve issue as correct answer and helpful replies as helpful answer.

Hope you understood my point.

Regards,

Rama

santhosh_nagavalli
Participant
0 Kudos

Hi Ramakrishnappa,

                    

                            As iam new to scn.sap i dont know,now onwards i will do what you have suggested me to do.

Thanks & Regards

santhosh

Answers (2)

Answers (2)

parag_parikh
Participant
0 Kudos

Santhosh,

Do you wan to hide fields on SAP provided WD Component or in your custom component?

For custom component, you already have received answers from Chandra and Rama.

To enhance standard UI of SAP WDA, you need to perform some additional steps and plenty of material is already available on SCN for the same like

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e07268c2-f61b-2e10-05a5-cd4bddfd1...

and http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/700317da-bd79-2c10-368e-8f18bf5d8....

santhosh_nagavalli
Participant
0 Kudos

Thanks parag for quick response... i want to hide fields in custom component ....ya i go correct answers from chandra and Rama.

Regards.

Santhosh

Former Member
0 Kudos

Create an attribute of type "WDY_BOOLEAN" in context..

Bind the Attribute with Read only Property of input field..

Now in the DOINIT method or based on condition in some action..

DATA lo_el_context TYPE REF TO if_wd_context_element.
     DATA ls_context TYPE wd_this->element_context.
     DATA lv_read_only TYPE wd_this->element_context-read_only.
     lo_el_context = wd_context->get_element( ).
    
*    Condition we want all ediatable..
*    lv_read_only  = abap_false
    
*   Condition we want all non ediatable..
*    lv_read_only  = abap_true
    
    
     lo_el_context->set_attribute(
       name `READ_ONLY`
       value = lv_read_only ).

santhosh_nagavalli
Participant
0 Kudos

Thanks Chandra agarwal for quick response your reply is so helpful for me

Former Member
0 Kudos

Welcome.

ramakrishnappa
Active Contributor
0 Kudos

Thanks for your understanding

I think you can still mark/unmark answers for this question