Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error in "OBJECT_REF" is not an object reference.

Former Member
0 Likes
2,318

Below r my code

&----


*& Report Z_FIRST_PROGRAM

*&

REPORT z_first_program.

TABLES spfli.

DATA : object_ref TYPE REF TO application.

START-OF-SELECTION.

CREATE OBJECT object_ref.

CALL SCREEN 100.

----


  • MODULE status_0100 OUTPUT

----


*

----


MODULE status_0100 OUTPUT.

SET PF-STATUS 'SCREEN_100'.

ENDMODULE. "status_0100 OUTPUT

----


  • 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

i_carrid = spfli-carrid.

ENDIF.

ENDMODULE. "user_command_0100 INPUT

&----


*& Class (Implementation) Application

&----


  • Text

----


CLASS application DEFINITION.

PUBLIC SECTION.

METHODS : read_data IMPORTING i_carrid TYPE spfli-carrid.

PRIVATE SECTION.

DATA : spfli_tab TYPE TABLE OF spfli.

ENDCLASS. "Application

----


  • CLASS application IMPLEMENTATION

----


*

----


CLASS application IMPLEMENTATION.

METHOD read_data.

SELECT * FROM spfli

INTO TABLE spfli_tab

WHERE carrid = i_carrid.

ENDMETHOD. "read_data

ENDCLASS. "application IMPLEMENTATION

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,197

Put the Definition and implementation of the class application in front of the statement

CREATE OBJECT object_ref.

IN fact you can put it even before the start-of-selection

Alternatively,

YOu can put this statement:

CLASS application DEFINITION DEFERRED. before the start-of-selection.

Regards,

Rav

Below r my code

&----


*& Report Z_FIRST_PROGRAM

*&

REPORT z_first_program.

TABLES spfli.

DATA : object_ref TYPE REF TO application.

START-OF-SELECTION.

CREATE OBJECT object_ref.

CALL SCREEN 100.

----


  • MODULE status_0100 OUTPUT

----


*

----


MODULE status_0100 OUTPUT.

SET PF-STATUS 'SCREEN_100'.

ENDMODULE. "status_0100 OUTPUT

----


  • 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

i_carrid = spfli-carrid.

ENDIF.

ENDMODULE. "user_command_0100 INPUT

&----


*& Class (Implementation) Application

&----


  • Text

----


CLASS application DEFINITION.

PUBLIC SECTION.

METHODS : read_data IMPORTING i_carrid TYPE spfli-carrid.

PRIVATE SECTION.

DATA : spfli_tab TYPE TABLE OF spfli.

ENDCLASS. "Application

----


  • CLASS application IMPLEMENTATION

----


*

----


CLASS application IMPLEMENTATION.

METHOD read_data.

SELECT * FROM spfli

INTO TABLE spfli_tab

WHERE carrid = i_carrid.

ENDMETHOD. "read_data

ENDCLASS. "application IMPLEMENTATION

2 REPLIES 2
Read only

Former Member
0 Likes
1,198

Put the Definition and implementation of the class application in front of the statement

CREATE OBJECT object_ref.

IN fact you can put it even before the start-of-selection

Alternatively,

YOu can put this statement:

CLASS application DEFINITION DEFERRED. before the start-of-selection.

Regards,

Rav

Read only

0 Likes
1,197

Thanks