cancel
Showing results for 
Search instead for 
Did you mean: 

Access via null obj ref not possible error

former_member206760
Active Contributor
0 Kudos

Hi

I am using an assistance class and have specified it in the component...

i am getting the error Access via null obj ref not possible at following point in the code..

temp = wd_assist->IF_WD_COMPONENT_ASSISTANCE~GET_TEXT( key = '001' ).

i do not think we need to instantiate a assistance class ( or am i missing something ?/ )

Accepted Solutions (1)

Accepted Solutions (1)

ashish_shah
Contributor
0 Kudos

do you have a text element created in your assistance class with key '001'?

Regards,

Ashish Shah

former_member206760
Active Contributor
0 Kudos

yes i do have the text symbol created and is active

ashish_shah
Contributor
0 Kudos

You may try following code :


  lv_text_001 =
    wd_assist->if_wd_component_assistance~get_text( '001' ).

Regards,

Ashish Shah

former_member206760
Active Contributor
0 Kudos

tried but the same error

Former Member
0 Kudos

Hi,

I tried it is working fine for me..

data lv_str type string.
CALL METHOD wd_assist->if_wd_component_assistance~get_text
  EXPORTING
    key    = 'HEL'   "It is atext symbol/elemnt present in my component assistance class
  receiving
    text   = lv_str    .

Have you checked wether you are getting the error at the same place..ST22 can you check again for detailed error and paste it here..

Regards,

Lekha.

ashish_shah
Contributor
0 Kudos

Just make sure that Assistance class that you have declared at component level is the one where you have text symbol with key '001' , i mean make sure the class name matches.

Otherwise i done see any reason to get this error.

Former Member
0 Kudos

Hi,

After reading all these posts and i have done a small test , it is working for me as the other posts already confirmed. I am not sure why it is not working for you the way you described and it is working for all others.

I hope that you are not executing this code from used component->view referring the WD_ASSIST where in the wd_assist reference is not passed.

moreover to make sure that the error is from this code you can code a if else construct.

if wd_assist is bound.

" get the text element.

endif.

If the above code is working then i suspect that the text element is not active .

Success.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi ,

Try calling the assistence class method as

temp = wd_assist->GET_TEXT( key = '001' ).

Thanks,

Aditya.

former_member206760
Active Contributor
0 Kudos

this gives a syntax error as the method name is not only get_text ..

Former Member
0 Kudos

Hi,

Yes..Your previous coding was only correct.

May be you are not getting the 'Access via null reference ' error on this part of code..

Are you sure of this?

Thanks,

Aditya.

former_member206760
Active Contributor
0 Kudos

yes i saw it in debugging...i am getting the error at this point only

Former Member
0 Kudos

Hi,

Where is this code written?

I mean which controller?view or component controller

Please check if wd_assist is haveing a reference?

Thanks,

Aditya.

former_member206760
Active Contributor
0 Kudos

code is in the view contoller...

also there is a reference to wd_assist to my assistance class in the attribute section

former_member389677
Active Participant
0 Kudos

hi,

please check whether you have activated the assistance Class or not ?

Double click on the assistance class name in the Web dynpro component and check it is activated ?

Regards

Shaira

Edited by: Shaira Madhu on May 4, 2011 10:55 AM

former_member206760
Active Contributor
0 Kudos

yes it is active

vaibhav_tiwari
Contributor
0 Kudos

Hi Tarang,

Its a very basic thing and you might have created it as well but still check if you have created the text symbol (or it is active) you are accessing using this code.

Regards,

Vaibhav