Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SALV

Former Member
0 Likes
506

What is wrong here ? I'd like to add a functionallyty to the SALV TABLE

form set_function  using    cho_hndlr
      type ref to zcl_handler_hrcockpit .

  data : lo_salv type ref to cl_salv_table        .
  data : lo_function type ref to cl_salv_functions.

  lo_salv =   cho_hndlr->get_salv( ).

  lo_function = lo_salv->get_functions( ).

  lo_function->set_all( ).


  call method lo_function->add_function
    exporting
      name     = 'EXEC'
      icon     = 'ICON_EXECUTE'
*    text     =
      tooltip  = 'Process Selected entries'
      position = 1   .

endform.                    " set_handler

2 REPLIES 2
Read only

athavanraja
Active Contributor
0 Likes
454

Have you seen this demo program?

SALV_DEMO_TABLE_FUNCTIONS

Raja

Read only

0 Likes
454

they is only why you are using a screen/container to display SALV you can use the add_function method.


  try.
        cl_salv_table=>factory(
          exporting
            r_container    = gr_container
            container_name = 'CONTAINER'
          importing
            r_salv_table   = gr_table
          changing
            t_table        = gt_outtab ).
      catch cx_salv_msg.                                "#EC NO_HANDLER
    endtry.

*... §3.1 activate ALV generic Functions
    data: lr_functions type ref to cl_salv_functions,
          l_text       type string,
          l_icon       type string.

    lr_functions = gr_table->get_functions( ).
    lr_functions->set_all( gc_true ).

*... §3.2 include own functions
    l_text = text-b01.
    l_icon = icon_complete.
    try.
      lr_functions->add_function(
        name     = 'MYFUNCTION'
        icon     = l_icon
        text     = l_text
        tooltip  = l_text
        position = if_salv_c_function_position=>right_of_salv_functions ).
      catch cx_salv_existing cx_salv_wrong_call.
    endtry.


otherwise you have to create your own GUI status and set it as below.


try.
      cl_salv_table=>factory(
        importing
          r_salv_table = gr_table
        changing
          t_table      = gt_outtab ).
    catch cx_salv_msg.                                  "#EC NO_HANDLER
  endtry.

*... §3 Functions
*... §3.1 activate ALV generic Functions
*... §3.2 include own functions by setting own status
  gr_table->set_screen_status(
    pfstatus      =  'MYGUISTATUS'
    report        =  gs_test-repid
    set_functions = gr_table->c_functions_all ).

Regards

Raja