Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

FM in background task

asim_isik
Active Participant
0 Kudos

Hello All ,

i need to create an fm for example taking 1000 rows from mara not in once but 4 parallel process as 250.

And i need it in background task.

Any help and ideas would be great!!

Thanks,

Asim..

1 ACCEPTED SOLUTION

asim_isik
Active Participant
0 Kudos

i have found it.. it was getting dump cause of the table i was using.. i have changed it and to make it 4 paralled process i needed to change taskname in every process cause its saying the process already working so its not working with same session name here is code how i solved it and thank you all for answers

START-OF-SELECTION.
   DO 4 TIMES.
     lv_tabix = lv_tabix + 1.
     taskname = taskname + 1.

     CALL FUNCTION 'ZAI_FM_H4D'
       STARTING NEW TASK taskname
       DESTINATION IN GROUP DEFAULT
       PERFORMING s_form ON END OF TASK
       EXPORTING
         rows                  = p_rows
         index                 = lv_tabix
       EXCEPTIONS
         communication_failure = MESSAGE gv_msg
         system_failure        = MESSAGE gv_msg.
   ENDDO.

6 REPLIES 6

NAeda
Contributor
0 Kudos

Hi,

You can write a parallel processing, here is the link <link farm removed>

Split your selection criteria and pass to RFC function module, and get the results from the return table.

Message was edited by: Suhas Saha

asim_isik
Active Participant
0 Kudos

i have changed the method i need to do it starting new task now but i am getting dump CALL_FUNCTION_SEND_ERROR here how i call my fm i didnt understand what is wrong its not going to s_from subroutine getting dump

CALL FUNCTION 'ZAI_FM_H4D'
STARTING NEW TASK 'TASK'
PERFORMING s_form ON END OF TASK
   EXPORTING
     ROWS                     = 1000
   EXCEPTIONS
     MATERIAL_NOT_FOUND       = 1
     OTHERS                   = 2.

IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

0 Kudos

Hi,

Is your s_form is a subroutine or method??

Create a method to call on end of task..

Ex:

CALL FUNCTION 'ZFM_SAVE2'

       STARTING NEW TASK zpa_taskno

       DESTINATION IN GROUP zpa_group

       CALLING return_info ON END OF TASK

Here return_info is a method in the same class.

Thank you

asim_isik
Active Participant
0 Kudos

It's subroutine ..

Former Member
0 Kudos

Hi Asim,

Have a look in this link http://help.sap.com/saphelp_45b/helpdata/en/34/8e73966df74873e10000009b38f9b8/content.htm.

Hope this will helpful for you

Regards,

Prasanna

asim_isik
Active Participant
0 Kudos

i have found it.. it was getting dump cause of the table i was using.. i have changed it and to make it 4 paralled process i needed to change taskname in every process cause its saying the process already working so its not working with same session name here is code how i solved it and thank you all for answers

START-OF-SELECTION.
   DO 4 TIMES.
     lv_tabix = lv_tabix + 1.
     taskname = taskname + 1.

     CALL FUNCTION 'ZAI_FM_H4D'
       STARTING NEW TASK taskname
       DESTINATION IN GROUP DEFAULT
       PERFORMING s_form ON END OF TASK
       EXPORTING
         rows                  = p_rows
         index                 = lv_tabix
       EXCEPTIONS
         communication_failure = MESSAGE gv_msg
         system_failure        = MESSAGE gv_msg.
   ENDDO.