SapCheckArfcsState
Configuration file |
Path to a properties file in field "Configuration file". |
Class name |
com.ebd.hub.datawizard.util.SapCheckArfcsState |
Description
This class can be called periodically in a cronjob to detect any unsuccessful IDoc send attempts from a connected SAP system. This may occur when the request server registration fails, is not done or is lost.
For this purpose, the table ARFCSSTATE is read via an RFC call if outgoing connections are still working (which is a prerequisite). Note: You can use checkpoints, to monitor if the class is working.
Parameters
Parameter |
Description |
sap.alias |
(mandatory) Name of the SAP alias configured in ./etc/sap.xml that should be used. |
sap.timeout |
(optional) The timeout in milliseconds. Default: 60000. |
sap.destination |
(optional) Name of the destination (type T) defined in SM59. SQL placeholders are allowed, e.g. %. Default: %LOB% |
sap.function |
(optional) The function that is called to send the IDocs. Default: IDOC_INBOUND_ASYNCHRONOUS |
sap.host |
(optional) The SID of the sending SAP system. By default all SIDs are accepted. Important note: Only entries younger than 3*24=72 hours are shown. |
sap.fields |
(optional) Controls which database fields of the ARFCSSTATE table are included in the XML response. Note: Of course, the field names specified in the property must exist in the ARFCSSTATE table, otherwise an error will be generated. If the property is missing, the ITEM structure described below is generated. If the property exists and the value starts with +, the corresponding fields are added at the end. Example: sap.fields=+ARFCMSG+ARFCSTATE If the property exists and does not start with +, the field list is replaced with the one defined in the property. |
Example file
sap.alias=myalias
sap.destination=LOBSTER TEST
XML response
The following is an example of a standard response file (encoding UTF-8). Note: See also parameter sap.fields below.
The call creates an XML file that contains at least the root element ITEMS with the attribute count. The maximum number of ITEM elements is set to 500 and sorting is not possible.
If there are no pending IDocs in SAP, count has the value 0. With the help of ARFCUZEIT and ARFCDATUM, you can decide in the profile whether an alarm email is sent, for example, if there are entries (i.e. count>0). Note: The evaluation in the querying profile should only generate warnings for entries that are not too young.
<
ITEMS
count
=
"1"
>
<
ITEM
nr
=
"1"
>
<
ARFCIPID
>C0A8DF63</
ARFCIPID
>
<
ARFCPID
>0230</
ARFCPID
>
<
ARFCTIME
>60900160</
ARFCTIME
>
<
ARFCTIDCNT
>0090</
ARFCTIDCNT
>
<
ARFCDEST
>LOBSTER TEST</
ARFCDEST
>
<
ARFCFNAM
>IDOC_INBOUND_ASYNCHRONOUS</
ARFCFNAM
>
<
ARFCUZEIT
>183043</
ARFCUZEIT
>
<
ARFCDATUM
>20210503</
ARFCDATUM
>
<
ARFCUSER
>LOBSTER</
ARFCUSER
>
<
ARFCTCODE
>WE19</
ARFCTCODE
>
<
ARFCRHOST
>QWT</
ARFCRHOST
>
</
ITEM
>
<
OPTIONS
/>
</
ITEMS
>
Schema file: sap.xsd (see also section XML to XSD (to structure))
Example profile: Profile-TEST_SAP_ARFCSSTATE.pak
Note: The XSD file/the source structure for the XML response have to be adjusted if parameter sap.fields is used.
Monitoring REST call for unsuccessful IDoc sending attempts from SAP
The response XML described above (also in UTF-8 encoding) can be made available via a REST call. For authentication, see section System monitoring (general) (REST API).
http(s)://<IP/URL Integration Server>:<Port>/dw/monitor/v1/saparfcs |
Configuration file
The configuration is expected as properties file under ./conf/saparfcs.cnf (parameters as for class SapCheckArfcsState).
To be able to query different aliases in a scenario where several SAP systems are connected, it is possible to use parameter config in the HTTP request. This allows you to change the properties file used. However, this feature only affects the properties that start with sap. and not the security configuration client (see below). To use the config parameter, several configuration files must be prepared under ./conf, whose names begin with SM58_ and end with .conf. Between them the part passed with parameter config is set. If no file is found under this name, the absence of the mandatory property sap.alias will be reported in the response. Example: Request http(s)://<IP/URL Integration Server>:<Port>/dw/monitor/v1/saparfcs?config=abc sets the configuration file ./conf/SM58_abc.conf. Note: The value of config may also contain the directory separator /. This makes it possible to group the configuration files (e.g. in a subdirectory SM58_...).
Security configuration
Two parameters are available in the configuration file to allow access only from specific IP addresses or only via HTTPS.
client.ip |
(optional) Access allowed from these IPs. Default: localhost . You can use regular expressions with prefix "regex:" (see example below). |
client.secure |
(optional) false if HTTP is allowed. true, if only HTTPS is allowed. Default: true. |
Example:
client.ip = regex:127\\..*;regex:192\\.168\\.21[367]\\..*;0:0:0:0:0:0:0:1
client.secure=false
Parameters in URL
The parameters can also be specified in the request, e.g. http(s)://<IP/URL Integration Server>:<Port>/dw/monitor/v1/saparfcs?sap.alias=myalias&sap.destination=LOBSTER_TEST. Request parameters that are already defined in the configuration file are ignored. The configuration file therefore has priority.
However, the timeout can only be defined with property sap.timeout in a configuration file and not by a request parameter.
Any special characters, such as the percent sign or spaces within the value for "sap.destination" must be URL-encoded, e.g. percent as "%25" or spaces as "%20".