Executiing program in background..??
Right now, I want to create a background program which monitors certain folder. What I mean by background is that, I want create a program that will continue running on myLinux Machine whether I log on or off (of course the computer willl be on). Also, the program must be executing while I ssh onto the machine or do other command line on the screen.
How would I create the program so that it remains executing in background ?
You need to make no modifications to your program to allow it to run in the background in Unix or Linux.
There are two ways to start the program, depending on which shell (command interpreter) you use:
java com.whatever.GeeWhiz &
or
nohup java com.whatever.GeeWhiz &
Some shells need the "nohup" thing. Try out which one works for you. Or, the latter should work always; the first one gets HUP'ed (killed by a hangup signal) on some shells.
Similar Messages
-
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 -
Regarding SUBMIT statement - to process a program in background
Hi All,
I have issue of submitting a program in background and also i need to process the no of records come from program by splitting them by 1000(n).
First of all i have program whose code is like following:
<b>REPORT z_update_material_master.</b>
TYPES: BEGIN OF t_marc,
matnr LIKE marc-matnr, "Material Number
werks LIKE marc-werks, "Plant
beskz LIKE marc-beskz, "Procurement Type
sobsl LIKE marc-sobsl, "Special procurement type
fhori LIKE marc-fhori, "Scheduling Margin Key for Floats
dzeit LIKE marc-dzeit, "In-house production time
plifz LIKE marc-plifz, "Planned delivery time in days
webaz LIKE marc-webaz, "Goods rcpt processing time
pwwrk LIKE t460a-wrk02, "Production plant in planned order
erhor LIKE t436a-erhor, "Opening periodr
zlt TYPE p DECIMALS 3, "Total replenishment lead time
ztlt TYPE p DECIMALS 3, "Total replenishment lead time
wzeit TYPE p DECIMALS 3, "Total replenishment lead time
upd(1) TYPE c, "UPDATE INDICATER
ind TYPE c,
END OF t_marc.
DATA: i_marc TYPE SORTED TABLE OF t_marc INITIAL SIZE 0
WITH HEADER LINE
WITH NON-UNIQUE KEY matnr werks,
i_marc_rpt LIKE i_marc OCCURS 0 WITH HEADER LINE.
DATA: l_plantdata LIKE bapi_marc,
l_headdata LIKE bapimathead,
l_plantdatax LIKE bapi_marcx,
l_tabix LIKE sy-tabix.
CONSTANTS: c_s TYPE c VALUE 'S',
c_x TYPE c VALUE 'X'.
DATA i_temp_bapi_return LIKE bapi_matreturn2
OCCURS 0 WITH HEADER LINE.
DATA BEGIN OF i_temp_zppe0091_01 OCCURS 0.
INCLUDE STRUCTURE zppe0091_01.
DATA: END OF i_temp_zppe0091_01.
DATA: l_tab_nam LIKE rstable-tabname VALUE 'ZPPE0091_01'.
SELECT * FROM zppe0091_01
INTO CORRESPONDING FIELDS OF TABLE i_temp_zppe0091_01.
IF sy-subrc EQ 0.
LOOP AT i_temp_zppe0091_01 WHERE upd = c_x.
l_tabix = sy-tabix.
l_headdata-material = i_temp_zppe0091_01-matnr.
l_plantdata-plant = i_temp_zppe0091_01-werks.
l_plantdata-replentime = i_temp_zppe0091_01-wzeit.
l_plantdatax-replentime = c_x.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = l_headdata
plantdata = l_plantdata
plantdatax = l_plantdatax
TABLES
returnmessages = i_temp_bapi_return.
IF NOT i_temp_bapi_return[] IS INITIAL.
READ TABLE i_temp_bapi_return WITH KEY type = c_s.
IF sy-subrc EQ 0.
i_marc_rpt-matnr = i_temp_zppe0091_01-matnr.
i_marc_rpt-werks = i_temp_zppe0091_01-werks.
APPEND i_marc_rpt. CLEAR i_marc_rpt.
ELSE.
i_temp_zppe0091_01-upd = space.
MODIFY i_temp_zppe0091_01 INDEX l_tabix TRANSPORTING upd.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
Now i want to call this program from another program that is already exists by using <b>SUBMIT</b>
statement in background and i need to process this program by dividing records by <b>1000</b> into seperate session.
how can i do it. Can any body tell me the solution with syntax.
I might get lot of records from above program so i want to split them into diffrent sessions based on number of records(1000).
can any body give me the solution.
Thanks in advance.
Thanks & Regards,
Rayeez.Try implementing the following code. Use the code accordingly...
MOVE 100 TO c_recs_b4_split.
IF num_src_trans > c_recs_b4_split.
target_break = num_src_trans / p_thread.
ELSE.
target_break = num_src_trans + 1.
ENDIF.
wa_subbch = 1.
last_index = 1.
No batch split required if total recrods less than 100
IF num_src_trans < c_recs_b4_split.
CLEAR : range_btch.
REFRESH: range_btch.
IF wa_subbch = p_thread.
target_break = num_src_trans.
ENDIF.
MOVE 'S_SRCTRN' TO range_wa-selname.
MOVE 'S' TO range_wa-kind .
MOVE 'I' TO range_wa-sign .
MOVE 'EQ' TO range_wa-option .
LOOP AT itab_src_trans INTO st_src_trans.
MOVE st_src_trans-src_tran_id TO range_wa-low.
APPEND range_wa TO range_btch.
ENDLOOP.
Step 3 Submit the batch.
v_job_no = v_job_no + 1.
PERFORM submit_tp_jobs.
ELSE.
DO.
Step 1 Collect data for the target count
CLEAR : range_btch.
REFRESH: range_btch.
IF wa_subbch = p_thread.
target_break = num_src_trans.
ENDIF.
MOVE 'S_SRCTRN' TO range_wa-selname.
MOVE 'S' TO range_wa-kind .
MOVE 'I' TO range_wa-sign .
MOVE 'EQ' TO range_wa-option .
IF wa_subbch = p_thread.
target_break = num_src_trans - v_cnt .
ENDIF.
LOOP AT itab_src_trans INTO st_src_trans FROM last_index.
last_index = sy-tabix.
batch_total = batch_total + 1.
IF batch_total <= target_break.
MOVE st_src_trans-src_tran_id TO range_wa-low.
APPEND range_wa TO range_btch.
ELSE.
EXIT.
ENDIF.
v_cnt = v_cnt + 1.
ENDLOOP.
CLEAR batch_total.
Step 2 Submit the batch.
v_job_no = v_job_no + 1.
PERFORM submit_tp_jobs.
ADD 1 TO wa_subbch.
IF wa_subbch > p_thread.
EXIT.
ENDIF.
ENDDO.
ENDIF.
FORM submit_tp_jobs .
DATA : l_jobcount LIKE tbtcjob-jobcount,
l_jobrelease LIKE btch0000-char1,
w_job_flag VALUE 'X',
w_process_mode,
w_user_print_params LIKE pri_params.
l_jobname = p_batch.
CONCATENATE 'TP_' l_jobname '_' v_job_no INTO l_jobname.
CONDENSE l_jobname NO-GAPS.
w_process_mode = ' '.
IF NOT range_btch[] IS INITIAL.
PERFORM create_post_ctrl.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = l_jobname
IMPORTING
jobcount = l_jobcount.
SUBMIT zfi_pc_tran_proc
AND RETURN
WITH p_batch = p_batch
WITH p_jobid = p_jobid
WITH p_mode = w_process_mode
WITH p_subbch = wa_subbch
WITH p_jobq = p_jobid
WITH p_cntlmt = p_cntlmt
WITH p_tpiop = p_iop
WITH SELECTION-TABLE range_btch
USER sy-uname
VIA JOB l_jobname NUMBER l_jobcount
TO SAP-SPOOL
SPOOL PARAMETERS w_user_print_params
WITHOUT SPOOL DYNPRO.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_jobcount
jobname = l_jobname
strtimmed = 'X'
IMPORTING
job_was_released = l_jobrelease
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.
ENDIF.
ENDFORM. " submit_tp_jobs
Pl. add the points.... -
To run a program in BACKGROUND using SUBMIT
I need to run a program in background using the SUBMIT option. Here i have to pass an internal table form one program to another which will be used to update sales orders using BDC.
Questions
1} Can we execute a program in background using SUBMIT?
2} I am sending data to a MEMORY ID , if i run the program in background will the memory id work. As in do memory IDs work in the background.
Thanks in Advancerefer same thread.
Re: Problem with SUBMIT in Background -
How to schedule a program in background after 5 or 10 sec
Hi All,
Can anyone tell me how to schedule a program after 5 or 10 sec in background after the transaction is completed.
It is not a custom transaction. I want to execute a Z program in background in a BADI
Regards
Yathish
Message was edited by:
Yathish GundlupetProgramattically? You can add this code to the end of your transaction(if it is custom, of course).
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 = 'THIS_JOB'.
call function 'JOB_OPEN'
exporting
jobname = l_jobname
importing
jobcount = l_jobcount.
* Submit report to job
submit <your_program_name
via job l_jobname
number l_jobcount
to sap-spool without spool dynpro
spool parameters ls_params
and return.
* Kick job off 10 seconds from now.
sdate = sy-datum.
stime = sy-uzeit + 10.
* Schedule and close job.
call function 'JOB_CLOSE'
exporting
jobcount = l_jobcount
jobname = l_jobname
sdlstrtdt = sdate
sdlstrttm = stime
Regards,
RIch Heilman -
Executing a report program in background from another program
Hi Experts,
I developed a report to display material change history based on change date range. Report is taking much time (around 15-20 mins) as I'm hitting CDPOS and CDHDR tables. User wants to execute the report in foreground because he/she can give selection criteria that is required everytime.
So, my requirment is now to create another program with same selection screen elements which will execute the original program in background. In the new program, we will be just capturing the selection elements and will pass them to original program to run in background and display a message to user without wait for the background job to complete. Original program should send an email to an fixed email id with the report output as attachment (for example excel file).
Please suggest.
Thanks in Advance,
Siva SankarHi Siva,
Please see the link
http://help.sap.com/saphelp_nw04/helpdata/EN/2a/fa01dd493111d182b70000e829fbfe/content.htm
Regarding a Change Document Function Module ----- VERY VERY Urgent
When using function modules , I dont think you can directly get data based on material and plant . these function modules usualy works with object class and creation date .
Once you retrieve the data using the function modules you have to filter out the unncecessary data based on your selection screen conditions .
Regards,
Ratheesh BS
Edited by: Ratheesh Bhaskarapillai Suseeladev on Mar 8, 2012 5:19 AM
Regarding a Change Document Function Module ----- VERY VERY Urgent -
Running BDC program in background for the transaction VL02N
Hi All,
I have coded a BDC program (call transaction method) for the transaction code VL02N. I can able to run the program manually & successfully. But if I execute the program in background(SM36), it is going to dump giving CNTL_ERROR.
Note: I am not using any of the GUI_UPLOAD, GUI_DOWNLOAD funciton modules in the program. But I am using the FTP command funtion modules like( FTP_COMMAND, FTP_CONNECT, FTP_DISCONNECT and FTP_SERVER_TO_R/3).
<removed_by_moderator>
Thanks in advance.
Ramesh.
Edited by: Julius Bussche on Jul 8, 2008 5:55 PMVL02N is an enjoy transaction. You cant run it in background. Please try VL02.
Thanks
Romit -
How to create a variant and execute a Z-program in background
Hello,
I have created a specific transaction to update relationships between partners (BP).
For this i have create a screen painter, but as the run time is long i want to execute the program in background.
How to save a variant and to execute the report in background ?
Thanks in advance
ChristopheHi,
Please go to your z-transaction.
Enter your selection criteria. & click on save button to save your your selection criteria as a variant.
Now go to tcode SM36 to shedule your program with saved variant.
Regards,
Narendra -
Call transaction KB21N processed by a program in background mode
Hi to all,
I call transaction KB21N using BDCDATA in a custom program. If I process this program in foreground mode all it's OK, but if I process the program in background mode, I have a runtime error with DUMP: RAISE EXCEPTION with exception condition CNTL_ERROR. This program has to be executed in background so a bapi exist to use instead of call transaction or something else?
Thank you very much,
regards
AntonioHI Antonio,
The transaction you are dealing with is an SAP Enjoy transaction and for such transactions it is not recommended to do a BDC. YOu should search for a BAPI for the same as you have already identified. Basically the enjoy transactions uses GUI controls which cannot be handled by BDC.
BAPI_ACC_ACTIVITY_ALLOC_POST may serve your purpose.
Regards,
ravi
Message was edited by:
Ravi Kanth Talagana -
Run a java program in background
Hi, I am implementing a bot that's supposed to do something when it receives mesages. My question is how I can make the program keep running. I guess the idea of threading would help but I just dunno how to do it. some hints will be appreciated. I dun wanna put a while(true){} there it just takes too much CPU time. I have some Listeners that will do something when some event happens.
examples will be helpful.I am implementing a bot that's supposed to do something when it receives mesages.Which way does it receive a message? You could run the program in background. It would block on an incoming message. If it listens a socket, you can use
java.net.ServerSocket's accept()
which will block until a connection request arrives. -
"GUI Download" not working if program run background
Dear All,
I`ve created program to download my internal table using function module GUI_DOWNLOAD and it works fine if run foreground. The problem is now when the program run background it didn`t work and got error "Could not ascertain code page".
Or maybe somebody hv another idea how to download that data to frontend drive but the program should run background.
thkshi..
Hope this this will be helpful.
DATA : v_transfer_record(950) TYPE c,
vfl_file LIKE LINE OF itab.
OPEN DATASET file_name FOR OUTPUT IN TEXT MODE
ENCODING DEFAULT.
IF sy-subrc = 0.
LOOP AT itab INTO vfl_file.
CLEAR v_transfer_record.
v_transfer_record = vfl_file.
TRANSFER v_transfer_record TO file_name.
ENDLOOP.
CLOSE DATASET file_name.
IF sy-subrc <> 0.
MESSAGE 'Error Closing dataset'.
EXIT.
ELSE.
MESSAGE 'records in file file_name.
ENDIF.
ELSE.
MESSAGE 'error openning file for output' .
EXIT.
ENDIF.
Regards,
Pranali -
I have a problem in processing the program in background
Hi,
We have cloned the T'code V_V2 and added some additional functionality and when we try to run the program in background the error is blocking the process
This is because, say example i am tring to process the sales order in production systen through my program ,in that time some one may chage the sales document . in trhis case my program should not blocked it should check the block before processing and then it should proceed.
is there any FM to find the blocked sales order.
Regards,
VijayTry using the FM:
ENQUE_READ2
Passing the follwing values:
GNAME --> VBAK (Sales Order header table)
GARG --> The lock argument
(This will be a combination of client number anb Sales Order No.
Eg: '3001210000054' where the first three digit i,e 300 is the client No
and 1210000054 is the sales order no.)
Regards,
Firoz. -
Call external program in background mode
Hi,
I am creating a PO using bapi BAPI_PO_CREATE1 in exit USEREXIT_SAVE_DOCUMENT_PREPARE.
I dont want to write the code in my exit. Instead I want to write the code in a Z program and call it in my exit.
My Problem.
How do I call my z program in my exit so that I can pass internal tables from my exit to the z program. Also I want to schedule the call of my external program for background processing.
I am trying with SUBMIT ZPROG AND RETURN. But not able to pass an internal table.
I tried PERFORM BAPI_PO_CREATE IN PRGRAM ZPROG, but in this case not able to schedule it in background.
Please advise.
Regards,
ShobhitHi Rich,
Im setting runtime error:
My Code in Exit: (xvbfa is the table which i wanna pass)
concatenate 'SERVICEPO' sy-datum into l_key.
export xvbfa = xvbfa
to shared buffer indx(st) id l_key.
My Code in the called program ZMM_SERVICE_PO
Runtime Errors CONNE_IMPORT_WRONG_OBJECT_TYPE
Exceptn CX_SY_IMPORT_MISMATCH_ERROR
Date and Time 05.12.2005 21:41:54
ShrtText
Error when attempting to IMPORT object "XVBFA".
What happened?
Error in ABAP application program.
The current ABAP program "ZMM_SERVICE_PO" had to be terminated because one of
the
statements could not be executed.
This is probably due to an error in the ABAP program.
When importing the object "XVBFA", the object in the
dataset had a different type from the target object in the program
"ZMM_SERVICE_PO" (object types: field, field string/structure, table).
table).
Error analysis
An exception occurred. This exception will be dealt with in more detail
below. The exception, assigned to the class 'CX_SY_IMPORT_MISMATCH_ERROR', was
not caught, which
led to a runtime error. The reason for this exception is:
The object "XVBFA" has a different object type in the dataset from
that in the target program "ZMM_SERVICE_PO". (Object types: Field, flat
structure,
deep structure, flat table, deep table).
Missing Handling of System Exception
Program ZMM_SERVICE_PO
Trigger Location of Exception
Program ZMM_SERVICE_PO
Include ZMM_SERVICE_PO
Row 43
Module Name START-OF-SELECTION
Source Code Extract
Line SourceCde
REPORT ZMM_SERVICE_PO.
DATA: l_poheader LIKE bapimepoheader.
DATA: l_poheaderx LIKE bapimepoheaderx.
DATA: l_poitem LIKE bapimepoitem OCCURS 0 WITH HEADER LINE.
DATA: l_poitemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.
DATA: l_cond LIKE BAPIMEPOCOND OCCURS 0 WITH HEADER LINE.
DATA: l_condx LIKE BAPIMEPOCONDX OCCURS 0 WITH HEADER LINE.
DATA: l_poschedule LIKE bapimeposchedule OCCURS 0 WITH HEADER LINE.
DATA: l_poschedulex LIKE bapimeposchedulx OCCURS 0 WITH HEADER LINE.
DATA: l_purchaseorder LIKE bapimepoheader-po_number.
DATA: l_return TYPE BAPIRET2 OCCURS 0.
DATA: l_error_found TYPE c.
DATA: l_show_messages TYPE c.
DATA: l_eindt(10) TYPE c.
DATA: l_answer TYPE c.
DATA: l_VBAK TYPE STANDARD TABLE OF VBAK WITH HEADER LINE.
DATA: l_VBFA TYPE STANDARD TABLE OF VBFA WITH HEADER LINE.
DATA: xlips TYPE STANDARD TABLE OF LIPS WITH HEADER LINE.
*DATA: xvbfa TYPE STANDARD TABLE OF vbfa WITH HEADER LINE.
DATA xvbfa like vbfa.
DATA: l_key(60) type c.
concatenate 'SERVICEPO' sy-datum into l_key.
>>>>> import xvbfa = xvbfa
from shared buffer indx(st) id l_key.
delete from shared buffer indx(st) id l_key.
Could you help.
Regads,
Shobhit -
Issue while capturing messages when running program in background
Hi,
I have a program where we have BDC for transaction KSU5 and this is using CALL TRANSACTION method to post the documents after this we have to check a table COEP for the document no's generated in ksu5.
This program works absolutely fine in foreground printing the output on screen the document numbers that we get once we use
CALL TRANSACTION 'KSU5' USING bdcdata MODE 'E' MESSAGES INTO return.
but the same gets spoiled if we run this program in background !! the return table where I use to get the document no it shows additional data of the KSU5 transaction which is not required I am just trying to print the document no from the return table with variable msgv1 and msgv2.
Can someone explain or give solution to run this program in background and get the result printed correctly for the user.
Thanks
SudharshanSudarshan,
I guess your code was recorded for Online mode , try to compare it with Simulated background BDC code for the transaction and see if there is any difference for your required functionality .
You can generate 'Simulated background BDC code' by SHDB->New recording-> and then check 'Simulate background BDC code' option in popup window .
-Tushar Shukla
Edited by: TUSHAR SHUKLA on Oct 8, 2010 2:23 AM -
BDC is not working in when executing the program in background
Hi gurus,
I have a problem that in BDC is not working when i'm executing the upload program in background thru scheduling(SM36) , while it works fine when i execute directly with NO screen display modeMany transactions behave differently when executed in foreground and background. The fields on the screen may be different.
In transaction SHBD when starting a recording there is a checkbox where you can select 'Simulate Background Mode'. If you do your recording using this option you will get the code suitable for background mode. If you do not select this option you will get a code for foreground mode.
By compairing the two codes you will know the changes required for background mode.
Hope this helps you
Maybe you are looking for
-
Adobe Bridge CS6 stalls in Photoshop...
I downloaded CS6 Design Standard from Adobe webpage and have tried several times to get mini bridge/bridge to run, but the message 'Waiting for Bridge CS6' runs for hours. I am using a 64-bit Dell desktop with Windows 7 Home Premium. I have tried opt
-
New iMac 2012 & Mini DisplayPort to DVI-Adapter
Will this adapter work with the new iMac 2012 (27-inch)? (I´m not sure because there are only thunderbolt ports on the picture and no Mini DisplayPort) Thank you! bye
-
Date Filter in BEx Query not applied to Webi Document
Hi I have a simple BEx Query on 0MATERIAL - with Article (0MATERIAL) and Created On Date (0CREATEDON) characteristics in the Rows and 1ROWCOUNT key figure in the columns. If I restrict the BEx Query on 0MATERIAL to a single value, only that particula
-
am giving hard coded message at output. i want F1 Help , can help me to get out of this problem? do n't tell use DYN_FIELD_F1_HELP' this FM, please give suitable solution. Any funtional module, anything please let me. Please please, As early as pos
-
Oracle Client 11.2.0.3
Hi All, I want to download Oracle Client 11.2.0.3 for HP UX system. I only see Oracle Client 11.2.0.1 in the Oracle Download page. How do I get Oracle Client 11.2.0.3? Thanks!