I need to display an internal table with cl_salv_table
. Currently I take the bkpf
table, cut out three columns and insert them into the internal table. But now it's saying that the parameter and lt_bkpf
are type-incompatible.
Here is my Code:
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(15) p_name1 FOR FIELD p_blart.
PARAMETERS: p_blart TYPE blart.
SELECTION-SCREEN END OF LINE.
AT SELECTION-SCREEN OUTPUT.
p_name1 = 'Belegart'.
INITIALIZATION.
p_blart = 'DD'. "Set default value
END-OF-SELECTION.
Data:
BEGIN OF gt_bkpf OCCURS 0,
bukrs LIKE bkpf-bukrs,
blart LIKE bkpf-blart,
gjahr LIKE bkpf-gjahr,
END OF gt_bkpf.
SELECT bukrs, blart, gjahr
FROM bkpf
WHERE blart LIKE @p_blart
INTO CORRESPONDING FIELDS OF @gt_bkpf.
ENDSELECT.
cl_salv_table=>factory( IMPORTING r_salv_table = go_table
CHANGING t_table = gt_bkpf ).
go_table->display( ).
The internal table is declared with header line (because of OCCURS), this is obsolete and not supported in OO environment. You have to declare the table like this:
Please note the LIKE is also replaced by TYPE.