Calling function in NEW TASK

Hi,
I am creating a program which calls a function, becuse the function gets list of 2000 employess and run for long time over the amount of employees i wrote "call function zxxxxx starting new task p_task_number...."
My question is - how many tasks can i create ? can i run the function in 10 tasks (20 employees in each task)????
thanks
Elad

Hi Diwakar,
try CALL FUNCTION func STARTING NEW TASK task1 DESTINATION dest IN GROUP DEFAULT, this will enable to run FM in groups (parallel processing) and might help in performance as will itself take care of available Application server.
Not true, you can call an FM(which needs to be RFC of course) just like below, and you would still achieve parallel processing, read IN GROUP for more details on when and where to use it.
DATA: l_task TYPE char10.
DO 5 TIMES.
  l_task = sy-index.
  CONDENSE l_task.
  CONCATENATE 'TASK' l_task INTO l_task.
  CALL FUNCTION 'ZTEST_CHEN' STARTING NEW TASK l_task.
ENDDO.
Regards,
Chen
Edited by: Chen K V on May 26, 2011 2:55 PM

Similar Messages

  • Use of CALL FUNCTION - STARTING NEW TASK parameter_list.

    SELECT strt_code
                 city_code
                 commu_code
                 regiogroup
          INTO TABLE gt_adrstreet1
          FROM adrstreet
          FOR ALL ENTRIES IN gt_street_district
          WHERE strt_code EQ gt_street_district-strt_code.
    To optimize the performance of teh above query I am planning to use call function CALL FUNCTION - STARTING NEW TASK .....
    by spliting the above internal table gt_street_district into two internal tables and use the value of each internal table into two different queries and these queries will be put in call function - start new task ....so that these queries are run in different workprocess and thus improve the performance of the program.
    Can you please let me know if this would be a good option and also how to implement the same.
    Thanks.....

    >To optimize the performance of teh above query I am planning to use call function CALL FUNCTION - STARTING NEW TASK .....
    nonsense! You should not try parallel processing for a non-optimized SELECT statement.
    Better add the first key field of the WHERE condition as said above and check
    + whether the driver table is empfty
    + and whether there are duplicated entries
    ... And it is also a good idea to really use the SINGLE RECORD BUFFER, therefore you must write
    field-symbol:  <fs>  type ...
    LOOP AT gt_street_district ASSIGNING <fs>
       SELECT *
                    INTO TABLE gt_adrstreet1
                    FROM adrstreet
                    WHERE counrty =
                     AND       strt_code = <fs>-strt_code.
    ENDLOOP.
    Then it will be extremely fast!

  • COMMUNICATION_FAILURE in CALL FUNCTION STARTING NEW TASK/Background task

    Hi friends,
    I am trying to use a FM in a Print Program (when user prints a document), using
    CALL FUNCTION STARTING NEW TASK 'TASK' DESTINATION 'NONE'.
    The program is triggered from VL02N tcode.
    But it's giving an exception - COMMUNICATION_FAILURE. Message is Error when opening an RFC connection
    I also tried
    CALL FUNCTION IN BACKGROUND TASK as Separate Unit
    then error message pops up - Database error when recording transactional RFC
    We are attaching a PDF file of the print to content server within this function module and because the "attaching" takes a while, this part needs to be detached from the print program so that we can avoid performance issue.
    I can't figure out the issue. i gues this is happening because print program is already running in Update task. I also tried with RFC enabled FM. Please help me resolve/understand the issue.
    Appreciate your help.
    Regards,
    Ronjan.

    Hi Ronjan,
    COMMUNICATION_FAILURE. Message is Error when opening an RFC connection
    I guess the reason for the above is that every RFC call synchronous/Asynchronous issues a DB COMMIT and we cannot have DB COMMITs in the V1/V2 updates, please go through the link below.
    http://help.sap.com/saphelp_nw70ehp2/helpdata/en/23/e9aa61638e404d81575e939b5cd847/frameset.htm
    Now, the possible solutions i can think of are,
    1) Call the FM in update task delayed start and try.
    2) Or create a report program and use SUBMIT (look at the job options as well).
    @Mainak
    3. Write a statement COMMIT WORK AND WAIT. This will actually invoke the FM
    Mainak, this will lead to a Update termination, as the program is running in an update task.
    Regards,
    Chen

  • Parallel Processing Issue : call function starting new task

    Hi
    I am using the parallel processing functionality using the call function new task  destination in group default  Performing    on end of task  inside a loop ( i am splitting the internal table )
    However when i am debugging the code, i am able to see the function module( it opens a new session in debugging ) ,  and i see that new task is started after the RFC Function module is executed .
    How is this parallel processing ? I mean the new task starts after control returns back to main program , after the execution of the RFC FM.
    I thought the idea was to have the same FM executing in multi threads. So that time is saved.

    Thanks for the answers.
    There were too many  complications in the 'call function in new task '  option.
    So we are trying it with the job submit option. So we are splitting up the data into smaller tables and submiting it with this statement : Submit  'prog' with selection-table 's_sel' via job 'job' and return .
    Thanks

  • Call function creatung new task

    Hi friends,
    I am running f110 in background...I have a Z function module which runs in update task....Insoide the z function module i have another rfc enabled function module where the updating of the docs is taking place....i am not able to get into the code of third fm through debugging...I have covered max scenarios of debugiing session external update system but none is fruitfull.
    also,i have put infinite loop to see in sm50 ...there also i dont have rights...
    could somebody tell me ow i get into the code through debugging
    kanishak

    Hi Kanishak,
    if you call the function creating NEW TASK, you won't get to debugger easily: The function is enqueued in a TRFC queue which you could stop - but as you are not allowed SM50 you won't be allowed TRFC  queue administration.
    If you are allowed to use transaction SAAB, you can create and activate a checkpoint group. Use statement LOG-POINT to record contents of some program fields. Then you can see what is happening in background of background.
    Regards,
    Clemens

  • Call function starting new task:

    I am trying to create a program in which few database update are mentioned.
    after database updates , I am calling a function module using starting new task
    in which I want to commit database updates inside in function module.
    Problem is I want to commit only database updates if function module , not of main program. For that I tried using COMMIT WORK in function module and rollback statement after calling FM.  But it is not working.COMMIT statement in FM also commiting database updates of main program also that is not required.
    Can anybody help me in solving this problem.
    Thanks
    Ruchika

    I think this may be caused by an implicit database commit performed by the system at the moment of calling a fm with "starting new task".
    Try the following test:
    - Put "rollback work" statement inside your fm which you call "starting new task" (instead of "commit") and check if the updates performed by the code executed before the call to this fm are stored in db - inspite of the rollback. If they are (as I suppose) this means that the commit effect you observe is not due to the "commit work"  statement executed inside your fm but due to an implicit commit issued automatically at the time of calling the fm. If this is the case the solution could be placing the code which you now execute before "call function...starting new task" into a seperate fm called "in update task" - then the final commit or rollback statement in your main program should have the expected effect.
    regards

  • Call Function STARTING NEW TASK ----- Resource not available

    Hi All,
    I am calling a Function Module in new task using STARTING NEW TASK.
    If the resources are not available for the Dialog Process to start, for how long will SAP keep on trying to acquire the resources and in case if it fails to acquire resource, then what will happen
    Regards,
    Abhishek

    Hi,
    From memory (as it is a long time since I've done this) you can call another function module or SAP command that will tell you how many work processes are currently available before you actually then start the new task.  This can help you to avoid this issue and also stop you from eating up all available work processes on a system which will annoy all other users!
    I think this is the FM
    CALL FUNCTION 'SPBT_INITIALIZE'
      EXPORTING
        group_name     = 'parallel_generators'
      IMPORTING
        free_pbt_wps   = w_free_processes
      EXCEPTIONS
        OTHERS         = 1.
    Gareth.

  • CALL FUNCTION STARTING NEW TASK Debug

    Hi,
    How can you debug a function module which is called with an add on 'STARTING NEW TASK' ?
    Thank you.

    Hi,
    the only way i know is :
    1. Create an endless loop in the FM like:
    clear x.
    do.
    if x = 1. exit. endif.
    enddo.
    Now run the program. If you call the sm50 trx you'll see a new task : your function module. Now get the session in debug (Menu Program/Sessio -> Program -> Debugging) and change the x value to exit form the loop. Continue with the debug.
    Regards
    Andrea

  • CALL FUNCTION STARTING NEW TASK  DESTINATION

    Hi All,
    I have tried to use CALL FUNCTION 'ZWHV_TEST' STARTING NEW TASK 'TEST' DESTINATION 'NONE' But it didnt work.
    Please explain me  to use above statement and detail me more about NEW TASK 'TEST'.
    How to declare TEST in new task ?
    Thanks ,
    Vinay.

    >
    Vinay parakala wrote:
    > ...But it didnt work.
    Moderator message - Give more information please in a new thread - post locked

  • Facing problem in call function starting new task taskname

    Hi all,
    when i call a function module using starting new task, it is failing with sy-subrc 3. can anyone guide me in this.
    see the code :
      DATA   lv_taskname(7) TYPE c VALUE 'PEM_EXE'.
        CALL FUNCTION 'PEM_SCHEDULE'  STARTING NEW TASK lv_taskname
             EXPORTING
                  iv_packid             = gv_packid
                  iv_pebid              = ls_alv_out-peb_id
             EXCEPTIONS
                  invalid_state_request = 1
                  database_error        = 2
                  OTHERS                = 3.
    Thanks in advance.
    Best Regards,
    Prashant

    when i change the function module from normal to remote, it gives me a error that the "generic types are not allowed in RFC", but i have not given any generic type in the parameters.
    see the signature of the function module.
    *"  IMPORTING
    *"     VALUE(IV_PACKID) TYPE  CNVMBTPACK-PACKID
    *"     VALUE(IV_PEBID) TYPE  CNVMBTPEB-PEB_ID
    *"  EXPORTING
    *"     VALUE(EV_ERROR_DETECTED) TYPE  C
    *"     VALUE(EV_STOP) TYPE  C
    *"  EXCEPTIONS
    *"      INVALID_STATE_REQUEST
    *"      DATABASE_ERROR
    *"      FORIEGN_LOCK
    Can u please check it and find out the problem
    Thanks,
    Prasanth

  • Call function starting new task - Issue with memory variables

    Hi All,
      From our OIL application we have a call to the core delivery update FM WS_DELIVERY_UPDATE starting new task.Before the call we are exporting a variable to memory and deep inside the FM we have an oil routine which checks the value of this variable to decide on further flow. But since the FM is called in new task the variable is not available here.
    We cannot use the SET GET parameter also as this value can be different for each session.
    Can anyone suggest how to set and get the parameter value in this flow.
    With regards,
    Usha

    Hi again,
    To check whether the FM is running in new task or not - This is what I have tried (this may not be the best way), but it works fine.
    1. The variable to check inside the called FM is SY-CPROG.
    2. This variable will have value.
    RS_TESTFRAME_CALL - If being checked from se37
    Z / Y program                - if called from the original z / y program (WITHOUT new task).
    SAPMSSY1  - if being called using NEW TASK (and no debugging)
    hope this helps.
    Regards,
    Amit Mittal.

  • Call function in new task in RECEIVE RESULTS module

    Hello Gurus,
    at the end of one of the parallel tasks I have in my program I have to trigger a new task. The problem is that this is not permitted
    Does anyone have a solution for this very very nasty problem?? I can't belive this is not possible.
    I am starting about 8 tasks and after each one is ready I have to start the next set of tasks but do not want to wait until all of them are finished.
    Regards,
    Ioan.

    Normally you control starting of new tasks via global counters (one of the very few reasons to use global variables...) that track the number of tasks started and finished, and compare that to the number of DIA processes reserved for the parallel RFC action using the WAIT UNTIL command. This way new tasks are started once processes become available again.
    I don't see a reason to start new tasks in the RECEIVE RESULTS section, and it's obviously not allowed anyway.
    Thomas
    P.S. now I see the previous reply, but I'll let mine stand nevertheless

  • Call function '' in update task - code inside is BDC

    hi to all,
    in using call function '' in update task
    the code inside is bdc. is this possible? 
    my scenario is from VA01 then post billing to VF01,
    i am using user-exit MV45AFZZ in subroutine userexit_save_document.
    i need to post billing after va01 save.
    thanks to all.

    To debug in the update task, you have to set that option on in the debugger.
    If the user exit runs in the update task, then you must have something like: CALL FUNCTION MODULE my_fm_to_do_BDC STARTING NEW TASK.   ( This function module should wait until the SD is created.  You might want to check in a loop, with a WAIT command.   Once it is created, then you start your BDC and CALL TRANSACTION. )  This is NOT an update function module.  It may need to be RFC enabled - I'm not certain at the moment.
    If the user exit doesn't run in the update task, you need to create, and call from the user exit, an update function module that calls your function module "my_fm_to_do_BDC" STARTING NEW TASK. 
    The attribute "collective run", which is V3, means that the update task won't run that function module until a regularly scheduled job on the application server runs.  For processing to run during the rest of the SD save, you must use V1 (could be run in any order with other V1s) or V2 (Will run after V1, but in any order with other V2s).  Typically, I use V2 for this kind of task.
    matt

  • Call function in background task... How to get the result?

    I want to use Call function in background task parameter.
    But I cannot find the result of this function. (No export parameter, no table result, no exception)
    How to get the result of this function module? Correct or not?

    Hi Heinz,
    You can check the result in SM58 transaction.
    For more information pls. refer this thread :
    No IMPORTING parameters allowed in CALL FUNCTION IN BACKGROUND TASK
    Best regards,
    Prashant

  • Save Order - Call function in background Task

    Hi all,
    I have written a function module which is called in order save Badi and copies the system status on the Master contract to the sub contracts.
    This works fine but when I call this function in background task the status is not getting copied over.For testing I have created a program similar to function module and scheduled that in background and this was working as required.
    Can someone please let me know if I missed out anything or how can i resolve this issue.
    Any inputs in this regard would be very helpful.
    Thanks and regards,
    Vijay

    Hi Heinz,
    You can check the result in SM58 transaction.
    For more information pls. refer this thread :
    No IMPORTING parameters allowed in CALL FUNCTION IN BACKGROUND TASK
    Best regards,
    Prashant

Maybe you are looking for

  • Adode Creative Suite 3 Crashing OSX 10.9.1

    I've had Adobe Creative Suite 3 for awhile now (I mainly use Photoshop, Dreamweaver and Illustrator).  And nearly every day, one of my programs crashes while I'm using it.  I've gotten in a habit of saving often to prevent losing anything, but it's j

  • Mass maintenance of internal order groups

    Hello everyone, I need to create an internal order group with a large number of subgroups, each with a few internal orders assigned to it, and I am looking for ways to automatize this procedure. I am equally concerned about any changes to the hierarc

  • DQS installation fails: Exit code 255

    Hello, I am having a heck of a time installing DQS.   I have tried installing from command, from specific Instance directory, etc.  No matter what method , the below error is thrown.  Also, There are no system restrictions, elevated prompt issues, et

  • Artifacts with Mercury GPU Acceleration.

    Hello there, I hope someone will be able to help me with a problem that has just started to occur on my PC. I have Premiere Pro CS5 (5.0.3). When I have the renderer switched to "Mercury Playback Engine GPU Acceleration" in project settings all my cl

  • E71: Is there somthing like ipconfig/command promp...

    Is there something like a command prompt on the E71 where I can run something similar to ipconfig?  When I goto the address of 192.168.1.1, I normally get the local wifi routers prompting for passwords...... but now theres a new access point appearin