CALL fucntion update task
why does it not allow me to set the import para for func module when atribute is set as update mode...
Hi
You can call it three times. It will be executed simultaneously ad the data which was there at the time of call will be visible in update task.
For example
CALL FUNCTION F1 IN UPDATE TASK
EXPORTING
P1 = W1.
CALL FUNCTION F1 IN UPDATE TASK
EXPORTING
P1 = W2.
CALL FUNCTION F1 IN UPDATE TASK
EXPORTING
P1 = W3.
COMMIT WORK .
It would execute 3 times in update task in the sequence above . You can even test in debugging - , put a break point on commit work. In debugging mode enable Update debugging in settings tab ( -> SAVE ) . Press F8 , another window of update task will open . Here BREAKPOINT -> AT FUNCTION -> <F1> . You will see that your code stops in the FM 3 times with different parameter values W1/W2/W3 .
Cheers
Similar Messages
-
I need to have COMMit WORK with in a FM, which is calling in UPDATE task
Hello
I am sending out the custom IDOC from SAP to partner application by writing a custom my_OB_IDOC_FM, well.
With in this my_OB_IDOC_FM, for some functionality, i am using a standard SAP FM and I need to use a COMMIT WORK immediately after this standard SAP FM call.
But, all my IDOC is calling in update task, so once am triggering IDOC (inturn my_OB_IDOC_FM is calling in UPDATE task) am getting dump because of that inside used COMIT WORK statement!
So, pls. let me know how can replace this COMMIT WORK or hoe can i fix my issue? can i do like CALL FUNCTION standard_SAP_FM in background task/seperate task? so that i can use COMMIT WORK?
Thank youI've dealt with something similar before.
You could make a new z-program and run in a background job... like this:
* create the job
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = mv_JOBNAME
IMPORTING
JOBCOUNT = mv_JOBCOUNT
EXCEPTIONS
CANT_CREATE_JOB = 1
INVALID_JOB_DATA = 2
JOBNAME_MISSING = 3
OTHERS = 4.
* submit the program to the job
SUBMIT ZPROGRAM
WITH i_ebeln in mr_ebeln
WITH updall = 'X'
WITH wq_simul = ''
TO SAP-SPOOL
DESTINATION sv_output_device
IMMEDIATELY ''
KEEP IN SPOOL 'X'
WITHOUT SPOOL DYNPRO
USER sy-uname
VIA JOB mv_jobname NUMBER mv_jobcount
AND RETURN.
* submit the job
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = mv_JOBCOUNT
JOBNAME = mv_JOBNAME
STRTIMMED = 'X'
EXCEPTIONS
CANT_START_IMMEDIATE = 1
INVALID_STARTDATE = 2
JOBNAME_MISSING = 3
JOB_CLOSE_FAILED = 4
JOB_NOSTEPS = 5
JOB_NOTEX = 6
LOCK_FAILED = 7
OTHERS = 8. -
Function Module called in Update Task
Hi Gurus,
We are calling Sales Order Change in update task inside the user Exit MV50FZ1. We can see that the FM is called in update task after the commit work and the return of the FM shows the success message. But still the changes are not saved to the DB.
Can any one help me out with this one.
RashitHi,
If two commit works are called in update task the update will end up with error. Check whether any Commit work is present in the funtion module? If so you may use it in some other method like at save or something like that.
Regards,
Renjith Michael. -
Calling another FM, in the FM which is called in Update task
Hi Experts,
I have created the implicit enhancement in the Function module say 'X' .
This 'X' FM is called in Update Task.
Now i am calling another FM say 'Y' in this 'X' FM.
The FM 'Y' has got its own commit statement.It is updating some tables.
Here are my findings,
When i commented the explicit 'commit and wait' from the 'Y' Fm , the data that i needed to be saved was being saved and updated successfully.
However , when i added an extra parameter say 'No Commit' in the 'Y' FM to by pass the explicit 'commit and wait' , the FM 'Y' itself is not getting called for strange reasons.
The update gets interrupted.
Please suggest why this FM is not getting called.
Any thing that i may be missing.
Regards,
Abhishek KokateHope you have called the FM correctly with the additional importing parameter , also check if your FM is RFC enabled then check the "pass by value" option.
-
Function modules called in update task
Hi,
I am calling two function modules in update task sequentially. I want to know whether these two function modules are also called sequentially in update debugging also?
My code is like this
1. call FM1 in update task
2. Call FM2 in update task
will this be the same sequence at the time of execution also? or will it be random?
Thanks in advance.ya it will this be in the same sequence only...........
Regards
Anbu -
Do CIF BAdIs issue implicit COMMIT WORKS (for FM's called "in update task")
I am calling the CIF BAdI:
/SAPAPO/TR_TRANSFER.
In the PUSH_LANE_DATA method of this BAdI, I want to call a function module "in update task".
To trigger the actual execution of this function module, do I have to code an explicit COMMIT WORK in the BAdI or will SAP automatically generate a COMMIT WORK when the BAdI ends?Hope you have called the FM correctly with the additional importing parameter , also check if your FM is RFC enabled then check the "pass by value" option.
-
Function module In Update Task is called more than once
Hi experts!!
I had a requirement to Create a Customer ( i will call it B) when another Customer (A) is created (ON SAVE).
I used a Badi to implement the requirement, and inside my Badi i have 2 Function Calls in Update Task.
The first one to create Customer B and the second one to send Customer's B data to another System.
Even though the second function call is inside an IF-ENDIF condition ( so that only Customer's B data are sent) the function is called twice sending the same data. My guess is that since the First Function saves the Customer to the database, that is the reason why the second Function is called twice.
Is there any way i can control how many times a Function In Update Task is called????
Please help!!
Thank you in advance!!Hi BreakPoint & thank you for your reply!!
I tried your suggestion but even if i fill the flag during the first call the function is called twice. Looks like during the second database commit the function is called with the correct conditions met but twice.
Also while debugging it looks like it is only called once. It s very strange!
Any other ideas??? -
Update termination error while calling FM in Update task
Hi Friends,
I am calliing my Z Function Module in update task from my report, my function module contain reuse alv list display fm which should create a Spool in the spool list.
When ever i am directly executing my Z function module i am getting spool in SP01, but when ever i am calling the Z Function Module in update task from my report i am getting a message as "Express document "Update was terminated" received from author.
I want to call the Function module in update task and it should generate spools .
Syntax:
CALL FUNCTION 'ZLOK_TEST' IN UPDATE TASK.
Commit work.
Thanks Regards,
Sandipan jenaHi sandipan jena,
a function called in update task will not create a spool list if not told so to to. Only reports scheduled in a JOB will put the output into spool.
Make sure you have no COMMIT WORK and no MESSAGE output when in UPDATE TASK. You can enter /h and in debugger switch on UPDATE debugging. This will lead you to any error occurring.
You should analyze the errors you get. Mabe NEW-PAGE PRINT ON can help you.
Regards
Clemens -
Call function module in backgrouns task and in update task
Hi Gurus,Pls crear me on the " <b>Call function module in backgrouns task and in update task</b>".
how it works and waht is the link with LUW releated to these .
also heard that commit work statement aslo linked with this.
Pls clarfiy me with expalnation of code.Hi sridhar,
the explanation already given is correct and good. Small add-on:
All functions called during one LUW with addition IN UPDATE TASK are stored together with their actual parameters in a temporary memory area. The moment a COMMIT WORK is issued, the functions are released to be executed by a so-called update task which is running in the background. This explains why functions called in update task never return anything, no SY-SUBRC and no export or table parameters If a function called in update task raises an exception or runs into an error the calling user will get an express message informing about this. Also, all database updates done by this update process are rolled back to keep consistency.
This proceeding helps to keep database tables consistent and allows the user to keep on doing his work before all database updates are complete. You may have seen messages like "material will be changed" after saving. If you open the same material immediately, you'll get a message "object locked by...<yourself>". This means the update task is still running.
Regards,
Clemens -
Problem when using Call FM IN UPDATE TASK.
we plan to update ztable using Call FM in update task, and write the success/error message into log.
Does below is right?? I found the commit work can not be used here. Thanks..
CALL FUNCTION 'ENQUEUE_ETABLE'.
IF sy-subrc = 0.
CALL FUNCTION 'update_ztable'' IN UPDATE TASK.
Endif.
COMMIT WORK and wait.
IF sy-subrc <> 0.
ROLLBACK WORK.
write error log.
Else.
Write successful log.
Endif.
CALL FUNCTION 'DNQUEUE_ALL'.Hi ,
Please see the refernce of UPDATE FUNCTION MODULES:
UPDATE FUNCTION MODULE
-In the attributes tab, under processing type, choose Update Module,
Start Immediately. Define your import parameters, enter the source
code, All validations should have been done prior to the call to this
function module, so all you need in the source, is the updating of the
database, INSERT, MODIFY, UPDATE, whatever.
-When you call you function module, use IN UPDATE TASK, after the call,
COMMIT WORK. The commit work will trigger the db update.
Why do we use this " In Update Task " ??
The main update technique for bundling database changes in a single
database LUW is to use CALL FUNCTION... IN UPDATE TASK.
How do we Use ??
A typical R/3 installation contains dialog work processes and at least one update work process. The update work processes are responsible for updating the database. When an ABAP program reaches a COMMIT WORK statement, any function modules from CALL FUNCTION... IN UPDATE TASK statements are released for processing in an update work process. The dialog process does not wait for the update to finish. This kind of update is called asynchronous update.
What is the Use... ??
Asynchronous update is useful when response time from the transaction is critical, and the database updates themselves are so complex that they justify the extra system load
Real time scenario.
Suppose a user wants to change an entry in a database table, or add a new one. He or she enters the necessary data, and then starts the update process by choosing Save. This starts the following procedure in the ABAP program:
Firstly, the program locks the database entry against other users, using the enqueue work process (or the message server in the case of a distributed system). This generates an entry in the lock table. The user is informed whether the update was successful, or whether the lock could not be set because of other users.
If the lock is set, the program reads the entry that is to be changed and modifies it. If the user has created a new entry, the program checks whether a record with the same key values already exists.
In the current dialog work process, the program calls a function module using CALL FUNCTION... IN UPDATE TASK, and this writes the change details as an entry in table VBLOG.
When the program is finished (maybe after further dialog steps), a COMMIT WORK statement starts the final part of the SAP LUW. The work process that is processing the current dialog step starts an update work process.
Based on the information passed to it from the dialog work process, the update work process reads the log entries belonging to the SAP LUW from table VBLOG.
The update work process passes this data to the database for updating, and analyzes the return message from the database. If the update was successful, the update work process triggers a database commit after the last database change and deletes the log entries from table VBLOG.
If an error occurred, the update work process triggers a database rollback, leaves the log entries in table VBLOG, flags them as containing errors, and sends a SAPoffice message to the user, who should then inform the system administrator.
The corresponding entries in the lock table are reset by the update work process.
Q:We are calling Sales Order Change in update task inside the user Exit MV50FZ1. We can see that the FM is called in update task after the commit work and the return of the FM shows the success message. But still the changes are not saved to the DB.
A: check sm21 or sm13 to see if the update was successful .. In SM21 I checked. It is giving me the error Transaction Failed
Reward if useful
Thanks
Jagadeesh.G -
RE:CALL FUNCTION update_function IN UPDATE TASK
Hi,
Can anyone give a sample code or a simple scenario for CALL FUNCTION update_function IN UPDATE TASK .
Thanks in advance,
Alex.Hello George
In a project dealing with material master data I had the problem that I needed to update standard as well as customer tables at the same time when the user pushed the SAVE button.
For the standard tables I used BAPI_MATERIAL_MAINTAINDATA_RT (retail material) and for the customer tables I created my own SAVE function modules.
How to ensure that either both (standard and custom) tables are updated or not simultaneously?
I created a special SAVE function module which called both the standard BAPI and my custom SAVE function modules.
This "wrapper" SAVE function module was then called IN UPDATE TASK.
This way I created a LUW (logic unit of work) which comprised both standard and custom tables. If everything was ok both types of tables were updated, otherwise the entire transaction was rolled back.
Further reading: [Special LUW Considerations|http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbae3435c111d1829f0000e829fbfe/content.htm]
Regards
Uwe -
Authority-Check in UPDATE TASK CALL
Hi Gurus,
Does anybody know, from the Technical point of view, if there is any special issue with an Authority-Check put in a user-exit called in UPDATE TASK?
Thanks & Regards
Ernesto.Hello Michael,
Thank you for your reply. I was asking this because I have a problem regarding an Authority Check and I do not know what the problem is. In user exit EXIT_SAPLL03T_002 (executed in Update TASK) I want to check for Storage Type condition from the object L_LGNUM. The user that executes LT12 transaction has one role only that has object L_LGNUM like this:
Object L_LGNUM
Warehouse Number - LNUM = 200
Storage Type - LGTYP = 100, 200, 300, 400, 500, 600, 700, 800
The two checks I am doing are:
Check Source Storage Type
AUTHORITY-CHECK OBJECT 'L_LGNUM'
ID 'LGNUM' FIELD i_ltak_vb-lgnum (200)
ID 'LGTYP' FIELD ls_ltap_vb-vltyp (902)
Check Destination Storage Type
AUTHORITY-CHECK OBJECT 'L_LGNUM'
ID 'LGNUM' FIELD i_ltak_vb-lgnum (200)
ID 'LGTYP' FIELD ls_ltap_vb-nltyp (002)
And for no reason SAP doesn't return sy-subrc NE 0 when it should. I've checked the role and it has no conflict with another one as it is the only role the user has. Any idea?
Thanks & Regards
Ernesto -
Regarding calling the fuctional module Using 'in update task'
Hi ,
I want to call a Functional module Z-PS_VK11_FRC using the statement IN UPDATE TASK .
What is procedure to work with . can anybodt tell me how to proceed or give me some sample program .
Regards,
Shilpa TalluriFunction modules that run in update task can not return any values because your program has no longer control over the function module (the update task has).
UPDATE TASK fm mostly used to update database tables.
You don't any special coding other than calling fm UPDATE TASK
And in the attributes of function module you need to tick the Update mode and "Coll Run" so that it can be used to run individually in the V2 update process can be grouped together and run collectively.
a® -
Running Function Module in Background with Update Task is not working
Hello Friends,
I have a "Z" Report Program where I am running this Report in Background using JOB_OPEN, JOB_SUBMIT, JOB_CLOSE. I am calling this in BADI.
In this Report I am calling another Function Module PRICES_POST which is a standard Function Module and in this FM there is another FM 'CKML_UPDATE_MATERIAL_PRICE IN UPDATE TASK'. Now when I am running the BADI these values are not being updated.
Friends I would like to know whether can we run Function Modules which are included with UPDATE TASK as Background Job program?
Kindly help me in providing your valuable suggestions in proceeding further.
Thanks and Regards
Pradeep GoliUsually the sequence of CALLs in your report should look like
CALL FUNCTION 'CM_F_INITIALIZE'
EXPORTING
msg_on_screen = c_x.
CALL FUNCTION 'CKMS_BUFFER_REFRESH_COMPLETE'.
CALL FUNCTION 'PRICES_CHANGE'
EXPORTING
actual_bdatj = f_matpr-pp-bdatj
actual_poper = f_matpr-pp-poper
bukrs = p_bukrs
budat = p_date
xblnr = p_xblnr
TABLES
t_matpr = t_matpr.
READ TABLE t_matpr WITH KEY pp-xerror = ' '
TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
MESSAGE i046(ckprch).
ELSE.
CALL FUNCTION 'PRICES_POST'
EXPORTING
i_bktxt = p_bktxt
bukrs = p_bukrs
lis_update = 'X'
TABLES
t_matpr = t_matpr.
ENDIF.
COMMIT WORK.
If you forget the COMMIT-WORK each and every FM called in UPDATE TASK will not be triggered.
Regards,
Raymond -
Update tasks - Transfer Order creation.
I have an issue in our production environment where in some situations a Transfer Order (TO) is created with missing storage handling unit information. This only happens intermittently, and when the TO is cancelled and re-created, it is created with the correct storage unit information.
I have looked at the TO creation function l_to_create_int and it is called from within an update function module l_communication_to_create. The l_to_create_int function is not called within an update task. The function within l_to_create_int which creates the storage handling unit is an update function module (function L_TA_HINZUFUEGEN).
So my question is, what happens when you have a combination of function modules called as an update and function modules called normally? Will the updates in the function called normally update outside of the update task commit? I'm beginning to think that the problem may be caused by inconsistencies in when updates are completed by the program.
I'd greatly appreciate any help or guidance regarding this issue.
Kind regards,
James Mandikos.Hi James,
You are correct, a function module must be explicitly be called in 'UPDATE TASK' for it to be executed in the update task (regardless of the settings flagged in SE37).
If, however, it is called in UPDATE TASK there are four possible settings you can have in SE37 which each behave differently (as of the release I am looking at at the moment - R/3 4.7).
Here is my understanding of how the settings behave:
<b>Start immed.</b>
Will run in a V1 update process together with all other update functions called in the same LUW with Start immed. flagged.
<b>Immediate start, no restart</b>
As above, but cannot be reprocessed via transaction SM13 in the case of error (but can be viewed).
<b>Start delayed</b>
Will run in a V2 update process individually.
<b>Coll.run</b>
Will run in a V2 update process toegether with all other update functions called in the same LUW with Coll.run flagged.
So given the data you have provided both your function modules should be running in a collective V1 process, and therefore if one failed then the whole transaction should have been rolled back (and hence this does not explain your problem).
<b>BUT</b> what may be happening is that for whatever reason the transaction fails (maybe due to heavy system load) and either your system admin (or an autmated job) is pushing through the error in SM13. As the function L_TA_HINZUFUEGEN is flagged as immediate start, no restart then it will not be processed and the L_TO_CREATE_INIT will be. This could exactly explain your problem.
Hope that makes things clearer.
Cheers,
Brad
Maybe you are looking for
-
How can I import Contacts from Gmail to Facetime???
I've just downloaded Facetime and am wondering how I can do a mass important of my contacts from Gmail so as to not have to enter every one individually. I can't find any instructions for this.
-
How to assign agent at runtime
Hello gurus, I have a small querie. My requirement is when a workitem is received by a possible agent and he is not responding eventhough he receives repeative mail. I want to assign the new agent at runtime when the actual agent is received more tha
-
I installed the latest software update on our Apple TV - this allows us to access VIMEO. However, although we can still play music from an iPhone 4 we can no longer play purchased tv shows - unless the buffering process has been extended to be glaci
-
I keep getting this message the past week when I try to copy/paste text to Pages or upload a picture to a website chat forum. I don't know what it means, or how to correct it. I'm running a 2009 iMac desktop with OSX Lion 10.7.3 with 2 GB Any help
-
Hello world, am I the only one with this problem? I just purchased and installed Tiger 10.4.3. (Yes, I'm an idiot.) Well, Final Cut Express 2.0.3 -- which ran so well with Panther -- is now useless with Tiger. I also just downloaded and installed the