Skip to Content

This document will walk you through :

The concept of making a UI-element Mandatory(Required)/Non mandatory in  a web dynpro component using “State” Property.

*********************************************************************************************************************************************************************

Assumption :

    1. You have created a web dynpro application .

    2. You have created the UI elements “Field1” in the view of the component , which you have to make mandatory/optional based on your requirement. .

  

Procedure :

   Step 1 : Create a Attribute in the context of the view with type “WDUI_STATE” lets say i have created “field1_state”. 

   Step 2 : Bind the property “State” of the Field1 with “field1_state” (context attribute created in step 1 ).

   Step 3 : Now based on your requirement , place the below code in the appropriate method for making  the Field1 as mandatory(with red astrik) .

              

   DATA lo_el_context TYPE REF TO if_wd_context_element.

 

   lo_el_context->set_attribute(
   name
= `field1_enabled`
   value = ’01’ ).

   Step 4 :  Same way place the below code in the appropriate method for making the  field1as non mandatory (Normal item).

 

 

    DATA lo_el_context TYPE REF TO if_wd_context_element

    lo_el_context

->set_attribute(
    name
= `field1_enabled`
    value = ’00’ ).

.

Please let me if more clarification is required.

Thanks,

Gejo john.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply