cancel
Showing results for 
Search instead for 
Did you mean: 

Context-Based Adaption (CBA) Without URL Parameter

Former Member
0 Kudos

Hello,

I want to provide different Views for multiple User Groups in a Floorplan OIF Application.

The CBA functionality seemed to fulfill all my requirements.

So I changed my application and as long as I provide the role as an URL Parameter everything works perfect.

With the disadvantage that every user was able to change his view by updating the URL parameter.

I found some Code to change the ADAPTION Value, which I added to the init method of my FPM_APP_CONTROLLER.

The code change the MS_ADAPTATION_CONTEXT attribute in the adaption manager.


DATA:

     lo_fpm      TYPE REF TO if_fpm,

     lo_event    TYPE REF TO cl_fpm_event,

     lo_adap_man TYPE REF TO cl_fpm_adapt_manager.

   lo_fpm = cl_fpm_factory=>get_instance( ).

   lo_adap_man ?= lo_fpm->mo_adaptation_manager.

   CREATE OBJECT lo_event

     EXPORTING

       iv_event_id       = if_fpm_constants=>gc_event-adapt_context

       iv_adapts_context = abap_true.

   lo_event->mo_event_data->set_value(

     iv_key = 'ROLE'

     iv_value = 'TEST_ROLE'

   ).

   lo_event->mo_event_data->set_value(

     iv_key   = if_fpm_constants=>gc_event_param-source_config_id

   ).

  lo_adap_man->set_context_from_event( io_event = lo_event ).


But it seems like the component is already initialized with the wrong configuration and the change of the adaption context does not raise a reload of the active component adaption.

Is there a way to use CBA without URL Parameters or is there another possibility to load different configuration for roles?

Best regards

Philipp Steinberg

Accepted Solutions (1)

Accepted Solutions (1)

former_member193369
Active Participant
0 Kudos

Hello Philipp,

the OIF configuration can only be adapted at application startup - Adaptation context changes at runtime (dynamic CBA) will only have effect on the adaptations of UIBBs. To set the adaptation at startup you can either use URL parameters or application parameters. You can also create individual application configurations where you set the CBA parameter(s) for each role and assign those to your users.

Nevertheless if you want to prevent users from seeing the CBAs they are not assigned to, you should create an authorization object for this and check in your app controller whether the user is allowed to run the application with the loaded CBA context.

On further remark: CL_FPM_ADAPT_MANAGER is an internal class of FPM, which must not be used. To change the context you should simply raise the event you created. So instead of


lo_adap_man->set_context_from_event( io_event = lo_event ).

you should do


lo_fpm->raise_event( lo_event ).

and then you don't need CL_FPM_ADAPT_MANAGER. Else you are taking the risk that we break your code with some future upgrade.

Please have also a look at

where you should find a comprehensive description of all the CBA functionality.

Best regards,

Christian

Former Member
0 Kudos

Hello Christian,

first thanks you for the quick and helpful response.

I prefer the option with the individual application configurations.

I created the different configurations and when I test them everything works fine.

But I could not find the option to assign the configurations to the users.

Best regards

Philipp

former_member193369
Active Participant
0 Kudos

Hello Philipp,

there is no such functionality like assigning application configurations directly to users. The way to go is to add the application with the right application configuration to the right role (depending on your environment in PFCG or in portal content administrator) and then via the role assignment assign the application configuration indirectly to the user.

Best regards,

  Christian

Answers (0)