Restrict background Jobs thro' ABAP Program
Hello,
While I was working in one of the customer place , they restricted the background jobs thro' one ABAP program for customer reports . Unfortunately , I don't have the source code with me. As you are all aware that users fires the background jobs for different periods so that he/she can submit the reports to the higher up in time.
Scenario : I have 10 application servers and each application has 20 work processes ( 12-Dialog,4-Background,3-spool,1-Gateway). I would like to restrict 1 background process/per appl server for customer reports(Y OR Z programs) during the business hours .
It would be great help to Basis Consultants , if you can contribute to restrict the background jobs .
Thanks
Regards,
S.Srinivasan
Hi Daniel,
The program MEREP_DISTRIBUTOR(Client Data Distributor) determines delta data independent of a download request from the client.This is mainly used to reduce the load on the server and scheduling of this program is part of "SAP MI Administration" which is generally performed as part of OR after MI Post Installation steps that recommends you to Schedule Background Jobs for Generic and Smart Sync which you wanted to confirm in your post.So the programs
(1)WAF_MW_MAPPING
(2)WAF_DEPLOYMENT_FROM_ROLES &
(3)MEREP_RETRY_BP
are good enough for scheduling Generic & Smart Sync(in your case for MAM).Apart from these you may have to check up the Handler Settings that is mentioned in my previous post.
Hope this helps.
Thanks
Gisk
Similar Messages
-
How to trigger an existing background job in ABAP program?which fm?
Hi experts,
how to trigger an existing background job( defined in SM36 ) in ABAP program?which fm?
seems that FM 'JOB_OPEN' / 'JOB_SUBMIT' / 'JOB_CLOSE' can only create a new job.Hi,
now my requirement is that sap has generated one job automatically, and then i will have a job name
'XXX'. and then i want to schedule the job in abap program,. which function module could i use ?
my expected fm is that the system will trigger the job after i give the job name and start condition.
i have tried job_open, but it seems just to create a new job. any advice ? -
Schedule a background job for a program using ABAP code.
Hi,
I have to write a program to schedule a background job for another program.
Need your help to understand how we can achieve this functionality.Any example of an abap code would be of great help.
Need it urgently.
Thanks in advance.
Sandeep.Hi Sandeep,
Here is the demo program regarding the BDC For the background job.
report zprprbdc1
no standard page heading line-size 255.
include bdcrecx1.
parameters: dataset(132) lower case.
*** DO NOT CHANGE - the generated data section - DO NOT CHANGE ***
* If it is nessesary to change the data section use the rules:
* 1.) Each definition of a field exists of two lines
* 2.) The first line shows exactly the comment
* '* data element: ' followed with the data element
* which describes the field.
* If you don't have a data element use the
* comment without a data element name
* 3.) The second line shows the fieldname of the
* structure, the fieldname must consist of
* a fieldname and optional the character '_' and
* three numbers and the field length in brackets
* 4.) Each field must be type C.
*** Generated data section with specific formatting - DO NOT CHANGE ***
***data: begin of itab occurs 0 ,
*** matnr(20) type c,
*** mbrsh(30) type c,
*** mtart(30) type c,
*** kzsel(20) type c,
*** maktx(40) type c,
*** meins(5) type c,
*** end of itab.
data: begin of record occurs 0,
* data element: MATNR
matnr_001(018),
* data element: MBRSH
mbrsh_002(001),
* data element: MTART
mtart_003(004),
* data element: XFELD
kzsel_01_004(001),
* data element: MAKTX
maktx_005(040),
* data element: MEINS
meins_006(003),
* data element: MTPOS_MARA
mtpos_mara_007(004),
end of record.
*** End generated data section ***
start-of-selection.
*perform open_dataset using dataset.
perform open_group.
**do.
**read dataset dataset into record.
**if sy-subrc <> 0. exit. endif.
call function 'GUI_UPLOAD'
exporting
filename = 'c:\jitu\bdc\10002.txt'
filetype = 'ASC'
has_field_separator = 'x'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* VIRUS_SCAN_PROFILE =
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
tables
data_tab = record
* EXCEPTIONS
* FILE_OPEN_ERROR = 1
* FILE_READ_ERROR = 2
* NO_BATCH = 3
* GUI_REFUSE_FILETRANSFER = 4
* INVALID_TYPE = 5
* NO_AUTHORITY = 6
* UNKNOWN_ERROR = 7
* BAD_DATA_FORMAT = 8
* HEADER_NOT_ALLOWED = 9
* SEPARATOR_NOT_ALLOWED = 10
* HEADER_TOO_LONG = 11
* UNKNOWN_DP_ERROR = 12
* ACCESS_DENIED = 13
* DP_OUT_OF_MEMORY = 14
* DISK_FULL = 15
* DP_TIMEOUT = 16
* OTHERS = 17
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
loop at record .
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RMMG1-MATNR'
record-matnr_001.
perform bdc_field using 'RMMG1-MBRSH'
record-mbrsh_002.
perform bdc_field using 'RMMG1-MTART'
record-mtart_003.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
record-kzsel_01_004.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'MAKT-MAKTX'
record-maktx_005.
perform bdc_field using 'BDC_CURSOR'
'MARA-MEINS'.
perform bdc_field using 'MARA-MEINS'
record-meins_006.
perform bdc_field using 'MARA-MTPOS_MARA'
record-mtpos_mara_007.
perform bdc_transaction using 'MM01'.
**enddo.
endloop.
perform close_group.
*perform close_dataset using dataset.
&*****************Reward point if helpful************& -
How to debug the background job in ABAP
Hi Guys,
Can anyone let me know how to debug the background job in ABAP.
Thanks in advance
peterHi,
Goto SM37 and see the log if any is there and based on that you can check the code.
you can't debug background job.
Create a Variant for the Program and
Schedule JOB in background:
Go to SM36 create a Job
enter Program and Variant for that program in STEP..
click on Start Condition
Click on DATE and TIME enter date scheduled Start and END times
click on Period Values
Click on HOURLY/WEEKLY etc
CLick on RESTRICTIONS also to use further criteria.
so your job will be scheduled and run as per your requirement.
and in SM37 Transaction check the status of that JOB
Check this link for scheduling jobs..
http://help.sap.com/saphelp_nw2004s/helpdata/en/c4/3a7f87505211d189550000e829fbbd/content.htm
Check this
http://jplamontre.free.fr/SAP/Debug%20background%20process.htm
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/abap+debugger&
Regards,
Padmam. -
How to create a job thru ABAP program for calling a program with variant???
Hello experts,
can u give me step wise procedure to create jobs for a program with a variant name thru ABAP???
Also, can a transaction can be scheduled as a job to run in background with a variant name???
Edited by: SAP USER on Jul 22, 2008 6:08 AMHi,
To create a job through ABAP program you can do the following.
Go to Menu bar.
In there, go to SYTSTEM> SERVICES> JOBS--> DEFINE JOB.
Then give the JOB NAME and CLASS in the screen that comes up.
This is how we schedule a program.
Now, to create a variant for a program -
First activate your program in SE38. Then execute it .
Now, click on SAVE button. It will open up the variant creation screen. Give the details there like variant name and value for the fields. Save and come back.
Hope this helps.
Regards,
Hari Kiran -
Can a transaction be called in background dynamically using ABAP program??
Hi Experts,
Can a transaction be called in background dynamically using ABAP program without BDC???
Regards,
Mansi.u can create job dynamically through programming..Try this sample code..
data: jobname like tbtcjob-jobname value
' TRANSFER TRANSLATION'.
data: jobcount like tbtcjob-jobcount,
host like msxxlist-host.
data: begin of starttime.
include structure tbtcstrt.
data: end of starttime.
data: starttimeimmediate like btch0000-char1.
Job open
call function 'JOB_OPEN'
exporting
delanfrep = ' '
jobgroup = ' '
jobname = jobname
sdlstrtdt = sy-datum
sdlstrttm = sy-uzeit
importing
jobcount = jobcount
exceptions
cant_create_job = 01
invalid_job_data = 02
jobname_missing = 03.
if sy-subrc ne 0.
"error processing
endif.
Insert process into job
SUBMIT zreport and return << Here it is a static call but u can make it dynamic
with p_param1 = 'value'
with p_param2 = 'value'
user sy-uname
via job jobname
number jobcount.
if sy-subrc > 0.
"error processing
endif.
Close job
starttime-sdlstrtdt = sy-datum + 1.
starttime-sdlstrttm = '220000'.
call function 'JOB_CLOSE'
exporting
event_id = starttime-eventid
event_param = starttime-eventparm
event_periodic = starttime-periodic
jobcount = jobcount
jobname = jobname
laststrtdt = starttime-laststrtdt
laststrttm = starttime-laststrttm
prddays = 1
prdhours = 0
prdmins = 0
prdmonths = 0
prdweeks = 0
sdlstrtdt = starttime-sdlstrtdt
sdlstrttm = starttime-sdlstrttm
strtimmed = starttimeimmediate
targetsystem = host
exceptions
cant_start_immediate = 01
invalid_startdate = 02
jobname_missing = 03
job_close_failed = 04
job_nosteps = 05
job_notex = 06
lock_failed = 07
others = 99.
if sy-subrc eq 0.
"error processing
endif.
Regards,
JOy. -
Background Job Scheduling of Program RSEIDOC2
Hi Folks,
Can we schedule program RSEIDOC2 as background job? This program is used by Transaction Code WE02.
If it is possible then please let me know how can i do the same. Currently I am trying to schedule this with SM36 but when executing with SM37 then it is moving to canceled status. So please let me how it can be done??
Thanks and regards,
SiddarthPlease refer to the SAP documentation [Scheduling Background Job|http://help.sap.com/saphelp_nw70ehp2/helpdata/EN/c4/3a7f87505211d189550000e829fbbd/frameset.htm]
Regards
Suresh -
How to create Background job for Dialog program
Hi Experts,
I have copied Standard tcode to Z-tcode (CS12 tcode).
Now my requirement is to create background job for this program (but program is not a 'E' type its 'I').
How we can schedule Dialog program to Background.
Pls suggest me.
Regards
SKHi do as below :
Reefer below :
Bakcground Job Creation
You will have to submit your report using Submit statement ,
then inside the submitted report write open_job.
Regards,
Uma -
Restrict background jobs to immediate execution
Hello,
we have got a central jobmanagment and want to restrict background jobs to immediate execution.
Of course users should be able to send processes in the background, especially when creating a list needs a lot of performance. But users should not be able to plan these jobs to a time in future or perodically.
So, in authorization object S_BTCH_JOB I didn't find a solution - just JOB_ACTION can be restricted to "RELE", so that a user needs a release from another user. This is not what we want.
Is there a possibility to restrict the execution in background to the Option "immediate". The options "Date/Time", "After job", "After event", "at operation mode" should not be possible.
Regards,
JuliaHello Julius,
with searchterm "BTCOPTIONS" I can't find suitable notes or anything else, even with a search machine.
But I found thread Restrict periodic scheduling in SM37 which describes exactly this problem.
So I will ask in that thread again, because there haven't been any news since may.
Regards,
Julia -
Program works but background job for that program fails....
I have a requirement where I have to collect the details of the purchase order and put the details in XML file format and FTP the XML file to an external third party FTP Server.
To realize this I developed a report program which follows following logic.
1) First I collected the PO details by calling the BAPI BAPI_PO_GETDETAIL1.
2) Then using the following link "/people/r.eijpe/blog/2005/11/10/xml-dom-processing-in-abap-part-i--convert-an-abap-table-into-xml-file-using-sap-dom-approach
I converted these PO details to the XML file format that the third party people accept.
In the code I used u201CCALL METHOD cl_gui_frontend_services=>gui_downloadu201D and in this process first the XML file is generated and is getting stored on my deskytop.
3) Then I called HTTP_SCRAMBLE, FTP_CONNECT, FTP_COMMAND , FTP_DISCONNECT and RFC_CONNECTION_CLOSE.
This works perfectly well and each time I execute the report the file is getting FTPu2019ed to the third party FTP server.
Now I tried to schedule a batch job for this and the batch job fails with follwing errors
02/25/2009 15:08:47 Error in Control Framework
Message Class = FES
Message Number = 022
Message Type = E
02/25/2009 15:08:47 Job cancelled after system exception ERROR_MESSAGE
Message Class = 00
Message Number = 564
Message Type = A
Can some one tell me what is going wrong. My report works perfect in front end but fails if I try to schedule a background job for it in SM36.
Can you please tell me whatz going wrong with batch job? Any Help is highly appreciated.
Regards,
JEssica SAmRobert...Thanks for the reply...
I am using follwing code
l_xml_size = l_ostream->get_num_written_raw( ).
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = l_xml_size
filename = FILEPATH
filetype = 'BIN'
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 24.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
Now what changes should i make..where should i store my XML file then instead of my desktop?
and whih Function Module should i Use.. -
Workprocess for Infinite background job in ABAP
Dear all,
I have a background job which has an infinite loop i.e. WITHOUT any exit condition. The loop contains WAIT UPTO x mins statement.
So my query is if I run this program in background then will the Background Work process which executes this job, always be occupied and cant be used for other background jobs ? In other words, will I be wasting 1 BG workprocess for this job since it will never be freed to be used for other background jobs?
LOOP AT ITAB
WAIT UP TO x MINS.
ENDLOOP.
Requesting your expert insights .
Thanks in advance.
BR
NileshI am not so sure if this is correct. To my knowledge, BTC processes, as opposed to DIA, never perform "roll out" (e.g. during an RFC call) but just wait until processing continues. I just made a quick test in NW 740 release, there the BTC process remains occupied by my job when it does WAIT UP TO xxx SECONDS. So you occupy one BTC process as long as your job runs.
Please try out yourself and then award points to whoever is right, please.
Regards,
Alex -
Schedule/Execute POWL Query in Background or via ABAP Program
Hi all,
I would like to know if there is any chance/possibilities to schedule/execute the POWL Query for example the Query ID
"SAPSSRM_R_CENTRALCONFIRM_01_01" Confirmations Pending in the background to output report.
Or perhaps there is anyway I can make use of the logic within the Query ID above in an ABAP program?
The main reason is that I need create a Confirmations Pending report and sent out to relevant SC Creator and the quickest way is to make use of the existing query of above.
Many thanks and regards,
Hon LeongHi Hon Leong,
please first check POWL - Web Dynpro ABAP - SCN Wiki to understand, how POWL works.
You need to find a Feeder Class of your query and execude GET_OBJECTS Method to get the result list.
For example you can check report POWL_WLOAD or function module POWL_QUERY_REFRESH.
Regards
Konstantin -
Job statastics-ABAP program in BW
Hi All,
I have an ABAP program that is in one of the update rules from source ODS to destination ODS. Source ODS has 20million records. When we are loading the records to destination ODS , Is there any way I can find howmuch time will take to process 1 record and also when it is running how do I know howmany records it has processed or howmany yet to process ? I have tried with SM50 but not able to find much useful information?
Please help me and if you have any documents please send it to [email protected]
Regards
VennelaHi,
Please check with ST05 or ST03 or STAT
or use Coverage Analyser
aRs -
Cancleling a background job through ABAP code
hi
in my report i have a condition like this
if s_erdat > sy-datum.
xxxxxxxx
xxxxxxxxxxx
xxxxxxxxx
xxxxxxxx
endif.
if my selection screen date is grater than the system date i dont need to run the report at all
when i am running this report in back ground and i have given the erdat date greater than the system date my job status is finished.
but i dont want the job to be finished i want the job to be cancled. in this case how i need to modify the codeif s_erdat > sy-datum.
xxxxxxxx
xxxxxxxxxxx
xxxxxxxxx
xxxxxxxx
else.
message e001 text-001. "date is lower than the current date.
endif.
if you raise a error message background job will be cancelled with the text 001 in job spool..
Edited by: Jackandjay on Apr 22, 2008 12:57 AM -
How to cancel the background job processing in ABAP programming?
Hi,
I have a requirement where i need to cancel the job depending on some constraint. My code is something like this:
Select some data from the table.
if sy-subrc = 0.
Do nothing.
Else
Cancel the job
call function 'BP_JOB_ABORT'
exporting
jobcount = number
jobname = name
EXCEPTIONS
CHECKING_OF_JOB_HAS_FAILED = 1
JOB_ABORT_HAS_FAILED = 2
JOB_DOES_NOT_EXIST = 3
JOB_IS_NOT_ACTIVE = 4
NO_ABORT_PRIVILEGE_GIVEN = 5
OTHERS = 6
The above code is cancelling the job but it is throwing an exception called CX_SY_DYN_CALL_PARAM_MISSING because i dint pass job count. How can we find the job count of next job that is going to run? Or How to handle the exception which it is throwing. Even if i try to handle that exception something like this:
TRY
call function 'BP_JOB_ABORT'
exporting
jobcount = number
jobname = name
EXCEPTIONS
CHECKING_OF_JOB_HAS_FAILED = 1
JOB_ABORT_HAS_FAILED = 2
JOB_DOES_NOT_EXIST = 3
JOB_IS_NOT_ACTIVE = 4
NO_ABORT_PRIVILEGE_GIVEN = 5
OTHERS = 6
RAISE EXCEPTION TYPE CX_SY_DYN_CALL_PARAM_MISSING.
CATCH
CX_SY_DYN_CALL_PARAM_MISSING.
ENDTRY.
It avoids the exception but it doesnt cancel the job. I even tried with function modules like JOB_OPEN
JOB_SUBMIT,BP_JOB_SELECT,BP_JOB_ABORT and tried to build some logic using status overview table (TBTCO) and TBTCP (Jobstep overview table).
Can someone suggest me the right way to write this program ?
Thanks in advance.
RashmiHi,
Problem is solved.
Create an background job with 2 steps. The first step in the background job calls the program ZBACKJOB_STEP1. In the variant we have a wrong material number
If the material number is not found in Mara, the next step in the job should not get executed and the job should get cancelled..
In the above posts i had asked how do I get the job count of the job that is currently triggering the program at the runtimeu2026..If u see the below code uu2019ll get to know.. We have to use the standard structure TBTCM which captures the properties/characteristics of the job.
REPORT ZBACKJOB_STEP1.
TABLES: MARA,TBTCM.
PARAMETERS : MATNR TYPE MATNR.
START-OF-SELECTION.
SELECT SINGLE * FROM MARA WHERE MATNR = MATNR.
IF SY-SUBRC IS INITIAL.
WRITE / : 'This is the material selected on the selection-screen' , MARA-MATNR.
ELSE.
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
EVENTID = TBTCM-EVENTID
EVENTPARM = TBTCM-EVENTPARM
EXTERNAL_PROGRAM_ACTIVE = TBTCM-XPGACTIVE
JOBCOUNT = TBTCM-JOBCOUNT
JOBNAME = TBTCM-JOBNAME
STEPCOUNT = TBTCM-STEPCOUNT
EXCEPTIONS
NO_RUNTIME_INFO = 1
OTHERS = 2.
IF SY-SUBRC = 0.
CALL FUNCTION 'BP_JOB_ABORT'
EXPORTING
JOBCOUNT = TBTCM-JOBCOUNT
JOBNAME = TBTCM-JOBNAME
EXCEPTIONS
CHECKING_OF_JOB_HAS_FAILED = 1
JOB_ABORT_HAS_FAILED = 2
JOB_DOES_NOT_EXIST = 3
JOB_IS_NOT_ACTIVE = 4
NO_ABORT_PRIVILEGE_GIVEN = 5
OTHERS = 6.
IF SY-SUBRC <> 0.
ENDIF.
ENDIF.
ENDIF.
Regards,
Rashmi
Maybe you are looking for
-
Unable to open a report and asking for user credentials
Hi, when i am trying to open a crystal report, i am asking for user credentials and my URL is directed to the below URL http://hostname/PlatformServices/service/app/logon.do?appKind=InfoView&service=%2FOpenDocument%2FappService.do&backContext=%2FOpen
-
Design view disappears when I uncheck Restrict Page Occurrence
Dear Adobe Forms Experts, I have an Adobe print form with two master pages: one mailing address page that should only occur once, as the first page, and then the main page, which can occur many times. I have been asked to make the mailing page condit
-
Oracle 9.2.0.1 + redhat 9.0 install error
i see that's like error message Configuration tool Oracle Net Configuration Assistant failed jre was not found in /oracle/product/9.2.0/oracle.swd.jre/bin/i386/native_threads/jre Configuration tool Agent Configuration Assistant failed jre was not fou
-
My phone did something new today. I had a full battery logo all last night and today. I was thinking that was odd since it should be due for charging (I've had it since the day they first went on sale so I'm very familiar with how long I get from a c
-
Failed to parse SQL query by one user
Hi all, in my app i have a text-item with a submit button. In this item i type a name and a report after the item-region show me the result(s). this works for all my users (>2000) perfectly, but one of this users become an error in the report-region: