cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to create TEXTEDIT UI element dynamically in ROOTUIELEMENT container having GRID layout

Former Member
0 Kudos

Dear Experts,

Pls help me to resolve the issue.Issue is : "Unable to create TEXTEDIT UI element dynamically in ROOTUIELEMENT container having GRID layout".

Following is the code in WDMODIFY( )  of corresponding  view.

DATA: lr_container    TYPE REF TO cl_wd_uielement_container,
        lr_group        TYPE REF TO cl_wd_group,
        lr_caption_group TYPE REF TO cl_wd_caption,
        lr_textedit      TYPE REF TO cl_wd_text_edit.

lr_container ?= view->get_root_element( ).  "  Get reference of ROOTUIELEMENTCONTAINER
      cl_wd_grid_layout=>new_grid_layout( container = lr_container ).

      lr_group = cl_wd_group=>new_group( id = 'GROUP' ).  " Create the GROUP element
      lr_group->set_width( value = '100%' ).

      CALL METHOD cl_wd_grid_layout=>new_grid_layout
        EXPORTING
          container              = lr_group
          stretched_horizontally = 'X'.


      lr_caption_group = cl_wd_caption=>new_caption( text = 'Ticket Details' ).
      lr_group->set_header( the_header = lr_caption_group ).

      lr_textedit = cl_wd_text_edit=>new_text_edit( id    = 'TVIEW'  " Provide a unique id to your textedit element
                                                    cols  = 200        " Specify the number of columns
                                                    rows  = 10        " Specify the number of rows
*                                                    width = '90%'    " Specify the width
                                                    bind_value = 'TEXT' ). " Here

      DATA lr_grid_data  TYPE REF TO cl_wd_grid_data.

      lr_grid_data = cl_wd_grid_data=>new_grid_data( element = lr_textedit ).

      lr_textedit->set_layout_data( the_layout_data = lr_grid_data ).

      lr_container->add_child( the_child = lr_group ).
      lr_group->add_child( the_child = lr_textedit ).

I'm getting dump. PFA of ST22 .

Accepted Solutions (1)

Accepted Solutions (1)

former_member184578
Active Contributor
0 Kudos

Hi,

You are not setting the layout data to group UI. I just modified your code:

DATA: lr_container     TYPE REF TO cl_wd_uielement_container,

         lr_group         TYPE REF TO cl_wd_group,

         lr_caption_group TYPE REF TO cl_wd_caption,

         lr_textedit      TYPE REF TO cl_wd_text_edit.

   IF first_time = abap_true.

     lr_container ?= view->get_root_element( ).   "  Get reference of ROOTUIELEMENTCONTAINER

     cl_wd_grid_layout=>new_grid_layout( container = lr_container ).

     lr_group = cl_wd_group=>new_group( id = 'GROUP' )" Create the GROUP element

     lr_group->set_width( value = '100%' ).

     CALL METHOD cl_wd_grid_layout=>new_grid_layout

       EXPORTING

         container              = lr_group

         stretched_horizontally = 'X'.

     cl_wd_grid_data=>new_grid_data( element = lr_group ).

     lr_caption_group = cl_wd_caption=>new_caption( text = 'Ticket Details' ).

     lr_group->set_header( the_header = lr_caption_group ).

     lr_textedit = cl_wd_text_edit=>new_text_edit( id    = 'TVIEW'  " Provide a unique id to your textedit element

                                                    cols  = 200         " Specify the number of columns

                                                    rows  = 10        " Specify the number of rows

*                                                     width = '90%'    " Specify the width

                                                    bind_value = 'TEXT' ). " Here

     DATA lr_grid_data   TYPE REF TO cl_wd_grid_data.

     lr_grid_data = cl_wd_grid_data=>new_grid_data(

      h_align  = cl_wd_matrix_data=>e_h_align-forced_right

      v_align  = cl_wd_matrix_data=>e_v_align-bottom

      width  = '100%'

      element = lr_textedit ).

     lr_textedit->set_layout_data( the_layout_data = lr_grid_data ).

*

     lr_group->add_child( the_child = lr_textedit ).

     lr_container->add_child( the_child = lr_group ).

   ENDIF.




hope this helps,


Regards,

Kiran

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Finally i can able to resolve dump,but UI element is not getting displayed.

Following is the code.

    lr_container ?= view->get_root_element( ).   "  Get reference of ROOTUIELEMENTCONTAINER
      cl_wd_grid_layout=>new_grid_layout( container = lr_container ).

      lr_group = cl_wd_group=>new_group( id = 'GROUP' ).  " Create the GROUP element
      lr_group->set_width( value = '100%' ).

      CALL METHOD cl_wd_grid_layout=>new_grid_layout
        EXPORTING
          container              = lr_group
          stretched_horizontally = 'X'.

      lr_caption_group = cl_wd_caption=>new_caption( text = 'Ticket Details' ).
      lr_group->set_header( the_header = lr_caption_group ).

      lr_textedit = cl_wd_text_edit=>new_text_edit( id    = 'TVIEW'  " Provide a unique id to your textedit element
                                                     cols  = 200         " Specify the number of columns
                                                     rows  = 10        " Specify the number of rows
*                                                     width = '90%'    " Specify the width
                                                     bind_value = 'TEXT' ). " Here

      DATA lr_grid_data   TYPE REF TO cl_wd_grid_data.
      lr_grid_data = cl_wd_grid_data=>new_grid_data(
       h_align  = cl_wd_matrix_data=>e_h_align-forced_right
       v_align  = cl_wd_matrix_data=>e_v_align-bottom
       width  = '100%'
       element = lr_textedit ).

      lr_textedit->set_layout_data( the_layout_data = lr_grid_data ).

*    
      lr_group->add_child( the_child = lr_textedit ).
*       lr_container->add_child( the_child = lr_group ).