cancel
Showing results for 
Search instead for 
Did you mean: 

what is Null error?

Former Member
0 Kudos

Hi,

I want to assign one text to TextView(userinterface element) at runtime.

For this i have written this code in WDDOMODIFYVIEW method.

DATA TV4 TYPE REF TO CL_WD_TEXT_VIEW.

TV4->SET_TEXT ( 'ABC' ).

when i run this, i am getting an error: Access Via 'NULL' object reference not possible.

How should i resolve this??????????

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member196517
Contributor
0 Kudos

Null error means you are trying to access some property or method of object which is still not been created or is still a reference and as in this code u r trying to access a method set_text thru object TV4 which is still a reference and hasn't been created so please create an object with calling a constructor of the class CL_WD_TEXT_VIEW.

Regards

Anuj

Yashpal
Active Contributor
0 Kudos

Hi ,

You havent created the object of the class CL_WD_TEXT_VIEW ..and u r trying to access the method thats why its giving this null reference error.

write this code ..

DATA TV4 TYPE REF TO CL_WD_TEXT_VIEW.

tv4 ?= view->get_element( 'ID OF ELEMENT' ).

TV4->SET_TEXT ( 'ABC' ).

it will solve ur problem..

Regards

Yashpal