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 when calling a method inside a form routine...

aris_hidalgo
Contributor
0 Likes
593

Hello experts,

I am trying to call a method inside a form but it is giving me an error. The error is:

Access not possible using 'NULL' object reference.

Anyway, below is my code guys:

START-OF-SELECTION.

DATA: main TYPE REF TO lcl_main,

old_and_new TYPE REF TO lcl_old_and_new,

check_changes TYPE REF TO lcl_check_changes,

messages TYPE REF TO lcl_messages.

CREATE OBJECT: main, old_and_new, check_changes, messages.

----


  • FORM get_orig_contents_of_zts0001 *

----


  • ........ *

----


FORM get_orig_contents_of_zts0001.

CALL METHOD main->export_old_recs.

ENDFORM.

Help would be greatly appreciated. Thanks a lot and take care!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
547

Before the "START-OF-SELECTION " just add this sentense :

<b>class lcl_main definition deferred.</b>

CLASS Definition.

ENDCLASS.

CLASS Implementation.

ENDCLASS.

START-OF-SELECTION.

*Do your coding here

<b>in this way we are deferring the class definition for later</b>

3 REPLIES 3
Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
547

Hi Viray,

Loks like ur method is not avaliable for the subroutine u r calling.

Just check whether u have defined the method and all it's objects in ur program.

Cheers,

SImha.

Read only

Former Member
0 Likes
547

hi,

While calling a method it should be available. You need to define the class and its methods in the program. You might have missed some method.

Regards,

Richa

Read only

Former Member
0 Likes
548

Before the "START-OF-SELECTION " just add this sentense :

<b>class lcl_main definition deferred.</b>

CLASS Definition.

ENDCLASS.

CLASS Implementation.

ENDCLASS.

START-OF-SELECTION.

*Do your coding here

<b>in this way we are deferring the class definition for later</b>