CLASS zcl_flifm_process_factory DEFINITION
  PUBLIC
  CREATE PUBLIC .

  PUBLIC SECTION.

    CLASS-METHODS create
      IMPORTING
        !iv_menu          TYPE zif_flifm_definitions=>ty_flifm_menu_type
        !iv_company       TYPE zif_flifm_definitions=>ty_flifm_company_type
        !iv_action        TYPE zif_flifm_definitions=>ty_action
      RETURNING
        VALUE(ro_process) TYPE REF TO zcl_flifm_process
      RAISING
        zcx_flifm_exception .
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.



CLASS ZCL_FLIFM_PROCESS_FACTORY IMPLEMENTATION.


  METHOD create.

    CASE zcl_flifm_utils=>split_menu( iv_menu ).
      WHEN zif_flifm_definitions=>c_flifm_menu_type-tb.
        CREATE OBJECT ro_process TYPE zcl_flifm_process_tb
          EXPORTING
            iv_menu    = iv_menu
            iv_company = iv_company
            iv_action  = iv_action.
      WHEN zif_flifm_definitions=>c_flifm_menu_type-pl.
        CREATE OBJECT ro_process TYPE zcl_flifm_process_pl
          EXPORTING
            iv_menu    = iv_menu
            iv_company = iv_company
            iv_action  = iv_action.
      WHEN zif_flifm_definitions=>c_flifm_menu_type-bs.
        CREATE OBJECT ro_process TYPE zcl_flifm_process_bs
          EXPORTING
            iv_menu    = iv_menu
            iv_company = iv_company
            iv_action  = iv_action.

      WHEN OTHERS.
        zcx_flifm_exception=>raise_t100( iv_msgno = 003 iv_msgv1 = |{ iv_menu }| ).
    ENDCASE.

  ENDMETHOD.
ENDCLASS.
