cancel
Showing results for 
Search instead for 
Did you mean: 

Enhancement of Employee Self-Service Shop by an own Catalogue (ABAP)

Former Member
0 Kudos

Hello SRM-Development-Experts

I enhanced the /SAPSRM/WDC_DODC_SC_GAF_C-WD-Component of Employee Self-Service Shop with an own ActionLink to an own WD-Component.

Details

The own WD-Component uses the interfaces /SAPSRM/WDI_L_FPC_GENERAL, /SAPSRM/WDI_L_FPC_POPUP and /IF_FPM_UI_BUILDING_BLOCK.

So the call from the V_DODC_SC_GAF_FSCA view is like this:

method ONACTIONZ_ENH_MATCAT .
DATA: lv_ref_cmp_usage  TYPE REF TO if_wd_component_usage,
      lr_general_controller TYPE REF TO /sapsrm/iwci_wdi_l_fpc_general,
      lv_task_container  TYPE REF TO /sapsrm/if_cll_task_container,
      lr_node  TYPE REF TO if_wd_context_node,
      lr_mo_bom_sc  TYPE REF TO /sapsrm/cl_ch_wd_bom_sc,
      lr_pdo  TYPE REF TO /sapsrm/cl_pdo_bo_sc_adv,
      lt_usages TYPE /sapsrm/t_ch_wd_usages,
      lr_api  TYPE REF TO if_wd_controller,
      lr_comp  TYPE REF TO if_wd_component,
      lr_win_manager  TYPE REF TO if_wd_window_manager,
      lr_win  TYPE REF TO if_wd_window.
" component usage for our component.
     lv_ref_cmp_usage = wd_this->wd_cpuse_z_myself( ).
" Initialization step starts.
    IF lv_ref_cmp_usage->has_active_component( ) IS INITIAL.

" Component creation.
     lv_ref_cmp_usage->create_component( ).
     lr_mo_bom_sc ?= wd_this->mo_bom_sc.
     lr_pdo  ?= lr_mo_bom_sc->/sapsrm/if_cll_xo_mapper~get_pdo( ).
     APPEND lv_ref_cmp_usage TO lt_usages.

     wd_this->mo_component_manager->init_component_usages( it_usages = lt_usages ).

     " Second step: SRM-specific Initialisation of wd-component
     lr_general_controller ?= wd_this->wd_cpifc_z_myself( ).
     lr_general_controller->l_fpc_general__init( io_task_container = wd_this->mo_task_container
                                               io_bo_mapper       = wd_this->mo_bom_sc ).
  endif.
  
  lr_api = wd_comp_controller->wd_get_api( ).
  lr_comp = lr_api->get_component( ).
  lr_win_manager = lr_comp->get_window_manager( ).

  lr_win = lr_win_manager->create_window_for_cmp_usage(
      interface_view_name  = 'Z_W_MYSELF'
      component_usage_name = 'Z_MYSELF'
      title = 'Material-Katalaog'
      close_in_any_case = abap_false ).
  lr_win->open( ).
endmethod.

To add products I (mis)used the /SAPSRM/IF_CLL_DODM_SC_I_IGOSV-Interface and copy pasted the content of /SAPSRM/WDC_DODC_SC_I_IGS into my WD-Comp:

METHOD onactionadd_to_basket .
  DATA: lo_api_component  TYPE REF TO if_wd_view_controller,
        lo_w_component  TYPE REF TO if_wd_component,
        lo_window  TYPE REF TO if_wd_window,
        lo_window_ctrl  TYPE REF TO if_wd_window_controller,
        lr_current_controller TYPE REF TO if_wd_controller,
        lr_message_manager   TYPE REF TO if_wd_message_manager,
        lr_internal_goods TYPE REF TO if_wd_context_node,
        lv_close_window TYPE abap_bool, 
        lo_idr  TYPE REF TO if_fpm_idr,
        lo_fpm  TYPE REF TO if_fpm,
        lo_cnr_gaf  TYPE REF TO if_fpm_cnr_gaf,
        lo_pdo_node TYPE REF TO if_wd_context_node,
        lo_pdo TYPE REF TO /sapsrm/cl_pdo_bo_sc_adv,
        ls_item TYPE bbp_pds_sc_item_icu,
"..

 TRY.
      lr_internal_goods = wd_context->get_child_node( name = wd_this->wdctx_internal_goods ).
      lr_internal_goods->bind_structure( new_item = ls_item ).

     " mo_bom_sc is initialized in method L_FPC_GENERAL__INIT
      wd_comp_controller->mo_bom_sc->/sapsrm/if_cll_mapper~is_ui_changed_by_client( ). 
      wd_this->mo_dodm_sc_i_igosv->add_internal_goods( IMPORTING ev_close_window = lv_close_window ).
      wd_comp_controller->mo_bom_sc->/sapsrm/if_cll_mapper~is_ui_changed_by_client( ).
      IF lv_close_window EQ abap_true.
" Close window
        lo_api_component = wd_this->wd_get_api( ).
        lo_window_ctrl = lo_api_component->get_embedding_window_ctlr( ).

        IF wd_comp_controller->mv_popup_active EQ abap_true.
          FIELD-SYMBOLS: <ls_mapper> TYPE /sapsrm/s_cll_mapper.
          wd_comp_controller->mo_message_handler->deactivate_popup( EXPORTING iv_view_name_of_popup = 'V_ADD_TO_BASKET' ).
          LOOP AT wd_comp_controller->mt_mapper ASSIGNING <ls_mapper> .
            wd_comp_controller->mo_bom_sc->/sapsrm/if_cll_bo_mapper~deregister_mapper( io_mapper = <ls_mapper>-mapper ).
          ENDLOOP.
          CLEAR: wd_comp_controller->mt_mapper.
        ENDIF.
" special message stack handling
        wd_comp_controller->mv_popup_active = abap_false.
        lo_window = lo_window_ctrl->get_window( ).
        lo_window->close( ).
      ENDIF.
    CATCH cx_root INTO lr_root.
"...
  ENDTRY.
ENDMETHOD.

So, the after closing my own WD-Component the products have been added to the basket & the basket can be properly saved.

But pushing the Next-Step-Button or Previous-Step-Button provided by the GAF framework makes the shopping basket "empty" and the Previous/Next navigation doesn't react anymore.

What is the correct approach? Documentation?

Thanks in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

jason_boggans
Active Contributor
0 Kudos

Dear Poster,

As no response has been provided to the thread in some time I must assume the issue is resolved, if the question is still valid please create a new thread rephrasing the query and providing as much data as possible to promote response from the community.

Best Regards,

SDN SRM Moderation Team