Function in General Query for Data Extraction

  • Last update:November 07, 2024
  • Description

    FineReport provides the source code for EXTRACT_TABLE_DATA and supports subsequent dataset use.

    This document provides a detailed explanation of the creation process of EXTRACT_TABLE_DATA and the resolution of the problems that may arise.

    Procedure

    Creating an ABAP Function

    Create an ABAP function named EXTRACT_TABLE_DATA.

    Click Source code and paste the source code of EXTRACT_TABLE_DATA, as shown in the following figure.

     2024-05-20_13-59-21.png

    Click the Tables tab, add four tables: FIELDS/FROMCLAUSE/WHERECLAUSE/DATA. and set Type spec. to LIKE.

    According to the source code of the document, set Short text to ZSQL_CLAUSE_ELEMENTS for the first three tables and ZTABLEROWS for the last table, as shown in the following figure.

    1563503978741483.png 

    Note: In this case, an error message indicating that ZSQL_CLAUSE_ELEMENTS and ZTABLEROWS does not exist may be displayed. Save the function first.

    Unfold ABAP Workbench and double-click ABAP Dictionary, as shown in the following figure.

     1563504446663379.png

    Select Data type, name the data structure ZSQL_CLAUSE_ELEMENTS, and click Create, as shown in the following figure.

     1563504516316455.png

    Select Structure and click , as shown in the following figure.

     1563504615873755.png

    Set Short Description, add a data element named TEXT, and set Component type to SO_TEXT, as shown in the following figure.

     1563504683542208.png

    Using the same method, create a structure named ZTABLEROWS, add a data element with any name (for example, ZTABLEROWS), and set Component type to CHAR2000.

     1563504759870427.png

    Save these two structures,and click the structure tree button above to open the directory of the package where structures are located.

     1563504888356312.png

    Unfold Structures to see the two structures defined before. Right-click each one and select Activate.

     1563504969448387.png

    Go back to EXTRACT_TABLE_DATA, re-click the Tables tab on the left, add four tables  (FIELDS/FROMCLAUSE/WHERECLAUSE/DATA), and set Type spec. to LIKE. According to the source code of the document, set Short text to ZSQL_CLAUSE_ELEMENTS for the first three tables, and ZTABLEROWS for the last table.

    Saving and Checking

    Save the function and click the check button on the toolbar to perform syntax checking.

     1563505104454152.png

    An error may occur, as shown in the following figure.

    1715933743xlQW.png

    In this case, change ZALBUS_STRUCT_WHERECLAUSE to ZSQL_CLAUSE_ELEMENTS within the function.

    Double Checking

    If no error occurs, the function can be operated normally. Do not forget to select Remote-enabled module for the function to be accessed remotely.

     1563505162245962.png

    Finally, activate the function to complete the setting.

    Attachment List


    Theme: Data Preparation
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy