Create spool for background jobs which uses submit statement
Hi Gurus,
I have a quick question regarding the backgroud jobs. When we run a program in the background , it should create a spool for us, but, the problem comes when I am running a program in the background, its not creating the spool. This program uses SUBMIT statement. This program collects the data and it will submit to the other program and then retuen. In this case, its not creating a spool. Its very important for us to look at the spool for this program. Does anybody cam across this kind of problem? I need ur inputs.
Thanks in advance, <REMOVED BY MODERATOR>
Regards,
Srinivas.
Edited by: Alvaro Tejada Galindo on Mar 18, 2008 4:31 PM
hi check this link ...
Scheduling a submitable program as a background task with the number number in a background request name. After scheduling, the background task is completed by function module JOB_CLOSE and released immediately.
DATA: number TYPE tbtcjob-jobcount,
name TYPE tbtcjob-jobname VALUE 'JOB_TEST',
print_parameters TYPE pri_params.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = name
IMPORTING
jobcount = number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SUBMIT submitable TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB name NUMBER number
AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = number
jobname = name
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.
IF sy-subrc <> 0.
ENDIF.
ENDIF.
ENDIF.
https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=backgroundsubmit&adv=false&sortby=cm_rnd_rankvalue
sy-subrc Meaning
0 Background task scheduled successfully.
4 Scheduling cancelled by user on the selection screen.
8 Error during scheduling, i.e. when accessing JOB_SUBMIT internally.
12 Error in internal number assignment.
regards,
venkat.
Edited by: venkat appikonda on Mar 18, 2008 6:32 PM
Similar Messages
-
Merge Excel cells when creating file for Background job
Hi Experts
I need to create an Excel document and within the excel sheet merge some cells, I can get that done via OLE.
My problem though comes in with... the Report needs to be scheduled as a background job and therefore OLE does not work!!!
Does any of you have another solution to merge cells while running in background??
Your thoughts are greatly appreciated.
VicHi Vic,
You can use the xml transformations for formatting excel. For my case I needed multiple sheets including glossary sheet to be mailed in a particular format , which was achieved by using transformations.
CALL TRANSFORMATION z_xls_xxx
SOURCE table = i_tmp_b[]
RESULT XML wa_xmlstr.
TRY.
cl_bcs_convert=>string_to_solix(
EXPORTING
iv_string = wa_xmlstr
iv_codepage = '4103' "suitable for MS Excel, leave empty
iv_add_bom = 'X' "for other doc types
IMPORTING
et_solix = l_bin
ev_size = l_size ).
CATCH cx_bcs.
MESSAGE e445(so).
ENDTRY. -
Email multiple spools from background job - SM36 using Spool List recipient
I create a background job using Spool List Recipient to email me the reports. The program that I scheduled to run creates 2 spools. When the spools are sent via email, only the last spool is sent.
Please advise on how I can get the 2 spools sent via email.i would not use the Spool List recipient from Job and use the function RSPO_SPOOLJOB_TO_OFFICE in your Program instead.
tell me if it helps.
Regards,
Laurent -
Spool list is not getting created for background job
I am creating background job using JOB_OPEN and then submitting my z-report using submit statement and then closing job using JOB_CLOSE. for this job is getting creating in sm37 and also gets finished but it does not create spool list showing output.
Any idea how to do this?
Thanks in advance.DATA: lv_jobname TYPE tbtcjob-jobname,
lv_jobcount TYPE tbtcjob-jobcount,
lv_variant TYPE variant,
wa_var_desc TYPE varid,
wa_var_text TYPE varit,
it_var_text TYPE TABLE OF varit,
it_var_contents TYPE TABLE OF rsparams.
REFRESH: it_var_contents, it_var_text.
CLEAR: wa_var_desc, wa_var_text.
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = sy-cprog
TABLES
selection_table = it_var_contents
EXCEPTIONS
not_found = 1
no_report = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CONCATENATE sy-datum sy-timlo INTO lv_variant.
wa_var_desc-mandt = sy-mandt.
wa_var_desc-report = sy-cprog.
wa_var_desc-variant = lv_variant.
wa_var_desc-transport = 'F'.
wa_var_desc-environmnt = 'B'.
wa_var_desc-version = '1'.
wa_var_desc-protected = 'X'.
wa_var_text-mandt = sy-mandt.
wa_var_text-langu = sy-langu.
wa_var_text-report = sy-cprog.
wa_var_text-variant = lv_variant.
lv_jobname = lv_variant.
CONCATENATE 'Batch Job Variant -'(006)
sy-uname INTO wa_var_text-vtext.
APPEND wa_var_text TO it_var_text.
Create the varaint for the back ground job.
CALL FUNCTION 'RS_CREATE_VARIANT'
EXPORTING
curr_report = sy-cprog
curr_variant = lv_variant
vari_desc = wa_var_desc
TABLES
vari_contents = it_var_contents
vari_text = it_var_text
EXCEPTIONS
illegal_report_or_variant = 1
illegal_variantname = 2
not_authorized = 3
not_executed = 4
report_not_existent = 5
report_not_supplied = 6
variant_exists = 7
variant_locked = 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.
Open the job.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = lv_jobname
IMPORTING
jobcount = lv_jobcount
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.
submitt the job in background mode.
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
authcknam = sy-uname
jobcount = lv_jobcount
jobname = lv_jobname
report = sy-repid
variant = lv_variant
EXCEPTIONS
bad_priparams = 1
bad_xpgflags = 2
invalid_jobdata = 3
jobname_missing = 4
job_notex = 5
job_submit_failed = 6
lock_failed = 7
program_missing = 8
prog_abap_and_extpg_set = 9
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
close the job.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = lv_jobcount
jobname = lv_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
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.
Hope this will be helpful.. -
Spool not generated for background job
Hi all!
I have a Zprogram that does some validation and submits the data to transaction ME59 using SUBMIT statement. The program is running fine in foreground.When it is scheduled for background, the spool is not getting generated. I know that if a program contains SUBMIT statement, the spool will not be generated when run in background. But is there a way to make it work? The client requires the exact output that we get in foreground.Hi,
All spool requests will be stored in TSP01 table
TSP01 - Spool Requests
field name for Spool request number is RQIDENT
Hi,
Take a look at OSS Note 422136 which states:
"2. You can only store one spool request even if a step generates several spool requests during processing. The application is responsible for a "spool overview" in this case. If a step generates several spool requests during processing, only one request can be stored. In this case, the application report should issue the number with a message when writing a spool request so that it is then displayed in the job log."
Also take a look at OSS Note 519059 which further supports the case that you must capture the individual spool numbers as they are being created (i.e. within the job step's program). The note contains the following:
8] Question: How are the spool requests assigned?
Answer: The step information is stored in table TBTCP. This has space for exactly one spool request (field LISTIDENT). If a step generates several spool requests during the processing, only one can be stored. In this case the application is responsible for a "spool overview
<b>Reward points</b>
Regards -
Creating a Step for Background Job from within ABAP Program
Step-1: I have a Report in ECC, which is scheduled as Background Job, which writes the file to the Application Server(UNIX)
Step-2: Trigger a Unix Command to ftp the file to other server.
Both Step-1 & Step-2 can be done from SM36.
Another Scenario:
Users can run the report in background from SE38 or using the transaction code for the report, In this case we want to call the external command.
Instead of calling the External Command as below in the report, I want to create a Step from within the program when it is scheduled in background mode.
CALL 'SYSTEM' ID 'COMMAND' FIELD lc_unixcom. [ Here lc_unixcom has the External Command ].
Any ideas??? Appreciate help.Hi,
For submitting a report step, you may use either SUBMIT ... VIA JOB ... or JOB_SUBMIT function module.
For external commands, this should be done only by calling JOB_SUBMIT function module.
Sandra -
Delete Spools created by one background job
Hi ,
I have a background job which runs every now and then and it creates spools. My requirement is to delete all spools created by this one job only in regular intervals via another program.
Regards,
Arun.Hi J@Y,
the spools that my background job is creating should stay in the system for a while for users to go and see it. After a specific interval, say every 30 minutes, i want all the spools created by that one job till that time to be deleted
regards,
Arun. -
Urgent : Want to know table stores spools created by a background job
Actually background job executed by me creates 2 spool requests
table - tbtcpv holds only the 1 spool
Can any one tell me the table which stores all the spool created by the background job ?
Need urgent help.....Guru,
Try with below tables
TBTCO
TBTCO
TBTCP
TBTCR
TBTCS
TBTCJSTEP
TBTCO
TBTCP
Pls. reward if useful.. -
You need to schedule and automate batch jobs in an organisation. There will be multiple variants and multiple steps within same batch jobs. The variants are date dependent and needs to change every day. You need to automatically change the variants every day and schedule the jobs. Also check for the failures in the jobs. Apart from that Once the jobs in one server example : R/3 server ends the jobs in BW servers should be triggered automatically. Explain all steps with proper T codes and also provide a dry run example. Also provide all the table used for the variants purpose.
Please help on this,thanks
NarendraHi Narendra,
The background jobs are scheduled depending on the requirement with specific variants which are both date specific and even specific sometimes. These variants are created for the programs or reports which are run in the background job ,These variants are stored in VARID table for client specific variants and
VARID_CI for client independent. For most of the times all these jobs are maintained in some job scheduling tools so that they automatically inform about job failures and processes can be automated.In our organisation we use UC4 for background job schedulign and it controls the process as you are looking for.
Please award points accordingly
With Regards,
Junaid
Message was edited by:
muhammed junaid -
Userexit or BADI for program *RMMRP000* for background job
Hi,
We are scheduling background job for MRP through SM36 using program RMMRP000 or Through Transaction MDBT (MDBT is calling program RMMRP000) which creates PR (through background job).
I want to default one field in PR (PO Price field in valuation tab in PR default to gross) using any userexit or BADI.
Can any body suggest me userexit or BADI for program RMMRP000 for background job
Regards.Hi,
1. The below are the List of Userexit for this MDBT t.CODE.
2. But i dont see any one helping to resolve your issue.
3. May be you should lookg at the Userexit for me21n or relevant Purhcase requisition creation transaction.
reg
dsk -
A background job creating/instantiating another background job
Hi,
Is there any possibility in SAP, that, a background job can create/instantiate another background job ?
I have one suce requirement, and not sure if this is possible. Any inputs..
-DKyes you can
when you create a job using SM36,there is a option for start condition
in that there is an option for After Job
just give the job name and when that job completes,this job will trigger off
http://help.sap.com/saphelp_nw04/helpdata/EN/c4/3a7fae505211d189550000e829fbbd/frameset.htm
Rohit -
Date and time for background job
Hi,
I am creating a program with out selection screen . This program runs based on date and time . so I need to create a table
with date and time fileds.
Program runs based on FROM DATE FROM TIME TO DATE TO TIME....... FROM DATE and FROM TIME will get it from ztable and TO DATE & TO TIME values as SY-DATUM & SY-UZEIT. In the end I will update sy-datum and sy-uzeit values in the custom table to get the values ( Use it for from date from time ) for next run of the program.
This program is mainly used for background job so how do we get the values of from date and from time for the first run of the program ? how do we update the latest date and time details by deleting old date and time details.
Thanks ,
Vinay.
Edited by: Vinay parakala on Apr 22, 2010 9:18 AMFirst of all, I'll suggest to maintain TVARVC instead of doing it in custom table unless you need a complete log.
As per my understanding, you are trying to fetch some records based on the time period(Delta loads).
So, you will do an initial run to load the complete data then you will run it for time periods. For example,
1st Load- 01/01/1991(earliest date possible) - today's date say 03/22/2010
2nd load- 03/22/2010 - today's date
so on............
You have to move the to date values to from date values and to date value needs to be updated by the latest one for each load.
Do you have any dependency on background job? Please let me know if my understanding is correct or specify your requirement in detail. -
Regarding Variants for Background jobs
Hi Folks
Can you please let me know the procedure how we can create the variants for Background jobs.
Points are assured for correct answers.
Regards,
kumarHi Sree Ram,
Check this info.
If you have any selection screen parameters for your program you need to enter the values for those fields in runtime. So, if you schedule your program in background to execute then there is no one to do this job. Here comes the concept of Variant.
With variant you define what are the selection field values in the runtime. During runtime the program picks this values and runs the program.
When you execute your program which has selection fields, you enter the values and then you click on 'GO TO ' tab and 'SAVE AS VARIANT'.
When you schedule your program in background, give this variant also. Then it will run automatically.
Hope this resolves your query.
Reward all the helpful answers.
Regards -
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 -
Master data table name for background jobs...
Hi Friends,
can any body pl tell me the table name, where I can see all the background jobs which have been created till date.
Thanks,
Hardikhi,
please check table TBTCP ,TBTCO
Regards
Suresh.
Maybe you are looking for
-
About Create Asset Master Record
hi expert, when use the tcode as01 to create an asset master record. there is a location filed and the location relative to an address number . my concerns that how can we maitian the address number or do we just pick one from the table adrc? thanks
-
I rented a movie, was charged but it's not showing up under videos. How can I resolve this problem?
-
i did this and all my contacts are all gone
-
Time Machine said it would take 16 days to do an initial backup, and indeed, after many days it is less than a quarter done. (The problem started when I put in a new bank disk for Time Machine to write to for its backup file.) Activity Monitor show
-
How do I save composed email for use indefinitely
I am trying to compose one email with Mac Mail 7.2. That I am going to be using for a lot of emails to be sent out in the future. I would like to know. How do I save that composed emai, so I don't have to keep retyping thet same email over and over