‎2007 Nov 23 6:59 AM
Hi:
I've got a Z function module. I want to use starting new task syntax with it. But the problem is that its having an importing parameter also. is there any alternative for that. I need to process this FM in a new task. Points will be rewarded.
‎2007 Nov 23 7:58 AM
Hi,
HERE THE EXAMPLE
<b>&----
*& Form DIF_PLAN
&----
FORM dif_plan TABLES it_param TYPE tdf_el
USING nam LIKE t_name
idx.
CONCATENATE nam idx INTO taskname.
CALL FUNCTION 'Y_F_CO_DIF_DF_ELEM'
STARTING NEW TASK taskname
DESTINATION IN GROUP DEFAULT
PERFORMING outdata_new ON END OF TASK
EXPORTING
i_keart = 'N'
i_kkzst = ' '
i_curtp = p_curtp
TABLES
t_param = it_param
t_el_hv = it_el_hv
t_elehkns = it_elehkns
t_ckmlkev = it_ckmlkev
r_mlcct = ra_mlcct
r_categ = ra_categ
EXCEPTIONS
int_err = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e203(zmco).
ELSE.
ADD 1 TO started_task.
ENDIF.
IF free_task <= proc_cnt_n .
WAIT UNTIL gs_cnt >= started_task.
CLEAR: started_task, gs_cnt.
*
<b>*Quantity of free processes</b>
CALL FUNCTION 'SPBT_GET_CURR_RESOURCE_INFO'
IMPORTING
free_pbt_wps = free_task
EXCEPTIONS
internal_error = 1
pbt_env_not_initialized_yet = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
PERFORM num_task USING 4.
proc_cnt = proc_cnt - 1.
ENDFORM. "DIF_PLAN
<b>&----
*& Form outdata_new
&----
*& -->TASKNAME text
&----
FORM outdata_new USING taskname.
RECEIVE RESULTS FROM FUNCTION 'Y_F_CO_DIF_DF_ELEM'
TABLES
t_outdata = it_dif_df_elem1
EXCEPTIONS
int_err = 1
OTHERS = 2.
APPEND LINES OF it_dif_df_elem1 TO it_dif_df_elem.
ADD 1 TO gs_cnt.
ENDFORM.
‎2007 Nov 23 7:09 AM
CALL FUNCTION update_function IN UPDATE TASK
[EXPORTING p1 = a1 p2 = a2 ...]
[TABLES t1 = itab1 t2 = itab2 ...].
‎2007 Nov 23 7:29 AM
The problem is that he has IMPORTING parameters.
You call the FM STARTING NEW TASK, without IMPORTING parameters. If you need the results, then you must use the addition
{PERFORMING subr}|{CALLING meth} ON END OF TASK
And in the subroutine or method, you'll need:
RECEIVE RESULTS FROM FUNCTION, putting your import parameters there. This is all documented very well in the ABAP help.
edit: note that you have posted this before. You say you have a problem with the importing params. What precisely is the problem?
matt
Message was edited by:
Matthew Billingham
‎2007 Nov 23 8:24 AM
Hi:
The problem was that I've importing parameters in FM...but as per ur guidance I was able to sort it out
‎2007 Nov 23 7:58 AM
Hi,
HERE THE EXAMPLE
<b>&----
*& Form DIF_PLAN
&----
FORM dif_plan TABLES it_param TYPE tdf_el
USING nam LIKE t_name
idx.
CONCATENATE nam idx INTO taskname.
CALL FUNCTION 'Y_F_CO_DIF_DF_ELEM'
STARTING NEW TASK taskname
DESTINATION IN GROUP DEFAULT
PERFORMING outdata_new ON END OF TASK
EXPORTING
i_keart = 'N'
i_kkzst = ' '
i_curtp = p_curtp
TABLES
t_param = it_param
t_el_hv = it_el_hv
t_elehkns = it_elehkns
t_ckmlkev = it_ckmlkev
r_mlcct = ra_mlcct
r_categ = ra_categ
EXCEPTIONS
int_err = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e203(zmco).
ELSE.
ADD 1 TO started_task.
ENDIF.
IF free_task <= proc_cnt_n .
WAIT UNTIL gs_cnt >= started_task.
CLEAR: started_task, gs_cnt.
*
<b>*Quantity of free processes</b>
CALL FUNCTION 'SPBT_GET_CURR_RESOURCE_INFO'
IMPORTING
free_pbt_wps = free_task
EXCEPTIONS
internal_error = 1
pbt_env_not_initialized_yet = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
PERFORM num_task USING 4.
proc_cnt = proc_cnt - 1.
ENDFORM. "DIF_PLAN
<b>&----
*& Form outdata_new
&----
*& -->TASKNAME text
&----
FORM outdata_new USING taskname.
RECEIVE RESULTS FROM FUNCTION 'Y_F_CO_DIF_DF_ELEM'
TABLES
t_outdata = it_dif_df_elem1
EXCEPTIONS
int_err = 1
OTHERS = 2.
APPEND LINES OF it_dif_df_elem1 TO it_dif_df_elem.
ADD 1 TO gs_cnt.
ENDFORM.