cancel
Showing results for 
Search instead for 
Did you mean: 

Error with Component Usage

IanStubbings
Active Participant
0 Kudos

Hi

I am trying to use a method from a used component but I am receiving a dump whenever I can the call following code, before I even get to the method call.

DATA: l_ref_interfacecontroller TYPE REF TO ziwci_is_test_road_map .

l_ref_interfacecontroller = wd_this->wd_cpifc_test_road_map( ).

The dump says the component is not active.

Termination occurred in the ABAP program "CL_WDR_COMPONENT_USAGE========CP" -

in "ENSURE_ACTIVE_COMPONENT".

The main program was "SAPMHTTP ".

The code is as follows:

if_wd_component_usage~has_active_component( ) = abap_false.

  • Active component must exist when ...

raise exception type cx_wdr_rt_exception

exporting

textid = cx_wdr_rt_exception=>no_active_component_found

msgv1 = me->name.

endif.

Both my components are active, so where is the issue?

Any help greatly appreciated.

Ian

Accepted Solutions (1)

Accepted Solutions (1)

thomas_szcs
Active Contributor
0 Kudos

Hi Ian,

Have you tried reactivating both components? Have you created a component instance beforehand?

Best regards,

Thomas

IanStubbings
Active Participant
0 Kudos

Hi Thomas

I have reactiviated both components time and time again but no change.

I have used the ALV components before and they went ok.

Regards

Ian

Former Member
0 Kudos

Hi Ian.

Did you create an instance?

IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.

l_ref_cmp_usage->create_component( ).

ENDIF.

Cheers,

Sascha

thomas_szcs
Active Contributor
0 Kudos

Hi Ian,

As suggested, have you created a component instance beforehand? If the ALV or any other component gets displayed, the runtime will create an instance automatically, but probably it hasn't been displayed yet in your example. Hence, you will need to create an instance by calling create_component.

Best regards,

Thomas

IanStubbings
Active Participant
0 Kudos

Hi Sacha/Thomas

Thanks to you both for your replies.

I haven't explicity created an instance, no. The tutotial on component usage does not mention this. For my understanding what are the differences?

Regards

Ian

Former Member
0 Kudos

Hi Ian.

As Thomas mentioned. When you try to call an interface method of a used

component you have to create a component instance prior.

If you just wanna display a view without calling methods prior the system takes

care of it.

Cheers,

Sascha

Message was edited by:

Sascha Dingeldey

IanStubbings
Active Participant
0 Kudos

Success!

Many thanks to you both. Now I understand where I was going wrong.

Cheers

Ian

Answers (0)