PARAMETERS: zp_url TYPE string LOWER CASE DEFAULT 'https://apimanagement.eu10.hana.ondemand.com/v1/api/hc/xxx/call_name', zp_sslid TYPE strustssl-applic DEFAULT 'ANONYM', zp_profl TYPE oa2c_profiles-profile DEFAULT 'ZOAUTH_CLIENT_PROFILE_CPI', zp_confg TYPE oa2c_client-configuration DEFAULT 'ZOAUTH_CLIENT_PROFILE_CPI'.
CONSTANTS: BEGIN OF zgcs_create_return, argument_not_found TYPE sy-subrc VALUE 1, plugin_not_active TYPE sy-subrc VALUE 2, internal_error TYPE sy-subrc VALUE 3, others TYPE sy-subrc VALUE 4, END OF zgcs_create_return.
START-OF-SELECTION.
" oData: restrict to two entries returned, via url DATA(zgv_api_url) = |{ zp_url }?$top=2|.
CASE sy-subrc. WHEN zgcs_create_return-argument_not_found. MESSAGE 'Argument not found when trying to create http client instance' TYPE 'E'. WHEN zgcs_create_return-plugin_not_active. MESSAGE 'Plugin not active for creation of http client instance' TYPE 'E'. WHEN zgcs_create_return-internal_error. MESSAGE 'Internal error when trying to create http client instance' TYPE 'E'. WHEN zgcs_create_return-others. MESSAGE 'Generic error when trying to create http client instance' TYPE 'E'. ENDCASE.
" Set oAuth token to the http client TRY. zgo_oauth_client->set_token( io_http_client = zlo_http_client i_param_kind = if_oauth2_client=>c_param_kind_header_field ). CATCH cx_oa2c_at_not_available cx_oa2c_at_expired.
" When setting the token fails, first try and get a new token TRY. zgo_oauth_client->execute_cc_flow( ). CATCH cx_oa2c_badi_implementation. MESSAGE 'OAuth 2.0 Client BAdI Impl. Error' TYPE 'E'. CATCH cx_oa2c_not_supported. MESSAGE 'Not supported by Service Provider.' TYPE 'E'. CATCH cx_oa2c_not_allowed. MESSAGE 'OAuth 2.0 Client Runtime - Not Allowed' TYPE 'E'. CATCH cx_oa2c_prot_http_failure. MESSAGE 'OAuth 2.0 Client Runtime Protocol - HTTP Failure' TYPE 'E'. CATCH cx_oa2c_prot_other_error. MESSAGE 'OAuth 2.0 Client Runtime Protocol - Other Error' TYPE 'E'. CATCH cx_oa2c_prot_unexpected_code. MESSAGE 'OAuth 2.0 Client Runtime Protocol - Unexpected Code' TYPE 'E'. CATCH cx_oa2c_prot_http_forbidden. MESSAGE 'OAuth 2.0 Client Runtime Protocol - HTTP 403 - Forbidden' TYPE 'E'. CATCH cx_oa2c_prot_http_not_found. MESSAGE 'OAuth 2.0 Client Runtime Protocol - HTTP 404 - Not Found' TYPE 'E'. CATCH cx_oa2c_server_error. MESSAGE 'OAuth 2.0 Client Runtime Protocol - Server Error' TYPE 'E'. CATCH cx_oa2c_temporarily_unavail. MESSAGE 'OAuth 2.0 Client Runtime Protocol - Temporarily Unavailable' TYPE 'E'. CATCH cx_oa2c_unsupported_grant_type. MESSAGE 'OAuth 2.0 Client Runtime Protocol - Unsupported Grant Type' TYPE 'E'. CATCH cx_oa2c_unauthorized_client. MESSAGE 'OAuth 2.0 Client Runtime Protocol - Unauthorized Client' TYPE 'E'. CATCH cx_oa2c_invalid_scope. MESSAGE 'OAuth 2.0 Client Runtime Protocol - Invalid Scope' TYPE 'E'. CATCH cx_oa2c_invalid_grant. MESSAGE 'OAuth 2.0 Client Runtime Protocol - Invalid Grant' TYPE 'E'. CATCH cx_oa2c_invalid_client. MESSAGE 'OAuth 2.0 Client Runtime Protocol - Invalid Client' TYPE 'E'. CATCH cx_oa2c_invalid_request. MESSAGE 'OAuth 2.0 Client Runtime Protocol - Invalid Request' TYPE 'E'. CATCH cx_oa2c_invalid_parameters. MESSAGE 'OAuth 2.0 Client Runtime - Invalid Parameters' TYPE 'E'. CATCH cx_oa2c_secstore_adm. MESSAGE 'OAuth 2.0 Client Runtime - SecStore Administration' TYPE 'E'. CATCH cx_oa2c_secstore. MESSAGE 'OAuth 2.0 Client Runtime - Secstore' TYPE 'E'. CATCH cx_oa2c_protocol_exception. MESSAGE 'OAuth 2.0 Client Runtime - Protocol Exception' TYPE 'E'. ENDTRY.
" Set oAuth token to the http client TRY. zgo_oauth_client->set_token( io_http_client = zlo_http_client i_param_kind = if_oauth2_client=>c_param_kind_header_field ). CATCH cx_oa2c_at_not_available. MESSAGE 'oAuth 2.0: Acces token not available' TYPE 'E'. CATCH cx_oa2c_at_expired. MESSAGE 'Access Token has expired.' TYPE 'E'. CATCH cx_oa2c_at_profile_not_covered. MESSAGE 'Access token has expired.' TYPE 'E'. CATCH cx_oa2c_not_supported. MESSAGE 'Not supported by Service Provider.' TYPE 'E'. CATCH cx_oa2c_badi_implementation. MESSAGE 'OAuth 2.0 Client BAdI Impl. Error' TYPE 'E'. CATCH cx_oa2c_secstore. MESSAGE 'OAuth 2.0 Client Runtime - Secstore' TYPE 'E'. CATCH cx_oa2c_invalid_parameters. MESSAGE 'OAuth 2.0 Client Runtime - Invalid Parameters' TYPE 'E'. CATCH cx_oa2c_icf_error. MESSAGE 'Unknown error received from ICF.' TYPE 'E'. ENDTRY.
CATCH cx_oa2c_at_profile_not_covered. MESSAGE 'Access token has expired.' TYPE 'E'. CATCH cx_oa2c_not_supported. MESSAGE 'Not supported by Service Provider.' TYPE 'E'. CATCH cx_oa2c_badi_implementation. MESSAGE 'OAuth 2.0 Client BAdI Impl. Error' TYPE 'E'. CATCH cx_oa2c_secstore. MESSAGE 'OAuth 2.0 Client Runtime - Secstore' TYPE 'E'. CATCH cx_oa2c_invalid_parameters. MESSAGE 'OAuth 2.0 Client Runtime - Invalid Parameters' TYPE 'E'. CATCH cx_oa2c_icf_error. MESSAGE 'Unknown error received from ICF.' TYPE 'E'. ENDTRY.
" From here on handle the http client for the API interaction zlo_http_client->request->set_version( if_http_request=>co_protocol_version_1_0 ). DATA(zlo_rest_client) = NEW cl_rest_http_client( io_http_client = zlo_http_client ).
" Get data from API TRY. zlo_rest_client->if_rest_client~get( ). " Collect response received from the REST API DATA(zli_response) = zlo_rest_client->if_rest_client~get_response_entity( ). DATA(zgv_http_status_code) = zli_response->get_header_field( `~status_code` ). DATA(zgv_status_reason) = zli_response->get_header_field( `~status_reason` ). DATA(zgv_response_data) = zli_response->get_string_data( ).
" Record the response of the interface IF zgv_http_status_code BETWEEN 200 AND 299. " Success MESSAGE 'Call was succesful' TYPE 'S'. ELSE. MESSAGE 'Call failed' TYPE 'E'. ENDIF.
WRITE / 'Response'. WRITE / zgv_response_data.
" Issues with REST client must not lead to a short-dump CATCH cx_rest_client_exception INTO DATA(zlx_rest_client). IF zlx_rest_client->if_t100_message~t100key IS NOT INITIAL. DATA zlv_message TYPE string. MESSAGE ID zlx_rest_client->if_t100_message~t100key-msgid TYPE 'E' NUMBER zlx_rest_client->if_t100_message~t100key-msgno WITH zlx_rest_client->if_t100_message~t100key-attr1 zlx_rest_client->if_t100_message~t100key-attr2 zlx_rest_client->if_t100_message~t100key-attr3 zlx_rest_client->if_t100_message~t100key-attr4. ELSE. MESSAGE 'Rest client Exception' TYPE 'E'. ENDIF. ENDTRY.
On table level: Check the table ICFSERVLOC. All active services are marked with an “X” flag.
Checking SICF security settings
Don’t use the old program RSICFCHK (see OSS note 3300857 – Report RSICFCHK shows incomplete result). Use the new SECSTORE transaction. At the start of transaction SECSTORE choose in the check entries section “ICF Service”:
Now hit execute and check the results:
Mass processing
SICF mass processing is done via program RS_ICF_SERV_MASS_PROCESSING.
Logging of SICF changes
To enable logging of SICF changes: switch on table logging for table ICFSERVLOC.
In some cases you need to debug the session of another user. This can be needed for example when you need to solve an issue in ABAP for a FIORI app. The end user is doing his work until the break point is reached. Then you take over the session using the normal debugging tools. The basic principle is explained in OSS note 1919888 – Debugging the applications of another user, and in this SAP help file.
Follow the steps explained in this blog to set up a new custom check. We will use these steps to set up an extra SCI class to check if the AUTHORITY-CHECK statement is added in ABAP code or not.
New SCI check coding
Step 1: create the ZCL_CI_SCAN_AUTH class
In SE24 copy class CL_CI_TEST_FREE_SEARCH to ZCL_CI_SCAN_AUTH. In the attributes of the copied class set C_MY_NAME as variable to ‘ZCL_CI_SCAN_AUTH’. Also set the error code MCODE_0001 to ‘Z001’.
Step 2: redo the CONSTRUCTOR
Goto the constructor of the new class and overwrite the existing code with this code snippit:
The snoozing is a very useful function. For example, you detect a red alert on HANA revision, but it will take you a month to implement (due to regression testing, process, etc), you can now snooze the alert for the implementation period:
After the implementation is done, the alert should be gone. If the implementation is delayed, you will be reminded again.