Friday, July 22, 2016

Another SALV post

select * from makt into table @data(lt_makt) where matnr like '100-%'.
try.
    " setup SALV
    cl_salv_table=>factory(
       importing r_salv_table = data(lo_salv)
       changing t_table = lt_makt
     ).
    " prepare SALV
    lo_salv->get_functions( )->set_all( ). " activate toolbar
    lo_salv->get_columns( )->get_column( 'MANDT' )->set_technical( ).
    lo_salv->get_columns( )->get_column( 'SPRAS' )->set_output_length( 8 ).
    lo_salv->get_columns( )->get_column( 'MAKTX' )->set_visible( abap_false ).
    lo_salv->get_sorts( )->add_sort( 'MATNR' ).
    lo_salv->get_sorts( )->add_sort( 'SPRAS' ).
    lo_salv->get_display_settings( )      ->set_striped_pattern( cl_salv_display_settings=>true ).
    lo_salv->get_layout( )->set_key(       value salv_s_layout_key( report = sy-repid ) 

    ).
    lo_salv->get_layout( )->set_save_restriction( 

      cl_salv_layout=>restrict_none 
    ).
    lo_salv->get_selections( )->set_selection_mode( 

      cl_salv_selections=>multiple 
    ).

    " Display SALV
    lo_salv->display( ).
  catch
    cx_salv_msg
    cx_salv_not_found
    cx_salv_data_error
    cx_salv_existing into data(lo_x).

    message lo_x type 'E'.
endtry.

No comments:

Post a Comment

Working with the session Id // ID für den Modus

Sometimes it can be helpful to know the id of the current session     CALL FUNCTION 'TH_GET_CONTEXT_ID'       IMPORTING         cont...