cancel
Showing results for 
Search instead for 
Did you mean: 

Assistance class

Former Member
0 Kudos

Hi,

i m calling a method of assistance class, and i have added this assistance class in my web dynpro. But when i call this method of assistance class, it gives short dump ' Access via 'NULL' object reference not possible.' Do i need to perform any other steps for calling assistance class method.

Thanks,

Accepted Solutions (1)

Accepted Solutions (1)

alejandro_bindi
Active Contributor
0 Kudos

How are you calling this method and where from?

Three steps must be followed:

- At component level, you must enter in the Assistance class field either a new class name (which will be created) or an already existant class which must inherit from class CL_WD_COMPONENT_ASSISTANCE.

- After previous step, a new reference attribute is created both on component and view controllers: WD_ASSIST. This is instanciated automatically by the framework so it shouldn't be null.

- The method you're calling should of course exist on the assistance class.

If you're still getting NULL reference errors, chances are the assistance class method or another part of the component itself tries to access a null reference.

Check trx ST22 for the specific code section which is causing the error.

Regards

Former Member
0 Kudos

I m following the same steps, my method call is

wd_assist->get_details(
      EXPORTING
        id = t_id ).

I debugged this, it's going inside the assistance class method, but there its throwing the short dump. The same method is called by another component but there its working fine.

Pls suggest, what other possible cuases of error

Thanks

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Sounds like something wrong inside the Assistance calls. If you can debug inside the assistance class, instaniation is OK. Maybe some dependency inside the assistance class. Before anyone is going to be able to help you, you are going to have to tell us what code is inside the assistance class and where it is dumping in side that code.

Former Member
0 Kudos
METHOD display_messages.
  DATA:
      wa_return TYPE bapiret2,
      wa_msg    type symsg.

  CASE is_attribute_message.
    WHEN 'X'.
      LOOP AT messages INTO w_return.
        wa_msg-MSGTY = wa_return-type.
        wa_msg-MSGID = wa_return-id.
        wa_msg-MSGNO = wa_return-number.
        wa_msg-MSGV1 = wa_return-message_v1.
        wa_msg-MSGV2 = wa_return-message_v2.
        wa_msg-MSGV3 = wa_return-message_v3.
        wa_msg-MSGV4 = wa_return-message_v4.

        CALL METHOD wd_message_manager->REPORT_ATTRIBUTE_T100_MESSAGE
          EXPORTING
            MSG = w_msg
            ELEMENT = element
            ATTRIBUTE_NAME = attribute_name.
      ENDLOOP.
    WHEN ''.
      IF where_clause IS INITIAL.
        LOOP AT messages INTO w_return.
          CALL METHOD wd_message_manager->report_t100_message  ---->>>> (Dump on this point)
            EXPORTING
              msgid = wa_return-id
              msgno = wa_return-number
              msgty = wa_return-type
              p1    = wa_return-message_v1
              p2    = wa_return-message_v2
              p3    = wa_return-message_v3
              p4    = wa_return-message_v4.
        ENDLOOP.

I'm using this code to call this method.

wd_assist->display_messages(
      EXPORTING
        messages = t_return ).

And the error is ' Access via 'NULL' object reference not possible.'

Thanks,

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

How is your assistance class supposed to get a reference to wd_message_manager? It won't automatically have access to that object from WD. In other places that this assistance class is used, they must be filling this attribute of the assistance class in custom code or passing in via a different method. I can only assume that you are missing this in your component and the usage of this assistance class.

Former Member
0 Kudos

Hello,

The dump occurs probably because you don't have an instance to the wd_message_manager.

To create it take a look on these: [IF_WD_MESSAGE_MANAGER|http://help.sap.com/saphelp_nw04s/helpdata/en/6c/7aae42cd7fb611e10000000a155106/frameset.htm].

And see if it's used a method of your assistance class to get reference to it or it's passed like an attribute to the assistance class.

Regards.

Former Member
0 Kudos

Thanks buddies...Its solved.

I have not Set Web dynpro component in assistance class i.e

wd_assist->set_wd_component( lcl_wd_component ).

Former Member
0 Kudos

Where exactly in code u included the above code ?

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

Take a look on this [Assistance class functionality in WDA |https://wiki.sdn.sap.com/wiki/x/koCEAQ].

Regards.