cancel
Showing results for 
Search instead for 
Did you mean: 

Property binding of a dynamic UI element

Former Member
0 Kudos

Hi all,

It is no problem to define property binding of a UI element statically (see [Example|http://wiki.sdn.sap.com/wiki/display/WDABAP/SimpleapplicationtochangepropertiesofUIElementsduringruntimeinWebDynpro+ABAP])

But, how can I define property binding for a UI element which I create at runtime? I can't find any statement to tell the UI element (for example CL_WD_INPUT_FIELD) that it should use property binding.

Any ideas?

Best regards

Oliver

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi Prashant

I already use bind_value (it has the complete path to the attribute).

The attribute value is shown correctly, but the visibility doesn't work.

Keep in mind that I do not want to create a dedicated context attribute for visibility. I want to use the property of the context attribute.

At time of dynamic context creation, I use the following statement to set the value of the context attribute property:

DATA l_attribute_name TYPE string.
      l_attribute_name = <fs_context_attribute_info>-name.
      CALL METHOD lr_context_element->set_attribute_property
        EXPORTING
          attribute_name = l_attribute_name
          property       = lr_context_element->e_property-visible
          value          = l_visible.

When creating the UI element, the following code is used.

DATA lr_input_field TYPE REF TO cl_wd_input_field.
            CALL METHOD cl_wd_input_field=>new_input_field
              EXPORTING
                bind_value             = l_context_binding_value
*   bind_visible           =
                id                     = l_id
                 state                  = l_state
*  visible                = 
              RECEIVING
                control                = lr_input_field.

Keep in mind that I can't use bind_value (I dont want an dedicated context attribute for visibility) and I also can't use visible because it should be context (attribute property) dependent.

Thanks in advance

Oliver

Former Member
0 Kudos

Any particular reason for not having dedicated context value ? As my guess is once u use deciated context value that it would work !!

Greetings

Prashant

ChrisPaine
Active Contributor
0 Kudos

>Keep in mind that I can't use bind_value (I dont want an dedicated context attribute for visibility) and I also can't use visible because it should be context (attribute property) dependent.

Although you might want to use the attribute property - you should consider what that does to the supportability and enhanceability of your development. Using a separate context attribute makes it very clear what needs to be set in order to show/hide the UI element. Also were you wanting to handle the population of this in an assistance class, you would not need to pass the reference to the WD node element, rather you could work with a structure and then in your controller, handle the get/set static attributes of the context element. In this way you are ensuring that the view part of your application logic( handling of WD context elements and node is separated from the model/controller part.

I'm sure you could somehow do what you are trying to do (I'm sorry I don't haven't looked at actually doing it) but if it is complex enough that you are having trouble figuring out how to do it, think of the poor person who has to come along later and try to support it!

I'm just trying to say sometimes the most elegant solutions aren't the most supportable - and if - as in this case it makes no difference to the end user experience, it might be worth just going with the simple solution.

Cheers,

Chris

hermanoclaro
Participant
0 Kudos

Hello, Oliver!

Try using the method BIND_VALUE from this class, CL_WD_INPUT_FIELD, in the example you stated.

Best Regards!