Read and Exchange Specification Data from SAP EHS to .Net system Using ABAP Web-Services
2. Overview of EHS Specifications in SAP EHS
3. Reading a Specification
4. SAP Web-service connections
This document explains details of reading an SAP EHS Product Safety Specification using standard EHS BAPI_BUS1077_GETDETAIL and using Web services to exchange this data with Non-SAP 3rd Party system.
Source of Data: SAP EHS Product Safety Module
Consumer of Data: .Net Application
Middle-ware: SAP Web service (RFC Enabled Function Module)
SAP EHS Product Safety Specification Overview
In SAP EHS Product Safety, consists of Specifications, which are analogous of a material in other SAP Modules Like MM. Specifications contain the information on Hazardous Data, Safety information, Transport classification, Precautionary statements, etc. which are used by business in labeling, printing Material Safety Data Sheets (MSDS), sending the relevant data to multiple consumer systems such as websites, printing software, other SAP Landscapes, etc.
In the below screenshot you can see a test Specification TEST_EU. These specifications have property Tree structure which is used to store data specific to each property. E.g in the below screenshot, you can see Safety Related properties this section stores all the properties related to Safety measures to be taken while handling the material.
Identifier tab shows the different Names/Numbers/alphanumeric tags related to this specification.
Each specification has a Specification Type based on the data it is holding.
EHS has a unique structure of property Tree, Value Assignment, Classes and Characteristics which is used to store the Data in EHS. The specification data is not stored in a single table, but across a multiple tables which are linked using linkage of Record Numbers between multiple EST* tables. This structure of storing data makes it difficult for directly reading the Data for a particular specification. This standard BAPI provided by SAP BAPI_BUS1077_GETDETAIL is used.
Reading a Specification
EHS specification can be read by using an ABAP Program using a standard BAPI provided by SAP BAPI_BUS1077_GETDETAIL. This BAPI takes inputs in form of FLAGs Sets and Specification details. Using this BAPI, all data for one or more specifications can be read by assigning values to certain import parameters. The selection of the data can be restricted by entering details in specific import or export tables.
The key of the specification object to be read must be specified in the specification header table SUB_HEADER of the BAPI. These flags can be set based on the sections of the specifications you want to read.
Input Flag Setting
Corresponding BAPI Table
- FLG_HEADER = 'X'
Substance Header Data (Specification key)
- FLG_HEADER_USAGE = 'X'
Usage details of Each Value Assignment. One can specify the rating and validity area for which data is to be read.
- FLG_REFSUBS = 'X'
Reference Substances linked to the specification
- FLG_IDENT = 'X'
Identifiers in Headers and Linked Specifications
- FLG_IDENT_LONGTEXT = 'X'
Identifier Long text
- FLG_IDENT_USAGE = 'X'
Value assignment usage
- FLG_PROPERTIES = 'X'
Property header Data, Property Values, if they are inherited from other specification or Not
- FLG_PROP_DATA = 'X'
- FLG_PROP_DETAILS = 'X'
- FLG_PROP_FTEXT_LONGTEXT = 'X'
Long text linked to property
- FLG_DANG_GOOD_DATA = 'X'
PROP_TAB07, PROP_TAB0B, PROP_TAB0D
Dangerous Goods Data, Hazard inducers
We need to pass the specification Number to the SUB_HEADER Table as shown below:
One can read the specification details for a particular USAGE by setting the relevant USAGE in PROP_USAGE table
More details on the BAPI can be easily obtained from the BAPI Documentation provided by SAP.
Creating an SAP Web service connections
The approach that we used was to create an RFC Enabled Function Module which takes the specification number as the input and reads the specification by setting relevant Flags in BAPI. The Data is then extracted and stored in a structure table. This structure is dynamic in nature i.e. the fields are dynamically populated based on the number of values returned by BAPI.
Step 1: Create a RFC Function Module
Create a Function Module and enable the Remote Function Call.
Step 2: Publish a services provider based on the FM
In the menu, MENU->Utilities->More Utilities->Create Web Service->From the Function Module.
Mention the Service defination and the SOAP Application.
Also the profile should be set to PRF_DT_IF_SEC_HIGH as shown in the below screenshots:
Next Steps are to Use the SOAMANAGER t-code and configure the web-service. Choose the second tab “Application and Scenario Communication”, then click “Single Service Administration”.
Search with the web-service name. Once the web-service is selected, click Display selected Binding’s WSDL URL. This will give you the URL which needs to be passed to the .net Team. They will consume this URL in the web application code and call the FRC function Module.
The web-service can be activated using the transaction SICF. The transported web-service might be needed to be created manually in the Next System.
The web-service created in the above step will be consumed by the .Net application.