Skip to Content
1
Former Member
May 23, 2012 at 08:24 AM

How to dynamically embed a FPM component in a WD4ABAP component?

60 Views

Hi All,

I'm trying to embed a FPM component in a WD for ABAP component. According to the FPM Cookbook it seems possible. But until now all my attemps failed.

I'm trying the following code :

data: l_view_controller_api type ref to if_wd_view_controller,

l_component_usage type ref to if_wd_component_usage,

component_name type string,
ls_conf_key type Wdy_config_key,

l_cmp_api type ref to if_wd_component,

l_cmp_usage_group type ref to if_wd_component_usage_group.

component_name = 'FPM_OIF_COMPONENT'.

ls_conf_key-config_id = 'ZJPM_FLOOR_PLAN_COPYID'.

l_cmp_api = wd_comp_controller->wd_get_api( ).


if l_cmp_api->has_cmp_usage_group( 'TESTGROUP' ) is initial.

l_cmp_usage_group = l_cmp_api->create_cmp_usage_group(

name = 'TESTGROUP'

used_component = component_name ).

endif.

l_component_usage = l_cmp_usage_group->add_component_usage(

name = 'MAIN_USAGE_1'

embedding_position = 'MAIN/CNT_FPM'

used_component = component_name ).

if l_component_usage->has_active_component( ) is initial.

l_component_usage->create_component( exporting component_name = component_name
configuration_id = ls_conf_key ).

endif.

l_view_controller_api = wd_this->wd_get_api( ).


l_view_controller_api->prepare_dynamic_navigation(

source_window_name = 'W_MAIN'

source_vusage_name = 'EMPTYVIEW_USAGE_1'

source_plug_name = 'OUT'

target_component_name = component_name

target_component_usage = 'MAIN_USAGE_1'

target_view_name = 'FPM_WINDOW'

target_plug_name = 'DEFAULT'

target_embedding_position = 'MAIN/CNT_FPM'
).


wd_this->fire_out_plg( ).

despite the same kind of code works with a non FPM WD Component, That one does not work with FPM Component. I got a dump :

Access via 'NULL' object reference not possible.

  • The ABAP call stack was:
    Method: PREPARE_NAVIGATION of program /1BCWDY/0AMWTCDY1FMANSYO8492==CP
    Method: IF_CNR_VIEW~PREPARE_NAVIGATION of program /1BCWDY/0AMWTCDY1FMANSYO8492==CP
    Method: MODIFY_VIEW_ASSEMBLY of program /1BCWDY/0AMWTCDY1FMANSYO8492==CP
    Method: IF_WDR_VIEW_DELEGATE~WD_INVOKE_EVENT_HANDLER of program /1BCWDY/0AMWTCDY1FMANSYO8492==CP
    Method: INVOKE_EVENTHANDLER of program CL_WDR_DELEGATING_VIEW========CP
    Method: FIRE_EVENT of program CL_WDR_COMPONENT==============CP
    Method: _IF_WDR_INTERNAL_API~RAISE_EVENT of program SAPLWDR_RG_PROXY_FACTORY
    Method: IF_COMPONENTCONTROLLER~FIRE_PREPARE_NAVIGATION_EVT of program /1BCWDY/0AMWTCDY1FMANSYO8492==CP
    Method: WDDOBEFORENAVIGATION of program /1BCWDY/0AMWTCDY1FMANSYO8492==CP
    Method: IF_WDR_COMPONENT_DELEGATE~WD_DO_BEFORE_NAVIGATION of program /1BCWDY/0AMWTCDY1FMANSYO8492==CP

Do you have an idea of what i'm doing wrong?

Thanks a lot.