Hi Danny,
Please see the code below:-
method QPLEXT_COMM_TEC_IF~DETERMINE_TECHNOLOGY.
*Sets communication technology to qRFC in case of EWM
*Sample Implementation takes field LGNUM into account
*Further interesting fields e.g. LOG_SYSTEM
type-pools ustyp.
data lt_user_parameters type ustyp_t_parameters.
data ls_user_parameter type ustyp_parameters.
data: lv_decsy type /spe/decsy,
lv_cust_typ type /spe/cust_typ,
l_client_role type t000-cccategory,
l_set_get type c,
lv_lgnum type lgnum.
constants: lc_ewm type /spe/decsy value 'E',
lc_qrfc type qplext_comm_technology value 'Q'.
* Get Set/Get Parameter
get parameter id '/SPE/CTRL_CUST_TYP' field lv_cust_typ.
if sy-subrc = 0.
* Get the client role for the current system
call function 'TR_SYS_PARAMS'
importing
system_client_role = l_client_role
exceptions
no_systemname = 1
no_systemtype = 2
others = 3.
if sy-subrc = 0 and l_client_role ne 'P'.
* exclude productive systems from Set/Get
authority-check object 'S_DEVELOP' "#EC *
id 'OBJTYPE' field 'DEBUG'
id 'ACTVT' field '03'.
if sy-subrc eq 0.
l_set_get = 'X'.
endif.
endif.
endif.
if l_set_get is initial.
*CHeck SPM is active
select single cust_typ from /spe/ctrl_sw into lv_cust_typ.
endif.
if lv_cust_typ na '13'.
exit.
endif.
*Check import parameter
if ip_qals is initial.
raise missing_import_parameter.
endif.
if ip_qals-lgnum is initial.
select single lgnum from t320 into lv_lgnum
where
werks = ip_qals-werk
and lgort = ip_qals-lagortvorg.
else.
lv_lgnum = ip_qals-lgnum.
endif.
*CHECK warehouse number
select single decsy from t340d into lv_decsy
where lgnum = lv_lgnum.
if sy-subrc <> 0.
raise invalid_import_parameter.
endif.
*Check warehouse is EWM, set technology to qRFC in this case
if lv_decsy eq lc_ewm.
ep_comm_technology = lc_qrfc.
endif.
endmethod.
Regards,
Ankush