Hi experts,
I am trying to call this FM written by me from ABAP Web Dynpro Code, on button click. I created a function module so I can run this in background (as it takes long and otherwise hangs the system for about 10 minutes each time. The FM is suppossed to create multiple users in HANA systems.
Here's the code inside WD calling the function:
CALL FUNCTION 'ZFM_HUBERT'
IN BACKGROUND TASK
EXPORTING
LV_CON = lv_con
userid = wa_iuser-userid
IMPORTING
error = lv_error.
And here's the FM source code:
FUNCTION ZFM_HUBERT.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(LV_CON) TYPE DBCON_NAME
*" REFERENCE(USERID) TYPE ZCOE_DUB-USERID
*" EXPORTING
*" REFERENCE(ERROR) TYPE STRING
*"----------------------------------------------------------------------
DATA: query_first TYPE string,
query_rest TYPE string,
query TYPE char200,
rows_processed TYPE i,
lr_dbconn TYPE REF TO cl_sql_connection,
sql_env TYPE REF TO cl_sql_statement.
lr_dbconn = cl_sql_connection=>get_connection( con_name = LV_CON ).
CREATE OBJECT sql_env
EXPORTING
con_ref = lr_dbconn.
* wa_iuser-userid = 'I313771'.
query_first = 'SYSTEM.CREATE_USER_AND_COPY_PRIVILEGES('''.
query_rest = ''', ''Initial1'', ''SYSTEM'')'.
CONCATENATE query_first userid query_rest INTO query.
CALL METHOD sql_env->execute_procedure
EXPORTING
proc_name = query
RECEIVING
rows_processed = rows_processed.
ENDFUNCTION.
The job will display message saying it did the job but nothing happens and the job is not visible in the monitor.
I appreciate any help
Regards,
Hubert