cancel
Showing results for 
Search instead for 
Did you mean: 

Name of used component in component interface

former_member185943
Participant
0 Kudos

Hi,

I have a component interface which can be implemented by many components. How can I find dynamically the name of the Z used component?

If I use name attribute of comp. usage attribute or info, I can only get the name which is either the statically defined name (for first usage) or freely assigned dynamical name. However, I need the Z name of the component. Like in this example:

IF...
*  first usage
  lo_comp_usage = wd_this->wd_cpuse_if_usage( ). "statical name 'IF_USAGE'
ELSE.
*  clones
  lo_comp_usage = lo_comp_usage->create_comp_usage_of_same_type( 'FREELY_ASSIGNED_NAME' ).
ENDIF.
lo_comp_usage->create_component( 'ZUSED_COMPONENT' ).
...
*Now I'd like to get used component name from lo_comp_usage.
*In this example, satisfactory result would be: 'ZUSED_COMPONENT'.
l_name = lo_comp_usage->name. "here I get 'IF_USAGE' or  'FREELY_ASSIGNED_NAME' 
lo_info = lo_comp_usage->get_component_usage_info( ).
l_name = lo_info->get_name( ). "also 'IF_USAGE'... 😞

I know a workaround: I can create an attribute in component interface with used component name, but I would first like to try to do it properly, without workaround.

Thanks in advance!

KR,

Igor

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

IF_WD_COMPONENT~GET_COMPONENT_USAGES

Have you used the above to get the compoenent usages for a component.

Regards,

Lekha.

former_member185943
Participant
0 Kudos

Hi, Lekha,

I can't find such a method. The IF_WD_COMPONENT has method GET_CMP_USAGE_GROUP, but I am not using usage groups in this case. I have created my own attribute GT_CMP_USAGES of type WD_COMPONENT_USAGE_GROUP, if that's what you are suggesting. It contains my usage components and lines of this internal table are LO_COMP_USAGE objects from my example. I don't know how to get their component names (they are all implementations of the same interface component) and that is my problem.

Thanks for a try anyway!

KR,

Igor

Former Member
0 Kudos

Hi,

I'm on latest version of netwaeaver. Please check it out the method is alaready there.. that method returns this parameter

WDAPI_COMPONENT_USAGES which has fields in it -

COMPONENT_USAGE_NAME

USED_COMPONENT

EMBEDDING_POSITION

COMPONENT_USAGE

Regards,

Lekha.

former_member185943
Participant
0 Kudos

Hi, Lekha,

I am on NWAS 7.01 and don't see the method.

Thanks!

KR,

Igor

Former Member
0 Kudos

Hi,

Check it in SE24 for IF_WD_COMPONENT and that method.

Donot try to open it in PATTERN button in view of WD.

Have you checked the filter option in se24 for that class.

Regards,

Lekha.

former_member185943
Participant
0 Kudos

Yes, I tried in SE24, but I really don't see it. Are you sure that I would be able to get used component name? The name of the method indicates that I would get the table of objects of type IF_WD_COMPONENT_USAGE. It has attribute NAME, but it contains the usage ID, or the name under which the consuming component knows the usage (defined either statically or freely by program code), like in my example. This is NOT the name of the used component that I need.

Thanks!

KR,

Igor

Answers (1)

Answers (1)

former_member185943
Participant
0 Kudos

I never found solution, but I have to close this.