How to run the program in background job,program should run in 3 days.
Dear Gurus,
i have a program , that program should run approximately 3 days to get the result.
i scheduled this program as a background job.
how can i run sto5 t-code for this same program.
i that case how we can trace the output.
Experts please help me out.
Thank u very much.
Regards
sudheer
Hello Sudheer,
The trace can be set on background jobs by using ST12 transaction. Please make sure that the trace is activated for only few minutes in production environment.
Contact your basis team to activate trace on background job and the transaction used is ST12.
Thanks
Similar Messages
-
How to submit the report in Background job.
Hello Friends,
In the selection screen I have 2 radio buttons one for background Process & other for foreground processing. if the user selects the background processing the program should execute in background and output need to be sent to SAP Inbox.
Issues:
1) If I am using the JOB_Submit FM or Report Submit the program is going to infinite loop and many continiously jobs are are being scheduled. How to avoid.
2) Is there any best possible way to send the mail to SAP Inbox.
Note: I am using OOALV in my program....
Thanks,
RaviHi,
the first problem looks like you have an infinite recursion. You just need to avoid background scheduling again. There is a system field sy-batch. So if this field is equal to 'X' then you are already in background mode and you don't need to schedule your background job again. Another way is to split your program in two programs. The first will be responsible for scheduling or executing the second one.
You can use FM SO_NEW_DOCUMENT_SEND_API1 to send message to workflow inbox. You need to user receiver type B. There are so many posts on this forum about sending emails from ABAP which may help you with implementing this requirement.
Cheers -
Failed to Run OLE Excel program in background JOB (SM36)
Please help.
I have write a program to use OLE to create a Excel file.
The program can run successful in front end workstation. However, when I run the program in background job by SM36.
The statement "CREATE OBJECT EXCEL 'EXCEL.APPLICATION'" return with error "SY-SUBRC = 2".
How can I solve it ?
Can OLE Excel be run on background job ?
Thanks so much,
MarkHi Mark:
Your need is a very common one. I also was asked to generate an Excel in Background.
It is not possible to work with OLE in background mode.
The reason is: In background mode there is no presentation server. OLE is executed in presentation server.
Below I paste the code I wrote to solve my problem.
This class sends a mail with an excel attached. The Excel content will be the internal table you pass to the class. But the Excel is not binary, it is a plain text file, separated by tabulators. Anyway, when you open it with Excel, the columns are properly shown.
Sorry. Comments are in spanish, I don't have time to translate it.
I kindly ask to everybody which want to use it to keep my name in the code.
* Autor: Jordi Escoda, 30/10/2008.
* Descripción: Esta clase genera un correo electrónico destinado a
* una persona, adjuntando el contenido de una tabla interna como
* Excel (campos separados por tabuladores).
* La virtud de esta clase es su sencillez de utilización. Para lanzar
* el mail con el excel adjunto basta con declarar la tabla interna,
* llenarla, colocar el asunto del mensaje, el destinatario, el nombre
* del excel adjunto, y pasar la tabla interna.
* Ejemplo de utilización:
* DATA: lc_mail TYPE REF TO cl_mail_builder_xls_attach.
* DATA: lt_anla TYPE STANDARD TABLE OF anla.
* SELECT * INTO TABLE lt_anla FROM anla.
* CREATE OBJECT lc_mail.
* CALL METHOD lc_mail->set_subject( 'Excel adjunto' ).
* CALL METHOD lc_mail->set_recipient( 'XXX@XXXDOTCOM' ).
* CALL METHOD lc_mail->set_attach_filename( 'ANLA' ).
* APPEND 'Cuerpo del mensaje' TO lt_body.
* APPEND 'Saludos cordiales' TO lt_body.
* CALL METHOD lc_mail->set_bodytext( lt_body ).
* CALL METHOD lc_mail->set_attach_table( lt_anla ).
* CALL METHOD lc_mail->send( ).
* CLASS cl_mail_builder_xls_attach DEFINITION
CLASS cl_mail_builder_xls_attach DEFINITION.
PUBLIC SECTION.
METHODS: set_subject
IMPORTING im_subject TYPE so_obj_des,
set_bodytext
IMPORTING im_body TYPE bcsy_text,
set_recipient
IMPORTING im_recipient TYPE ad_smtpadr,
set_attach_table
IMPORTING im_table TYPE ANY TABLE,
set_attach_filename
IMPORTING im_attach_name TYPE sood-objdes,
send.
PRIVATE SECTION.
CONSTANTS:
c_tab TYPE c VALUE cl_bcs_convert=>gc_tab,
c_crlf TYPE c VALUE cl_bcs_convert=>gc_crlf,
c_singlequote TYPE c VALUE '.
DATA: l_recipient_addr TYPE ad_smtpadr.
DATA: send_request TYPE REF TO cl_bcs,
document TYPE REF TO cl_document_bcs,
recipient TYPE REF TO if_recipient_bcs,
bcs_exception TYPE REF TO cx_bcs.
DATA: binary_content TYPE solix_tab,
size TYPE so_obj_len.
DATA: l_string TYPE string,
l_body_text TYPE bcsy_text,
l_subject TYPE so_obj_des,
l_attach_name TYPE sood-objdes.
METHODS: create_binary_content,
get_dataelement_medium_text
IMPORTING im_table_name TYPE tabname
im_field_name TYPE fieldname
EXPORTING ex_medium_text TYPE scrtext_m.
ENDCLASS. "cl_mail_builder_xls_attach DEFINITION
* CLASS cl_mail_builder_xls_attach IMPLEMENTATION
CLASS cl_mail_builder_xls_attach IMPLEMENTATION.
METHOD set_bodytext.
l_body_text[] = im_body[].
ENDMETHOD. "add_bodytext
METHOD set_subject.
l_subject = im_subject.
ENDMETHOD. "add_subject
METHOD set_attach_filename.
l_attach_name = im_attach_name.
ENDMETHOD. "add_subject
METHOD set_recipient.
l_recipient_addr = im_recipient.
ENDMETHOD. "add_subject
METHOD set_attach_table.
* Rellena en un string el contenido de la tabla interna recibida
DATA: ref_to_struct TYPE REF TO cl_abap_structdescr.
DATA: my_like TYPE fieldname,
nombretabla TYPE tabname,
nombrecampo TYPE fieldname,
texto_mediano TYPE scrtext_m.
DATA: l_idx TYPE i,
l_valorcampo(16) TYPE c,
l_long TYPE i.
FIELD-SYMBOLS: <fs_linea> TYPE ANY,
<fs_campo> TYPE ANY.
FIELD-SYMBOLS: <comp_descr> TYPE abap_compdescr.
CHECK NOT im_table[] IS INITIAL.
* Línea con los nombres de las columnas.
CLEAR l_string.
LOOP AT im_table ASSIGNING <fs_linea>.
* Toma los atributos del componente
ref_to_struct =
cl_abap_structdescr=>describe_by_data( <fs_linea> ).
LOOP AT ref_to_struct->components ASSIGNING <comp_descr>.
ASSIGN COMPONENT <comp_descr>-name
OF STRUCTURE <fs_linea> TO <fs_campo>.
* Obtenemos el origen de donde proviene (like). Ej:BKPF-BUDAT
DESCRIBE FIELD <fs_campo> HELP-ID my_like.
SPLIT my_like AT '-' INTO nombretabla nombrecampo.
CALL METHOD get_dataelement_medium_text
EXPORTING
im_table_name = nombretabla
im_field_name = nombrecampo
IMPORTING
ex_medium_text = texto_mediano.
IF texto_mediano IS INITIAL.
CONCATENATE l_string <comp_descr>-name INTO l_string.
ELSE.
CONCATENATE l_string texto_mediano INTO l_string.
ENDIF.
AT LAST.
CONCATENATE l_string c_crlf INTO l_string.
EXIT.
ENDAT.
CONCATENATE l_string c_tab INTO l_string.
ENDLOOP.
EXIT.
ENDLOOP.
* Contenido de la tabla
LOOP AT im_table ASSIGNING <fs_linea>.
* Toma los atributos del componente
ref_to_struct =
cl_abap_structdescr=>describe_by_data( <fs_linea> ).
LOOP AT ref_to_struct->components ASSIGNING <comp_descr>.
* Asignamos el componente ue tratamos, para obtener
* el valor del mismo
ASSIGN COMPONENT <comp_descr>-name OF STRUCTURE <fs_linea>
TO <fs_campo>.
CASE <comp_descr>-type_kind.
WHEN 'P'. "Packed Number
* Convierte a caracter
WRITE <fs_campo> TO l_valorcampo.
CONCATENATE l_string l_valorcampo INTO l_string.
WHEN OTHERS.
l_long = STRLEN( <fs_campo> ).
IF l_long > 11 AND <fs_campo> CO ' 0123456789'.
* El Excel muestra un número tal como 190000000006
* en formato 1,9E+11.
* Para eviarlo, los números de más de 11 dígitos los
* concatenamos con comillas simples.
CONCATENATE l_string c_singlequote
<fs_campo> c_singlequote INTO l_string.
ELSE.
CONCATENATE l_string <fs_campo> INTO l_string.
ENDIF.
ENDCASE.
AT LAST.
* Añade CRLF
CONCATENATE l_string c_crlf INTO l_string.
EXIT.
ENDAT.
* Añade tabulador
CONCATENATE l_string c_tab INTO l_string.
ENDLOOP.
ENDLOOP.
create_binary_content( ).
ENDMETHOD. "set_attach_table
METHOD create_binary_content.
DATA: l_size TYPE so_obj_len.
* convert the text string into UTF-16LE binary data including
* byte-order-mark. Mircosoft Excel prefers these settings
* all this is done by new class cl_bcs_convert (see note 1151257)
TRY.
cl_bcs_convert=>string_to_solix(
EXPORTING
iv_string = l_string
iv_codepage = '4103' "suitable for MS Excel, leave empty
iv_add_bom = 'X' "for other doc types
IMPORTING
et_solix = binary_content
ev_size = size ).
CATCH cx_bcs.
MESSAGE e445(so).
ENDTRY.
ENDMETHOD. "create_binary_content
METHOD send.
DATA: l_sent_to_all TYPE os_boolean.
TRY.
* create persistent send request
send_request = cl_bcs=>create_persistent( ).
* create and set document with attachment
* create document object
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = l_body_text
i_subject = l_subject ).
* add the spread sheet as attachment to document object
document->add_attachment(
i_attachment_type = 'xls'
i_attachment_subject = l_attach_name
i_attachment_size = size
i_att_content_hex = binary_content ).
* add document object to send request
send_request->set_document( document ).
* add recipient (e-mail address)
recipient =
cl_cam_address_bcs=>create_internet_address(
l_recipient_addr ).
* add recipient object to send request
send_request->add_recipient( recipient ).
* send document
l_sent_to_all = send_request->send(
i_with_error_screen = 'X' ).
COMMIT WORK.
IF l_sent_to_all IS INITIAL.
MESSAGE i500(sbcoms) WITH l_recipient_addr.
ELSE.
MESSAGE s022(so).
ENDIF.
CATCH cx_bcs INTO bcs_exception.
MESSAGE i865(so) WITH bcs_exception->error_type.
ENDTRY.
ENDMETHOD. "lcl_mail_xls_attachment
METHOD get_dataelement_medium_text.
DATA: lt_fld_info TYPE STANDARD TABLE OF dfies,
wa_fld_info TYPE dfies.
* Busca en el diccionario los datos del campo
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = im_table_name
fieldname = im_field_name
langu = sy-langu
TABLES
dfies_tab = lt_fld_info
EXCEPTIONS
not_found = 1
internal_error = 2
OTHERS = 3.
CLEAR ex_medium_text.
IF sy-subrc = 0.
READ TABLE lt_fld_info INDEX 1 INTO wa_fld_info.
* Si lo ha podido tomar del diccionario...
IF NOT wa_fld_info-scrtext_m IS INITIAL.
* Toma el nombre del nombre de campo del diccionario
ex_medium_text = wa_fld_info-scrtext_m.
ENDIF.
ENDIF.
ENDMETHOD. "get_dataelement_medium_text
ENDCLASS. "cl_mail_builder_xls_attach IMPLEMENTATION -
How to select server in which background job should run
Hi,
I want to run my program as background job. I want the user to select the server, in which background job should be run, in the selection screen of my program. When it is sheduled in background the job should run in the selected server.
How to do this?
Regards,
SriramHi,
please write the code like as below.
DATA : D_GROUP like TBTCJOB-JOBGROUP.
use the function moulde JOB_OPEN.
D_JOBNAME = SY-REPID.
D_GROUP- BTCSYSREAX = " pass the target server name Here
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = D_JOBNAME
JOBGROUP = D_GROUP
IMPORTING
JOBCOUNT = D_JOBNO
EXCEPTIONS
CANT_CREATE_JOB = 1
INVALID_JOB_DATA = 2
JOBNAME_MISSING = 3
OTHERS = 4.
submit <Program name>
USER SY-UNAME VIA JOB D_JOBNAME NUMBER D_JOBNO
USING SELECTION-SET ' var1 ' " Give varient name
AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = D_JOBNO
JOBNAME = D_JOBNAME
STRTIMMED = 'X'
IMPORTING
JOB_WAS_RELEASED = D_REL
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.
Hope this will helps you
Regards
Kiran -
How to get the list of batch jobs running in a specific application server
Hi Team,
I am trying to check in SM37 if there is any specific condition to get the list of batch jobs assigned to a specific target server but cant find any.
Is there is way to find the list of batch jobs assigned to run in one specific application server.( Target server specified in SM36 while job creation)Hello,
This is what you can do in SM37.
Execute the list of batch jobs, when the result appears on the screen edit the ALV grid via CTRL+F7.
Now add the following columns "TargetServ" and "Executing server".
You will now have two extra columns in your result list.
TargetServr contains the value of the application server where the job should run when you have explicitely filled it in.
Often this is empty, this means that at runtime SAP will determine itself on which application server the job will run (depending of course where the BGD processes are defined).
Executing server is filled in always for all executed jobs, this is the actual application server where the job has run.
You can also add these two fields in your initial selection screen of SM37 by using the "Extended job selection" button.
I hope this isusefull.
Wim -
How to Execute WebDynpro Applications as Background Job ?
Hi Gurus,
We have developed a lot of WDJ applications with component reusage; ie,
quite a lot of business logic are wrapped in WDJ Components which are
re-used by other WD UIs.
Now we'd like to automate some of the processes with background jobs
and faced with a few problems :
#1. How can we write a background WD application which can be
triggered by external mechanism and without presenting any UI?
#2. If we write the background program in a Java DC, how can we
invoke existing methods in WD components ?
Anyone got a clue ??
Ying-Jie ChenHello Amit,
> Well I can think of a workaround in this case.If you are aware
> of the suspend-resume functionality of the WD application then
> its possible to run the WD application virtually in background.
[ stuffs deleted ...]
It sounds like a possible alternative to our requirement, I'll
spend some time to investigate on the WD suspend-resume mechanism !
> Also let me know why are you preffering the WD if you dont
> require its UI
Our application requires the process to be performed with UI interaction;
with some instances it should be run as a background job. Either case involves
RFC calls to backend SAP R/3 and it's easy for RFC access with WD
Component. Though it's also possible to use CAF application service for
RFC access; due to some technical constrains, we did not use CAF
framework. Therefore it ends up where we are now ...
Thanks for your tip!
Ying-Jie Chen -
How to find process chain using background job in sm37
How to find process chain using background job in sm37
Better is to select the job.
Select (Define) Step (s) or F6.
Select the line and Menu Goto>Variant.
The variant contains the name of the CHAIN and its VARIANT.
Success
We faced an old job and via job monitoring we were informed about a cancelled job every 'interval'.
We noticed that the related chain was deleted but still the job was scheduled each interval again and was cancelled because an event was missing
We could not find the scheduled job via SM37.
Via view V_OP, view over tbtco abd tbtcp, we find the related entry.
We delete these entries via function BP_JOB_DELETE....
Edited by: Jack Otten on Jul 9, 2010 2:50 PM -
Rule set import - Background job did not run
Hi,
I am setting up my CC 5.2 production system. I have downloaded from ruleset from the dev CC and imported it into production. However the background job generated did not run. I am implementing SAP note 999785 to fix this, but am wondering what should I do about the rule set? Do I need to delete the rule set and reimport it? As this background job did not run I notice that the permission rules did not generate.
Any advice is welcome.
ThanksHi,
as the backgorund job never ran and no rules were created, I can just reimport the ruleset and let the job run. I have tried this and the rules were created successfully -
How to translate the key words in ABAp program from lower case to upper cas
How to translate the key words in ABAp program from lower case to upper case?
Hi Kittu,
You need to set the Pretty Printer settings to achieve key words in ABAP program from lower case to upper case.
Utilities -> Settings -> Pretty Printer (tab) -> Select third radio button.
Thats all.
<b>Reward points if this helps.
Manish</b> -
How to change the page Header background colour in a Theme
Hello,
I want to know how to change the page header background colour. If you are in the Editor I don't find a property where to change it.
If you are in the Theme Editor in the header bar I want to change stands <b>Theme Editor</b>. This (in my case blue colored bar) I want to change in another color.Hello Radhika,
thanks for your answer. Where do I find the option for the pageheader in System Administration>Portal Display>Theme Editor ->IView Trays exactly?
The pageheader is a picture, which must be uploaded for the web dynpro. Why should any webdynpro element in the ivew tray. There is no relationship between these two parts.
I have not found any option to change the web dynpro pageheader. Could there any extra theme editor for webdynpro?
Thanks.
Olaf -
How to find the patches for perticular concurrent program
HI
How to find the patches for perticular concurrent program. suppose for one concurrent program we create the patch and applied now i want know the which patch applied for perticular concurrent program through back end.
Thank'sQuery the concurrent program in Sysadmin responsibility.
Note the concurrent executable.
Query the concurrent executable in Sysadmin.
Note the file name.
If it is a package, open the package in TOAD and note down the file name.
If it is a report/form, open it in form developer and note down the file name.
Go to patch find screen in metalink. In the advanced search screen, enter the file name and you will see patches that contain it.
Hope this answers your question
Sandeep Gandhi
Independent Consultant
513-325-9026 -
How to change the particular column background color in jTable?
I am woking with a project, in which I am using a jTable. Then
How to change the particular column background color in jTable?Use a custom Renderer. This is the JTable tutorial:
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html -
HT204291 how do get the media icon for mac mirroring when running airplay on itunes?
how do get the media icon for mac mirroring when running airplay
Airplay mirroring requires a Mac from 2011 or later, running OSX 10.8 (or later)
http://support.apple.com/kb/HT5404?viewlocale=en_US&locale=en_US -
How 2 capture the request in background
Hi,
how 2 capture the request in background
ThanksHi,
My question is ,
while creating any object we generally assign that to particular request .
I have one object XXXX . I want to find which request is assigned to this object . i want to know.
Thanks -
What is the difference between background job and foreground job
Hi Experts,
Could you pls tell me
What is the difference between background job and foreground job
and where exactly used background jobs...
ThanksHello,
Background jobs - without user interaction, scheduled via SM37.
Foreground jobs - with user interaction (transactions).
For more information, please read these: [http://help.sap.com/saphelp_nw04/helpdata/en/e4/2adbda449911d1949c0000e8353423/frameset.htm], [http://help.sap.com/saphelp_nw04/helpdata/en/73/69ef5755bb11d189680000e829fbbd/frameset.htm] and [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/20cb0b44-8f0b-2a10-2381-ca8162bcb5b2].
Regards,
Maybe you are looking for
-
HELP!! iPod got frozen in HOLD !!!
Please somebody help me! i got a 2GB ipod nano, last day i switch it in HOLD mode but suddenly it got frozen, so now i can't reset it cause of the hold (even when the hold button is off), i've tried charging it, and it holds the charge, how can i res
-
Hi One of our clients has generated an E TDS file from SAP. However the DAT file generated is not getting accepted by the NSDL. Pls suggest Regards VG
-
Hi, How to implement multiple selection in LOV region-query result table and return multiple values from LOV region back to the main page? Any help in this regard is greatly appreciated.
-
Transaction Journal Print Layout Design
Hi all Is it possible to show in Transaction Journal Print Layout Design Report to show details of Journal Entry line details like Profit Center, Tax base amount and Tax Code? Kedalene
-
Photoshop CS4 and nVidia 8600GT
Just installed the latest nVidia drivers (190.38), and Photoshop CS4 (x64) keeps telling me to install the latest drivers in order to take advantage of graphics card acceleration. Why is that? What am I doing wrong? Running a GeForce 8600GT in Window