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

how to handle an error while using classes.

0 Likes
641

Hi gurus,

when i tried to copy the code from function module into report and execute it, it is giving some error message as

Error: components of classes declared using u201CCLASSLCL_TREE_EVENT_HANDLER

DEFINITION DEFERREDu201D can only be accessed after you have defined the class

(CLASS LCL_TREE_EVENT_HANDLER DEFINITION)..

i included the declarations include and forms include which are standards.

i copied the function module 'HR_CH_PERS_FILE' to get the employee infotype details in tree structure.

thank you..

2 REPLIES 2
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
542

Hi,

You must put the INCLUDE that contains the class object instantiation code (CREATE OBJECT) after the INCLUDE which contains the CLASS DEFINITION.

This error is coming due to the fact the your program is trying to create an instance of the class whose definition is not found at the time of the instantiation.

That is

Before you write

DATA obj TYPE REF TO cl_XXXxx.

CREATE OBJECT obj.

You need to have

CLASS cl_XXXxx DEFINITION.

ENDCLASS.

Best Regards,

Sesh

Read only

0 Likes
542

thanks