cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in Webdynpro button and link

Former Member
0 Kudos

     Hello All,

I have developed webdynpro for table maintenance generator i need your help on  below quarries.

     1. I have created one Copy button, when user select 1 or more rows it should copy for can anyone provide the code for this copy button.

     2. I have created URL links for one webdynpro component using this i can view the all tables using with different URL links with only one webdynpro

         component, Now i can view the table and do changes as per the created buttons but when i open the link the table should open           with change mode for only  non-key fileds, for this can anyone pls provide code for this.

Thank you.

BR

Srinivas.

Accepted Solutions (0)

Answers (2)

Answers (2)

ramakrishnappa
Active Contributor
0 Kudos

Hi Srinivas,

Find my suggestions for your queries as below

1. When user selects rows and press copy button,

  • Read the whole table data into an internal table lt_all
  • Read the selected elements from context node lt_selected
  • Append the selected elements to internal table lt_all

Sample:

               data lo_node type ref to if_wd_context_node.

               data lo_element type ref to if_wd_context_element.

               data lt_selected type WDR_CONTEXT_ELEMENT_SET.

               data ls_selected like line of lt_selected.

               data lt_data       type wd_this->elements_MY_NODE.

               data ls_data      like line of lt_data.

               "read node ref

               lo_node = wd_context->get_child_node( name = wdthis->wdctx_MY_NODE ).

              

               " get all records

               lo_node->GET_STATIC_ATTRIBUTES_TABLE(

                         importing

                              table = lt_data ).

                        

               " get selected records

               lt_selected = lo_node->get_selected_elements( ).

               loop lt_selected into ls_selected.

                    ls_selected->get_static_attributes(

                              importing

                                static_attributes = ls_data ).

                     append ls_data to lt_data.

               endloop.

               " Reset selection

               lo_node->clear_selection( ).

Note: replace my_node with your node name

2. Could you elaborate on this requirement in detail?

Regards,

Rama

Former Member
0 Kudos

Hi Rama,

 

Thank you for your replay.

I have developed only one webdynpro component with this I have created several URL links for several tables, If I m click on URL link it will trigger the webdypro component and it will show the table for view with display mode but wants table should be editable/change mode with only Non-key fields not entire table should be change mode.

Please provide your inputs on this.

Regards

Sirinivas.

 

ramakrishnappa
Active Contributor
0 Kudos

Hi Srinivas,

You can achieve your requirement as below

Let us say you are having 2 WD components, zwd_summary and zwd_table_viewer

Here, zwd_summary is the component with many URL links & Zwd_table_viewer is component which display/change table

Proceed as below

Component: zwd_table_viewer

  • You need to create a method in component controller SET_MODE( iv_mode = 2 ).

          here, iv_mode : 1 - create, 2 - change 3 - display

               if     iv_mode = 2.

                    " your logic goes as here

                    " You need to find out the key fields from table name

                    " for this you can use run time classes cl_abap_structdescr.

                    refer the thread to get the the key fields

                   

                    " loop over each field and if its key field set_read_only( abap_true ) otherwise, set_read_only( abap_false )

               endif.

  •      Now, on HANDLEDEFAULT of startup plug of window, you call the method

                    wd_comp_controller->set_mode( iv_mode = 2 ).

Hope this helps you.

Regards,

Rama

Former Member
0 Kudos

Hello All,

Can anyone please help on above issue.

Srinivas