Starting new task in FM
Hi,
I have FM 'update_table' with asynchrounous call(FM which use starting new task). This FM updates the table and commits the work.But when I try to read the datas from table I don't get the updated datas.This happens only in in real scenario.
When I try to debug the program it works fine and I get the updated data.
Let me know how to resolve the issue?
thanks
Suganya
Hi,
As you want to update table in the function module, are you calling this fm in UPDATE TASK?
Here are more details about the command.
CALL FUNCTION func IN UPDATE TASK.
Extras:
... EXPORTING p1 = f1 ... pn = fn
... TABLES p1 = itab1 ... pn = itabn
Effect
Flags the function module func for execution in the update task. It is not executed at once, but the data passed with EXPORTING or TABLES is placed in a database table and a subsequent COMMIT WORK then causes the function module to be executed by the update task. Update function modules must be flagged as such in the Function Builder
The return value is not set.
Addition 1
... EXPORTING p1 = f1 ... pn = fn
Effect
Values of fields and field strings specified under EXPORTING are passed from the calling program to the function module. In the function module, the formal parameters are defined as import parameters. In the interface definition, default values must be assigned to all import parameters of the update function module.
Addition 2
... TABLES p1 = itab1 ... pn = itabn
Effect
TABLES passes references to internal tables. All table parameters of the function module must have values.
Note
With update function modules, both import parameters and exceptions are ignored when the call is made.
1. During updating processes of function modules, you may not make any calls using the language statements SUBMIT, CALL DIALOG, CALL SCREEN, CALL TRANSACTION, COMMIT WORK or ROLLBACK WORK . All other language elements that trigger a database Commit (for example, a screen change using the MESSAGE statement) also lead to a runtime error during updating.
ashish
Similar Messages
-
Hello,
I created a test report for parallel processing and this works perfectly fine but when I try to build this into a class I somehow cannot create the receiving form inside the method of the class...
method test.
CALL FUNCTION 'ZZCR_PARALLEL' STARTING NEW TASK lv_index DESTINATION IN GROUP DEFAULT
PERFORMING transfo_result ON END OF TASK
EXPORTING
input_xstring = lx_clause_text.
endmethod.
I tried to place the form before the endmethod but this doesn't work and afterwards is also not an option.
Is ABP OO not supporting parallel processing?
Thanks and regards,
ChristophHello Christo ,
I am also trying to use the same in OO context . Just in he early stages of collecting information.If you could just tell what you found out in the document it could be opf immense help.
Comradely,
K.Sibi -
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 -
Call Function'BAPI_USER_CHANGE' starting new task 'TEST'
Hi All,
I have problem with starting new task statement, I am using one FM after that am using starting new task 'TEST'
statement but its not working in one system its working fine in other systems, Please help me who this works.
Thanks in Advance.
Eg: Call Function'BAPI_USER_CHANGE' starting new task 'TEST'
RegarThanks Lqueiroz ,
Now again i am getting a DUMP by saying ,
"An error occurred when executing a REMOTE FUNCTION CALL.
It was logged under the name "At least one entry could not be "
on the called page."
so what can be the reason for this
call function 'ZRFC_PER_DIEM' starting new task lc_taskid performing subr on end of task
exporting
h_guid = it_header_guid_n
request_obj = lt_requested_objects_n.
wait up to '1' seconds.
read table gt_scl into ls_scl index 1.
p_transaction_per_diem = ls_scl-value.
read table gt_scl into ls_scl index 2.
transaction_currency_code = ls_scl-value.
form subr using task_id type clike.
data: p_transaction_per_diem type char13,
transaction_currency_code type char3.
receive results from function 'ZRFC_PER_DIEM'
tables
value = gt_scl.
So basically i am getting dumo when receive statenment is running , by giving above dump.
Regards
PG -
CALL FUNCTION func STARTING NEW TASK task
hi,
i developed rfc to extract data and send to xi
as my interface is Async
as per soem documents it was mentioned the syntax
CALL FUNCTION func STARTING NEW TASK task
wat is the task ? in the syntax
and how do i use it
jeffHi suresh,
this is the code of RFC. if i execute without RFCDESTINATION it executes successfully. when i use RFC DESTINATION it shows error
call to messaging system failed: com.sap.aii.af.ra.ms.api.DeliveryException
i created RFC destination using TCP/IP and registered program. same parameters i am mentioning in XI.
FUNCTION z_bank_reconciliation.
""Local interface:
*" IMPORTING
*" VALUE(COMP_CODE) TYPE BUKRS
*" VALUE(HOUSE_BANK) TYPE HBKID
*" VALUE(ACCOUNT_ID) TYPE HKTID
*" TABLES
*" CHQDETAILS STRUCTURE ZPAYR
DATA: itab LIKE payr OCCURS 0 WITH HEADER LINE.
DATA: jtab LIKE payr OCCURS 0 WITH HEADER LINE.
DATA: it_bank LIKE zbankrecon OCCURS 0 WITH HEADER LINE.
DATA: it_bank1 LIKE zpayr OCCURS 0 WITH HEADER LINE.
TYPES : BEGIN OF ty_bseg ,
bukrs LIKE bseg-bukrs,
hbkid LIKE bseg-hbkid,
belnr LIKE bseg-belnr,
zlsch LIKE bseg-zlsch,
kostl LIKE bseg-kostl,
hkont LIKE bseg-hkont,
bzdat LIKE bseg-bzdat,
END OF ty_bseg.
TYPES : BEGIN OF ty_t012 ,
bukrs LIKE t012-bukrs,
bankl LIKE t012-bankl,
bankn LIKE t012k-bankn,
END OF ty_t012.
TABLES : payr, t012, t012k, bseg.
DATA : itpayr LIKE zpayr OCCURS 0 WITH HEADER LINE,
itt012 TYPE STANDARD TABLE OF ty_t012,
itbseg TYPE STANDARD TABLE OF ty_bseg,
wa_itt012 TYPE ty_t012,
wa_itbseg TYPE ty_bseg,
total TYPE n.
SELECT * FROM zbankrecon INTO TABLE it_bank
FOR ALL ENTRIES IN itab
WHERE chequeno EQ itab-chect.
SELECT abukrs abankl b~bankn
INTO CORRESPONDING FIELDS OF TABLE
itt012 FROM t012 AS a
INNER JOIN t012k AS b ON bbukrs = abukrs AND b~hbkid =
house_bank AND b~hktid = account_id
WHERE abukrs = comp_code AND ahbkid = house_bank.
DELETE ADJACENT DUPLICATES FROM itt012.
SELECT zbukr hbkid hktid vblnr gjahr zaldt checf chect znme1 rwbtr
waers zaldt zbnkl FROM payr INTO CORRESPONDING FIELDS OF TABLE itpayr
WHERE ( zbukr = comp_code AND hbkid = house_bank ) AND hktid =
account_id.
SELECT bukrs hbkid belnr zlsch kostl hkont bzdat FROM bseg INTO TABLE
itbseg
WHERE bukrs = comp_code AND hbkid = house_bank.
SORT itt012 BY bankl.
SORT itbseg BY belnr.
READ TABLE itt012 INTO wa_itt012 INDEX 1.
LOOP AT itpayr.
read table itbseg into wa_itbseg with key bukrs = itpayr-zbukr
hbkid = itpayr-hbkid.
if sy-subrc = 0.
itpayr-kostl = wa_itbseg-kostl.
itpayr-hkont = wa_itbseg-hkont.
itpayr-bldat = wa_itbseg-bzdat.
itpayr-zlsch = wa_itbseg-zlsch.
endif.
itpayr-zbnkl = wa_itt012-bankl.
itpayr-zbnkn = wa_itt012-bankn.
MODIFY itpayr.
APPEND itpayr TO chqdetails.
ENDLOOP.
LOOP AT chqdetails.
READ TABLE it_bank WITH KEY chequeno = chqdetails-chect.
IF sy-subrc NE 0.
MOVE chqdetails TO it_bank1.
APPEND it_bank1.
CLEAR it_bank1.
ENDIF.
ENDLOOP.
REFRESH chqdetails.
chqdetails[] = it_bank1[].
LOOP AT it_bank1.
MOVE : it_bank1-chect TO zbankrecon-chequeno,
sy-datum TO zbankrecon-check_date,
sy-uzeit TO zbankrecon-check_time.
INSERT zbankrecon.
CLEAR zbankrecon.
ENDLOOP.
ENDFUNCTION. -
CALL FUNCTION WITH STARTING NEW TASK
Hi All,
i'm call a function module through
CALL FUNCTION 'Y_WIN' DESTINATION 'rfc_destination' then it's give right result but when i want to call with starting new task then
CALL FUNCTION 'Y_WIN' STARTING NEW TASK 'INFO' DESTINATION 'rfc_destination'
it does nt provide me any data. i have check in debugger call fm is wkging fine so pls clear me why i'm nt geeting result.
pls give ur suggestions,
AnujDid you use the PERFORMING <form> ON END OF TASK to get the results back; like in the following sample
CALL FUNCTION 'SAPWL_STATREC_READ_FILE'
STARTING NEW TASK taskname
DESTINATION list-name
PERFORMING read_outtab ON END OF TASK
EXPORTING
read_start_date = s_date
read_start_time = '000000'
read_end_date = s_date
read_end_time = '235959'
EXCEPTIONS " failure when calling RFC
communication_failure = 1 MESSAGE msg_text
system_failure = 2 MESSAGE msg_text
RESOURCE_FAILURE = 3.
and
FORM read_outtab USING taskname.
* Receive results back
RECEIVE RESULTS FROM FUNCTION 'SAPWL_STATREC_READ_FILE'
TABLES
v2_normal_records = outtab
EXCEPTIONS " from the called FM
nodata = 1.
Regards -
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! -
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
RuchikaI 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 endless
Hi to all,
this post is ideally the continious of my previous post
"how to attach custom code after invoice create/modification".
Here the problem.
In the BADI of the invoice document i call a custom function module (F1) with the addition "in update task". This to ensure that the code inside is executed only if the commit is triggrered.
In this function module, i call another custom function module (F2), with the addition "starting new task".
This function module (F2) contains a batch that waits 10 seconds (to ensure the "standard" modify) and then modify the invoice document with my custom data (by a call transaction).
The problem is that this new task is .... endless !!
I watch it writing a log file after the call transaction. Using AL11, i watched that every 10 second, the file is updated.
Seems that this new task never ends: it call the trasaction, it writes the log file and the start again.
The only way i have to stop that, is modify manually the same invoice document with VF02 trx.
At exit, i don't save data (otherwise the endless cycle begins again) and then i watch that the log file stops to be updated.
This task must be executed just one time. I've already try to put "exit" instruction at the end of the function module, but it doesen't work, the task start again and again.
How i can solve this problem?
Usefull solutions/hints/ideas etc will be sure rewarded (as usually).
Thx a lot
Andrea>
Vinay parakala wrote:
> ...But it didnt work.
Moderator message - Give more information please in a new thread - post locked -
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,
UshaHi 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. -
ABAP Dump when calling Function Module Starting New Task
Hi all. I have a tricky situation now, I am doing a POC on parallel processing.
I am getting an ABAP dump on the following Call Function line which is in class lcl_steer_114numc (See below for full program):
METHOD start.
CALL FUNCTION 'Z_ZZCLS_STEER_114NUMC'
STARTING NEW TASK me->id
CALLING me->finish ON END OF TASK.
ENDMETHOD. "start
However I get the following ABAP dump:
Short text
Statement "CALL FUNCTION .. DESTINATION/STARTING NEW TASK/IN BACKGROUND TASK"
The function module only contains a wait statement to simulate parallel processing. It is strange that it dumps here, because when I change the FM call to another call that has been triggered successfully from other classes, it still produces the same ABAP dump.
The background of the Proof Of Concept is to see if I can get an event to trigger the next process that depends on the outcome of the previous process. Parallel processes are run in the start methods by calling RFC.
<Garbled code removed>
Moderator Message: Please post relevant portions of the code only.
Edited by: Suhas Saha on Jul 17, 2011 1:17 PMWell, the thing is I did manage to run 3 other Function Modules asynchronously succeesfully prior to that function call, with the same exact function call syntax. Further more, I have tried editing it with your suggestion but I get the exact same dump.
The complete function group can be downloaded here (slinkee file):
https://docs.google.com/leaf?id=0B3sua1Bw4XK4ZmFhNzcwMTgtYzQ0Mi00NzQ4LTg5YTMtNDNlNWUxYTM2NTg3&hl=en_US
The complete program can be downloaded here (slinkee file):
https://docs.google.com/leaf?id=0B3sua1Bw4XK4YWJmNjU3ODYtODRmMy00Nzg2LThkNTUtZjNkNDRhZGQ3MTUw&hl=en_US
The complete ST22 dump can be found here:
https://docs.google.com/leaf?id=0B3sua1Bw4XK4ZDU1YmFkZDAtOTU5MS00ZTgwLWFlZTktNWZhMDUxMzJlZWNl&hl=en_US
Basically I ST22 gives me the following:
Runtime Errors RPERF_ILLEGAL_STATEMENT
Date and Time 17.07.2011 05:29:54
|Short text |
| Statement "CALL FUNCTION .. DESTINATION/STARTING NEW TASK/IN BACKGROUND TASK" |
|What happened? |
| Error in the ABAP Application Program |
| |
| The current ABAP program "Z_ZZB1_CLOSE_PERIOD_TEST2" had to be terminated |
| because it has |
| come across a statement that unfortunately cannot be executed. |
And it explains it here (but is not helpful / relevant at all) as I ran the program from SE38.
|Error analysis |
| There is probably an error in the program |
| "Z_ZZB1_CLOSE_PERIOD_TEST2". |
| The program was probably called in a conversion exit |
| or in a field exit. These are implemented by |
| function modules called CONVERSION_EXIT_xxxxx_INPUT/OUTPUT or |
| USER_EXIT_xxxxx_INPUT. |
| Conversion exits are triggered during screen field transports or |
| WRITE statements, field exits during field transports from the |
| screen to the ABAP/4 program. |
| In this connection, the following ABAP/4 statements are not allowed: |
| |
I hope you try to download the slinkee files and you will notice the call function I performed was no different than the other call function RFC calls that really are working. -
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,
AbhishekHi,
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. -
Question on parallel processing using the STARTING NEW TASK keyword
I have the following code in a program on my development system:
call function 'FUNCTION_NAME'
starting new task ld_taskname
performing collect_output on end of task
exporting
pd_param1 = ld_param1
tables
pt_packet = lt_packet.
You'll notice in the code above I left out the following part of the function call:
DESTINATION IN GROUP group
In my one-server development system the topmost code executes fine, but I'm getting a 'REMOTE FUNCTION CALL ERROR' when I execute this in a multi-server Q&A system.
My question: Is the missing 'DESTINATION' keyword required in order for this technique to work in a multi-server environment or is it optional keyword? I made the assumption that since it worked in my development environment that without the 'DESTINATION' addition the system simply used the current logged on system to start the new processes.
Any input appreciated.
Thanks,
LeeHi Lee,
Just take F1 help on CALL FUNCTION key word and go to the variant
CALL FUNCTION func STARTING NEW TASK task
[DESTINATION {dest|{IN GROUP {group|DEFAULT}}}]
parameter_list
[{PERFORMING subr}|{CALLING meth} ON END OF TASK].
This gives you very clear information about this Key word.
No one would give you better information better than this, i hope
Cheers
Ram -
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 -
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
Maybe you are looking for
-
How do I save a Numbers spreadsheet as an earlier version
I have just upgraded to Yosemite from Snow Leopard. I have a spreadsheet which I have sent to a third party and they are unable to open it as they are on an earlier version of Numbers. How do I save my spreadsheet in the format which they can open?
-
Sharepoint 2010 document library pdf files are storing in browser cache when it is opened in browser
i have sharepoint 2010 site which consists of document library with pdf files if we click on pdf file it will open in browser .But the thing is it is storing in browser cache so i need to restrict that pdf to not store in browser cache. A,ny sugge
-
Find out user's screen size ?
Is it possible to find out the size of the user's current browser window in pixels in WebDynpro for ABAP? (i need this because I have a popup that is 100% high and 100% wide (works well), and on that popup I want to add a GANTT control with 100% widt
-
Matrix Reports Orientation!
Hi, I have the following situation: Report Orientation: Landscape. Paper Size: Letter Report Type: Matrix. My matrix report fetches 20+ COLUMNS and 80+ ROWS. In this situation, neither all ROWS nor all COLUMNS fit on one page. What happens is, when t
-
Upright Batch not working properly/individually
Hi, according to https://helpx.adobe.com/de/lightroom/help/upright-automatic-perspective-correction.html , upright is analyzed for each picture individually, when only selecting the "upright mode" and not "upright transformation" when syncing/copying