Hello friends!
I have a problem with my program, it's about showing an internal table in an alv. I don't know why this message when checking sintax appears:
"TI_HUERFANOS" is not type-compatible with formal parameter
"IT_OUTTAB".
It's suppose that it_outtab accepts internal table, wright?
Would you please help me telling me what's wrong ?
And what should i do to fix it.
Any suggestion about code is wellcome.
Thanks!
My code:
REPORT ZFBUS061 .
*******TABLAS
TABLES: ANLA,
ANLZ.
****DATA
DATA: ok_code LIKE sy-ucomm.
Declara las variables de referencia a los objetos ALV Grid y su
*contenedor
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
go_custom_container TYPE REF TO cl_gui_custom_container.
DATA: padre_aux(12) type C.
data: existe_aux(9) type C.
DATA: BEGIN OF ti_assets occurs 0,
anln1 like anla-anln1,
anln2 like anla-anln2,
bukrs like anla-bukrs,
txt50 like anla-txt50, "descripcion
gsber like anlz-gsber,
ernam like anla-ernam,
erdat like anla-erdat,
aenam like anla-aenam,
aedat like anla-aedat,
deakt like anla-deakt, "deactivation date
ZUJHR like anla-ZUJHR, "Fiscal year in which first acquisition
END OF ti_assets.
DATA: BEGIN OF ti_hijos occurs 0,
anln1 like anla-anln1,
anln2 like anla-anln2,
bukrs like anla-bukrs,
txt50 like anla-txt50, "descripcion
gsber like anlz-gsber,
ernam like anla-ernam,
erdat like anla-erdat,
aenam like anla-aenam,
aedat like anla-aedat,
deakt like anla-deakt, "deactivation date
ZUJHR like anla-ZUJHR, "Fiscal year in which first acquisition
padre(12) type C,
END OF ti_hijos.
DATA: BEGIN OF ti_huerfanos OCCURS 0,
anln1 like anla-anln1,
anln2 like anla-anln2,
bukrs like anla-bukrs,
txt50 like anla-txt50, "descripcion
gsber like anlz-gsber,
ernam like anla-ernam,
erdat like anla-erdat,
aenam like anla-aenam,
aedat like anla-aedat,
deakt like anla-deakt, "deactivation date
ZUJHR like anla-ZUJHR, "Fiscal year in which first acquisition
padre like anla-anln1,
existe(9) type C,
END OF ti_huerfanos.
****SELECTION SCREEN
selection-screen begin of block bloque_datos .
select-options: S_BUKRS for ANLA-BUKRS.
*select-options: S_ANLN1 for ANLA-ANLN1.
*No tomamos en cuenta anln1 puesto que es un reporte de hijos sin padre
selection-screen end of block bloque_datos.
start-of-selection.
perform reporte_huerfanos.
SET SCREEN '100'.
end-of-selection.
&----
*& Form reporte_huerfanos
&----
text
----
--> p1 text
<-- p2 text
----
FORM reporte_huerfanos.
SELECT anlaanln1 anlaanln2 anlabukrs anlatxt50 anlz~gsber
anlaernam anlaerdat anla~aenam
anlaaedat anladeakt anla~ZUJHR
INTO CORRESPONDING FIELDS OF TABLE ti_assets
FROM
( anla inner join anlz on anlaanln1 = anlzanln1 and
anlaanln2 = anlzanln2 and anlabukrs = anlzbukrs
).
LOOP AT ti_assets.
if ti_assets-anln1 CP '*8+++++++' and ti_assets-bukrs in S_BUKRS.
move-corresponding ti_assets to ti_hijos.
padre_aux = ti_hijos-anln1.
move '0' to padre_aux+4(1).
move padre_aux to ti_hijos-padre.
append ti_hijos.
endif.
ENDLOOP.
existe_aux = 'NO EXISTE'.
loop at ti_hijos.
READ TABLE ti_assets with key anln1 = ti_hijos-padre bukrs =
ti_hijos-bukrs gsber = ti_hijos-gsber binary search.
if sy-subrc <> 0.
move ti_hijos-anln1 to ti_huerfanos-anln1.
move ti_hijos-anln2 to ti_huerfanos-anln2.
move ti_hijos-bukrs to ti_huerfanos-bukrs.
move ti_hijos-txt50 to ti_huerfanos-txt50.
move ti_hijos-gsber to ti_huerfanos-gsber.
move ti_hijos-ernam to ti_huerfanos-ernam.
move ti_hijos-erdat to ti_huerfanos-erdat.
move ti_hijos-aenam to ti_huerfanos-aenam.
move ti_hijos-aedat to ti_huerfanos-aedat.
move ti_hijos-deakt to ti_huerfanos-deakt.
move ti_hijos-ZUJHR to ti_huerfanos-ZUJHR.
move ti_hijos-padre to ti_huerfanos-PADRE.
move existe_aux to ti_huerfanos-existe.
append ti_huerfanos.
clear ti_huerfanos.
endif.
endloop.
ENDFORM. " reporte_huerfanos
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
Crea los objetos
IF go_custom_container IS INITIAL.
CREATE OBJECT go_custom_container
EXPORTING container_name = 'ALV_CONTAINER'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
PERFORM load_data_into_grid.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
MODULE USER_COMMAND_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
&----
*& Form load_data_into_grid
&----
text
----
--> p1 text
<-- p2 text
----
FORM load_data_into_grid.
Carga los datos en el grid y los muestra por pantalla
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'ti_huerfanos'
CHANGING it_outtab = ti_huerfanos.
ENDFORM. " load_data_into_grid