FUNCTION ZRFID_DC -------------------- -------------------- ----------

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
FUNCTION ZRFID_DC .
*"----------------------------------------------------------------------
*"*"Локальный интерфейс:
*" IMPORTING
*" VALUE(IV_DEVGRP_ID) TYPE /AIN/DM_DEVGRP_ID
*" VALUE(IV_ACTION) TYPE STRING
*" VALUE(P_TASK) TYPE GUID_32
*" VALUE(IV_PWR) TYPE I OPTIONAL
*" TABLES
*" ET_RES TYPE BAPIRETTAB
*"----------------------------------------------------------------------
data lr_pxy TYPE REF TO IF_PROXY_CLIENT.
data lo_rfid_helper TYPE REF TO ZCL_AII_UTILS.
data ls_pxy TYPE ZSC_RFID_DEV_MGMNT.
data ls_params TYPE ZRFIDEDGEWARE_STOP_APPLICATIO2.
data lt_change_params TYPE ZRFIDSET_BRIATTRIBUTE_ANT_TAB2.
data ls_ant TYPE ZRFIDREQUEST_ROOT2.
data ls_change_params LIKE LINE OF LT_CHANGE_PARAMS.
data lt_res TYPE BAPIRETTAB.
data ls_res LIKE LINE OF lt_res.
data ls_dev_pwr_set TYPE ZSC_DEV_PWR_SETT.
data lv_ant_pwr TYPE i.
LS_PARAMS-APPNAME = 'SAP Device Controller V4.02.00'.
LS_RES-TYPE = /ain/cl_c=>SUCCESS.
CREATE OBJECT LO_RFID_HELPER.
TRY .
ls_pxy = LO_RFID_HELPER->GET_PXY_BY_DEVGRP_ID( IV_ACTION = IV_ACTION IV_DEVGRP_ID = IV_DEVGRP_ID ).
IF IV_ACTION = ZCL_AII_UTILS=>GC_DC_ACT_START or IV_ACTION = ZCL_AII_UTILS=>GC_DC_ACT_STOP.
IF LS_PXY-proxy is NOT INITIAL.
CALL METHOD LS_PXY-proxy->(LS_PXY-METHOD)
EXPORTING
OUTPUT = LS_PARAMS.
ELSE.
LS_RES-TYPE = /ain/cl_c=>WARNING.
ENDIF.
ELSEIF IV_ACTION = ZCL_AII_UTILS=>gc_dc_act_restart.
ls_pxy = LO_RFID_HELPER->GET_PXY_BY_DEVGRP_ID( IV_ACTION = ZCL_AII_UTILS=>GC_DC_ACT_STOP IV_DEVGRP_ID = IV_DEVGRP_ID ).
IF LS_PXY-proxy is NOT INITIAL.
CALL METHOD ls_PXY-proxy->(LS_PXY-METHOD)
EXPORTING
OUTPUT = LS_PARAMS.
endif.
ls_pxy = LO_RFID_HELPER->GET_PXY_BY_DEVGRP_ID( IV_ACTION = ZCL_AII_UTILS=>GC_DC_ACT_START IV_DEVGRP_ID = IV_DEVGRP_ID ).
IF LS_PXY-proxy is NOT INITIAL.
CALL METHOD ls_PXY-proxy->(LS_PXY-METHOD)
EXPORTING
OUTPUT = LS_PARAMS.
endif.
elseif IV_ACTION = ZCL_AII_UTILS=>GC_DC_ACT_CHANGE.
LV_ANT_PWR = IV_PWR.
DO 4 TIMES.
LS_CHANGE_PARAMS-ANTENNA = sy-INDEX.
LS_CHANGE_PARAMS-FIELDSTRENGTH_DB = LV_ANT_PWR.
append LS_CHANGE_PARAMS to LT_CHANGE_PARAMS.
ENDDO.
LS_ANT-REQUEST_ROOT-SET_BRIATTRIBUTE_ANTENNA_FIELD = LT_CHANGE_PARAMS.
IF LS_PXY-proxy is NOT INITIAL.
CALL METHOD LS_PXY-proxy->(LS_PXY-METHOD)
EXPORTING
OUTPUT = LS_ANT.
ELSE.
LS_RES-TYPE = /ain/cl_c=>WARNING.
ENDIF.
ENDIF.
* EV_APP = IV_ACTION.
catch CX_AI_SYSTEM_FAULT. " Application Integration: Technical Error
LS_RES-TYPE = /ain/cl_c=>ERROR.
catch CX_AI_APPLICATION_FAULT. " Application Integration: Application Error
LS_RES-TYPE = /ain/cl_c=>ERROR.
ENDTRY.
data lv_msg TYPE string.
ls_res-LOG_NO = 'ZRFID'.
LS_RES-LOG_MSG_NO = '000'.
ls_res-MESSAGE_V1 = IV_DEVGRP_ID.
ls_res-MESSAGE_V2 = IV_ACTION.
ls_res-MESSAGE_V3 = P_TASK.
IF LS_RES-TYPE = /ain/cl_c=>ERROR.
CONCATENATE IV_DEVGRP_ID IV_ACTION ' failed!' INTO lv_msg SEPARATED BY space.
ELSEIF ls_res-TYPE = /ain/cl_c=>WARNING.
CONCATENATE IV_DEVGRP_ID IV_ACTION ' no proxy exists!' INTO lv_msg SEPARATED BY space.
else.
CONCATENATE IV_DEVGRP_ID IV_ACTION ' status OK!' INTO lv_msg SEPARATED BY space.
ENDIF.
ls_res-MESSAGE = LV_MSG.
APPEND ls_res to ET_RES.
* data: lv_devgrp_intid TYPE /AIN/PUB_DEVGRP_INTID,
* lt_return TYPE bapirettab.
*
* data ls_pwr_sett TYPE ZSC_DEV_PWR_SETT.
*
*
* CALL FUNCTION '/AIN/PUB_DEVGRP_SIMPLEBY_EXTID'
* EXPORTING
* IV_DEVGRP_EXTID = IV_DEVGRP_ID
* IMPORTING
* EV_DEVGRP_INTID = LV_DEVGRP_INTID
* TABLES
* ET_RETURN = LT_RETURN
* EXCEPTIONS
* TECHNICAL_LEVEL_ERROR = 1
* BUSINESS_LEVEL_ERROR_INPUT = 2
* OTHERS = 3.
*
* IF sy-subrc = 0.
* LS_PWR_SETT-DEVGRP_GUID = LV_DEVGRP_INTID.
* LS_PWR_SETT-DEVGRP_ID = IV_DEVGRP_ID.
* LS_PWR_SETT-ANT_STRENGTH = iv_pwr.
* MODIFY ZSC_DEV_PWR_SETT FROM LS_PWR_SETT.
* ENDIF.
* WAIT Up to 5 SECONDS.
ENDFUNCTION.