Regarding Back ground
If i set a flag at the initialization event of a program, i need to restrict that program to run in Background mode.
How ?
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 19, 2008 6:03 PM
Hi,
INITIALIZATION.
flag = 'X'.
START-OF-SELECTION.
IF sy-batch NE 'X'. " foreground
IF flag = 'X'.
Message i000 WITH 'Program can be run only in background'.
LEAVE-LIST PROCESSING.
ENDIF.
ENDIF.
Hope thsi solves your problem.
Similar Messages
-
I have a report which is scheduled to run 2 times in the background.
here i am using OO ALV when to display output when run in back ground.
but i am getting an error when the same report is run in the back ground, stating there is a problem with the object references.
but one of my friend tried it and is successful to run in the background but another problem, when run in foreground 10 records are displayed and when run in background only 2 records are displayed for the same criteria.in both the cases i am sending the output to the file on appl server.
pls help me its urgent.
pionts are assured.Ravi,
I have faced the same problem when I schedule the job in background.
When the report was run in forground, it gives expected results, and when it run in background, it will supress some fields and disply the report output.
This problem, I have debugged it and corrected, and its application specific I can say, cant conclude it by seeing the problem, needs to do much research and fix it up.
Regards,
Sujatha. -
Regarding back ground job scheduling
Hi,
one of our program was sheduled for back ground job, by another user, so just i need to knwo when this job is sheduled and it is executing daily, so, i need to knwo whether he has created a background job through , sm36, or through a program, how could i found it out.
thanks in advance.
joguIt is difficult to say. But if you can go to SM37 and check the log of the JOB it will dispaly you some messages.
This might help you.
Regards,
Naimesh Patel -
Regarding back ground processing for excel.
Hi,
i want to create the Excel sheet and i want to save in Back ground Processing....
give me some suggestionss.......................This can create any file (spreadsheet/plain text/ dat files). but to add workbooks to the sheet you need to use OLE Object concepts.
PARAMETERS: p_terms(256) TYPE c OBLIGATORY,
p_del(1) TYPE c OBLIGATORY DEFAULT cl_abap_char_utilities=>horizontal_tab.
DATA: lv_str TYPE string,
lv_char(256) TYPE c,
lr_descrref TYPE REF TO cl_abap_typedescr.
FIELD-SYMBOLS: <comp> TYPE ANY.
IF itab IS NOT INITIAL.
OPEN DATASET p_terms FOR OUTPUT IN LEGACY TEXT MODE .
IF sy-subrc EQ 0.
CLEAR : lv_str.
Header of the file
CONCATENATE
'Action'
'Name'
'EE User ID'
'Termination Date'
'Last Day Worked'
'End Of Notice'
'Employee Type'
'Department'
'Department_type'
'Office Location'
'Manager Name'
'Has Cellphone'
'Has Home Office'
'VP and Above'
cl_abap_char_utilities=>cr_lf
INTO lv_str SEPARATED BY p_del.
LOOP AT itab INTO ls_terms.
WHILE sy-subrc EQ 0.
ASSIGN COMPONENT sy-index OF STRUCTURE ls_terms TO <comp>.
IF sy-subrc NE 0.
EXIT.
ENDIF.
lr_descrref = cl_abap_typedescr=>describe_by_data( <comp> ).
IF lr_descrref->type_kind = 'P'.
WRITE <comp> TO lv_char DECIMALS 2.
ELSE.
WRITE <comp> TO lv_char.
ENDIF.
SHIFT lv_char LEFT DELETING LEADING space.
IF sy-index NE 1.
CONCATENATE lv_str lv_char INTO lv_str SEPARATED BY p_del.
ELSE.
CONCATENATE lv_str lv_char INTO lv_str.
ENDIF.
CLEAR: lv_char.
ENDWHILE.
TRY.
This statement passes the content of data object to the file specified
TRANSFER lv_str TO p_terms.
CATCH cx_sy_file_authority .
FORMAT COLOR 6 ON.
WRITE:/ 'No authorization to access the Term file'.
ENDTRY.
CLEAR lv_str.
ENDLOOP.
CLOSE DATASET p_terms.
ENDIF.
ENDIF. -
Regarding back ground job sheduling
hi,
could u plz clear my issu
i am running a report which i want to shedule in back ground by writing the code within in that program.
very urgentThere are two ways for you to handle,
one manually setting up the job through SM36 which is better and convinient,
secondly through program using FM's JOB_OPEN, SUBMIT, JOB_CLOSE.
Find below steps in doing both:
Procedure 1:
1. Goto Trans -> SM36
2. Define a job with the program and variant if any
3. Click on start condition in application tool bar
4. In the pop-up window, click on Date/Time
5. Below you can see a check box "Periodic Job"
6. Next click on Period Values
7. Select "Other Period"
8. Now give '15' for Minutes
9. Save the job
In SM37 u can check the status of the jobs that u have assigned to background...
Here u mention the job name or the report name to check the status of the job...
After mentioning the job name or program name u just execute it.. ( without any name also u can execute then it gives u all the jobs set by your user name..
the status colud be released,active,finished etc..
Procedure 2 via Program:
Below is a sample code for the same. Note the ZTEMP2 is the program i am scheduling with 15mins frequency.
DATA: P_JOBCNT LIKE TBTCJOB-JOBCOUNT,
L_RELEASE(1) TYPE c.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = 'ZTEMP2'
IMPORTING
JOBCOUNT = P_JOBCNT
EXCEPTIONS
CANT_CREATE_JOB = 1
INVALID_JOB_DATA = 2
JOBNAME_MISSING = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SUBMIT ZTEMP2 VIA JOB 'ZTEMP2' NUMBER P_JOBCNT
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
WITH DESTINATION = 'HPMISPRT'
WITH IMMEDIATELY = SPACE
WITH KEEP_IN_SPOOL = 'X' AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = P_JOBCNT
JOBNAME = 'ZTEMP2'
STRTIMMED = 'X'
PRDMINS = 15
IMPORTING
JOB_WAS_RELEASED = L_RELEASE
EXCEPTIONS
CANT_START_IMMEDIATE = 1
INVALID_STARTDATE = 2
JOBNAME_MISSING = 3
JOB_CLOSE_FAILED = 4
JOB_NOSTEPS = 5
JOB_NOTEX = 6
LOCK_FAILED = 7
INVALID_TARGET = 8
OTHERS = 9.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Submit report as job(i.e. in background)
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
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.
Thanks -
This is regarding back ground job scheduling
Hi to all...........
1....here iam using background job scheduling for a report to run under background.I difine the backgorund job at sm36 and i had given the job name and time ,date in sm37.
With this details the report executed sucessfully.Now i want to see the output list for that report.Please tell that where i have to see the output list.
what is the transaction code for displaying that output list?????????????????
Thanks and regards,
k.swaminathGo to SM36.. select ownjobs..
List will come.. Select your job (check box) and click SPOOL ...
Output will come like this..
Spool no. Type Date Time Status Pages Title
16501 24.10.2007 11:25 Waiting 7 LIST1S LOCA Z00_SELECT_S
Press the Icon under Type...
Output will get displayed..
Message was edited by:
Rama Jyothi -
Hi,
is it possible to get the o/p in alv-grid while executing in background
if so can any one plz explain points will be rewarded for sure..
thanks in advanaceHi
Many a times there is a requirement to display ALV Grid (not ALV List) in the background Job. I have checked the SDN Forum for the same and it has been mentioned that ALV Grid cannot be displayed in Background, but the list output of ALV is possible. So user wont have the actual Grid interface but the List interface.
There is a workaround to display ALV Grid in Background Job. The only restriction is you cant schedule the job through SM36. You need to execute the transaction of the report program, fill in the selection screen data and hit Execute.
The job would be executed in background. User will be able to see the Job Log and Job Status after executing the program. User doesnt have to go to SM37 to view the job status/log. Once the Job Status is changed to COMPLETED, user can click on DISPLAY SPOOL to view the ALV Grid.
/people/prashant.patil12/blog/2007/02/20/displaying-alv-grid-in-background-job -
Regarding : back ground jobs
Hi,
Please let me know , in how many ways we can shedule a program as a background job, and how we pass variants to the job.
Thanks in advance
joguhi,
There are two ways for you to handle,
one manually setting up the job through SM36 which is better and convinient,
secondly through program using FM's JOB_OPEN, SUBMIT, JOB_CLOSE.
Find below steps in doing both:
Procedure 1:
1. Goto Trans -> SM36
2. Define a job with the program and variant if any
3. Click on start condition in application tool bar
4. In the pop-up window, click on Date/Time
5. Below you can see a check box "Periodic Job"
6. Next click on Period Values
7. Select "Other Period"
8. Now give '15' for Minutes
9. Save the job
In SM37 u can check the status of the jobs that u have assigned to background...
Here u mention the job name or the report name to check the status of the job...
After mentioning the job name or program name u just execute it.. ( without any name also u can execute then it gives u all the jobs set by your user name..
the status colud be released,active,finished etc..
Procedure 2 via Program:
Below is a sample code for the same. Note the ZTEMP2 is the program i am scheduling with 15mins frequency.
DATA: P_JOBCNT LIKE TBTCJOB-JOBCOUNT,
L_RELEASE(1) TYPE c.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = 'ZTEMP2'
IMPORTING
JOBCOUNT = P_JOBCNT
EXCEPTIONS
CANT_CREATE_JOB = 1
INVALID_JOB_DATA = 2
JOBNAME_MISSING = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SUBMIT ZTEMP2 VIA JOB 'ZTEMP2' NUMBER P_JOBCNT
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
WITH DESTINATION = 'HPMISPRT'
WITH IMMEDIATELY = SPACE
WITH KEEP_IN_SPOOL = 'X' AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = P_JOBCNT
JOBNAME = 'ZTEMP2'
STRTIMMED = 'X'
PRDMINS = 15
IMPORTING
JOB_WAS_RELEASED = L_RELEASE
EXCEPTIONS
CANT_START_IMMEDIATE = 1
INVALID_STARTDATE = 2
JOBNAME_MISSING = 3
JOB_CLOSE_FAILED = 4
JOB_NOSTEPS = 5
JOB_NOTEX = 6
LOCK_FAILED = 7
INVALID_TARGET = 8
OTHERS = 9.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
http://help.sap.com/saphelp_bw30b/helpdata/en/c4/3a7f87505211d189550000e829fbbd/content.htm
<b>Reward if usefull</b> -
hi,
I have a program which includes a bdc code.when i run that program it will take me to mb1a i.e goods issue.i have to press enter each time for each and every item .Is there any way i can do this as background job. i haven't done anything related to background .can u please guide me each and every step.
Thanks in advancehi suchitra,
check the transaction <b>sm36</b> give ur job name.
click on the <b>job wizard</b> button and flow the steps.
http://help.sap.com/saphelp_nw04/helpdata/en/73/69ef5755bb11d189680000e829fbbd/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/2c513897110872e10000009b38f889/content.htm
check ur job status in transaction<b>sm37</b>and press execute.
hope this helps,
<b>do reward if it helps,</b>
priya. -
hi,
question regarding back ground scheduling, one program consists of a selection screen having some input field and program calling SMARTFORMS in the program. When I shedule it in back ground I am not seeing output in the spool, and job is not completed sucessfully, so what is the problem??Hi Rajesh,
probably the report is not designed to work properly in background.
Give some details.
Regards,
Clemens -
Hi,
I have watched all the threads regarding Back Ground job like SE36 & SE37. I have given a back ground job and its not working.
Its an ABAP Program which is creating an OLEDB Connection to MSACCESS and then retrieving and updating database table. The program is working very fine on foreground but when it is given to back ground job then it shows that the program is running, i mean in delay the time is ticking. But at last it is canceled by the system.
What's the thing i am missing or what should i do here? I have already set my program at high priority.
Thanks.Hi Atish,
Are you sure that we cannot run in background? Can you please explain me why it cant be done.
Thanks,
Inder. -
Hi all,
i have a alv report when i say execute it is taking long time for the output.
can anybody tell me regarding back ground process and later i can see the result.
in simple i want to see the report may be next day.
how can i do this.
kindly help me regarding this if possible with example(sample code).
surely rewarded with points.
thanks in advance,
regards,
venu.report zrich_0004 .
data: sdate type sy-datum,
stime type sy-uzeit,
l_valid,
ls_params like pri_params,
l_jobcount like tbtcjob-jobcount,
l_jobname like tbtcjob-jobname.
start-of-selection.
* Get Print Parameters
call function 'GET_PRINT_PARAMETERS'
exporting
no_dialog = 'X'
importing
valid = l_valid
out_parameters = ls_params.
* Open Job
l_jobname = 'ZRICH_0005'.
call function 'JOB_OPEN'
exporting
jobname = l_jobname
importing
jobcount = l_jobcount.
* Submit report to job
submit zrich_0005
via job l_jobname
number l_jobcount
to sap-spool without spool dynpro
spool parameters ls_params
and return.
* Kick job off 30 seconds from now.
sdate = sy-datum.
stime = sy-uzeit + 30.
* Schedule and close job.
call function 'JOB_CLOSE'
exporting
jobcount = l_jobcount
jobname = l_jobname
sdlstrtdt = sdate
sdlstrttm = stime
* strtimmed = 'X'
Regards,
Rich Heilman -
hi,
i want to run the bdc from the program itself not using any transaction
could u plz tell me the syntex clearly with comments.
very urgent plz.Hi,
The name Batch Input Session itself tells u that a batch session will be craeted and u have to run it manually.
Automatically it will not get executed.
Go for ''call transaction'' to execute it immediately...
However if u want to use Batchinput session method, then u have to capture teh session name first and then u can run that Session in the back ground by creating the 'Background job' by sm36.
Cheers,
Simha. -
How To Handle With Back Ground JOB From WEBUI When Click On "Appove"
Hi
How To Scheduled A Job Through ABAP Report In back end Of CRM when i click on "Approve" Button in WEBUI From result list.
As per My requirement I have a Search View and Result View
In Search View I have Below Fields
ITC Vendor ID
Claim Status
User status (date status changed)
Model
Serial Number
Date completed of Service Completion
Based on Search Criteria I will get Result In Result View.(Suppose 10 Records I got In Result View)
In the Result View I need to Add one Button As "Approve"
When i Click On Approve button One Pop up Message Need to Open And In that popup window I need to Display Below Text
"Approve Claim Job Has Started In Background
Note: Only Claims Which are in Submitted Status Will be Approved. you May Close This Window"
In SAP CRM System Back Ground Job Need To Start When Click On "Approve" Button In WEBUI .
In the Back Ground ABAP Report which will validate based on Result List Records"
In the Result List we may have all types of Claims which are status in "Submitted" "Pending" "Rejected" "Approve".
I need to collect all records from Result list and validate Those Records who's Status in "Submitted
1)Sort all the claims based on ITC Vendor ID.
2)Grouped all the submitted claims against each ITC Vendor ID from the search result
3)Change the status of the selected submitted claims to Approved.
4)Displays information messages as mentioned whenever a claim is approved, the same message will be captured in the job log.
‘Claims <ClaimID 1>,…<ClaimID N> now approved for ITC Vendor ID’.
5)Sending Email to each IRC.
6)Capture all the approved claims in the below format (Format Attached "Screen Shot Attachment")
7)Store the file in the Application Server AL11 in .csv format
Please Find Attachement For Reference.
1)ITC Claim Screen Shot
2)Screen Shot For Attachment
Thanks
RajHi,
You can add the following code in on approve method to show popup to the user,
IF req_edit IS NOT BOUND. " gloabl attribute in impl class of the view
REFRESH lt_buttons.
lss_button-id = 'btnyes'.
lss_button-text = 'YES'.
lss_button-on_click = 'YES'.
APPEND lss_button TO lt_buttons.
CLEAR lss_button.
lss_button-id = 'btnno'.
lss_button-text = 'NO'.
lss_button-on_click = 'NO'.
APPEND lss_button TO lt_buttons.
CLEAR lss_button.
CALL METHOD comp_controller->window_manager->create_popup_2_confirm
EXPORTING
iv_title = 'ATTENTION'
iv_text = 'Are you sure you want to edit this document?'
iv_btncombination = '99'
iv_custombuttons = lt_buttons
RECEIVING
rv_result = req_edit.
req_edit->set_on_close_event( iv_event_name = 'EDIT' iv_view = me ). "#EC NOTEXT
req_edit->open( ).
RETURN.
ELSE.
lr_node ?= req_edit->get_context_node( 'OUTPUTNODE' ).
lv_outbound = lr_node->get_event_name( ).
* CLEAR ptc_pricing_status.
* lv_outbound = req_edit->get_fired_outbound_plug( ).
IF lv_outbound = 'YES'.
you can use the submit report code here and you can al the validations here
ELSE. " No
if user clicks no nothing to do..
ENDIF.
CLEAR req_edit.
ENDIF.
Best Regards,
Dharmakasi. -
How to find the back ground job details
Hi All,
I have a back ground job running from many days, now we would like to know when this job was created on what date this job actvlly created and schuduled.
Please informe me how to check this.
Thanks & Regards,
MuralikrishnaOn SM37 screen there is plenty of options are there:
This is what i got from SAP help
Explanation for each selection field:
o Jobname: Name of the job as an identifier.
o Username: Name of the user who designed and planned the job.
o Start date: The start condition of the job, which could be a time
frame or an event that the job is waiting for. Specifying both will
yield jobs whose starting condition is either of the two
conditions.
ABAP program step: Name of an ABAP program that acts as a step in a
job.
Status selection: The current status of the job. By default, the
SCHEDULED option is not marked. To see the scheduled jobs, you must
explicitly check this.
also give the proper values in Job Satus also.
Maybe you are looking for
-
Time Machine backup not recognized?
I have a Time Machine configured drive that I have been using since 2010. I recently tried connecting it to my Airport Extreme backup over the air. It worked, but very slowly so I attempted to connect directly to my iMac again. Now Time Machine wants
-
DATA BLOCK CORRUPTION : ORA-1578 해결 방법
제품 : ORACLE SERVER 작성날짜 : 2005-08-18 DATA BLOCK CORRUPTION : ORA-1578 해결 방법 ========================================= 모든 오라클 데이타 블럭은 sequence 번호(seq)와 incarnation 번호(inc)를 갖고 있다. ORA-1578 에러는 seq=0 이고 inc <> 0 (새로운 블럭이 아님)일 때 발생한다. ORA-1578 에러는 ORA-6
-
everytime i want to restore my previews backup to my new iphone, itunes asks for my password, when i enter my password it tells me my password is incorrect, but its not! i have even changed my password. but still nothing! I get the same error from it
-
Mac OS X 10.6.8 Issues with storage
Hi All, Be merecefull, first time posting here. Have got a server with Mac OS X 10.6.8 Server, which is profiding following services: • Open Directory • DNS • AFP Issues is with AFP more specifically with shares on Drobo box which is connected over F
-
Variable for start page number?
I have a collection of indesign documents collated in a book. I want to implement a footer that looks like: "Start Page - Last Page" "750 - 763" where Start Page is begining of the beging of the constituent indesign document and last page is the end