2008 Feb 12 5:21 AM
Hi all,
I have written an ALV report.I declared an internal table wiht my own table fields. while calling method set_table_for_table_display using object of the cl_gui_alv_grid, it throws the error "the internal table you have created is not type compatible witht it_outtab" of the class.Please help me out and guide me where to check for correcting it?
Reply me soon...its urgent..
Edited by: Lakshmanan JK on Feb 12, 2008 6:28 AM
2008 Feb 12 5:30 AM
Hello Lakshman,
How did you declare your internal table. It shoudl not be with header line.
Look at this program for reference "BCALV_GRID_DEMO".
I guess that is due to declaration of your internal table.
Regards,
Kiran I
2008 Feb 12 5:30 AM
Hello Lakshman,
How did you declare your internal table. It shoudl not be with header line.
Look at this program for reference "BCALV_GRID_DEMO".
I guess that is due to declaration of your internal table.
Regards,
Kiran I
2008 Feb 12 5:33 AM
Hi kiran,
thanks for ur kind and quick reply. i have declared my internal table with data statement along with occurs 0 and without header line only. ok i will check that program as u told....but tel me where to check for the error...
2008 Feb 12 5:39 AM
Hello Lakshaman,
Declaring with Occurs 0 it self means with header line. While using classes we should not use internal tabel with header line, rather you should declare internal table and header separately.
You can see the before program as example.
Regards,
Kiran I
2008 Feb 12 5:42 AM
I think you are telling me to create my internal table with types statement and declare a work area using data statement right. then will it work fine?????
2008 Feb 12 5:47 AM
Let us have a trial in that prospective also. I think it should.
Regards,
Kiran I
2008 Feb 12 5:53 AM
no it is not working fine..give some other idea. my internal table is with customized table fields so i cant use standard table in the i_structurename parameter in the function module.
my internal table has collection of fileds from various standard as well as customer tables, so i m confused where to check for the error?
2008 Feb 12 6:05 AM
hi,
see try this way.
1) create a work area.
data : begin of wa,
matnr like mara-matnr,
vbelen like vbap-vbeln,
end of wa.
2) create a table.
data : itab type table of wa.
now here according to your need i have a work area with fields from different table.
now all u have to do is create a field catalog say gt_fieldcat
and use the function module
data : GRID1 TYPE REF TO CL_GUI_ALV_GRID.
CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
CHANGING IT_FIELDCATALOG = GT_FIELDCAT
IT_OUTTAB = itab.
you use i_structurename parameter only when ur internal table is type standard SAP table and hence you dont need to create a field catalog
2008 Feb 12 5:32 AM
i think the problem is with ur internal table declaration,
i suppose u have declared ur internal table as with header line or occurs 0
instead try declaring like this.
u have to create a work area say WA
and then create a internal table type work area
data : itab type table of wa.