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 NULL object reference

former_member194669
Active Contributor
0 Likes
387

Hi All,

I am calling a method in at selection-screen on help-request event. But it is giving me dump ie "Access not possible using 'NULL' object reference"



  data : disp_help type ref to l_display_help.
  create object disp_help.
  at selection-screen on help-request for p_awerk.
    call method disp_help->m_display_help( ).


*&---------------------------------------------------------------------*
* Class l_display_help Implementation                                  *
*&---------------------------------------------------------------------*
* To display the documentation for the button clicked                  *
*----------------------------------------------------------------------*
class l_display_help implementation.
  method m_display_help.
    clear wa_help.
    refresh i_help.

    wa_help-tdline = text-069.
    wa_help-tdformat = '1'.
    append wa_help to i_help.
    clear wa_help.

    wa_help-tdline = text-070.
    wa_help-tdformat = '2'.
    append wa_help to i_help.
    clear wa_help.

    wa_help-tdline = text-071.
    wa_help-tdformat = '3'.
    append wa_help to i_help.
    clear wa_help.
    v_title = text-072.
    call function 'COPO_POPUP_TO_DISPLAY_TEXTLIST'
      exporting
        task       = c_display
        titel      = v_title
      tables
        text_table = i_help.
  endmethod.                             " M_display_help
endclass.                                " L_display_help IMPLEMENTATION

class l_display_help definition.
  public section.
    data : v_title type n.
    data : t_help  type tline.
    data : i_help  type standard table of t_help.
    data : wa_help type t_help.
    methods : m_display_help.
endclass.                                " L_display_help

Thanks

aRs

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
355

You must first create the object, but since it is not put in an event, it is not triggering the CREATE OBJECT. Modify like so.



  data : disp_help type ref to l_display_help.
  intialization.
       create object disp_help.
  at selection-screen on help-request for p_awerk.
       call method disp_help->m_display_help( ).



or.........



  data : disp_help type ref to l_display_help.

  at selection-screen on help-request for p_awerk.
    if   disp_help is initial
          create object disp_help.
    endif..
    call method disp_help->m_display_help( ).



Regards,

RIch Heilman

2 REPLIES 2
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
356

You must first create the object, but since it is not put in an event, it is not triggering the CREATE OBJECT. Modify like so.



  data : disp_help type ref to l_display_help.
  intialization.
       create object disp_help.
  at selection-screen on help-request for p_awerk.
       call method disp_help->m_display_help( ).



or.........



  data : disp_help type ref to l_display_help.

  at selection-screen on help-request for p_awerk.
    if   disp_help is initial
          create object disp_help.
    endif..
    call method disp_help->m_display_help( ).



Regards,

RIch Heilman

Read only

former_member194669
Active Contributor
0 Likes
355

Thanks Rich,

Your reply is working.

Thanks

aRs