cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic programming for textview with Radio Buttons in WebDynPro

Former Member
0 Kudos

Hi Guys,

I got a requirement on Dynamic programming in webdynpro.

My requirement is-> online exam pattern and its like the following:

1. Question number - 1

         

  • A. Answer
  • B. Answer
  • C. Answer
  • D. Answer

2. Question number - 2

         

  • A. Answer
  • B. Answer
  • C. Answer
  • D. Answer

3. Question number - 3

         

  • A. Answer
  • B. Answer
  • C. Answer
  • D. Answer

4. Question number - 4

         

  • A. Answer
  • B. Answer
  • C. Answer
  • D. Answer

and so on....

All the records retrieving from the database tables. I have created a one questions related table.

To display as above...I went to dynamic programming in webdynpro.

I'm fetching the table and displaying the User Interface using with TextView UI element along with the displaying the Radio Buttons also. But it is not

displaying as I have shown above. It is displaying as below.

1. Question number - 1

2. Question number - 2

3. Question number - 3

4. Question number - 4

  • A. Answer
  • B. Answer
  • C. Answer
  • D. Answer
  • A. Answer
  • B. Answer
  • C. Answer
  • D. Answer
  • A. Answer
  • B. Answer
  • C. Answer
  • D. Answer
  • A. Answer
  • B. Answer
  • C. Answer
  • D. Answer

and so on......

But I want to display as starting shown manner.

and this is my code which I have used to implement the above please check following code:

data : lr_textview type ref to cl_wd_text_view.
Data:lr_container type ref to cl_wd_uielement_container.
DATA: LR_RADIOBUTTON1  type ref to CL_WD_RADIOBUTTON.
data lr_matrix    type ref to cl_wd_matrix_head_data.


data:
      Node_Ques type ref to If_Wd_Context_Node,
      Elem_Ques type ref to If_Wd_Context_Element,
      Stru_Ques type If_Main_View=>Element_Ques ,
      it_ques TYPE  If_Main_View=>Elements_Ques .
   Node_Ques = wd_Context->get_Child_Node( Name = IF_MAIN_VIEW=>wdctx_Ques ).

select * FROM ZQUESTIONS_TBL INTO CORRESPONDING FIELDS OF TABLE it_ques.

LOOP AT it_ques INTO Stru_Ques .
     
     lr_textview = cl_wd_text_view=>new_text_view( view = view
                                                  text = Stru_Ques-QNAME ) .

               lr_matrix = cl_wd_matrix_head_data=>new_matrix_head_data(  lr_textview ).

               lr_textview->set_layout_data( lr_matrix ).
       
               CALL METHOD lr_container->add_child
                  EXPORTING
                    index     = 1
                    the_child = lr_textview.
  
           
            DO 4 TIMES.
                
                 CALL METHOD cl_wd_radiobutton=>new_radiobutton
                             EXPORTING
*                             BIND_KEY_TO_SELECT = 'SFLIGHT.CONNID '
                              bind_selected_key   =  'SFLIGHT.CONNID '
*                             BIND_TEXT           =  'SFLIGHT.QID'
                             receiving
                               control             = LR_RADIOBUTTON1.

                            lr_matrix = cl_wd_matrix_head_data=>new_matrix_head_data(  LR_RADIOBUTTON1 ).
 
                           LR_CONTAINER->ADD_CHILD( LR_RADIOBUTTON1  ). 
 

 
              ENDDO.                                                                      
  ENDLOOP.

Please let me give me a way to reach my target. Looking forward your answers.

Thanks and Regards

Venkatesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Venkatesh,

Try to use row repeater. That will be more suitable for this kind of layout.

http://wiki.sdn.sap.com/wiki/display/WDABAP/steps+to+create+row+repeater+ui+element

-Manish

Former Member
0 Kudos

Hi Manish,

I'm so happy to receive answer from you and its very helpful.

you have given URL its fine to display all the records which is getting from the database table.

What about the "Radio Buttons"?. Each and every row repeater I must require Four Radio Buttons.

Please show a path to reach my target and looking for your answer.

Thanks and Regards

Venkatesh

Former Member
0 Kudos

Hi Venkatesh,

Check out this link, its something similar to your requirement.

http://scn.sap.com/docs/DOC-27866

-Manish

Former Member
0 Kudos

Hi Manish,

I'm well thankful to you and helped me a lot to reach my destination.

Best Regards

Venkatesh

Answers (0)