cancel
Showing results for 
Search instead for 
Did you mean: 

Adding ui elements dynamically

former_member205144
Active Participant
0 Kudos

Hi,

I have a few ui elements in my view.Suppose, there is one label and an input field is there.And,dynamically i want to create an image element just after this input field.How can i do that?

Accepted Solutions (0)

Answers (2)

Answers (2)

amy_king
Active Contributor
0 Kudos

Hi Iavanya,

See if this SAP help document on Dynamic Layout Manipulation is helpful to you. There is also an example web dynpro component, WDR_TEST_DYNAMIC.

Cheers,

Amy

former_member205144
Active Participant
0 Kudos

It is not helping me do what i want.

          lr_container ?= wd_this->lv_view->get_element( 'ROOTUIELEMENTCONTAINER' ).

      

         CALL METHOD cl_wd_image=>new_image

           EXPORTING

*        ADJUST_IMAGE_SIZE      =

*        BIND_ADJUST_IMAGE_SIZE =

*        BIND_BORDER            =

*        BIND_ENABLED           =

*        BIND_HEIGHT            =

*        BIND_IS_DECORATIVE     =

*         bind_source            =

*         bind_tooltip           =

*        BIND_VISIBLE           =

*        BIND_WIDTH             =

*        BORDER                 =

*        ENABLED                = ABAP_TRUE

*        HEIGHT                 =

*        ID                     =

*        IS_DECORATIVE          =

          SOURCE                 = 'WEBICON_LED_INACTIVE'

         tooltip                = lv_inputs

*        VIEW                   =

*        VISIBLE                = E_VISIBLE-VISIBLE

*        WIDTH                  =

              RECEIVING

                control                = lr_image

                .

*        FOCUS_BY_CONTEXT_ELEMENT

         lr_matrix = cl_wd_matrix_data=>new_matrix_data( lr_image ).

         lr_image->set_layout_data( lr_matrix ).

*        CALL METHOD lr_container->add_child

*          EXPORTING

**            index     = 10

*            the_child = lr_image.

If i use this,the image will get added in the rootcontainer after all the existing ui elements.What i want is ,this image need to be added after an already statically created input field with name 'NAME1'.

How can i achieve that?

former_member199125
Active Contributor
0 Kudos

First take the reference of input field container. 

then create image object with required properties then add to corresponding layout( input field layout)

Regards

Srinivas

former_member205144
Active Participant
0 Kudos

u mean the input field should be inside a transparent container?