I'm trying to make an alv report using OO programming. I've already made it using the function module 'reuse_alv_list_display' and it's working propperly so my database query it's exactly the same, but whe I veryfy the sintax, the next error message appears:'gt_output is not type compatible with formal parameter it_outtab'. I don't know what's going on, because I think I've declared my parameters properly, anyway this is my source code:
DATA: grid TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container.
TYPES: BEGIN OF st_output,
tplnr LIKE viaufkst-tplnr,
pltxt LIKE iflo-pltxt,
acpos LIKE pmco-acpos,
END OF st_output.
DATA:gt_output TYPE STANDARD TABLE OF st_output WITH HEADER LINE.
SELECT-OPTIONS:TPLNR FOR gt_output-tplnr.
START-OF-SELECTION.
CALL SCREEN 1000.
*&----
*
*& Module STATUS_1000 OUTPUT
*&----
*
text
*----
*
*creo q para hacerlo con objetos hay que definir 1º la vista, y despues
*hacer el select sobre ella, en lugar de hacer los joins en el select
*la vista que definamos se utiliza como tipo de tabla para gt_output.
MODULE STATUS_1000 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING
CONTAINER_NAME = 'CCCONTAINER'.
CREATE OBJECT grid
EXPORTING
I_PARENT = g_custom_container.
ENDIF.
SELECT VTPLNR IPLTXT P~ACPOS
INTO CORRESPONDING FIELDS OF TABLE gt_output
FROM VIAUFKST AS V
INNER JOIN IFLO AS I
ON VTPLNR = ITPLNR
INNER JOIN PMCO AS P
ON VOBJNR = POBJNR
WHERE V~TPLNR IN TPLNR.
CALL METHOD grid->set_table_for_first_display
EXPORTING I_STRUCTURE_NAME = 'st_output'
CHANGING IT_OUTTAB = gt_output.
ENDMODULE. " STATUS_1000 OUTPUT
Thanks everybody, this is a really good way to learn about ABAP programming.