2007 Oct 04 6:29 AM
Hi Guys,
This is the first time i am working on ALV Grid with OO Concepts.
I wrote a program but i am getting error's
The code is below.
Data : grid type ref to cl_gui_alv_grid,
g_custom_container type ref to cl_gui_custom_container,
gt_final1 type ref to t_Final_out.
Form ALVGRID_OO_Display.
perform ALVGRID_OO_Display.
Form ALVGRID_OO_Display.
Call Method grid->set_table_for_first_display
Exporting I_Structure_name = 't_final_out'
Changing it_outtab = gt_final1.
Endform.
But i am getting the error
""GT_FINAL1" is not type-compatible with formal parameter "IT_OUTTAB".
"
so can anybody tell me how to solve this error.
Very Urgent.
Thanks,
Gopi.
Hi Gopi,
the mistake is gt_final1 type ref to t_final_out change this to
gt_final1 type table of t_final_out.
regards,
Santosh Thorat.
2007 Oct 04 6:31 AM
Hi,
Please refer sample program "BCALV_GRID_DEMO" in ECC.
Best regards,
Prashant
2007 Oct 04 6:31 AM
Hi Gopi,
the mistake is gt_final1 type ref to t_final_out change this to
gt_final1 type table of t_final_out.
regards,
Santosh Thorat.
2007 Oct 04 6:32 AM
DONT DECLARE gt_final1 likr type ref to,,,,
declare GT_FINAL1 type table of SOME STRUCTURE OR TYPE.
u will not get an error
reward points if useful.......
2007 Oct 04 6:32 AM
HI,
see this example.
DATA:t_mara TYPE TABLE OF mara.
DATA:FCAT TYPE LVC_T_FCAT.
DATA:G_CONTAINER TYPE SCRFNAME VALUE 'TABC',"TABC is *container in screen 101
GRID TYPE REF TO CL_GUI_ALV_GRID,
G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
set screen 101.
MODULE STATUS_0101 output.
IF G_CUSTOM_CONTAINER IS INITIAL.
CREATE OBJECT G_CUSTOM_CONTAINER "CREATING OBJECT FOR CUSTOM CONTAINER
EXPORTING CONTAINER_NAME = G_CONTAINER.
CREATE OBJECT GRID "CREATING GRID IN WRKBNCH SCREEN
EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = 'MARA'
CHANGING
CT_FIELDCAT = FCAT[].
SELECT * from mara into table t_mara.
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
CHANGING
IT_FIELDCATALOG = FCAT[]
IT_OUTTAB = t_MARA.
ENDIF.
ENDMODULE.
flow logic of screen 101:
PROCESS BEFORE OUTPUT.
MODULE STATUS_0101.
PROCESS AFTER INPUT.
rgds,
bharat.
2007 Oct 04 6:50 AM
Hi Bharat ,
What's the purpose of Set Screen '101' statement and
Module MODULE STATUS_0101 output? and where we have to define this statement i mean Module STATUS_0101 in Initaialization or Start-Of-Selection or..?
My Main doubt is why we have to define this Module Status_0101 and is there any other way or we must do like this only?If sodoes i need to drag and drop any thing in this screen.?
Please reply Thanks,
Gopi.
2007 Oct 04 6:35 AM
Hi,
gt_final1 i.e. the output internal table should be of TYPE TABLE, not a reference to object.
Check out BCALV_TEST_GRID for more details.
Regards,
Raghavendra
2007 Oct 04 6:59 AM
Hi,
CALL SCREEN 101.
Double click on 101 & create containter.
Then add MODULE etc in it.
Best regards,
Prashant
2007 Oct 04 6:23 PM
Hi Guys,
How to create a container after double cliciking screen 101.
Thanks,
Gopi.
2007 Oct 04 6:40 PM
Hi Guys,
When i am executing the program for ALV grid using OO concepts i got thisn type of error
"Short text
Access via 'NULL' object reference not possible.
What happened?
Error in the ABAP Application Program
The current ABAP program "Z_TEST_PGM" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_REF_IS_INITIAL', was not
caught in
procedure "ALVGRID_OO_DISPLAY" "(FORM)", nor was it propagated by a RAISING
clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
You attempted to use a 'NULL' object reference (points to 'nothing')
access a component (variable: "GRID").
An object reference must point to an object (an instance of a class)
before it can be used to access components.
Either the reference was never set or it was set to 'NULL' using the
CLEAR statement."
The code for this one is .
.
Data : grid type ref to cl_gui_alv_grid,
g_custom_container type ref to cl_gui_custom_container,
FCAT TYPE LVC_T_FCAT,
gt_final1 type table of t_Final_out.
Initialization.
v_repid = sy-repid.
set screen '101'.
MODULE STATUS_0101 output.
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.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = 't_final_out'
CHANGING
CT_FIELDCAT = FCAT[].
ENDMODULE.
Perform ALVGRID_OO_Display.
Form ALVGRID_OO_Display.
*set screen '101'.
Call Method grid->set_table_for_first_display
Exporting I_Structure_name = 't_final_out'
Changing it_outtab = gt_final1.
Endform.
't_final_out' is the final output Structure of the Internal table.
Please respond to this thread.
Thanks,
Gopi
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |