cancel
Showing results for 
Search instead for 
Did you mean: 

Create Radio button dynamically in Table column.

Former Member
0 Kudos

HI All

I have used following code to create radio button dynamically. but it's getting dump saying that Could not find attribute STATUS.

Here STATUS is the attribute of the node in View context. But why this dump is coming.

Please correct me if any thing worng.

DATA: lr_radio TYPE REF TO cl_wd_radiobutton.

DATA: lr_containr TYPE REF TO cl_wd_transparent_container.

DATA: lr_data TYPE REF TO cl_wd_flow_data.

IF first_time = abap_true.

lr_containr ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).

lr_radio = cl_wd_radiobutton=>new_radiobutton(

view = view

id = 'RADIO'

text = 'Enroll'

bind_selected_key = 'STATUS'

key_to_select = 'STATUS' ).

lr_data = cl_wd_flow_data=>new_flow_data( element = lr_radio ).

lr_radio->set_layout_data( lr_data ).

lr_containr->add_child( lr_radio ).

ENDIF.

Thank you very much

Ram

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

change lr_container type ref to cl_wd_transparent_container to

lr_container type ref to cl_wd_uielement_container

.

you want to create radio button dynamically or you want to place the radio button in table.

Thanks

Suman

Former Member
0 Kudos

HI Suman

Thank you very much for your replay.

Yes, I want to create as a row content ( with radio button with text ) in one of the Table Column.

I used DATA: lr_containr TYPE REF TO cl_wd_uielement_container. but still I am getting the same dump.

Can you please give me your suggestion..

Thanks

Ram

Former Member
0 Kudos

Hi Rama,

I solved it.check this code.

i think u did mistake in creating radio button you are not passing the

BIND_KEY_TO_SELECT

instead you are passing KEY_TO_SELECT.

data:lr_column2 type ref to cl_wd_table_column,
     lr_radio type ref to cl_wd_radiobutton.
     
   lr_column2 = obj_table->get_column(
               id         = 'TABLE1_PLANETYPE'
*              INDEX      = INDEX
                 ).
lr_radio = cl_wd_radiobutton=>new_radiobutton(
*      BIND_ENABLED        = BIND_ENABLED
       BIND_KEY_TO_SELECT  = 'STATUS'
*      BIND_KEY_VISIBLE    = BIND_KEY_VISIBLE
*      BIND_READ_ONLY      = BIND_READ_ONLY
       bind_selected_key   = 'STATUS'
*      BIND_STATE          = BIND_STATE
*      BIND_TEXT           = BIND_TEXT
*      BIND_TEXT_DIRECTION = BIND_TEXT_DIRECTION
*      BIND_TOOLTIP        = BIND_TOOLTIP
*      BIND_VISIBLE        = BIND_VISIBLE
*      ENABLED             = ABAP_TRUE
*      EXPLANATION         = EXPLANATION
       ID                  = 'RAD1'
*      KEY_TO_SELECT       = KEY_TO_SELECT
*      KEY_VISIBLE         = KEY_VISIBLE
*      ON_SELECT           = ON_SELECT
*      READ_ONLY           = READ_ONLY
*      STATE               = E_STATE-NORMAL
       TEXT                = 'Test'
*      TEXT_DIRECTION      = E_TEXT_DIRECTION-INHERIT
*      TOOLTIP             = TOOLTIP
*      VIEW                = VIEW
*      VISIBLE             = E_VISIBLE-VISIBLE
         ).
  
lr_column2->set_table_cell_editor( the_table_cell_editor = lr_radio  ).

Thanks,

Suman

Former Member
0 Kudos

HI Suman

Still I am getting the same dump issue ( saying that could not find attribute STATUS )while creating the radio button as a row content on one of the table column.

Please check the following code what I used in WDDOMODIFYVIEW method.

DATA: lr_radio TYPE REF TO cl_wd_radiobutton.

DATA: lr_containr TYPE REF TO cl_wd_uielement_container.

DATA:lr_column2 TYPE REF TO cl_wd_table_column.

DATA: lr_data TYPE REF TO cl_wd_flow_data.

DATA: obj_table TYPE REF TO cl_wd_table.

obj_table ?= view->get_element( 'LIFE_INS' ).

obj_table->get_column(

EXPORTING

id = 'LIFE_INS_STATUS'

RECEIVING

the_column = lr_column2 ).

IF first_time = abap_true.

  • lr_containr ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).

lr_radio = cl_wd_radiobutton=>new_radiobutton(

  • view = view

bind_key_to_select = 'STATUS'

bind_selected_key = 'STATUS'

id = 'RAD1'

text = 'Enroll' ). "'STATUS'

lr_column2->set_table_cell_editor( the_table_cell_editor = lr_radio ).

  • lr_data = cl_wd_flow_data=>new_flow_data( element = lr_radio ).

  • lr_radio->set_layout_data( lr_data ).

  • lr_containr->add_child( lr_radio ).

ENDIF.

Former Member
0 Kudos

The Problem might be...

1.Check the attribute STATUS of your view context.is this individual attribute under CONTEXT or under any other node.

if it is under any other node like ..

FLIGHTS ->Node name

......STATUS ->Attribute

then you have to bind the STATUS in this way.

bind_key_to_select = 'FLIGHTS.STATUS'
bind_selected_key = 'FLIGHTS.STATUS'

2. Put the Break point here

lr_radio = cl_wd_radiobutton=>new_radiobutton( ).

and check lr_radio has any value or not.if it is then the problem is with this statement only.

Still you are not able to solve the problem.Please get back to me immediately.

Thanks

Suman

Former Member
0 Kudos

thank you very much suman..it was solved the problem.

Answers (0)