SAP ABAP function module deployment guide
When you scan SAP ECC, SAP S/4HANA, and SAP BW sources in Microsoft Purview, you need to create the dependent ABAP function module in your SAP server. Microsoft Purview invokes this function module to extract the metadata from your SAP system during scan.
This article describes the steps required to deploy this module.
Note
The following instructions were compiled based on the SAP GUI v. 7.2.
Prerequisites
Download the SAP ABAP function module source code from the Microsoft Purview governance portal. After you register a source for SAP ECC, SAP S/4HANA, or SAP BW, you can find a download link on top as shown in the following image. You can also see the link when you create a new scan or edit a scan. To download this code, you need to have Data Source Administrator permissions on the root collection in your data map.
Deploy the module
Follow the instructions to deploy a module.
Create a package
This step is optional, and an existing package can be used.
Sign in to the SAP server and open Object Navigator (SE80 transaction).
Select Package from the list and enter a name for the new package. For example, use Z_MITI. Then select Display.
In the Create Package window, select Yes. In the Package Builder: Create Package window, enter a value in the Short Description box. Select the Continue icon.
In the Prompt for local Workbench request window, select Own Requests. Select the development request.
Create a function group
In Object Navigator, select Function Group from the list and enter a name in the input box. For example, use Z_MITI_FGROUP. Select the View icon.
In the Create Object window, select yes to create a new function group.
Enter a description in the Short Text box and select Save.
Select a package that was prepared in the Create a Package step, and select Save.
Confirm a request by selecting Continue.
Activate the function group.
Create the ABAP function module
After the function group is created, select it.
Select and hold (or right-click) the function group name in the repository browser. Select Create and then select Function Module.
In the Function module box, enter Z_MITI_DOWNLOAD in case of SAP ECC or S/4HANA and Z_MITI_BW_DOWNLOAD in case of SAP BW. Enter a description in the Short Text box.
After the module is created, specify the following information:
Go to the Attributes tab.
Under Processing Type, select Remote-Enabled Module.
Go to the Source code tab. There are two ways to deploy code for the function:
On the main menu, upload the text file you downloaded from the Microsoft Purview governance portal as described in Prerequisites. To do so, select Utilities > More Utilities > Upload/Download > Upload.
Alternatively, open the file and copy and paste the contents in the Source code area.
Go to the Import tab and create the following parameters:
P_AREA TYPE DD02L-TABNAME (Optional = True)
P_LOCAL_PATH TYPE STRING (Optional = True)
P_LANGUAGE TYPE L001TAB-DATA DEFAULT 'E'
ROWSKIPS TYPE SO_INT DEFAULT 0
ROWCOUNT TYPE SO_INT DEFAULT 0
Note
Select the Pass Value checkbox for all the parameters.
Go to the Tables tab and define EXPORT_TABLE LIKE TAB512.
Go to the Exceptions tab and define the exception E_EXP_GUI_DOWNLOADFAILED.
Save the function by selecting Ctrl+S. Or select Function module and then select Save on the main menu.
Select the Activate icon on the toolbar and then select Continue. You can also select Ctrl+F3. If prompted, select the generated includes to be activated along with the main function module.
Test the function
After you finish the previous steps, test the function:
Open the Z_MITI_DOWNLOAD or Z_MITI_BW_DOWNLOAD function module you created.
On the main menu, select Function Module > Test > Test Function Module. You can also select F8.
Enter a path to the folder on the local file system in the parameter P_LOCAL_PATH. Then select the Execute icon on the toolbar. You can also select F8.
Enter the name of the area of interest in the P_AREA field if a file with metadata must be downloaded or updated. After the function finishes working, the folder indicated in the P_LOCAL_PATH parameter must contain several files with metadata inside. The names of files mimic areas that can be specified in the P_AREA field.
The function finishes its execution and metadata is downloaded much faster if it's launched on the machine that has a high-speed network connection with the SAP server.