Skip to Content
author's profile photo Former Member
Former Member

Null reference error

Hi Experts,

I'm an ABAPER and new to CRM Web UI working on developing a z-bsp-component. I need to trigger a pop-up window to show an alert message to the user who submits a request if some information is not available. I succeeded in achieving this one as a 'INFORMATION' message in the view, but couldn't trigger a new pop-up window as i end up with "access null reference error". This is the code i tried in the view attribute level get-method.

IF VALUE IS NOT INITIAL.

***

  • Data: lr_confirm_popup TYPE REF TO if_bsp_wd_popup,*

  • lr_comp_controller TYPE REF TO CL_BSP_WD_COMPONENT_CONTROLLER,*

  • lr_wd_ctrl TYPE REF TO CL_BSP_WD_CONTROLLER.*

***

  • IF lr_confirm_popup IS NOT BOUND.*

  • CALL METHOD lr_comp_controller->window_manager->create_popup_2_confirm*

  • EXPORTING*

  • iv_title = 'Window Title Here'*

  • iv_text = 'Message Text Here'*

  • iv_btncombination = if_bsp_wd_window_manager=>co_btncomb_ok "OK Button*

  • RECEIVING*

  • rv_result = lr_confirm_popup.*

***

  • lr_confirm_popup->set_display_mode( if_bsp_wd_popup=>c_display_mode_surrounded ).*

  • lr_confirm_popup->set_on_close_event( iv_event_name = 'POPUP_CLOSED' iv_view = lr_wd_ctrl ).*

  • ENDIF.*

  • lr_confirm_popup->open( ).*

***

*ENDIF.

The error message is as follows:

Error when processing your request

Note

The following error text was processed in the system DCR : Access via 'NULL' object reference not possible.

The error occurred on the application server dcr_DCR_02 and in the work process 1 .

The termination type was: RABAX_STATE

The ABAP call stack was:

Method: GET_AREA of program ZL_ZHMS_CRM_TABVIEW_CN00======CP

Method: IF_BSP_MODEL_BINDING~GET_ATTRIBUTE of program CL_BSP_MODEL==================CP

Method: RESOLVE_MODEL_BINDING of program CL_THTMLB_INPUTFIELD==========CP

Method: IF_BSP_ELEMENT~DO_AT_BEGINNING of program CL_THTMLB_INPUTFIELD==========CP

Please advise me on fixing this error.

Thanks and Regards,

Arun V.

Edited by: Arunmozhi_06 on Mar 6, 2012 9:15 AM

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Posted on Mar 06, 2012 at 08:32 AM

    Hi Arun,

    Possibly the component controller that you are referring is not assigned and hence null.

    Also declare the popup variable as a class variable(in the attributes tab)

    Refer the code:

    data: lv_text  type string,
            lv_title type string.
    
    
      if not gr_no_tg_popup is bound.
    
        lv_text = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT_SERVICE_PSL/NO_TG' ). "#EC NOTEXT
        lv_title = 'Product Service Letter'(003). "#EC NOTEXT
        call method comp_controller->window_manager->create_popup_2_confirm
          exporting
            iv_title          = lv_title
            iv_text           = lv_text
            iv_btncombination = if_bsp_wd_window_manager=>co_btncomb_ok
          receiving
            rv_result         = gr_no_tg_popup.
    
      endif.
    
      if gr_no_tg_popup is bound.
        gr_no_tg_popup->open( ).
      endif.

    Regards,

    Leon

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Leon,

      I declared the pop-up variable in the implementing class and tried it, but in vain. Please clarify me on how to declare the component controller that we use to call the method " create_popup_2_confirm".

      call method comp_controller->window_manager->create_popup_2_confirm

      exporting

      iv_title = lv_title

      iv_text = lv_text

      iv_btncombination = if_bsp_wd_window_manager=>co_btncomb_ok

      receiving

      rv_result = gr_no_tg_popup.

      I'm confused on how to declare the instance of the "comp_controller" like whether to declare inside the method or as attribute of implementing class and then calling the method for pop-up that you have specified before. Please clarify me.

      Regards,

      Arun V.

      Edited by: Arunmozhi_06 on Mar 6, 2012 11:05 AM

      Edited by: Arunmozhi_06 on Mar 6, 2012 11:15 AM

  • author's profile photo Former Member
    Former Member
    Posted on Mar 06, 2012 at 10:51 AM

    Hi ,

    Change the below code:

    • lr_confirm_popup->set_on_close_event( iv_event_name = 'POPUP_CLOSED' iv_view = lr_wd_ctrl ).

    To.:

    • lr_confirm_popup->set_on_close_event( iv_event_name = 'POPUP_CLOSED' iv_view = me ).

    Hope it works.

    Best Regards

    Basav

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Basavaraj,

      I tried it with ME-> reference. But it throws an error due to formal parameter incompatibility with "iv_view".

      ERROR:- "ME" is not type-compatible with formal parameter "IV_VIEW".

      Thanks and Regards,

      Arun V.

  • author's profile photo Former Member
    Former Member
    Posted on Mar 06, 2012 at 11:30 AM

    Hi,

    Can you check what value you are getting in lr_wd_ctrl while calling SET_ON_CLOSE_EVENT method.

    It should be the implementation class of the view where you are trying to give a popup message.

    Best Regards

    Basav

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Basavaraj,

      I found it's due to null reference error with "lr_comp_controller" which is still not bound as Leon has specified below.

      I have declared "lr_comp_controller" attribute in the implementing class and instantiated in within the set method for the view. But i'm clueless on how it's still unbound and please clarify on how to make it instantiated or bound.

      Thanks and Regards,

      Arun V.

  • author's profile photo Former Member
    Former Member
    Posted on Mar 06, 2012 at 12:29 PM

    Hi,

    check below code:

    Instead of -

    • IF lr_confirm_popup IS NOT BOUND.

    • CALL METHOD lr_comp_controller->window_manager->create_popup_2_confirm

    put-

    • IF lr_confirm_popup IS NOT BOUND.

    CALL METHOD comp_controller->window_manager->create_popup_2_confirm

    No need to use lr_comp_controller.

    Best Regards

    Basav

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Leon,

      I'm new to SAP CRM as well and I'm trying to get my head around the new concepts.

      I received the same error message, because I used the same "concept" code.

      What I'm trying to achieve is a popup screen for "user + password" input. I tried this easy example but it seems it's not so easy. 🤪

      Now, u're talking about a "view controller" class.

      At the moment I'm using the new created class ZCL_IM_ORDER_SAVE to do some things after save, but in the same time I need this popup.

      In what view do I need to find this controller ?

      Here are the only data that I can think of that can help you share the relevant info 😊

      Do I access that view with "BSP_WD_CMPWB"?

      Thank you in advance,

      Marius

      prop1.jpg (69.3 kB)
      prop2.jpg (60.6 kB)

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.