SAP SCAN_ORA_SELECT_STATEMENT Function Module for scan oracle select statement for columns and tables
SCAN_ORA_SELECT_STATEMENT is a standard scan ora select statement SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for scan oracle select statement for columns and tables processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for scan ora select statement FM, simply by entering the name SCAN_ORA_SELECT_STATEMENT into the relevant SAP transaction such as SE37 or SE38.
Function Group: STD9
Program Name: SAPLSTD9
Main Program: SAPLSTD9
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:
Function SCAN_ORA_SELECT_STATEMENT pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'SCAN_ORA_SELECT_STATEMENT'"scan oracle select statement for columns and tables.
EXPORTING
STATEMENT = " sql statement to be parsed / scanned
* DBCON = "Logical name for a database connection
IMPORTING
OPERATION = "(main) sql operation (SELECT, UPDATE ...)
CHANGING
PTABLES = "Table: tables / views within a parsed sql statement
PCOLUMNS = "Table: columns within a parsed sql statement
EXCEPTIONS
NO_STATEMENT = 1 NO_FROM_FOUND = 10 NO_OPERATION_FOUND = 2 INVALID_SQL_OPERATION = 3 ERROR_IN_HINT = 4 ERROR_IN_PARSING_SELECT_LIST = 5 ERROR_IN_TABLE_REFERENCES = 6 COLUMNS_NOT_MATCHING_WITH_TABS = 7 ERROR_REDUCING_DISTINCT = 8 ERROR_IN_SET_OPERATOR = 9
IMPORTING Parameters details for SCAN_ORA_SELECT_STATEMENT
STATEMENT - sql statement to be parsed / scanned
Data type: STRINGOptional: No
Call by Reference: No ( called with pass by value option)
DBCON - Logical name for a database connection
Data type: DBCON_NAMEOptional: Yes
Call by Reference: Yes
EXPORTING Parameters details for SCAN_ORA_SELECT_STATEMENT
OPERATION - (main) sql operation (SELECT, UPDATE ...)
Data type: STMTOPOptional: No
Call by Reference: Yes
CHANGING Parameters details for SCAN_ORA_SELECT_STATEMENT
PTABLES - Table: tables / views within a parsed sql statement
Data type: TSQLPTABLESOptional: No
Call by Reference: Yes
PCOLUMNS - Table: columns within a parsed sql statement
Data type: TSQLPCOLOptional: No
Call by Reference: Yes
EXCEPTIONS details
NO_STATEMENT - statement is empty
Data type:Optional: No
Call by Reference: Yes
NO_FROM_FOUND - no from with table references found
Data type:Optional: No
Call by Reference: Yes
NO_OPERATION_FOUND - no operation found in the statement
Data type:Optional: No
Call by Reference: Yes
INVALID_SQL_OPERATION - invalid sql operation found in the statement
Data type:Optional: No
Call by Reference: Yes
ERROR_IN_HINT - error in parsing hint
Data type:Optional: No
Call by Reference: Yes
ERROR_IN_PARSING_SELECT_LIST - error in parsing the select list
Data type:Optional: No
Call by Reference: Yes
ERROR_IN_TABLE_REFERENCES - error in parsing the table references
Data type:Optional: No
Call by Reference: Yes
COLUMNS_NOT_MATCHING_WITH_TABS - columns could not be matched to tables
Data type:Optional: No
Call by Reference: Yes
ERROR_REDUCING_DISTINCT - error while reducing DISTINCT / UNIQUE / ALL
Data type:Optional: No
Call by Reference: Yes
ERROR_IN_SET_OPERATOR - error in parsing UNION / INTERSECT / MINUS
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for SCAN_ORA_SELECT_STATEMENT Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.DATA: | ||||
lv_ptables | TYPE TSQLPTABLES, " | |||
lv_operation | TYPE STMTOP, " | |||
lv_statement | TYPE STRING, " | |||
lv_no_statement | TYPE STRING, " | |||
lv_no_from_found | TYPE STRING, " | |||
lv_dbcon | TYPE DBCON_NAME, " | |||
lv_pcolumns | TYPE TSQLPCOL, " | |||
lv_no_operation_found | TYPE TSQLPCOL, " | |||
lv_invalid_sql_operation | TYPE TSQLPCOL, " | |||
lv_error_in_hint | TYPE TSQLPCOL, " | |||
lv_error_in_parsing_select_list | TYPE TSQLPCOL, " | |||
lv_error_in_table_references | TYPE TSQLPCOL, " | |||
lv_columns_not_matching_with_tabs | TYPE TSQLPCOL, " | |||
lv_error_reducing_distinct | TYPE TSQLPCOL, " | |||
lv_error_in_set_operator | TYPE TSQLPCOL. " |
  CALL FUNCTION 'SCAN_ORA_SELECT_STATEMENT' "scan oracle select statement for columns and tables |
EXPORTING | ||
STATEMENT | = lv_statement | |
DBCON | = lv_dbcon | |
IMPORTING | ||
OPERATION | = lv_operation | |
CHANGING | ||
PTABLES | = lv_ptables | |
PCOLUMNS | = lv_pcolumns | |
EXCEPTIONS | ||
NO_STATEMENT = 1 | ||
NO_FROM_FOUND = 10 | ||
NO_OPERATION_FOUND = 2 | ||
INVALID_SQL_OPERATION = 3 | ||
ERROR_IN_HINT = 4 | ||
ERROR_IN_PARSING_SELECT_LIST = 5 | ||
ERROR_IN_TABLE_REFERENCES = 6 | ||
COLUMNS_NOT_MATCHING_WITH_TABS = 7 | ||
ERROR_REDUCING_DISTINCT = 8 | ||
ERROR_IN_SET_OPERATOR = 9 | ||
. " SCAN_ORA_SELECT_STATEMENT |
ABAP code using 7.40 inline data declarations to call FM SCAN_ORA_SELECT_STATEMENT
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.Search for further information about these or an SAP related objects