cancel
Showing results for 
Search instead for 
Did you mean: 

Component Reuse

Former Member
0 Kudos

HI,

In my page threre will be seach button from whre user can chose multiple employee. Chosen fields will be displayed in a table. It is fine. Now in my page this seacrh will come again for chosing some different people. So i am planning to make the search a different componet and use the interface view . But i am affaid of that when the next seach will happen it will overwrite the previous table. As they will using same context.

Any one have any suggestion for this.

Thanks,

Prosun

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You will be declaring a different component usages both times of the same component. So internally WD treats it like 2 different instances of the component.

So lets say for first search you used component A inside Component B. In the component controller of Component B, u declare usage of A, name of which is <b>UsageA1</b>. When u instantiate this usage preferably in WDDOINIT method,

data l_cmpusage type ref to if_wd_component_usage

l_cmpusage = wd_this->wd_Cpuse_<b>UsageA1</b>( ).

if l_cmpusage.hasActiveComponent( ) is INITIAL.

blah blah

l_cmpusage for Usage 1 is a brand new component usage (component) of COmponent A

Now again when COmponent A is used inside Component B, <b>you declare a DIFFERENT usage of Component A AGAIN</b> inside B , name of which is <b>UsageA2</b>

while instantiating the component usage

data l_cmpusage type ref to if_wd_component_usage

l_cmpusage = wd_this->wd_Cpuse_<b>UsageA2</b>( ).

if l_cmpusage.hasActiveComponent( ) is INITIAL.

blah blah

So in the component Usages section of B you will have 2 usages of Component A

Usage A1 Component A

UsageA2 Component A

WD will treat this as 2 different instances of Component A and <b>HENCE YOU CAN HAVE 2 DIFFERENT CONTEXT INSTANCES ETC</b>

So don't worry...data won't interfere from 2 usages

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Prosun.

You can use two component usages to your search component and create 2 components. Then map the context of each csearch omponent to where you need it and nothing will be overwritten.

Cheers,

Sascha