Calling fm in new task only when it is possible.

I'm calling a fm in a new task, and I need to check it is possible to open a new task before proceeding.
How can I check the number of open tasks? How can I check the maximum number of tasks allowed?
Thanks in advance.

Hi!
You don't have to check it, it is handled by SAP automatically.
The only requirement, there has to be at least 3 dialog processes in your SAP system.
For this check transaction SM50.
Because startin an FM in a new task is an asyncronous processing, it's result is not important to your program run.
Regards
Tamá

Similar Messages

  • 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

  • Hello, I have bought an iphone two weeks ago. Now I have a big problem. Whenever I receive a phone call, the caller could not heare me only when I switch to the handsfree speakers phone. The same issue accurs, when I call somebody.

    I have an iphone and whenever I receive a phone call, the caller could not hear me only when I switch to the hansfree speakers phone. the same issue occurs whenever I call somebody. Could anybody help me?

    Hi
    You should ask your relative to physically take the iPhone to the store rather than shipping it because as diesel vdub has said:
    "No Apple store will accept an iPhone shipped to them"
    All you have to do is safely pack and ship your iPhone from the Philppines to your California-based relative.
    HTH?
    Tony

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

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

  • 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

  • Load new data only when needed

    I am trying to reduce the number of unnecessary load request to the server. I have this:
    var ds1 = new Spry.Data.XMLDataSet("test2.php", "export/row", {sortOnLoad: "grade_id", sortOrderOnLoad: "ascending", distinctOnLoad: true, useCache: false, loadInterval: 2000});
    But I want to update regions associated with this dataset only when i click a button, that way i dont kill the server , what is the best way to do that.

    Call ds1.loadData(); when you click the button.

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

  • 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

Maybe you are looking for

  • Possible to redefine function keys via Ansi ESC sequences in terminal?

    If it is possible, I would be be very grateful if somebody could be so kind as to show me a couple of examples. BACKGROUND: I want to reconfigure my function keys in terminal,via ansi-escape-sequencenses from a script, before invoking the "screen" ut

  • Syntax error in For Loop statement

    Hello Normally my FOR staements have not been a problem as only access one table. I the example below I am accessing three table and therefore I get a Syntax error. I only wish to select the "Product" recored but need the other table to enable the se

  • How to deploy oracle BISE one

    Hi all, Is there any doc to be followed for deployment of  BISE one on any application. Regards, Mahesh

  • What happens with iphoto with the new software

    I downloaded the new software os x for my mac and now I can't open iphoto, did I lose my pictures?

  • Conditional display of buttons in a report

    Hello all, I'm a beginner in HTMLDB 2.0 so excuse any obvious mistake of mine! I have a report about the running status of some procedures. I wanted to had a button to each line of the report to start or stop that procedure. If the line contains a Y