Save Order - Call function in background Task
Hi all,
I have written a function module which is called in order save Badi and copies the system status on the Master contract to the sub contracts.
This works fine but when I call this function in background task the status is not getting copied over.For testing I have created a program similar to function module and scheduled that in background and this was working as required.
Can someone please let me know if I missed out anything or how can i resolve this issue.
Any inputs in this regard would be very helpful.
Thanks and regards,
Vijay
Hi Heinz,
You can check the result in SM58 transaction.
For more information pls. refer this thread :
No IMPORTING parameters allowed in CALL FUNCTION IN BACKGROUND TASK
Best regards,
Prashant
Similar Messages
-
Call function in background task... How to get the result?
I want to use Call function in background task parameter.
But I cannot find the result of this function. (No export parameter, no table result, no exception)
How to get the result of this function module? Correct or not?Hi Heinz,
You can check the result in SM58 transaction.
For more information pls. refer this thread :
No IMPORTING parameters allowed in CALL FUNCTION IN BACKGROUND TASK
Best regards,
Prashant -
Call Function in Background Task
Hi all,
I have written a method in which I call a function in background task, I would like to perform a task after the function has ended succesfully. this is possible with the addition PERFORMING 'next_task' ON END OF TASK.
This is sadly not possible in a global class.
How can I get info back on the state of the function in the background?
greetings Fred.Hi,
try using export import statement in FM
call function ...
flay = 'Y'.
export flag to memory id 'TESt'
endfunction
import flag from memory id 'TEST'.
if flag = 'Y'.
perform next_task.
endif.
Regards
amole -
Facing issue with tRFC (CALL FUNCTION in BACKGROUND TASK DESTINATION
In transcation CJ20N there is aBADI call ZCL_IM_CL_IM_PROJ_UPDATE in which there is a method
IF_EX_PROJECTDEF_UPDATE~AT_SAVE. My requirement is that when the status of the project is changed and saved then after the SAVE some actions are to be performed (BDC for transcation CJ30 & CJ9FS are to be called).
Since this method is called AT SAVE and i need to call the bdc after the comit (of SAVE) is done. So I have made a RFC FM in which I am calling the bdc. and then calling the FM as
CALL FUNCTION <FM> in BACKGROUND TASK DESTINATION <sy-sysid>.
For the txn. CJ9FS bdc this method is working fine and bdc is called after SAVE but for txn. CJ30, at times,the bdc is not working though if I run the BDC FM seperately using SE37 then its working fine.
Can any body guide me where I am going wrong.The scenario works fine for me. The issue was unable to create a proper test condition in the RFC.
CALL FUNCTION 'ZMY_RFCASYNC'
IN BACKGROUND TASK
EXPORTING...
TABLES...
EXCEPTIONS...
Simulated error condition in 'ZMY_RFCASYNC'
and got entry in SM58 by simply making an exception.
Thank you all. -
Call function IN BACKGROUND TASK don't work
Hello,
I've a interface RFC to JDBC asyncronous.
When i call function in R3 (IN BACKGROUND TASK), sy-subrc = 0, however i don't see any message in SXMB_MONI and runtime workbench.
The CC sender (for RFC) is OK,
what happen?
thanks very muchHave this code after your call function:
CALL FUNCTION 'START_OF_BACKGROUNDTASK'
EXPORTING
STARTDATE = SY-DATUM
STARTTIME = TIME
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC = 1.
EXIT.
ENDIF.
COMMIT WORK.
Also, if you want to call your RFC function module in async mode, you can try
Call function '<fm name>' in update task....
Regards,
Ravi Kanth Talagana -
CALL FUNCTION IN BACKGROUND TASK - enable tRFC
Hi Experts,
I want to call a Remote Function module 'IN bACKGROUND TASK' and get the status in SM58 within the same AS. Kindly help me to do this.
Requirement is to call the remote function module asynchronously in a guarentied way.
Thank you
NikhilThe scenario works fine for me. The issue was unable to create a proper test condition in the RFC.
CALL FUNCTION 'ZMY_RFCASYNC'
IN BACKGROUND TASK
EXPORTING...
TABLES...
EXCEPTIONS...
Simulated error condition in 'ZMY_RFCASYNC'
and got entry in SM58 by simply making an exception.
Thank you all. -
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 -
CALL FUNCTION IN BACKGROUND UNIToref.
Hi All,
Please tell me the method how to use FM IN Backgorund job(only IN BACKGROUND UNIToref)
CALL FUNCTION IN BACKGROUND UNIToref.
it would be better if give practical example.
Regards,
Anuj jainHi Heinz,
You can check the result in SM58 transaction.
For more information pls. refer this thread :
No IMPORTING parameters allowed in CALL FUNCTION IN BACKGROUND TASK
Best regards,
Prashant -
Call function '' in update task - code inside is BDC
hi to all,
in using call function '' in update task
the code inside is bdc. is this possible?
my scenario is from VA01 then post billing to VF01,
i am using user-exit MV45AFZZ in subroutine userexit_save_document.
i need to post billing after va01 save.
thanks to all.To debug in the update task, you have to set that option on in the debugger.
If the user exit runs in the update task, then you must have something like: CALL FUNCTION MODULE my_fm_to_do_BDC STARTING NEW TASK. ( This function module should wait until the SD is created. You might want to check in a loop, with a WAIT command. Once it is created, then you start your BDC and CALL TRANSACTION. ) This is NOT an update function module. It may need to be RFC enabled - I'm not certain at the moment.
If the user exit doesn't run in the update task, you need to create, and call from the user exit, an update function module that calls your function module "my_fm_to_do_BDC" STARTING NEW TASK.
The attribute "collective run", which is V3, means that the update task won't run that function module until a regularly scheduled job on the application server runs. For processing to run during the rest of the SD save, you must use V1 (could be run in any order with other V1s) or V2 (Will run after V1, but in any order with other V2s). Typically, I use V2 for this kind of task.
matt -
'Missing parameter with PERFORM' error with a function IN BACKGROUND TASK
I am getting this error when calling a custom function in MIGO user exit ZXMBCU01. When I remove the 'IN BACKGROUND TASK' the function works fine and there are no error messages. When using 'IN BACK...' you can't debug within it to see where the message comes from. I see the message with SM58. I am working in an sap 4.7 environment. I have not found any solutions from google searches.
Here is the statement within ZXMBCU01:
CALL FUNCTION 'Z_UPDATE_MATERIAL_AVAIL_STATUS' IN BACKGROUND TASK
EXPORTING
work_order = xmseg-aufnr.
Here is the code for the function:
FUNCTION Z_UPDATE_MATERIAL_AVAIL_STATUS.
""Update function module:
""Local interface:
*" IMPORTING
*" VALUE(WORK_ORDER) LIKE AUFK-AUFNR DEFAULT '0000000000'
TABLES: eban, resb, aufk.
-Global Types----
TYPES: BEGIN OF t_data,
rsnum TYPE resb-rsnum,
rspos TYPE resb-rspos,
aufnr TYPE resb-aufnr, "Order Number
bdmng TYPE resb-bdmng, "Requirement Quantity
enmng TYPE resb-enmng, "Quantity withdrawn
bsmng TYPE eban-bsmng, "Quantity ordered against this purchase requisition
END OF t_data.
DATA: gt_data TYPE t_data OCCURS 0,
ga_data TYPE t_data.
-Global Variables----
DATA: gv_refused TYPE BAPIFLAG-BAPIFLAG,
gs_caufvd TYPE caufvd,
g_text TYPE t100-text,
gv_objnr LIKE aufk-objnr,
gv_status LIKE bsvx-sttxt,
gv_trig_stat TYPE c.
TABLES RETURNED FROM BAPI
DATA: BEGIN OF xreturn OCCURS 0.
INCLUDE STRUCTURE bapiret2.
DATA: END OF xreturn.
SELECT SINGLE objnr FROM aufk
INTO gv_objnr
WHERE aufnr = work_order.
CALL FUNCTION 'STATUS_TEXT_EDIT'
EXPORTING
flg_user_stat = 'X'
objnr = gv_objnr
only_active = 'X'
spras = sy-langu
IMPORTING
line = gv_status.
IF ( gv_status CS 'REL' ) AND
( gv_status NS 'NMAT' AND gv_status NS 'CNF' AND gv_status NS 'CLSD' AND
gv_status NS 'TECO' AND gv_status NS 'DLFL' ).
SELECT SINGLE *
FROM AUFK
WHERE aufnr = work_order AND
( auart = 'PM01' OR
auart = 'PM02' OR
auart = 'PM03' OR
auart = 'PM99' ).
IF sy-subrc = 0.
SELECT resbrsnum resbrspos resbaufnr resbbdmng resbenmng ebanbsmng
INTO CORRESPONDING FIELDS OF ga_data
FROM resb LEFT JOIN eban
ON resbrsnum = ebanarsnr AND
resbrspos = ebanarsps
WHERE resb~aufnr = work_order AND
resb~bdmng > 0.
SELECT rsnum rspos aufnr bdmng enmng
INTO CORRESPONDING FIELDS OF ga_data
FROM resb
WHERE aufnr = work_order
AND bdmng > 0.
SELECT SINGLE bsmng
INTO ga_data-bsmng
FROM eban
WHERE arsnr = ga_data-rsnum
AND arsps = ga_data-rspos.
IF sy-subrc <> 0.
CLEAR ga_data-bsmng.
ENDIF.
IF ga_data-bdmng = ga_data-enmng OR
ga_data-bdmng = ga_data-bsmng.
"update status - but all items must pass
ELSE.
gv_trig_stat = 'N'.
EXIT. "status won't change so get out now
ENDIF.
ENDSELECT.
IF ga_data~bdmng > 0.
IF ga_data-bdmng = ga_data-enmng OR
ga_data-bdmng = ga_data-bsmng.
IF gv_trig_stat <> 'N'.
CALL FUNCTION 'CO_IH_USERSTATUS_SET'
EXPORTING
I_AUFNR = ga_data-aufnr "'000005000263'
I_USR_STAT_INT = 'E0002'
I_USR_STAT_EXT =
I_SET_INACTIVE =
I_BUF_READ =
I_SPRAS = sy-langu
IMPORTING
E_CHNG_REFUSED = gv_refused
E_CAUFVD = gs_caufvd
TABLES
RETURN = xreturn.
LOOP AT xreturn
WHERE type = 'E'.
ENDLOOP.
IF sy-subrc <> 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
RETURN.
ELSE.
READ TABLE xreturn INDEX 1.
CALL FUNCTION 'PI_BP_GET_MESSAGE_TEXT'
EXPORTING
iv_message_id = xreturn-id
iv_message_type = xreturn-type
iv_message_number = xreturn-number
iv_message_v1 = xreturn-message_v1
iv_message_v2 = xreturn-message_v2
iv_message_v3 = xreturn-message_v3
iv_message_v4 = xreturn-message_v4
IMPORTING
ev_message_text = g_text.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDSELECT.
ENDIF.
ENDIF.
ENDFUNCTION.
Does anyone have any ideas? Thank you very much in advance.
Glenn Allen
Software Architect (specializing in SAP)I'd be starting a process of elimination... perhaps start with an "exit." right after
SELECT SINGLE objnr
FROM aufk
INTO gv_objnr
WHERE aufnr = work_order.
exit. "leave FM NOW
and if that doesn't crash, work down the code down the code in the function e.g. comment out the BAPI_commit call... and / or build a little test harness report to call the Z function in background task... btw, does the ST22 dump point to anything more specific...? -
Creation of spool for job created by calling FM in background task
Hi Gurus,
1.Wanted to confirm if it is possible to attach spool to the job that has been created by calling a function module in background task.
Currently I have created one RFC enabled FM and called it in background task. It runs fine, and the job is created which can be seen in SM37. But it does not contain the spool even if the RFC FM contains the code for list ALV.
2. Also is it possible to control the name of the job created by calling the RFC FM in background task?
Code for calling the FM is given below(ZK_XX is th RFC FM):
CALL FUNCTION 'ZK_XX' IN BACKGROUND TASK
CALL FUNCTION 'START_OF_BACKGROUNDTASK'
EXPORTING
startdate = sy-datum
starttime = sy-uzeit
NOSEND = ' '
COMMIT WORK.
Thanks a lot for your help!!
Warm Regards,
RaveeshThanks for replying.
I need to do the processing in background. Hence using 'IN BACKGROUND TASK' addition.
Please let me knowif you have some idea.
Thanks & Warm Regards,
Raveesh -
Queries on Call Function In update Task
Hi ,
I have a requirement where I have to update a ztable in background once I execute the report.THe requirement is to exceute the updation in background.Will
Call funtion in update task help me?If yes, I have never used call function in update task .so can you guide me on the same.If no, how best can I acheive this?
Thanks & Regards,
JyotsnaHi,
look F1 to call function pls:
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.
-> so in error case you can analyse err. with TA SM13
(update records)
regards Andreas -
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! -
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 -
Qs about call FM in background task, and monitoring in SM37.
Hi, guys, i got a question here, if I call a FM using addition "in background task" in a Z program, does this mean the FM process is running in background? And can I monitor my task in sm37?
i've tried to do that, the FM was successfully proceeded, but I cannot see anything related to that task in SM37 under mine user ID.No, you cannot see that in SM37.
What it means is that the function is being executed in a seprated thread and the program that called the function will continue the execution without waiting for the function finish execution, that means the function is called in a synchronous manner.
Regards,
Ravi
Note : Please mark all the helpful answers
Maybe you are looking for
-
How do I get to the GW.MESSAGE.MAIL.ATTACHMENTCONTROL Context
Hi all, I'm writing a C3PO to save docs to, and attach from Lotus eDocs. The problem I have now is that I can insert a new MenuItem on the context menu under "GW.MESSAGE.MAIL". However it only appears if I right click on the new message window itself
-
I Exported a 3D mesh from Blender 2.49b as a 3Ds file, CS6 found the file but would not open it. Win7 with all updates.
-
Connecting to the Third Party Applicatin through Portal
Hi, Does anyone know how do we connect to the Third Party Application through Portal? WHat technology EP uses to connect to the third party application and retrieve data from the system to display? ALso if i have 2 application connected to the portal
-
My iphone is not showing up in devices on itunes
I have unistalled and reinstalled about 20 times. It wants an updated version of Applemobile device support what can I do! I am tearing my hair out!
-
Update 10.1.4 on MacBook Air
When attempting update the Updater keeps asking for me to close Adobe Reader.app Nothing is open - update won't proceed. Help please