‎2005 Feb 28 11:32 PM
Hello everyone,
I just started my abap object programming and I have a error that according to the book code is ok, but does not run, compiles but crashes.
Does anyone sees something wrong with it?
Thanks in advance
Carlos
*&---------------------------------------------------------------------*
*& Report Z_MYFIRST_PROGRAM *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT z_myfirst_program.
*---------------------------------------------------------------------*
* CLASS appliction DEFINITION
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
CLASS application DEFINITION.
PUBLIC SECTION.
METHODS: consturctor,
read_data IMPORTING l_carrid TYPE spfli-carrid,
fill_list.
PRIVATE SECTION.
DATA: spfli_tab TYPE TABLE OF spfli,
container TYPE REF TO cl_gui_custom_container,
alv_list TYPE REF TO cl_gui_alv_grid.
ENDCLASS.
*---------------------------------------------------------------------*
* CLASS appliction IMPLEMENTATION
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
CLASS application IMPLEMENTATION.
METHOD consturctor.
CREATE OBJECT container
EXPORTING container_name = 'LIST_AREA'.
CREATE OBJECT alv_list
EXPORTING i_parent = container.
CALL METHOD alv_list->set_table_for_first_display
EXPORTING i_structure_name = 'SPFLI'
CHANGING it_outtab = spfli_tab.
ENDMETHOD.
METHOD read_data.
SELECT *
FROM spfli
INTO TABLE spfli_tab
WHERE carrid = l_carrid.
ENDMETHOD.
METHOD fill_list.
CALL METHOD alv_list->refresh_table_display. "<< CRASHES HERE
"OBJECTS_OBJREF_NOT ASSIGNED
ENDMETHOD.
ENDCLASS.
TABLES spfli.
DATA object_ref TYPE REF TO application.
START-OF-SELECTION.
CREATE OBJECT object_ref.
CALL SCREEN 100.
*---------------------------------------------------------------------*
* MODULE satus_100 OUTPUT *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
CALL METHOD object_ref->fill_list.
ENDMODULE.
*---------------------------------------------------------------------*
* MODULE user_command_0100 INPUT *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
IF sy-ucomm = 'BACK' OR
sy-ucomm = 'EXIT' OR
sy-ucomm = 'CANCEL'.
LEAVE PROGRAM.
ELSE.
CALL METHOD object_ref->read_data
EXPORTING l_carrid = spfli-carrid.
ENDIF.
ENDMODULE.
‎2005 Mar 01 2:40 AM
The constructor name is misspelled:
METHODS: consturctor,
and
METHOD consturctor.
should read
METHODS: constructor,
and
METHOD constructor.
Because it is misspelled, it is not being executed when the object is created.
Let us know how it goes.
‎2005 Mar 01 2:40 AM
The constructor name is misspelled:
METHODS: consturctor,
and
METHOD consturctor.
should read
METHODS: constructor,
and
METHOD constructor.
Because it is misspelled, it is not being executed when the object is created.
Let us know how it goes.
‎2005 Mar 01 3:45 AM
Hi charles,
I must say that Charles has an amazing eye for detail !!
Regards,
Anand Mandalika.
‎2005 Mar 01 1:27 PM
Charles,
Thank you very much and I am very sorry about this silly error. But, since I am new on this I just panic and started looking for a different cause than syntax.
Thanks again
Carlos