cancel
Showing results for 
Search instead for 
Did you mean: 

Calling components in another component

Former Member
0 Kudos

Hi experts,

I am calling component B, component C and component D in component A by component usage.

I have created 3 view containers in comp A and I have set the visibility property to null.

I have 3 buttons in same view. If I click on button1 it will display the view container1 (Comp B) by setting the visibility property.

Similarly I have done for other 2 button.

Is there any way to call the view (Components B,C and D) in component A to increase the performance?

Another question is:

When will be the use components get loaded into memory?Will it affect the performance if all the components get loaded initially?

Thanks in Advance.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Solved.

Former Member
0 Kudos

Thanks All.the issue has been solved by dynamic binding.

Edited by: Delphi on Mar 1, 2010 5:34 AM

Edited by: Delphi on Mar 1, 2010 5:37 AM

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>When will be the use components get loaded into memory?Will it affect the performance if all the components get loaded initially?

Declaring the component usage doesn't immediately instaniate the inner component. The component will be instantiated upon first usage of its context, first visibility within the window, or when explicity created via API calls.

For instance, quite often with the ALV you will explicity create the instance of the inner component usage so that you can access its API methods. You always put this block of code within a check to see if it is already active, as the data binding of the context might have already been processed:

****Access Component Usage - Create it if it hasn't already been created by framework
data: l_ref_cmp_usage type ref to if_wd_component_usage.
  l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).
  if l_ref_cmp_usage->has_active_component( ) is initial.
    l_ref_cmp_usage->create_component( ).
  endif.

****Access Component Interface
  data l_salv_wd_table type ref to iwci_salv_wd_table.
  l_salv_wd_table = wd_this->wd_cpifc_alv( ).

There is garbage collection for component usages but it tends to work on the safe side. If you really want to release memory it is better to explicity destroy the component usage. For instance if you have a tabstrip, you might want to destroy inner component usages displayed in one tab when the user switches to a different tab.

data: l_cmp_usage type ref to if_wd_component_usage.
* delete f4 component
  l_cmp_usage =   wd_this->wd_cpuse_f4_config_id( ).
  if l_cmp_usage->has_active_component( ) = abap_true.
    l_cmp_usage->delete_component( ).
  endif.

Former Member
0 Kudos

Hi,

There is no other way to achieve this. U have to do the component usage.