通知を受け取る

UiPath Process Mining

UiPath Process Mining ガイド

SAP システムに Z_XTRACT_IS_TABLE 関数モジュールをインストールする

はじめに

To use the native SAP extraction from UiPath Process Mining, you must add the Z_XTRACT_IS_TABLE Function module to your SAP system.

📘

注:

ネイティブな SAP データの抽出を設定する際は、関数モジュール Z_XTRACT_IS_TABLE が必要です。たとえば、お使いの SAP システムでこの関数モジュールの名前が変更されている場合は、SAP 接続文字列の FunctionModule パラメーター (任意) で正しい名前を指定できます。

前提条件

To be able to install the Custom Function Module on your SAP system you must have the credentials of an SAP user with a development key.

Adding a new Function group

📘

注:

It is recommended to add a new Function group to add the function module.

Follow these steps to add a new Function group.

StepAction
1Open the SAP GUI.
2Enter SE37 in the command field in the top left.
3Go to the Goto menu and select Function group -> Create group.
4Enter a name for the Function group.
Note: the name must start with Z, for example Z_PM_DATA_EXTRACTION.
5Enter a description for the Function group in the Short Text field, for example ProcessMining Data Extraction.
6Click on Save.

Activating the Function group

Follow these steps to activate the Function group.

StepAction
1Select Function Group.
2Search for the Function group you created, for example PM_DATA_EXTRACTION.
3Right-click on the top object of the Function group and select Activate it from the context menu.

Adding the Function module

Once the Function group is created, you can add the Function module from the SE37 GUI window.

Follow these steps to install the Z_XTRACT_IS_TABLE Function module.

StepAction
1Enter Z_XTRACT_IS_TABLE in the Function Module field and click on Create.
2Go to the Attributes tab and select the Remote-Enabled Module option in the Processing Type options list.
3Go to the Import tab and define the import parameters as listed below.

Note: you might get a warning that the LIKE operator is obsolete. You can ignore the warning and go through the list. Click ENTER to acknowledge that you still want to use it. Once you went through the entire list the code is accepted.
4Go to the Tables tab and define the tables parameters as listed below.

Note: you might get a warning that the LIKE operator is obsolete. You can ignore the warning and go through the list. Click ENTER to acknowledge that you still want to use it. Once you went through the entire list the code is accepted.
5Go to the Exceptions tab to define the exceptions as listed below.
6Go to the Source code tab and enter the ABAP code for the Z_XTRACT_IS_TABLE.

Note: you can copy and paste the code displayed below.
7Save the Function module and activate it.

Import parameters

See illustration below for an overview of the import parameters to be defined in the Import tab.

670

Tables parameters

See illustration below for an overview of the tables parameters to be defined in the Tables tab.

617

例外

See illustration below for an overview of the Exceptions to be defined in the Exceptions tab.

591

ABAP Code

See code text below for the ABAP code to be pasted in the Source code tab.

FUNCTION Z_XTRACT_IS_TABLE.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  IMPORTING
*"     VALUE(QUERY_TABLE) LIKE  DD02L-TABNAME
*"     VALUE(DELIMITER) LIKE  SONV-FLAG DEFAULT SPACE
*"     VALUE(NO_DATA) LIKE  SONV-FLAG DEFAULT SPACE
*"     VALUE(ROWSKIPS) LIKE  SOID-ACCNT DEFAULT 0
*"     VALUE(ROWCOUNT) LIKE  SOID-ACCNT DEFAULT 0
*"  TABLES
*"      OPTIONS STRUCTURE  RFC_DB_OPT
*"      FIELDS STRUCTURE  RFC_DB_FLD
*"      DATA STRUCTURE  CHAR8000
*"  EXCEPTIONS
*"      TABLE_NOT_AVAILABLE
*"      TABLE_WITHOUT_DATA
*"      OPTION_NOT_VALID
*"      FIELD_NOT_VALID
*"      NOT_AUTHORIZED
*"      DATA_BUFFER_EXCEEDED
*"----------------------------------------------------------------------
"
CALL FUNCTION 'VIEW_AUTHORITY_CHECK'
     EXPORTING
          VIEW_ACTION                    = 'S'
          VIEW_NAME                      = QUERY_TABLE
     EXCEPTIONS
          NO_AUTHORITY                   = 2
          NO_CLIENTINDEPENDENT_AUTHORITY = 2
          NO_LINEDEPENDENT_AUTHORITY     = 2
          OTHERS                         = 1.

IF SY-SUBRC = 2.
  RAISE NOT_AUTHORIZED.
ELSEIF SY-SUBRC = 1.
  RAISE TABLE_NOT_AVAILABLE.
ENDIF.

* ----------------------------------------------------------------------
*  find out about the structure of QUERY_TABLE
* ----------------------------------------------------------------------
DATA BEGIN OF TABLE_STRUCTURE OCCURS 10.
        INCLUDE STRUCTURE DFIES.
DATA END OF TABLE_STRUCTURE.
"DATA TABLE_HEADER LIKE X030L.
DATA TABLE_TYPE TYPE DD02V-TABCLASS.

CALL FUNCTION 'DDIF_FIELDINFO_GET'
  EXPORTING
    TABNAME              = QUERY_TABLE
*   FIELDNAME            = ' '
*   LANGU                = SY-LANGU
*   LFIELDNAME           = ' '
*   ALL_TYPES            = ' '
*   GROUP_NAMES          = ' '
  IMPORTING
*   X030L_WA             =
    DDOBJTYPE            = TABLE_TYPE
*   DFIES_WA             =
*   LINES_DESCR          =
  TABLES
    DFIES_TAB            = TABLE_STRUCTURE
*   FIXED_VALUES         =
  EXCEPTIONS
    NOT_FOUND            = 1
    INTERNAL_ERROR       = 2
    OTHERS               = 3
          .
IF SY-SUBRC <> 0.
  RAISE TABLE_NOT_AVAILABLE.
ENDIF.
IF TABLE_TYPE = 'INTTAB'.
  RAISE TABLE_WITHOUT_DATA.
ENDIF.

* ----------------------------------------------------------------------
*  isolate first field of DATA as output field
*  (i.e. allow for changes to structure DATA!)
* ----------------------------------------------------------------------
DATA LINE_LENGTH TYPE I.
FIELD-SYMBOLS <D>.
ASSIGN COMPONENT 0 OF STRUCTURE DATA TO <D>.

* If this line leads to a syntax error
* please just delete the 'in character mode'
DESCRIBE FIELD <D> LENGTH LINE_LENGTH in character mode.


* ----------------------------------------------------------------------
*  if FIELDS are not specified, read all available fields
* ----------------------------------------------------------------------
DATA NUMBER_OF_FIELDS TYPE I.
DESCRIBE TABLE FIELDS LINES NUMBER_OF_FIELDS.
IF NUMBER_OF_FIELDS = 0.
  LOOP AT TABLE_STRUCTURE.
    MOVE TABLE_STRUCTURE-FIELDNAME TO FIELDS-FIELDNAME.
    APPEND FIELDS.
  ENDLOOP.
ENDIF.

* ----------------------------------------------------------------------
*  for each field which has to be read, copy structure information
*  into tables FIELDS_INT (internal use) and FIELDS (output)
* ----------------------------------------------------------------------
DATA: BEGIN OF FIELDS_INT OCCURS 10,
        FIELDNAME  LIKE TABLE_STRUCTURE-FIELDNAME,
        TYPE       LIKE TABLE_STRUCTURE-INTTYPE,
        DECIMALS   LIKE TABLE_STRUCTURE-DECIMALS,
        LENGTH_SRC LIKE TABLE_STRUCTURE-INTLEN,
        LENGTH_DST LIKE TABLE_STRUCTURE-LENG,
        OFFSET_SRC LIKE TABLE_STRUCTURE-OFFSET,
        OFFSET_DST LIKE TABLE_STRUCTURE-OFFSET,
      END OF FIELDS_INT,
      LINE_CURSOR TYPE I.


LINE_CURSOR = 0.
*  for each field which has to be read ...
LOOP AT FIELDS.

  READ TABLE TABLE_STRUCTURE WITH KEY FIELDNAME = FIELDS-FIELDNAME.
  IF SY-SUBRC NE 0.
    RAISE FIELD_NOT_VALID.
  ENDIF.

* compute the place for field contents in DATA rows:
* if not first field in row, allow space for delimiter
  IF LINE_CURSOR <> 0.
    IF NO_DATA EQ SPACE AND DELIMITER NE SPACE.
      MOVE DELIMITER TO DATA+LINE_CURSOR.
    ENDIF.
    LINE_CURSOR = LINE_CURSOR + STRLEN( DELIMITER ).
  ENDIF.

* ... copy structure information into tables FIELDS_INT
* (which is used internally during SELECT) ...
  FIELDS_INT-FIELDNAME  = TABLE_STRUCTURE-FIELDNAME.
  FIELDS_INT-LENGTH_SRC = TABLE_STRUCTURE-INTLEN.
*  FIELDS_INT-LENGTH_DST = TABLE_STRUCTURE-LENG.
* modified by Theobald, 2007-11-20
  FIELDS_INT-LENGTH_DST = TABLE_STRUCTURE-OUTPUTLEN.

  FIELDS_INT-OFFSET_SRC = TABLE_STRUCTURE-OFFSET.
  FIELDS_INT-OFFSET_DST = LINE_CURSOR.
  FIELDS_INT-TYPE       = TABLE_STRUCTURE-INTTYPE.
  FIELDS_INT-DECIMALS   = TABLE_STRUCTURE-DECIMALS.

* compute the place for contents of next field in DATA rows
*  LINE_CURSOR = LINE_CURSOR + TABLE_STRUCTURE-LENG.
* modified by Theobald, 2007-11-20
LINE_CURSOR = LINE_CURSOR + TABLE_STRUCTURE-OUTPUTLEN.



  IF LINE_CURSOR > LINE_LENGTH AND NO_DATA EQ SPACE.
    RAISE DATA_BUFFER_EXCEEDED.
  ENDIF.
  APPEND FIELDS_INT.

* ... and into table FIELDS (which is output to the caller)
  FIELDS-FIELDTEXT = TABLE_STRUCTURE-FIELDTEXT.
  FIELDS-TYPE      = TABLE_STRUCTURE-INTTYPE.
  FIELDS-LENGTH    = FIELDS_INT-LENGTH_DST.
  FIELDS-OFFSET    = FIELDS_INT-OFFSET_DST.
  MODIFY FIELDS.

ENDLOOP.
* end of loop at FIELDS

* ----------------------------------------------------------------------
*  read data from the database and copy relevant portions into DATA
* ----------------------------------------------------------------------
* output data only if NO_DATA equals space (otherwise the structure
* information in FIELDS is the only result of the module)
IF NO_DATA EQ SPACE.

DATA: BEGIN OF WORK, BUFFER(30000), F TYPE F, END OF WORK.

FIELD-SYMBOLS: <WA> TYPE ANY, <COMP> TYPE ANY.
ASSIGN WORK TO <WA> CASTING TYPE (QUERY_TABLE).

IF ROWCOUNT > 0.
  ROWCOUNT = ROWCOUNT + ROWSKIPS.
ENDIF.

  SELECT * FROM (QUERY_TABLE) INTO <WA> WHERE (OPTIONS).

    IF SY-DBCNT GT ROWSKIPS.

*   copy all relevant fields into DATA (output) table
      LOOP AT FIELDS_INT.
        IF FIELDS_INT-TYPE = 'P'.
        ASSIGN COMPONENT FIELDS_INT-FIELDNAME
            OF STRUCTURE <WA> TO <COMP>
            TYPE     FIELDS_INT-TYPE
            DECIMALS FIELDS_INT-DECIMALS.
        ELSE.
        ASSIGN COMPONENT FIELDS_INT-FIELDNAME
            OF STRUCTURE <WA> TO <COMP>
            TYPE     FIELDS_INT-TYPE.
        ENDIF.
        MOVE <COMP> TO
            <D>+FIELDS_INT-OFFSET_DST(FIELDS_INT-LENGTH_DST).
      ENDLOOP.
*   end of loop at FIELDS_INT
      APPEND DATA.

      IF ROWCOUNT > 0 AND SY-DBCNT GE ROWCOUNT. EXIT. ENDIF.

    ENDIF.

  ENDSELECT.

ENDIF.

ENDFUNCTION.

Checking and activating the Function module

After you pasted the ABAP code it is recommend to check your code for syntax errors before you activate the Function module.

Checking the Function module

Follow this step to check the ABAP code.

StepAction
1Press CTRL+F2 in the SAP Source code tab.

If there are no errors, you can activate the Function module.

Activating the Function module

Follow these steps to activate the Function module.

StepAction
1Enter SE80 in the command field in the top left.
2Select Function Module.
3Search for Z_XTRACT_IS_TABLE.
4Right-click on the top object of Z_XTRACT_IS_TABLE and select Activate it from the context menu.

Connecting to the SAP datasource from UiPath Process Mining

At this point it is possible to extract data from the SAP system using the native SAP connection. You can connect to the SAP datasource by creating a new input table using an SAP connection string table and defining a query to extract the data. See illustration below.

732

3 か月前に更新

SAP システムに Z_XTRACT_IS_TABLE 関数モジュールをインストールする


改善の提案は、API リファレンスのページでは制限されています

改善を提案できるのは Markdown の本文コンテンツのみであり、API 仕様に行うことはできません。