SAP Function Modules

STU3_EXECUTE_DB2COMMAND SAP Function module







STU3_EXECUTE_DB2COMMAND is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name STU3_EXECUTE_DB2COMMAND into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: STU3
Released Date: Not Released
Processing type: Remote-Enabled
remote enabled module settings


Pattern for FM STU3_EXECUTE_DB2COMMAND - STU3 EXECUTE DB2COMMAND





CALL FUNCTION 'STU3_EXECUTE_DB2COMMAND' "
  EXPORTING
    fb_db2command =             " stu3cotabs
*   force_user_sel = 0          " int4          If 1, command executed on specified member
*   ds_member_spec =            " db2dsmem-memb_name  Name of the data sharing group member
*   remote_db_con =             " dbcon-con_name  Logical name for a database connection
*   dont_provide_member =       " int4          Natural number
  IMPORTING
    ds_member_used =            " db2dsmem-memb_name  Name of the data sharing group member
  TABLES
    fb_result_tab =             " linetab
  EXCEPTIONS
    RS_AUTH_FAILURE = 1         "
    RS_INTERNAL_ERROR = 2       "
    REQUEST_TO_OLD = 3          "
    NO_BUFFER_SPACE_IN_SHM = 4  "
    UNVALID_REQUEST_ID = 5      "
    ANSWER_IS_NOT_YET_AVAILABLE = 6  "
    COMMUNICATION_ERROR = 7     "
    ANSWER_NOT_POSSIBLE = 8     "
    COMMUNICATION_BUFFER_TO_SMALL = 9  "
    UNKNOWN_ERROR = 10          "
    ILLEGAL_PARAMETER = 11      "
    IFI_ERROR = 12              "
    OTHER_EXCEPTION = 13        "
    .  "  STU3_EXECUTE_DB2COMMAND

ABAP code example for Function Module STU3_EXECUTE_DB2COMMAND





The ABAP code below is a full code listing to execute function module STU3_EXECUTE_DB2COMMAND including all data declarations. The code uses 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 original method of declaring data variables up front. 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).

DATA:
ld_ds_member_used  TYPE DB2DSMEM-MEMB_NAME ,
it_fb_result_tab  TYPE STANDARD TABLE OF LINETAB,"TABLES PARAM
wa_fb_result_tab  LIKE LINE OF it_fb_result_tab .

DATA(ld_fb_db2command) = 'Check type of data required'.
DATA(ld_force_user_sel) = 'Check type of data required'.

DATA(ld_ds_member_spec) = some text here

SELECT single CON_NAME
FROM DBCON
INTO @DATA(ld_remote_db_con).

DATA(ld_dont_provide_member) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_fb_result_tab to it_fb_result_tab. . CALL FUNCTION 'STU3_EXECUTE_DB2COMMAND' EXPORTING fb_db2command = ld_fb_db2command * force_user_sel = ld_force_user_sel * ds_member_spec = ld_ds_member_spec * remote_db_con = ld_remote_db_con * dont_provide_member = ld_dont_provide_member IMPORTING ds_member_used = ld_ds_member_used TABLES fb_result_tab = it_fb_result_tab EXCEPTIONS RS_AUTH_FAILURE = 1 RS_INTERNAL_ERROR = 2 REQUEST_TO_OLD = 3 NO_BUFFER_SPACE_IN_SHM = 4 UNVALID_REQUEST_ID = 5 ANSWER_IS_NOT_YET_AVAILABLE = 6 COMMUNICATION_ERROR = 7 ANSWER_NOT_POSSIBLE = 8 COMMUNICATION_BUFFER_TO_SMALL = 9 UNKNOWN_ERROR = 10 ILLEGAL_PARAMETER = 11 IFI_ERROR = 12 OTHER_EXCEPTION = 13 . " STU3_EXECUTE_DB2COMMAND
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 4. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 5. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 6. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 7. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 8. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 9. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 10. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 11. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 12. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 13. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_ds_member_used  TYPE DB2DSMEM-MEMB_NAME ,
ld_fb_db2command  TYPE STU3COTABS ,
it_fb_result_tab  TYPE STANDARD TABLE OF LINETAB ,
wa_fb_result_tab  LIKE LINE OF it_fb_result_tab,
ld_force_user_sel  TYPE INT4 ,
ld_ds_member_spec  TYPE DB2DSMEM-MEMB_NAME ,
ld_remote_db_con  TYPE DBCON-CON_NAME ,
ld_dont_provide_member  TYPE INT4 .

ld_fb_db2command = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_fb_result_tab to it_fb_result_tab.
ld_force_user_sel = 'Check type of data required'.

ld_ds_member_spec = some text here

SELECT single CON_NAME
FROM DBCON
INTO ld_remote_db_con.

ld_dont_provide_member = 'Check type of data required'.

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name STU3_EXECUTE_DB2COMMAND or its description.