SAP MDG: How to make Roles default for Customer & Supplier Change Request Type

sowmya surekha manukonda's photo
·

1 min read


Scenario:

Process:

Create a Class

Method – DERIVE_DATA

Code:

METHOD if_mdg_bs_bp_access_handler~derive_data.

DATA : lv_crtype        TYPE usmd_crequest_type,
           lt_bp_role       TYPE TABLE OF /mdgbp/_s_bp_pp_bp_role,
           ls_bp_role       TYPE /mdgbp/_s_bp_pp_bp_role,
           lt_tax_indicator TYPE TABLE OF /mdgbpx/_s_bp_pp_bp_custax,
           ls_tax_indicator TYPE /mdgbpx/_s_bp_pp_bp_custax.

    CONSTANTS lc_crtype TYPE string VALUE 'CRTYPE'.
    DATA(obj_param) = cl_FPM_factory=>get_instance( )->mo_app_parameter.
    CALL METHOD obj_param->get_value EXPORTING iv_key = lc_crtype IMPORTING ev_value = lv_crtype.
    READ TABLE gt_bproot_task ASSIGNING FIELD-SYMBOL(<ls_bproot_task>) INDEX 1.

    IF <ls_bproot_task> IS ASSIGNED.
      ls_bp_role-bp_header = <ls_bproot_task>-bp_id.
      CASE lv_crtype.
        WHEN 'ZSUPPTL' OR 'ZSUPPTO' OR 'ZSUPPNTL' OR 'ZSUPPNTO'.
          ls_bp_role-bp_rol_id ='FLVN01'.
          ls_bp_role-rol_vfrom = sy-datum. ls_bp_role-rol_vto = '99991231'.
          APPEND ls_bp_role TO lt_bp_role.
          ls_bp_role-bp_rol_id ='FLVN00'.
          ls_bp_role-rol_vfrom = sy-datum.
          ls_bp_role-rol_vto = '99991231'.
          APPEND ls_bp_role TO lt_bp_role.

        WHEN 'ZCUST1S1' OR 'ZCUST1H1'.
          ls_bp_role-bp_rol_id = 'FLCU00'.
          ls_bp_role-rol_vfrom = sy-datum. ls_bp_role-rol_vto = '99991231'.
          APPEND ls_bp_role TO lt_bp_role.
          ls_bp_role-bp_rol_id = 'FLCU01'.
          ls_bp_role-rol_vfrom = sy-datum.
          ls_bp_role-rol_vto = '99991231'.
          APPEND ls_bp_role TO lt_bp_role.


      ENDCASE.
    ENDIF.
    io_write_data->write_data( i_entity = 'BP_ROLE' it_data = lt_bp_role ).
    me->if_mdg_bs_bp_access_handler~buffer_derived_data( io_model = io_model iv_entity = 'BP_ROLE'
it_data_ins = lt_bp_role ).

ENDMETHOD.

Thank You :)