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.

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 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 - 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.

  • 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 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

  • 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

  • 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 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

  • Behaviour of CALL FUNCTION fname STARTING NEW TASK DESTINATION 'NONE'

    As per ABAP help documentation, the statement CALL FUNCTION fname  STARTING NEW TASK DESTINATION 'NONE' should create a new main session in  same user session.The behaviour is wrong as per documentation.
    But  current behaviour:
    The statement CALL FUNCTION fname STARTING NEW TASK DESTINATION 'NONE'   is creating a new user session.
    Any reason?

    Hi Prakash,
    I'd agree with Suhas, that you're reading the documentation wrong. Here's your quote:
    As per ABAP help documentation, the statement CALL FUNCTION fname STARTING NEW TASK DESTINATION 'NONE' should create a new main session in current user session.
    If you look at the help, you can see that it says:
    When the destination NONE is used, a new main session is opened for the current user session.
    Do you see the difference? Also, note that in this context main session basically means that we're talking about a new external session:
    Each task ID defines a separate RFC connection with its own context, meaning that, in the case of repeated function module calls of the same task ID, the global data of the relevant function group can be accessed, if the connection still exists.
    In dialog processing, note that the maximum number of six main sessions cannot be exceeded, else an error message is displayed.
    If you're still in doubt, check out the online ABAP documentation for [CALL FUNCTION - STARTING NEW TASK|http://help.sap.com/abapdocu_70/en/ABAPCALL_FUNCTION_STARTING.htm]. So I'd say the documentation is in line with the actual behavior.
    Cheers, harald

  • Problem in Call function .. starting new task

    Hi,
    I want to execute a dialog program in background. I am trying to use call function starting new task.
    I am facing some syntax issue. Can any one guide me how to use call function starting new task. The function module is RFC FM. Do we need to define task some where before use please guide.
    Thanks in advance. A sample program will be gr8.

    Hi,
    Incase you want to call a RFC FM in background you can call ity like this.
         call function 'Y_L_TO_CREATE_HUPAST' in background task
                 exporting
              venum   = y_v_venum
              backg   = 'X'
               buser   = y_lv_uname
              langu   = sy-langu
              objky   = y_lv_objky
              printer = y_lv_printer.
    Here Y_L_TO_CREATE_HUPAST is a RFC FM.
    Regards,
    Ankur Parab

  • STARTING NEW TASK

    can ny 1 give me a simple example as to WHY call function STARTING NEW TASK is used ???
    i need a very very simple example to demonstrate the concept

    hi there...
    Syntax
    CALL FUNCTION func STARTING NEW TASK task
                  DESTINATION {dest
                  parameter list
                  {PERFORMING subr}.
    Additions:
    1. ...DESTINATION IN GROUP { group |DEFAULT}
    2. ...{PERFORMING subr}|{CALLING meth} ON END OF TASK
    Effect
    Asynchronous call of a remote-capable function module specified in func using the RFC interface. You can use the addition DESTINATION to specify a single destination in dest, or to specify a group of application servers by using IN GROUP. The latter supports parallel processing of multiple function modules. The calling program is continued using the statement CALL FUNCTION, as soon as the remotely called function has been started in the target system, without having to wait for its processing to be finished. You can use PERFORMING and CALLINGto specify callback routines for copying results when the remotely called function is finished. Character-type data objects are expected for func and dest.
    If the destination has not been specified, the destination NONE is used implicitly. When the destination NONE is used, a new main session is opened for the current user session. The asynchronous RFC does not support communication with external systems or programs written in other programming languages.
    A character-type data object must be specified for task, one which contains for the remotely called function module a freely definable task ID that has a maximum eight digits. This task ID must be unique for each call, and is handed to the callback routines for identifying the function. Each task ID defines a separate RFC connection with its own context, meaning that, in the case of repeated function module calls of the same task ID, the global data of the relevant function group can be accessed, if the connection still exists.
    In dialog processing, note that the maximum number of six main sessions cannot be exceeded, else an error message is displayed.
    Addition 1
    ... DESTINATION IN GROUP {group|DEFAULT}
    Effect
    Specifying IN GROUP as a destination allows you to execute multiple function modules in parallel on a predefined group of application servers in the current SAP system.
    For group, you must specify a data object of the type RZLLI_APCL from the ABAP Dictionary, one that is either initial, or one that includes the name of an RFC server group created in transaction RZ12. When specifying DEFAULT, or if group is initial, all application servers that are currently available in the current SAP system are used as a group. Only one RFC server group may be used within a program. During the first asynchronous RFC using the addition IN GROUP, the specified RFC server group is initialized. For each asynchronous RFC where the group is specified, the most suitable application server is determined automatically, and the called function module is executed on this.
    If the function module cannot be executed on any application server, due to not enough resources being currently available, this leads to the predefined exception RESOURCE_FAILURE, to which a return value can be assigned, in addition to the remaining RFC exceptions. For this exception, the addition MESSAGE is not permitted.
    ·        The parallel processing of function modules using the addition IN GROUP makes optimum use of the resources available, and is preferred to self-programmed parallel processing with destinations that are specified explicitly.
    ·        An application server that is used as part of an RFC server group for parallel processing must have at least three dialog work processes, of which one is currently free. Other resources such as requests in the queue, number of system logons and so on, are also taken into account, and are not allowed to exceed certain limit values.
    ·        To ensure that only those application servers that have enough resources are accessed, we recommend that you work with explicitly defined RFC server groups instead of working with the addition DEFAULT.
    ·        The function modules of the function group SPBT provide service functions for parallel processing, for example, initialization of RFC server groups, determining the used destination, or temporarily removing an application server from an RFC server group.
    Addition 2
    ... {PERFORMING subr}|{CALLING meth} ON END OF TASK
    Effect
    You can use this addition to specify either a subprogram subr or, as of Release 6.20, a method meth as a callback routine, which is executed after the asynchronously called function module has finished. For subr, you have to directly specify a subprogram of the same program. For meth, you can enter the same details as for the general method call.
    The specified subprogram subr can have exactly one SING parameter of type clike only. The method meth must be public, and can have only one non-optional input parameter p_task of type clike. When the RFC interface is called, this parameter is supplied with the task ID of the remotely called function that was specified in the call in task. The results of the remote function can be received in the subprogram subr or method meth using the statement RECEIVE. In the callback routine, no statements can be executed that cause the program run to terminate or end an SAP LUW. Statements for list output are not executed.
    Prerequisite for executing a callback routine is that, after the remote function has ended, the calling program is still internally available. It is then executed the next time the work process is changed. If the program has ended, or if it is part of a call sequence in the stack, then the callback routine is not executed. The statement WAIT can be used to stop the program execution until certain or all callback routines have been executed.
    CALL FUNCTION - STARTING NEW TASK parameter_list
    Syntax
        [EXCEPTIONS exc1 = n1  exc2 = n2 ...
    Effect
    These additions are used to assign actual parameters to the formal parameters of the function module, and return values to exceptions that are not class-based. These additions have the same meaning as for the synchronous RFC. The only exception is that no values can be copied with IMPORTING and CHANGING.
    do reward if helpful

Maybe you are looking for

  • Need help finding a symbol library...

    hi, i created a postcard in illustrator (i believe it was a trial version, but i don't remember which version) and used some nice swirly images that i believe were from one of the symbol libraries. i've tried finding the symbols again (not a type sty

  • Calendar function not working in report launch form

    We are currently using Headstart 6.5.3.1 for 9i. When we invoke the calendar function for a date parameter in the report launch form (qms0012f), we get the error-message ORA-6508: could not find program unit being called in PL/SQL Program Unit qms$ca

  • JCo Server does not start

    Hi, I'm trying to create and start a JCoIDoc.Server on a Web Application Server 700 system. Because I could not find the required classes in the trfc.jar archive on the server I downloaded and packaged the required java connector classes sapidoc.jar

  • OEM not start

    Hello, I had too this problem, there were two reasons : a bad tnsnames.ora (perhaps a same services names appears 2 or more time), and the service OracleOraHome81ManagementServer is not start. Good luck,

  • Shop paper SAP script

    Hi dears,              I  need a change in the work order shop papers              How i can view the Shop paper SAP script  & what is the path ? Regards, M.Alagesan