Aller au contenu

Grille ALV

https://riptutorial.com/abap/example/16356/creating-and-displaying-an-alv

DATA: t_spfli       TYPE STANDARD TABLE OF spfli,
alv           TYPE REF TO cl_salv_table,
error_message TYPE REF TO cx_salv_msg.

* Fill the internal table with example data
SELECT * FROM spfli INTO TABLE t_spfli.

* Fill ALV object with data from the internal table
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = alv
CHANGING
t_table      = t_spfli ).
CATCH cx_salv_msg INTO error_message.

* error handling
ENDTRY.

* Use the ALV object's display method to show the ALV on the screen
alv->display( ).

* Ajouter les boutons
alv->get_functions( )->set_all( ).

* Rendre le filtre sensible au majuscule /minuscule
* [https://blogs.sap.com/2017/12/22/how-to-get-alv-filter-work-for-lower-case-characters/]* (https://blogs.sap.com/2017/12/22/how-to-get-alv-filter-work-for-lower-case-characters/)

* define the column
DATA lo_column     TYPE REF TO cl_salv_column_table.
DATA lo_columns    TYPE REF TO cl_salv_columns_table.
DATA lt_column_ref TYPE salv_t_column_ref.
DATA ls_column_ref TYPE salv_s_column_ref.
DATA go_salv_table TYPE REF TO cl_salv_table .
DATA lt_column_ref TYPE salv_t_column_ref.
DATA ls_column_ref TYPE salv_s_column_ref.

* get your ALV instance
cl_salv_table=>factory( IMPORTING r_salv_table   = go_salv_table
CHANGING  t_table        = "your table here
).

* get the column
lo_columns = go_salv_table->get_columns( ).
lt_column_ref = lo_columns->get( ).

* set lowwer case
LOOP AT lt_column_ref INTO ls_column_ref.
lo_column ?= ls_column_ref-r_column.
CASE ls_column_ref-columnname.
WHEN 'XXXX'.
lo_column->set_lowercase(   value = if_salv_c_bool_sap=>true ).
ENDCASE.
ENDLOOP.

Sinon trouver mon abap sur les BI tools (période DKT)