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 Goli
Usually 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
Similar Messages
-
Data Services XI3.1 function module files for SAP R/3 is not working
Hi guys,
Thank you for the quick response so far. I am very grateful to you all.
I got an issue and will try to explain as detail as I could and
hope ur guys won't mind. :P
I pass the functions module to SAP tech guy to install to SAP using CTS
method, and using 900086.R63 file type because my chinese client is
running SAP on unicode environment.
My DS installed on my laptop client; job server plus db2 is on HP
unix. SAP is on another HP Unix server. The function module I used is
supplied from Data Services XI3.1.
Anyway, the installation is successfully done with GUI wizard windows of
SAP Workbench instead of tp command line method.
1)However, I checked the ZAW0 function group, I opened and can't see any functions
listed under it, although the table structures ZACTA, ZTAB2048 and other items
were created.
2)So I tried to create SAP Datastore, Transport Target, etc and tried to
extract file. It failed and log said "can't open file ---
/db2/temp/curcode.txt". I checked and SAP working directory /db2/temp didn't have
curcode.txt, because the result file supposed to be extracted and stored there.
The SAP tech guy checked SAP and cant find generated ABAP program of
ZCURCD is running anyway, although my local CURCD ABAP program is
created.
3)Is it the 900086.R63 not complete? Is my function installation correct? I could view data
on datastore, but just cant run job to extract. Another non-unidcode 900200.S08 group
has larger file sizes. Should I try to install also this 900200.S08 files? Will it corrupt SAP
and cause system errors?
4)After that, I had tried to install the functions manually into ZAW0
one by one using cut and paste, however after that, I cant view the data view anymore with
error. Besides, I tried to run Check on the functions and they all returned
syntax errors, so I cant Activate any of them with SAP. Maybe dependency is missing??
Then, I deleted the manually installed functions and can view data again, but just cant extract
data by job.
5)Another side issue is all these SAP datastore creation and viewing is
through DI 11.5 old installation. The new Data Services X3.1 unable to
create datastore with database error, although the function module
installed is came from Data Services. Does anyone know the issue?
Thank you very much to read it patiently. :PHi,
Thank you for the informative link. It did help a lot in solving the problem.
(1) to (4) --- The Sap tech guy didnt install the function programs correctly, and he redo the transport again using CTS. Now I can see all the functions inside the function group ZAW0. While for the problem of cannot generate extracted file to SAP working directory for downloading, it is due to unix directory access permission setting. And also have to include the ftp username into SAPSYS user group as the help link suggested.
(5) For this problem, I reinstalled again the DS with all required components like Server Manager. The network technical guy helped me with the first installation, and the installation was not complete. So now the issue is solved, I can create R/3 Datastore with DS. -
How to run ABAP Function Module in Background FOR LONG TIME?
I am not that experienced with ABAP. I am on SAP BI 7.0. I WANT TO RUN A FUNCTION MODULE
RSDRT_INFOCUBE_DATA_COPY.
I used SE37 and then executed the module, I supplied the parameters on the form which opped-up and then program started running. . Program was however interrupted after 10 minutes by ABAP. How can I run it in background without interruption?
THANKS A LOT.Change parameter rdisp/max_wprun_time.
Default value for this is 600 seconds (10minutes).Change it to a time which you think you need for copying infocube data.
May be 5 hours.
PS:You can not run Function Module in background directly,but you can create a Z* program and call that FM from within that program and then run the program in background.
Hope this answers your query. Best of Luck!
Thanks and Regards
Anindya
Edited by: Anindya Bose on Jun 30, 2009 1:24 PM -
Difference between calling a function module in background task and update
Hi experts,
Can someone explain me the basic difference between calling a FM in background and update tasks?
Also what is the advantage of using backgroud RFCs over the above 2.
Thanks in advance,
reddyThis is essentially a difference of synchronization with the main program calling this FM.
For Update task, we specify explicitely that we want to update some rows in a database table. But Update task is essentially for waiting that all tasks to do before are done and updating database at the end. The main point is that MF called in Update task wait for a COMMIT WORK to be executed.
On the other hand FM in background task are executed immediatly and are not specific to updating database table : it can be a function that would return some values or something else like that.
If you want to see more about difference between background jobs / update jobs, you can also have a look at transaction SM51. Here you will see all the servers composing your SAP instance and what kind of task they can execute :
- background jobs corresponds to BATCH
- update tasks corresponds to UPDATE
Those 2 kinds of tasks stands not necessarily on the same server...
Best regards,
Samuel -
What is the use of CALL FUNCTION MODULE - AT BACKGROUND TASK?
Hi experts,
I found Call functional module in background task will make the FM run at the next commit work as some people said. So I have some questions:
1 if we use COMMIT WORK commend, the pending FM will be called? If there are several FMs called at background task, what is the sequence of them? How many conditions will trigger the running of these FMs?
2 Where can I find the log of this pending FMs? In SAP library, it says there are 2 tables. But I checked these tables and can only find the FM name and user of it. And I can not understand content of these tables. It seems one is for the main information of FM, and the other is for the data of the FM, maybe the parameters.
3 If I call a FM in this way, Can I canncel it before the next commit work in some way?
Finally, thanks for reading and help.HI,
When the COMMIT WORK statement is executed, the function modules registered for the current SAP-LUW are started in the order in which they were registered. ROLLBACK WORK deletes all previous registrations for the current SAP-LUW.
If the specified destination is not available when COMMIT WORK is executed, an executable program called RSARFCSE is started in background processing. By default, this tries to start the function modules registered for a SAP-LUW in their destination every 15 minutes and up to 30 times. These parameters can be changed in the transaction SM59. If the destination does not become available within the defined time, it is recorded in the database table ARFCSDATA as the entry "CPICERR". The entry in the database table ARFCSSTATE is deleted after a standard period of eight days -
How to run ABAP Function Module in Background Wchich Takes Long Time to Run
How to run ABAP Function Module in Background FOR LONG TIME
I am not that experienced with ABAP. I am on SAP BI 7.0. I WANT TO RUN A FUNCTION MODULE
RSDRT_INFOCUBE_DATA_COPY.
I used SE37 and then executed the module, I supplied the parameters on the form which opped-up and then program started running. . Program was however interrupted after 10 minutes by ABAP. How can I run it in background without interruption?
THANKS A LOT.Hi,
You can call this FM in a program and run that program in background.
Regards,
Raju -
Hi friends,
In the below am trying to update a custom table using a call function in update task. I dont see the table getting updated can someone take a look at it and let me knw what the problem is? I have the commit work statement and also marked the function module as an update one in the attribute. Please help me . Thanks in advance! kathy
*& Include ZINBOUND_TEST
Report: ZINBOUND_TEST.
DATA: l_dest TYPE REF TO if_bgrfc_destination_inbound,
l_unit TYPE REF TO if_trfc_unit_inbound,
l_inb_dest TYPE bgrfc_main_i_dst,
lv_matid TYPE /sapapo/matid,
lv_matnr TYPE /sapapo/matnr,
lv_maktx type /SAPAPO/MAKTX,
lv_langu TYPE LANGU.
data: lt_product type STANDARD TABLE OF ZUPDATE,
ls_product type ZUPDATE.
lv_matid = '123'.
lv_langu = 'E'.
lv_maktx = 'Materia1'.
CALL FUNCTION 'Z_TEST' IN UPDATE TASK
EXPORTING
iv_matid = lv_matid
iv_maktx = lv_maktx
iv_langu = lv_langu .
COMMIT WORK.
select * from zupdate into corresponding fields OF TABLE lt_product.
if sy-subrc <> 0.
write 'no records added'.
else.
loop at lt_product into ls_product.
write: / ls_product-MATID,
ls_product-MAKTX.
endloop.
endif.
FUNCTION Z_TEST.
*"*"Update Function Module:
*"*"Local Interface:
*" IMPORTING
*" VALUE(IV_MATID) TYPE /SAPAPO/MATID
*" VALUE(IV_MAKTX) TYPE /SAPAPO/MAKTX
*" VALUE(IV_LANGU) TYPE LANGU
data: itab type standard table of zupdate,
wa_itab type zupdate.
wa_itab-matid = iv_matid.
wa_itab-maktx = iv_maktx.
wa_itab-langu = iv_langu.
append wa_itab to itab.
update zupdate from table itab .
ENDFUNCTION.
Edited by: ka reddy on Sep 24, 2009 4:14 PM
Edited by: ka reddy on Sep 24, 2009 4:15 PM
Edited by: ka reddy on Sep 24, 2009 4:16 PM
Edited by: ka reddy on Sep 24, 2009 4:17 PM
Edited by: ka reddy on Sep 24, 2009 4:21 PMHey Naimesh thanks for the reply. yeah i read that document way before and i started taking a stab at implementing it.
I started with update task to see how it behaves and then wanted to go with BGRFC tats when i had the update issue.
Now that am done with update i want to implement BGRFC.
I have modified the earlier prgm...Can you give me some ideas how to extend this? Thanks!
*& Include ZBGRFC_INBOUND_TEST
Report: ZBGRFC_INBOUND_TEST.
DATA: l_dest TYPE REF TO if_bgrfc_destination_inbound,
l_unit TYPE REF TO if_trfc_unit_inbound,
l_inb_dest TYPE bgrfc_main_i_dst,
lv_matid TYPE /sapapo/matid,
lv_matnr TYPE /sapapo/matnr,
lv_maktx type /SAPAPO/MAKTX,
lv_matid1 TYPE /sapapo/matid,
lv_matnr1 TYPE /sapapo/matnr,
lv_maktx1 type /SAPAPO/MAKTX,
lv_langu1 TYPE LANGU,
lv_langu TYPE LANGU.
data: lt_product type STANDARD TABLE OF ZUPDATE,
ls_product type ZUPDATE.
lv_matid = '125'.
lv_langu = 'E'.
lv_maktx = 'Materia3'.
**--Get the inbound destination for BGRFC.
IF l_inb_dest IS INITIAL.
SELECT SINGLE * FROM bgrfc_main_i_dst INTO l_inb_dest.
ENDIF.
l_dest = cl_bgrfc_destination_inbound=>create( l_inb_dest-destination ).
l_unit = l_dest->create_trfc_unit( ).
CALL FUNCTION 'Z_TEST' IN BACKGROUND UNIT l_unit
EXPORTING
iv_matid = lv_matid
iv_maktx = lv_maktx
iv_langu = lv_langu .
select * from zupdate into corresponding fields OF TABLE lt_product.
if sy-subrc <> 0.
write 'no records added'.
else.
loop at lt_product into ls_product.
write: / ls_product-MATID,
ls_product-MAKTX.
endloop.
endif.
Edited by: ka reddy on Sep 24, 2009 5:16 PM -
Jco Call a Function Module in BackGround
Hello All.
Some one can send me a simple exemplo how to call a ABAP Function Module in BackGround.
Can i set this in Java side?
..or only set the BackGround Work Process in SAP side?
In my java application call the Abap Function Module like this:
client.execute(function);
How to set parameters to execute the function in BackGround.
My rpoblem is when the return the data to java side ...occurs the error TIME_OUT in Dialog WorkProcess.
I need to call in background to better performance and to prevent the TIME_OUT.
Best regards.
Taylor.Hi.
I dont know how to do, but, you can do a previous RFC, this new RFC execute the original function in background mode. I did something like that:
- JAVA: client.execute("RFC_FUNCTION", input, output);
- SAP: RFC_FUNCTION:
CALL FUNCTION func IN BACKGROUND TASK
[DESTINATION dest]
parameter_list
[AS SEPARATE UNIT].
or
CALL FUNCTION update_function IN UPDATE TASK
[EXPORTING p1 = a1 p2 = a2 ...]
[TABLES t1 = itab1 t2 = itab2 ...].
I hope that help you -
Commit changes after CALL FUNCTION ... IN UPDATE TASK
Hi ABAPers,
I'm a bit confused about the behaviour of Update Function Modules.
Following scenario:
In our transaction (Modulpool with dynpros) the user clicks a butto to change some data:
1. PAI-Modul performs FORM_A
2. FORM_A calls FM_A several times in a LOOP
3. FM_A does some business logic and calls FM_B IN UPDATE TASK
4. FM_B modifies database tables
5. After the LOOP FORM_A does COMMIT WORK AND WAIT
Then the changes are not in the db immediately, the user will see the old data for a short time.
Why does the COMMIT-statement not start the Update-process?
Thanks,
MarkusHi,
This executes all high-priority update function modules registered using CALL FUNCTION ... IN UPDATE TASK in the order of their registration and in a common database LUW. If you do not specify the addition AND WAIT, the program does not wait until the update work process has executed it (asynchronous updating). If you specify the addition AND WAIT, however, program processing after COMMIT WORK will not continue until the update work process has executed the high-priority update function modules (synchronous updating).
If all high-priority update function modules are completed successfully, the statement executes the low-priority update function modules together in a common database LUW.
here high priority function moudles are function module with V1 task.
Regards,
Siva chalasani. -
Function Module or BAPI to update Sale Order Quantity (VBAP-kwmeng)
Hi,
I have a requirement to use a Function Module or BAPI to update Sale Order Quantity (VBAP-kwmeng), which one (Function Module or BAPI) should I use? is there any sample codes?
Thanks a lot!!Hi,
*& Report ZTEST
REPORT ztest.
DATA : wa_header TYPE bapisdh1x,
i_item TYPE TABLE OF bapisditm WITH HEADER LINE,
i_itemx TYPE TABLE OF bapisditmx WITH HEADER LINE,
i_return TYPE TABLE OF bapiret2.
wa_header-updateflag = 'U'.
i_item-itm_number = '000010'.
i_item-target_qty = '4'.
APPEND i_item.
i_itemx-itm_number = '000010'.
i_itemx-updateflag = 'U'.
i_itemx-target_qty = 'X'.
APPEND i_itemx.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = '1234567890'
order_header_inx = wa_header
TABLES
return = i_return
order_item_in = i_item
order_item_inx = i_itemx
Hope this will help you.
Regards,
Anand. -
Debugging the Functional Module in Background.
I am calling a Custom Functional module in Background mode using the syntax CALL FUNCTION ZFM in background task.
Can anyone tell how to debug the code using this..
Thanks ,
YatishHello Yatish
You could try to use the following trick:
(1) Put an endless loop into the coding of your function module where you want to start debugging, e.g.
DATA:
lx_exit_loop(1) TYPE c.
lx_exit_loop = ' '.
DO.
IF ( lx_exit_loop = 'X' ).
EXIT.
ENDIF.
ENDDO.
(2) Call your function module in background task
(3) Call transaction <b>SM50</b> and search for the background process.
(3) Choose from menu <i>Program/Mode -> Program -> Debugging</i>
Now you the debugger should bring you right to your endless loop. Set lx_loop_exit = 'X' in the debugger and continue (F5 or F6).
Regards
Uwe -
How to Run Function Modules.
Hi folks.
How do you run function modules?
e.g.
The function module
RSBB_URL_PREFIX_GET will show information on URL prefix, path and server name in order to configure for web reports.
I am trying to figure out how to carry out the task step by step on BW system.
Thank you.
Kara.Hi:
Test run in BW -
go to transaction SE37
RSBB_URL_PREFIX_GET
give this info when you hit Test/Execute
Handler class: CL_RSR_WWW_HTTP
Protocal:
Message Server: X
Hit execute again.
Chamarthy -
Function module for background jobs email
hi abaper's
i hace to create a function module for background jobs this function module have to send an email automatically when a background job is assigned or processed in background.
thnks n regards
pardeep kumarhi dear
open this site
https://weblogs.sdn.sap.com/pub/wlg/781. [original link is broken] [original link is broken] [original link is broken]
<removed by moderator>
Edited by: Mike Pokraka on Aug 8, 2008 12:48 PM -
Need name of a function module or BAPI to update the Tax Classification val
Hi Guru's
Need name of a function module or BAPI to update the Tax Classification value for Material master.
Thanks in advance.Hi
U can try to use BAPI_MATERIAL_SAVEREPLICA
Max -
Creating a function module in background
Hi
Is there any way by which if i want to create any function module in background .
like in any screen i have created a button and on pressing that button a blank fucntion module should be created in the function group that is already created .
waiting for your reply.Hello, Ashish;
When you mention a "Function Module" where are you trying to create it? The report designer? A .NET form?
What version of Crystal Reports are you using?
What version of Visual Studio .NET?
What requirements are you trying to meet?
Elaine
Maybe you are looking for
-
My at@t service won't switch to my new phone
I just upgraded to the new iphone 4s and all the apps info and everything synced but my at@t service won't switch to the new phone?
-
Iphoto book page layout changes with the addition of a photo problem.
I'm making a photo book of a recent road trip. There are times when I select a page,,, perhaps a page with 6 photos. The layout appears as the grey squares with a large vertical one on the left, 4 small ones in the upper right and a larger square in
-
After I updated iOS 5 can´t use the "open with" for mail attachments.
After I updated iOS 5 on my iPad 2, I can not use the "open with" for mail attachments. The option is not appearing. For example, when I try to open an .wmv attachment the iOS 5 doesn´t show "open with". Before update, I was able to open with "AZUL"
-
Hi, I have an Audigy 2 ZS ([DE80], whatever that means) hooked up with my generic 5. sound system. It's always worked great in the past. After switching to a 2 speaker standard desktop setup a while ago, I recently re connected my 5. system- The prob
-
Most of the applications won't run..
after i had updated My phone from symbian Anna to symbian belle,it works fine at first...but after sometimes,most of the applications wont run.(i hope i did nothing) let me label the applications.(these applications are packed with symbian belle upda