cancel
Showing results for 
Search instead for 
Did you mean: 

Get own ComponentUsage-Name out of the Component itself

Former Member
0 Kudos

 

Hi experts,

i've got a big problem concerning the use of a ComponentUsage. My senario is the follwing.

I work with two components, lets call them CompA and CompB. The components are linked through a component usage which is defined in CompA and uses CompB. Now my question is:

Is it possible to get the ComponentUsage-name, which is defined in CompA, out of CompB?

regards

Accepted Solutions (0)

Answers (1)

Answers (1)

amy_king
Active Contributor
0 Kudos

Hi Florian,

Can you tell us more about why CompB needs to know the component usage name that was declared in CompA? You can't get this exact information, but depending on why CompB needs to know about CompA, maybe there is still a way to achieve your goal.


Cheers,

Amy

Former Member
0 Kudos

Hi Amy,

thx for your quick respond. I will explain it to you, but i guess it will take a few more sentences to get the sense behind it.

CompNav (CompA), is a dynamic navigator (to break it down – it’s a simple browser) which choose between multiple components (DialogB/DialogC) and put one of them on display.

Let’s assume that CompNav is displaying DialogB. If the user of our application clicks on a button in DialogB, CompNav will do a dynamic navigation to DialogC. Technically each of the Dialogs is hold as a component usage which gets dynamically created by copying an existing and change the name.

Our problem is that we have a SALV TABLE CONTROLL in DialogB and a different on in DialogC. The table controls have layouts which we configured in the administration mode of the application. If DialogB is the first one on display (technically component usage name as usual), the layout of the SALV TABLE is loaded and everything is fine (Same for CompC). But if DialogB is the second one on display (technically a different component usage name) none layout of the SALV TABLE is loaded.

We thought that this is a configuration problem and choose to analyze some SAP standard tables. We found a table called WDY_CONF_USER. This table inherits configuration keys, component names, a description of our layouts and a full qualified path through our application to the DialogB. I think that this path is read internally to get the right configuration for the SALV component. Problem is, in our scenario we need a relative path because we place the Dialogs in different component usages.

Now I try to create a relative path by myself in order to read from WDY_CONF_USER the configurations which fit my Dialog. Therefore I need a way to get the component usage name out of the component itself.

I know it’s a special problem, but I hope you got the sense of it and hope as well that you can give me some advice.

Cheers

amy_king
Active Contributor
0 Kudos

Hi Florian,

Thanks for the detailed explanation. I can think of two options that might work for your requirement.

This first option tackles the issue in a different way than you've described  but may work for you. Instead of needing DialogB to know what CompNav has named it, raise an event in DialogB (and DialogC) on click of the button, and have CompNav subscribe to the event so that it knows when the event has occurred. With this approach, DialogX doesn't need to know the component usage name that CompNav is using. CompNav will know when the button has been clicked in DialogX and will also know which component the event is coming from (DialogB or Dialog C). See this discussion which describes this approach.

The second option would be to create an interface method in DialogB (and DialogC) that sets the value of some context attribute, e.g., componentUsageName, and have CompNav call the interface method and pass in the value of the component usage name. With this approach, CompNav tells DialogX what component usage name is being used and DialogX can use this information as needed.

Cheers,
Amy

Former Member
0 Kudos

Hi Amy,

thx for your two possible solutions. We've tried the second one and it works fine. 🙂

Thank you.