cancel
Showing results for 
Search instead for 
Did you mean: 

Getting reference to used components of FPM OIF component

vivek_priyadarshi2
Participant
0 Kudos

Hello,

I am try to find a way to get reference to instances of used components created by OIF FPM. My scenario is as follows.

  • I have two custom components - Component A and component B.( both with just a single MAIN view )
  • BOth components are configured as subviews in FPM_OIF_COMPONENT component configuration. Component A forms the first  subview ( initial screen) and Component B forms the second subview.
  • Component B needs to display componentA->MAIN view in a view container ( component A defined as used component in component B- calling this usedcomponentA).
  • Changes made to fields of usedcomponent A ( from component B) should show up for component A when user switches back to component A.

Now since FPM framework creates an instance of componentA and component B creates another instance of componentA ( usedcomponentA)
My changes are not getting synced as required.

Does anyone know if there is a way to get the instance of the used component which FPM is using so that there is only only instance of the used component and thus no discrepency. I have done this with custom compoents but so far found no way of doing the same with FPM.

Note: i know my issue can be easily resolved using SDC or singleton class. However i was curious to know how to deal wth multiple instances of same used components when FPM is creating one of the instances.

Cheers,

Vivek

Accepted Solutions (1)

Accepted Solutions (1)

vivek_priyadarshi2
Participant
0 Kudos

I hope the above image provides better clarity for my question. I am trying to get reference to the used component marked X and highlighted ( ZWDR_TEST_SEARCH_HELP_ZWDR_TEST_SEARCH_HELP_CONFIG_00_ ). If i can get this instance i can set my component usage USER_SEARCH to reference it and this way there will be just one instance in momory.

Cheers,

Vivek

former_member193369
Active Participant
0 Kudos

Hello Vivek,

for such scenarios FPM offers method IF_FPM->ATTACH_COMPONENT_TO_USAGE. When

you call this method from component B and pass the component name and it's config id as well as the usage you want to get it attached to, FPM checks if component A is already instantiated and if yes attaches the existing instance to the passed usage and if not creates a new instance.

Best regards,

  Christian

vivek_priyadarshi2
Participant
0 Kudos

Hi Christian,

I have a question on a related issue. I created another FPM applicaiton and the used components in this case are using SDC to share data. The used component (SDC) created by the used components of FPM_OIF_COMPONENT are referenced and hence data is passing between them.

However when used component USER_SEARCH of Component ZWDR_TEST_SHLP_USED_COMP2 ( please check attached image ) is  created it in turn creates a used component SDC which is not referenced to the primary SDC component (ZWDR_IF_SDC).

I am able to get over this issue by using IF_FPM->ATTACH_COMPONENT_TO_USAGE( ) as you suggested in your answer. However i was under the impression that SDC is always a singleton class so all instances of the component in a session will always be linked?

Cheers,

Vivek

former_member193369
Active Participant
0 Kudos

Hello Vivek,

a shared data component is not a singleton (it's a component provided by the application - therefore a framework has no chance at all to enforce it being a singleton).

FPM simply takes care of instantiation of the SDC. Prerequisite that this works is that the application doesn't instantiate it on it's own. So simply declare a static usage to your SDC for each involved UIBB and FPM will take care of instantiation and that all usages get the same SDC instance assigned.

There is one big drawback when using SDC. It doesn't work with GUIBBs. The SDC concept was introduced with the very very first FPM release (only available SAP internally) and with the first public release it was already more or less obsolete. So using SDC is perfectly ok, but if you ever want to integrate a GUIBB you will have to redesign your application.

Best regards,

  Christian

vivek_priyadarshi2
Participant
0 Kudos

Thanks Christian.

I resolved the issue by explicitly calling the IF_FPM->ATTACH_COMPONENT_TO_USAGE method for the second /third level of used component which my custom component is instantiating.

Regards,

Vivek

Answers (2)

Answers (2)

vivek_priyadarshi2
Participant
0 Kudos

Works like a charm. Thanks Christian.

Former Member
0 Kudos

Hi Vivek,

Hope you're instantiating the  used component in your code. While instantiating,you'll get the reference of the used component.

Thanks

KH

vivek_priyadarshi2
Participant
0 Kudos

Hi Katrice,

Yes i am instantiating the used component and that is giving me instance of used component. But the issue is at runtime there are two instances of the component : 1 created by the FPM framework and the other created by component. How can i get hold of the instance created by FPM.

Cheers,

Vivek