Commit work for backgorund task
Can i use Commit work in Background tasks ?
Bcoz i find its not working .
Hi lavanya,
Commit work can be used in the background tasks, however if you are trying to fetch records after the commit, it will lead to a runtime error. Can you post the error you are getting?
Regards,
Vik
Similar Messages
-
How to execute Update Module FM after final commit work for a T-code.
Hello Folks,
I have a bit complex issue with my current object.
We have modified MM41/MM42 transactions and added a subscreen to fulfill the requirement.
We have designed the subscreen and embedded the same to MM41/MM42 through SPRO configuration.
Now for update business logic,i am trying to execute one Function module(Update Module) in update Task...so that it will be executed once after the final commit work will be done for MM41/MM42.
But its not executing.
To fulfill my requirement i need to execute the FM only after Final Commit work for MM41/MM42.
Please suggest in this regard.
Even i can see few BADI's which are triggering through MM01/MM02 but not through MM41/MM42.
BADI_ARTICLE_REF_RT
BADI_MATERIAL_CHECK
BADI_MAT_F_SPEC_SEL
Code with which i am trying is given below.
After PAI event of the subscreen---
1: MODULE USER_COMMAND_9001.
2: MODULE user_command_9001 INPUT.
PERFORM sub_save_mara ON COMMIT.
ENDMODULE.
3: FORM sub_save_mara.
CALL FUNCTION 'ZMMUPDATE_MARA_APPEND_STRUCT' "IN UPDATE TASK
EXPORTING
materialno = gv_matnr
appendmara = ty_zzmara.
ENDFORM. "sub_save_mara
4: FUNCTION zmmupdate_mara_append_struct.
""Update Function Module:
""Local Interface:
*" IMPORTING
*" VALUE(MATERIALNO) TYPE MATNR
*" VALUE(APPENDMARA) TYPE ZZMARA
Data Declaration for Local use
DATA : w_mara TYPE mara.
Selecting the latest values for the material.
SELECT SINGLE * FROM mara INTO w_mara WHERE matnr = materialno.
IF sy-subrc = 0.
Move the ZZMARA values to structure MARA
MOVE-CORRESPONDING appendmara TO w_mara.
Update the values in table MARA.
MODIFY mara FROM w_mara.
ENDIF.
ENDFUNCTION.
Kindly suggest.Thanks in advance.
Regards
AnsumeshHi..
The code given by me will work fine provided the Final commit should happen.
Because to execute FM with update task,final commit work should happen which is mandatory and after that it will call the update task.
In my case final commit work was not happeneing because..SAP standard program was not able to detect wether there is any change in my sub-screen or not as the standard program & my custom program,subscreens are different.
As it was not able to detect the change,so final commit was not happening and hence update task also.
To provide the reference of change in my subscreen to standard program ,i set a flag as per the change in the subscreen
And exported the same to memory.
Then Implemented one enhacement spot in MATERIAL_CHANGE_CHECK_RETAIL Fm where i have Imported the flag value.
Based on my custom flag value,i have set one standard flag FLG_AENDERUNG_GES which tells SAP standard program for MM42 wether any change has happened or not.
The above solved my purpose.
Regards
Ansumesh -
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.
-
Query in Main Task Not Working But it works For BG Task
Hi All,
I have a requirement to send work item to different level approvers for that i have to find final level approver from a table and save the data accordingly ,
i have a main task and a Background task
<b> my problem is that the same query that works in back ground task is not working in the Main Task.</b>
SWC_GET_ELEMENT CONTAINER 'LEVEL' Level. is a macro written in the method in BOR in main task for getting value which is in the WF container and has binded to the task container. it is not picking up the value from the task container to the method.
Please help me on this
Thanks & Regards
Hari Sankar Mhi Arghadip Kat,
Thank You for Your Response, i've tried ur Suggestion but it is again not working
just let me explain again
i have two tasks,(these two tasks are in a loop.) with one BOR(object) and two Methods
One Method is for first Main task and another is for second task(which is a background task)
i need to get a value called final from a table, i've written a query in the method of Back ground task. and i'm getting the value correctly but i'm not able to pass this value to the main task coz the loop exits after executing the subtask and coz loops exit point is the value final.
So for getting the value of Final in main task i've written the same query in main task but its not working.
Thanks & regards
Hari -
Sync Actual work for a task, per resource
Would by using VBA like to update Actual work for a certain task, and not only the total work, but want to add Actual work for each resource assigned to the task. Have tried to figure out how, but so far been unable to do so. Already have
the values per resource so just want to know how to access the Actual work field per resource.Anders,
We need a little more information about your VBA code but basically the following syntax should work:
Assume Katie Olson is assigned to Task 2 and you wish to update her actual work to 2 days. First, keep in mind that all time variables in Project are stored in minutes so 2 days are 960 minutes assuming a normal 8 hour workday.
ActiveProject.Tasks(2).Resources("Katie Olson").Assignments(1).ActualWork = 960
or this will also work
ActiveProject.Tasks(2).Resources.UniqueID(76).Assignments(1).ActualWork = 960
John -
Extended Notification not working for Dialog Task with agent assignment
Hi Friends,
I have an issue where I have a user decision step and a sub workflow contains a dialog task with agent assignment.
Extended notification is configured properly and is working properly for user decision step but its not working for the dialog task created as an activity.
Batch jobs are configured to run report SWN_SELSEN.
I was checking SDN and found this discussion handy :
http://help.sap.com/saphelp_nw73ehp1/helpdata/en/4f/3bed495cc018c8e10000000a42189e/content.htm
One thing that wonders me is that notifications show up in SOST 4-5 seconds before the user decision step starts execution.
See screenshot from SOST and WF log.
SOST log :
2 questions here: Why is notification not being sent for Dialog task?
Why is user decision notification being sent that early even before the User decision task starts execution?
Please provide your valuable inputs.
Regards,
SandipAn activity step with agents is supported by the extended notifications if it is a decision task or not, I have used it many times and it works well just no approval/rejection links if it's not a decision task.
From your screenshot you can see that a mail has been created and is found in SOST, usually this cases are problems with the mail server or connection to it, check the mail settings in the SMTP node in transaction SCOT, also check with mail server team if there is a block to/from the SAP server. -
Commit Work for just one function module
Hi experts,
i have one question;
I need one solutions for commit work but just one function module. If i set commit work in function module then everything is taking the commit. But i dont like this. I need just for FM. This is impossible ?
Thak you, regards.Hi,
The only way I know involves creating a nested LUW - opening a new internal session by calling ABAP program using SUBMIT ... AND RETURN or a CALL transaction code.
Meaning, you'd have to code your logic in a report program/transaction, use the function module to merely call that report/transaction and, if necessary, use EXPORT/IMPORT or SHARED MEMORY to exchange data between the sessions. It's quite "ugly" solution IMO, and it involves session handling overhead, which can make it unsuitable for time-critical mass processing.
Cheers,
Janis -
Rolling up Work for Grouped Tasks - Bug
Friends,
Scenario:
Step 1:
Group by any field and look at the Work rolled up value. In the case below it is 200 hours.
Step 2:
Inactivate one of the tasks
Rolled up Work value doesn’t change!?
I’d expect the rolled up value for Work to decrease down to 100 hours.
Is it by design?
Thanks,
Alex
All Tasks Active
One Inactive TaskHi Rob,
If you work in standalone and it should not be too much complicated to edit it with Project 2013, assuming you have it.
Hope this helps,
Guillaume Rouyre, MBA, MVP, MCP | -
Exchange 2013 CU3 Retention Policy Not working for Calendar & Tasks
We are currently on Exchange 2013 CU3 with Online Archiving Enabled for the user
Default policy is set to move all the items in mailbox which are older than 30 days to online archive mailbox.
Calendar and Tasks Items are also getting archived alongwith other Outlook items from Inbox,Deleted Items etc
Followed Technet website and created RPT for Calendar and Tasks with retention disabled
Still DPT takes precedence and move all the items under Calendar and Task to Online Archive MailboxHi Sam,
I recommend you refer to the following article, despite this for Exchange 2010, however the same applies to exhcnage 2013:
Prevent archiving of items in a default folder in Exchange 2010
To prevent the <acronym title="Default Policy Tag">DPT</acronym> from being applied to a default folder, you can create a disabled <acronym title="Retention Policy Tag">RPT</acronym> for that folder (or disable
any existing RPT for that folder). The Managed Folder Assistant, a mailbox assistant that processes mailbox items and applies retention policies, does not apply the
retention action of a disabled tag. Since the item/folder still has a tag, it's not considered untagged and the DPT isn't applied to it.
Why are items in the Notes folder still archived?
If you create a disabled <acronym title="Retention Policy Tag">RPT</acronym> for the
Notes folder, you'll see items in that folder are not deleted, but they do continue to be moved to the archive! Why does this happen? How do you prevent it?
It's important to understand that:
A retention policy can have a <acronym title="Default Policy Tag">DPT</acronym> to
archive items (using the Move to Archive retention action) and a DPT to
delete items (using the Delete and Allow Recovery or
Permanently Delete retention actions). Both apply to untagged items.
The move and delete actions are exclusive of each other. Mailbox folders and messages can have both types of tags applied - an archive tag and a delete tag. It's not an either/or proposition.
If you create a disabled RPT for the Notes folder to not delete items, the archive DPT for the mailbox would still apply and move items.
When it comes to archiving, there's only one archive policy that administrators can enforce – the <acronym title="Default Policy Tag">DPT</acronym> with 'Move to archive' action.
You can't create a <acronym title="Retention Policy Tag">RPT</acronym> with the 'Move to archive' action. This rules out using the disabled RPT approach to prevent items from being moved.
Best regards,
Niko Cheng
TechNet Community Support -
Hi experts,
A weird problem hits me so much. After I insert a table item and of course commit work following the insert clause in a function module, and I want to read the inserted item out and change it, but after I commit work for the update clause and go to the table to see the item you have changed, nothing happened. It seems that there are two threads for the insert and update clause. I want to know why, and how to solve the problem properly. Actually I use wait up to 1 seconds to solve the problem, but I do not want to wait for 1 second for each table item, as there are many items should be processed at one time, so it will take a long time to complete the whole processing which can not be accepted by the user.
Thx in advance, points will be rewarded.
Vincent.My suggestion is to do all the intermediate changes in the internal table itself first and only "SAVE" updates the database.
You may have to do without the first Insert and have the data in the internal table itself. and when user modifies some data, the changes happens to the data in internal table rather than the Database. You can have a SAVE button (which updates to Database & commit work) to save the changes at one go.
Regards,
Anish Thomas -
GP API - remove user dynamically for a task..
I am having dynamic looping for an action, users assigned in every level.
I am able to add user dynamically for an action using:
rtm1.addRuntimeDefinedUserToRole(prInstance1, Next_Action, userJames, userContext1);
Change user does not work as it will work only for running actions or tasks, for pending one it will not
rtm.changeTaskProcessor(processInstanceID, activityInstanceID, currentProcessor, newProcessor);
remove user is not working for me? suggest me how to use this code?
IGPProcessRoleInstance processRoleInstance=executionContext.getProcessRoleInstance();
processRoleInstance.removeUser(UMFactory.getUserFactory().getUserByLogonID(UserId));Hi
I tried using the following for my process where the action is yet to happen
I am calling the BG CO before my action. I need to remove the previous user.
rtm1.removeTaskProcessor(prInstance1.getID(),activityInstanceID, userContext1);
rtm.changeTaskProcessor(processInstanceID, activityInstanceID, currentProcessor, newProcessor);
processRoleInstance.removeUser(UMFactory.getUserFactory().getUserByLogonID(UserId));
but nothing is working.
any idea when we can use them? I think changeTaskProcessor will not work for pending tasks.
I am able to get the activityInstanceID from NWA -> GP Processes, but my GP Process is having dynamic loop where the task will generate depending on levels. How can we get the activityInstanceID of the next task/action? -
Reg. Commit Work Response time
Hi All,
Could you please let me know to which factors the response of the Commit work belong to.
Regards,
SenHi,
Commit work for the database tables.
Regards,
Naresh. -
Transaction se37 include any implicit commit work?
Hi guys,
I'm testing bapi_material_savedata in se37. the modification to material will be save into database. The sametime this bapi can be rollback in my testing program.
So I'm wondering does bapi have any commit work inside itself. or se37 has an implicit commit work for this bapi ?
I can share my testing code
DATA: ls_headdata2 TYPE bapimathead.
DATA: ls_plantdata TYPE bapi_marc,
ls_plantdatax TYPE bapi_marcx,
ls_return TYPE bapiret2,
lt_return TYPE bapi_matreturn2 OCCURS 0.
ls_headdata2-material = 'WDAIREZHOU2010691'.
ls_headdata2-sales_view ='X'.
ls_plantdata-plant = 'DCX1'.
ls_plantdata-availcheck = 'KP'.
LS_plantdata-profit_ctr = 'DCX1-1000'.
ls_plantdataX-plant = 'DCX1'.
ls_plantdataX-availcheck = 'X'.
LS_plantdataX-profit_ctr = 'X'.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = ls_headdata2
PLANTDATA = ls_plantdata
PLANTDATAX = ls_plantdatax
IMPORTING
RETURN = ls_return
TABLES
RETURNMESSAGES = lt_return[] .
ROLLBACK WORK.
Any ideas, welcome
thanks,
ireneSorry, I haven't read you question carefully. I though that it's a standard question about how to commit data created by BAPI in SE37. You are right. Unfortunately, some BAPIs have COMMIT statement inside. As far as I remember your BAPI is this case. But if you want to be sure you can use new debugger to put break point on every COMMIT statement or use SE30 to get full stack trace.
Cheers -
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. -
Commit work not working in Routine for Transaction because of LUW
Hi all,
i have req to send adobe PDF as attachement by email.
Basically i am calling adobe from output type of VL02n .
Inside this i can not use commit work because of LUW.Please suggest what should i do.
so not able to send email in green status.
i am using below code
TRY.
zlcl_send_request->set_document( zlcl_document ).
CATCH cx_send_req_bcs INTO zicl_oref_cast.
CLEAR gv_text_cast .
gv_text_cast = zicl_oref_cast->get_text( ).
ENDTRY.
Email sender
TRY.
zlcl_sender = cl_sapuser_bcs=>create( sy-uname ).
CATCH cx_address_bcs INTO zicl_oref_cast.
CLEAR gv_text_cast .
gv_text_cast = zicl_oref_cast->get_text( ).
ENDTRY.
TRY.
CALL METHOD zlcl_send_request->set_sender
EXPORTING
i_sender = zlcl_sender.
CATCH cx_send_req_bcs INTO zicl_oref_cast.
CLEAR gv_text_cast .
gv_text_cast = zicl_oref_cast->get_text( ).
ENDTRY.
Create the Reciever address
TRY.
zlcl_recipient = cl_cam_address_bcs=>create_internet_address(
gv_email ).
CATCH cx_address_bcs INTO zicl_oref_cast.
CLEAR gv_text_cast .
gv_text_cast = zicl_oref_cast->get_text( ).
ENDTRY.
TRY.
zlcl_send_request->add_recipient( EXPORTING i_recipient =
zlcl_recipient ).
CATCH cx_send_req_bcs INTO zicl_oref_cast.
CLEAR gv_text_cast .
gv_text_cast = zicl_oref_cast->get_text( ).
ENDTRY.
TRY.
zlcl_send_request->set_send_immediately( gc_x ).
CATCH cx_send_req_bcs INTO zicl_oref_cast.
CLEAR gv_text_cast .
gv_text_cast = zicl_oref_cast->get_text( ).
ENDTRY.
Send the mail
TRY.
zlcl_send_request->send( ).
CATCH cx_send_req_bcs INTO zicl_oref_cast.
CLEAR gv_text_cast .
gv_text_cast = zicl_oref_cast->get_text( ).
ENDTRY.Hi
From abap help:
SY-ONCOM
On Commit flag. This system field is set to different values depending on the call status of an ABAP program. Of these, only the value of u2018Pu2019 is guaranteed. If at all, SY-ONCOM must only be queried for u2018Pu2019.
The value 'P' means that the program is already executing a subroutine started using PERFORM u2026 ON COMMIT and therefore a
further subroutine call using PERFORM ... ON COMMIT would cause a runtime error.
That means the variable SY-ONCOM has the information if a process "ON COMMIT" is working and so it determines if a dump has to be raised.
Now it's clear the meaning of that correction: if before calling a new commit the value of SY-ONCOM is changed the dump will be avoided.
I've done the following texts:
REPORT ZCOMMIT.
WRITE: 'Calling routine on commit'.
PERFORM DO_SOMETHING ON COMMIT.
COMMIT WORK.
FORM DO_SOMETHING.
DATA: ONCOM TYPE SY-UCOMM.
MOVE SY-ONCOM TO ONCOM.
SY-ONCOM = 'S'.
COMMIT WORK.
MOVE ONCOM TO SY-ONCOM.
ENDFORM.
The code above is very dangerous, because it triggeres a ricorsive loop: no dump, but the form is continuously called, just as help says SY-ONCOM is equal to P
REPORT ZCOMMIT.
WRITE: 'Calling routine on commit'.
CALL FUNCTION 'Z_MAX_COMMIT' IN UPDATE TASK.
COMMIT WORK.
FUNCTION Z_MAX_COMMIT.
DATA: ONCOM TYPE SY-UCOMM.
MOVE SY-ONCOM TO ONCOM.
SY-ONCOM = 'S'.
COMMIT WORK.
MOVE ONCOM TO SY-ONCOM.
ENDFUNCTION.
I expected the same behavior as above, but here no dump and no infinite loop, SY-ONCOM = V
Now your process working in update task, but probably many function are called, I mean the system creates a queue of functions to be run in update task, so what happens here?
I've tried this:
FUNCTION Z_MAX_COMMIT.
*"*"Function module di reg.:
*"*"Interfaccia locale:
*" IMPORTING
*" VALUE(NO_COMMIT) TYPE FLAG DEFAULT SPACE
CHECK NO_COMMIT IS INITIAL.
DATA: ONCOM TYPE SY-UCOMM.
MOVE SY-ONCOM TO ONCOM.
SY-ONCOM = 'S'.
COMMIT WORK.
MOVE ONCOM TO SY-ONCOM.
ENDFUNCTION.
REPORT ZCOMMIT.
WRITE: 'Calling routine on commit'.
CALL FUNCTION 'Z_MAX_COMMIT' IN UPDATE TASK
EXPORTING
NO_COMMIT = 'X'.
CALL FUNCTION 'Z_MAX_COMMIT' IN UPDATE TASK.
CALL FUNCTION 'Z_MAX_COMMIT' IN UPDATE TASK
EXPORTING
NO_COMMIT = 'X'.
COMMIT WORK.
Here no dump and no infinite loop too, but also no impact on the rest of the functions,
I can suppose the impact will be on the saving of data on database only, because your COMMIT ends the LUW, so it's very important the routine for printing is called at the end, after all saving routines.
Max
Maybe you are looking for
-
WRT610n access external ip from within LAN - NAT loopback
Hi everybody, I've replaced my old ZyXEL P-320W with a WRT610n and lost one feature... I basically have a NAS assigned to IP 192.168.1.2, my router has IP 192.168.1.1 locally of course. Imagine I have IP X.X.X.X from the internet and that this IP is
-
Canon MG6120 -- slow initialization of print dialog
How can I speed up the initialization of the print dialog box with my Canon Pixma MG6120 copier-printer-scanner? I watch the spinner for 5 mins between asking to print and receiving the print dialog box. This is my third Canon Pixma printer. So I am
-
Need some help...don't know what I am doing wrong
here is the code...if I type anything other than a number it continually loops without asking for input again...what do I need to do differently. * SongMenu.java * Created on November 14, 2005, 8:55 PM * To change this template, choose Tools | Option
-
i am in progress of migrating my servers from gentoo to arch. i am trying to build an openvz host os in arch, simply because its easier to maintain than gentoo and less needlessly complex IMO. this package: http://aur.archlinux.org/packages.php?ID=
-
Creative inspire 5300 poping help please help
HI all i have had the Creative inspire 5300 for 2 years now on the same pc nothing changed and worked perfectly until now. now the last 4 weeks i am getting poping thud sounds from all speckers at diffrent times it looks like a interferance problem.