Issue in Foreground Report executing as background
I have developed a Report in ABAP which has a selection screen and 2 radiobuttons
Foreground
Background
The report basically reads a TXT file from Desktop and calls a standard BAPI.
In foreground, I have no issues i.e. I browse the call from desktop and call GUI_UPLOAD and so on
However, in background, I am confused how to proceed??
Please note: Report is still running in foreground mode i.e. i am browsing the file. Its just that i have selected background Radiobutton
Can anyone tell me how to proceed i.e. to execute in background.
Do I need to submit the same program via JOB_OPEN JOB_CLOSE in background and then exit??
Please advice
Hi Razdan,
If want to schedule the background job through the program, then you can try method explained in below links. Here you might have to create a separate program to submit.
https://help.sap.com/abapdocu_70/en/ABAPSUBMIT_VIA_JOB.htm
http://scn.sap.com/thread/590077
Another approach would be like below
Add an additional field apart from the radio button, say “ip_file” in the selection screen. This you can show while selecting the radio button “background”
Suppose if you have updated the file in app. Server(AL11 ) , in a location , say ( “home/myfile/test.txt” ) .
Save a variant with the radio button “background” selected and input field ip_file value as “home/myfile/test.txt”.
Now from the SM36 you can schedule the background job to run the report with the same variant.
Please note that , here you need to upload the file separately to app. Server using , tcode - CG3Z or any other FM. And in the program you can use open dataset to access the file in the app. Server.
Similar Messages
-
Report executing in background
Hi All,
I am able to run the report in background. But the problem is i am not able to see the output in the desired way.
I have set the back ground job in se38 transaction. then i am going to SM37 and selecting the job and going to spool but i am not able to see the output.
Please let me know the processing of seeing the output, or do we need to write any code for that. If we need to write a code to display the output please send the code.
Thanks,
GovindHi,
You don't have to write any code for this.
Just ensure that you run the background job immediately.
Please select all the check boxes in SM37 to see the scheduled job.
The output might take some time as program can run for sometime.
You can see the output in the spool.Check the details in Job Log.
Hope this helps..
Regards
Deepu -
COPA Report - Execution in Background
Friends,
We have a COPA report that takes very long time to execute. For this reason the user wants to schedule the report such that it executes in the background at month-end.
In order to test the scheduling of the report execution in background in Development system, I followed the following steps:
1) Selected the report to be executed using the t-code KE30.
2) Clicked on Report - Execute in background.
3) Filled in the execution parameters and since I did not want the print of the report, I ticked the checkbox 'Rebuild frozen report data' (I was getting the error message "Select either 'Print' or 'Save'".
4) Executed the report by pressing F8. I got the message 'Report data for the report saved'.
My question is how to view the report on screen when the report is executed in background?
Please advise at the earliest.
Thanks & Regards,
Sameer S. Gupte
Office: +91 22 66452730
Cell: +91 93232747801Sameer
You cannot see this data as it is.
When you see the message 'Report data for the report saved'. It means that the system has performed a kind of summarization for the selection criteria you have entered. This is performance enhancement tool.
So you have to run the report again to view this report; but this time choose the option Read saved Data for the Read Mode under Status of Data. You can get to the see report output fairly quick.
SAP documnetation reads thus " <b>You create report-specific frozen report data by executing the report in the background and by choosing the Rebuild frozen report data option in the selection. When you call up the report again using the same selection, you have the option of displaying this frozen report data. If you would like more up-to-date frozen report data, you need to create this data again."</b>
Good luck.
Sridhar -
How to display pop up in foreground when report is executing in background
Hi All,
The requirement is:
My report is executing in background and I have to display a pop-up to end user in foreground.
Is there any method to do this.
it is urgent,
Reward points will be awarded to correct answers.
Thanks,
Vishal.Thanks frnds,
ok can we go in this way......I need to display the pop up when the "program -> execute in background" button is clicked or F9 is pressed....just at that time....later the report can be executed in back ground.
Is there a way to do so......just displaying a pop up when one entry in menu bar ic clicked?
Vishal. -
How to extract the column width in ALv report if its executed in background
I am executing an ALV report in background , in front end i am getting data properly, in back end for some columns some of the digits are missing.For example if PO no is of 10 digits it will display only 8 becos column size is like that , how to extract coulmns in back ground.
I have executed in background and checked the spool and for some of the columns width is not sufficient to display comeplete data so please suggest how to extract the columns sizes if executed inj background for an ALVHi Deepthi,
you can try with the above mentioned suggestions ,if its worked its fine ,
If not use Docking container instead of custom container, For ALV in back ground jobs, its suggest to use docking container instead of custom container , below you can find the declaration for docking container and code to use docking and custom container in your program for fore and back ground.
or you can use docking container alone for both operations.
Data : G_DOCK1 TYPE REF TO CL_GUI_DOCKING_CONTAINER,
IF CCON IS INITIAL. (ccon is container name )
*Check whether the program is run in batch or foreground
IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL.
*Run in foreground
CREATE OBJECT CCON
EXPORTING
CONTAINER_NAME = 'CON1'.
CREATE OBJECT GRID1
EXPORTING
I_PARENT = parent_1.
ELSE.
*Run in background
CREATE OBJECT GRID1
EXPORTING
I_PARENT = G_DOCK1.
ENDIF.
ENDIF.
B&R,
Saravana.S -
Block list display when report is executed in background?
Hello all,
when i execute the report program in foreground ,output is displayed as block list with two blocks say success table and failure table.
when i execute the same report program in background, i could see only a single block which is success table. Why is this?
Thanks,
Sindhu.Did you check all the pages in spool? If the report has a output which runs multiple pages, then spool might not display everything unless you change the setting to display more than certain pages. Kindly check the same.
-
Report is executing in background and need data(output) in excel format
Report is executing in background and need data(output) to get downloaded in excel format in my PC from an internal table;;in any drive i.e. C: or D: .When executing in backround it prompt to user with which location excel file to be saved and the name of file.How to download in background in excel format?
Edited by: PRASHANT BHATNAGAR on Aug 26, 2008 6:24 AMHi
Download a report to excel with format (border, color cell, etc)
Try this program...it may help you to change the font ..etc.
Code:
REPORT ZSIRI NO STANDARD PAGE HEADING.
this report demonstrates how to send some ABAP data to an
EXCEL sheet using OLE automation.
INCLUDE OLE2INCL.
handles for OLE objects
DATA: H_EXCEL TYPE OLE2_OBJECT, " Excel object
H_MAPL TYPE OLE2_OBJECT, " list of workbooks
H_MAP TYPE OLE2_OBJECT, " workbook
H_ZL TYPE OLE2_OBJECT, " cell
H_F TYPE OLE2_OBJECT. " font
TABLES: SPFLI.
DATA H TYPE I.
table of flights
DATA: IT_SPFLI LIKE SPFLI OCCURS 10 WITH HEADER LINE.
*& Event START-OF-SELECTION
START-OF-SELECTION.
read flights
SELECT * FROM SPFLI INTO TABLE IT_SPFLI UP TO 10 ROWS.
display header
ULINE (61).
WRITE: / SY-VLINE NO-GAP,
(3) 'Flg'(001) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(4) 'Nr'(002) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(20) 'Von'(003) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(20) 'Nach'(004) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(8) 'Zeit'(005) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP.
ULINE /(61).
display flights
LOOP AT IT_SPFLI.
WRITE: / SY-VLINE NO-GAP,
IT_SPFLI-CARRID COLOR COL_KEY NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CONNID COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CITYFROM COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CITYTO COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-DEPTIME COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP.
ENDLOOP.
ULINE /(61).
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-007
EXCEPTIONS
OTHERS = 1.
start Excel
CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
PERFORM ERR_HDL.
SET PROPERTY OF H_EXCEL 'Visible' = 1.
CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'
PERFORM ERR_HDL.
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-008
EXCEPTIONS
OTHERS = 1.
get list of workbooks, initially empty
CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
PERFORM ERR_HDL.
add a new workbook
CALL METHOD OF H_MAPL 'Add' = H_MAP.
PERFORM ERR_HDL.
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-009
EXCEPTIONS
OTHERS = 1.
output column headings to active Excel sheet
PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
PERFORM FILL_CELL USING 1 3 1 'Von'(003).
PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
LOOP AT IT_SPFLI.
copy flights to active EXCEL sheet
H = SY-TABIX + 1.
PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
ENDLOOP.
changes by Kishore - start
CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #1 = 2.
PERFORM ERR_HDL.
add a new workbook
CALL METHOD OF H_MAPL 'Add' = H_MAP EXPORTING #1 = 2.
PERFORM ERR_HDL.
tell user what is going on
SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-009
EXCEPTIONS
OTHERS = 1.
output column headings to active Excel sheet
PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
PERFORM FILL_CELL USING 1 3 1 'Von'(003).
PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
LOOP AT IT_SPFLI.
copy flights to active EXCEL sheet
H = SY-TABIX + 1.
PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
ENDLOOP.
changes by Kishore - end
disconnect from Excel
CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'C:\SKV.XLS'.
FREE OBJECT H_EXCEL.
PERFORM ERR_HDL.
FORM FILL_CELL *
sets cell at coordinates i,j to value val boldtype bold *
FORM FILL_CELL USING I J BOLD VAL.
CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
PERFORM ERR_HDL.
SET PROPERTY OF H_ZL 'Value' = VAL .
PERFORM ERR_HDL.
GET PROPERTY OF H_ZL 'Font' = H_F.
PERFORM ERR_HDL.
SET PROPERTY OF H_F 'Bold' = BOLD .
PERFORM ERR_HDL.
ENDFORM.
*& Form ERR_HDL
outputs OLE error if any *
--> p1 text
<-- p2 text
FORM ERR_HDL.
IF SY-SUBRC <> 0.
WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
STOP.
ENDIF.
ENDFORM. " ERR_HDL
Regards
Murali Papana -
Sending report outpu executed in Background as mail attachment
Hi all
I am executng ALV Grid report in the background and the output has to send to the customer mail as pdf attachment .
Any Idea .
Regards,Hi,
check this code it will be helpfull to u.
REPORT ZEMAIL_ATTACH .
TABLES: ekko.
PARAMETERS: p_email TYPE somlreci1-receiver
DEFAULT '[email protected]'.
TYPES: BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
wa_ekpo TYPE t_ekpo.
TYPES: BEGIN OF t_charekpo,
ebeln(10) TYPE c,
ebelp(5) TYPE c,
aedat(8) TYPE c,
matnr(18) TYPE c,
END OF t_charekpo.
DATA: wa_charekpo TYPE t_charekpo.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
*START_OF_SELECTION
START-OF-SELECTION.
Retrieve sample data from table ekpo
PERFORM data_retrieval.
Populate table with detaisl to be entered into .xls file
PERFORM build_xls_data_table.
*END-OF-SELECTION
END-OF-SELECTION.
Populate message body text
perform populate_email_message_body.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Example .xls documnet attachment'
'XLS'
'filename'
changing gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT ebeln ebelp aedat matnr
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekpo.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM build_xls_data_table.
CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE x VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
LOOP AT it_ekpo INTO wa_charekpo.
CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
wa_charekpo-aedat wa_charekpo-matnr
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables pit_message
pit_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = pit_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM initiate_mail_execute_program.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
form populate_email_message_body.
REFRESH it_message.
it_message = 'Please find attached a list test ekpo records'.
APPEND it_message.
endform. " POPULATE_EMAIL_MESSAGE_BODY -
PDF document first page is blank when executing in background
Hi,
I am creating spool before displyaing report output by using GET_PRINT_PARAMETERS and NEW PAGE PRINT ON option and displaying report header and report final internal table. calling NEW PAGE PRINT OFF
finally i am sending mail, by using SO_NEW_DOCUMENT_SEND_API1 function module in foreground executing and background execution.
When we execute in foreground i am recieveing mail and pdf is perfect.
when we execute in background i am recieveing mail. But when i opend the pdf document in mail, PDF doucment first page is balnk and second page onwards i am able to see the report output
why the PDF first page is blank when i execute the same report with same variant in back ground.
Please help me in this issue.
Thanks in advance
RajuHi Raju,
<li> Call ABAP4_COMMIT_WORK function module after NEW-PAGE PRINT OFF command.
NEW-PAGE PRINT OFF.
CALL FUNCTION 'ABAP4_COMMIT_WORK'.
Thanks
Venkat.O -
Suppressed some coloum while executing in Background mode
Hi All
As I am trying to execute report in foreground mode I am getting ALV output properly with all coloum while I am executing the same report in background mode I am getting same output with some of the coloum is not coming properly.
Please guide me to resolve the above issue.
Thanks
KRISHHi All
I am executing the custom report in foreground mode ALV output showing all columns for that same report I am executing in background mode some of the ALV output columns are missed out
For example:
Standard report output showing 10 columns, but I am executing the same report in background some of the columns are suppressed only I am able to view 5 columns remaining I am not able to view.
Please help me to resolve the above issue.
Thanks
KRISH -
Not able to get data while executing in background for mb52
Dear all,
my requirement is i want to schedule the zreport for every 1 hour.but proble is when iam executing in fore ground iam able to get data.but when iam going to scheduling this iam not able to get data.
my code is
type-pools:slis.
data zbudat type RANGE OF budat.
data wab like line of zbudat.
data zmatkl type RANGE OF MATKL.
data waz like line of zMATKL.
data zwerks type RANGE OF werks.
data wax like line of zwerks.
waz-sign = 'I'.
waz-low = 'CRUDE'.
waz-option = 'EQ'.
append waz to zmatkl.
clear waz.
waz-sign = 'I'.
waz-low = 'SGO'.
waz-option = 'EQ'.
append waz to zmatkl.
clear waz.
*waz-sign = 'I'.
*waz-low = 'FINES'.
*waz-option = 'EQ'.
*append waz to zmatkl.
*clear waz.
*waz-sign = 'I'.
*waz-low = 'LUMPS'.
*waz-option = 'EQ'.
*append waz to zmatkl.
*clear waz.
*waz-sign = 'I'.
*waz-low = 'UFO'.
*waz-option = 'EQ'.
*append waz to zmatkl.
wax-sign = 'I'.
wax-low = 'BIMI'.
wax-option = 'EQ'.
append wax to zwerks.
clear wax.
wax-sign = 'I'.
wax-low = 'BIPL'.
wax-option = 'EQ'.
append wax to zwerks.
*waz-sign = 'I'.
waz-low = 'C'.
*waz-option = 'CP'.
*append waz to zmatnr.
*clear waz.
*waz-sign = 'I'.
waz-low = 'S'.
*waz-option = 'CP'.
*append waz to zmatnr.
*clear waz.
*waz-sign = 'I'.
waz-low = 'UC'.
*waz-option = 'CP'.
*append waz to zmatnr.
*waz-sign = 'I'.
waz-low = 'F'.
*waz-option = 'CP'.
*append waz to zmatnr.
*clear waz.
*waz-sign = 'I'.
waz-low = 'L'.
*waz-option = 'CP'.
*append waz to zmatnr.
types:begin of w_tab,
bwkey type werks_d,
matnr type matnr,
lgort type LGORT_D,
budat type budat,
labst type labst,
endmenge type p decimals 3,
end of w_tab.
DATA : IT_TAB TYPE STANDARD TABLE OF W_TAB WITH HEADER LINE .
FIELD-SYMBOLS: <gt_fieldcat> TYPE slis_fieldcat_alv,
<gt_report_list> TYPE w_tab .
field-symbols <lt_pay_data> type any table.
*FIELD-SYMBOLS : <LT_DATA> LIKE LINE OF IT_TAB .
FIELD-SYMBOLS : <LT_DATA> type any . " i have chaged it
data lr_pay_data type ref to data.
cl_salv_bs_runtime_info=>set( exporting display = abap_false
metadata = abap_false
data = abap_true ).
****SUBMIT ZQM_GR_BARGE_LOADING WITH S_date in zbudat with s_werks in zwerks with p_pend = ' ' AND RETURN .
submit RM07MLBS with MATKLA in zmatkl with werks in zwerks
"with XVBST = 'X'
using selection-SCREEN '1000' and return.
try.
cl_salv_bs_runtime_info=>get_data_ref( importing r_data = lr_pay_data ).
assign lr_pay_data->* to <lt_pay_data>.
catch cx_salv_bs_sc_runtime_info.
message `Unable to retrieve ALV data` type 'E'.
endtry.
cl_salv_bs_runtime_info=>clear_all( ).
data: obj_s type ref to ZKMINCO_MINESTOCKFROM_SAP_OUT.
create OBJECT obj_s.
data : output TYPE ZKMINMINESTOCKFROM_SAP1 ,
record type ZKMINMINESTOCKFROM_SAP_REC_TAB ,
wa_record like line of record.
LOOP AT <lt_pay_data> ASSIGNING <LT_DATA>.
MOVE-CORRESPONDING <LT_DATA> TO IT_TAB .
APPEND IT_TAB .
wa_record-STOCK_AS_ON_DATE = sy-datum .
wa_record-STOCK_AS_ON_TIME = sy-uzeit .
wa_record-PLANT_ID = it_tab-bwkey.
wa_record-STORAGE_LOC_ID = it_tab-lgort .
wa_record-MATERIAL = it_tab-matnr .
wa_record-STOCK_QTY = it_tab-labst.
append wa_record to record.
clear wa_record.
endloop.
output-MINESTOCKFROM_SAP-record = record .
CALL METHOD obj_s->MINESTOCKFROM_SAP_OUT
EXPORTING
output = output .
commit work.
Thanks in advance.Hi,
I assume that in your case you have two program lets say ZFOREGROUND and ZBACKGROUND (Called inside zforeground using submit statement)
zforeground has :
1. a input field to browse excel sheet or some file at the selection screen, and
2. button 'post all' to determine the background processing.
Now your requirement is such that you want zbackground to get scheduled as background job when post all button is clicked.
So, within the event AT USER-Command, check the sy-ucomm as that of post all button, if so write the following code to schedule the job:
DATA: jobname LIKE tbtcjob-jobname.
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.
DATA: gv_job_dt TYPE sy-datum,
gv_job_tm TYPE sy-uzeit.
jobname = 'EXCLUSION_LISTING'.
gv_job_dt = sy-datum.
gv_job_tm = sy-uzeit.
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 ZBACKGROUND AND RETURN
WITH p_file1 = gv_file_cust_exc "<----
Parameters which you want to pass to report zbackground from the report
WITH p_file2 = gv_file_win_deal "------zforeground
USER sy-uname
VIA JOB jobname
NUMBER jobcount.
IF sy-subrc ne 0.
"error processing
ENDIF.
Close job
starttime-sdlstrtdt = gv_job_dt.
starttime-sdlstrttm = gv_job_tm.
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.
WRITE:/1 'JOB' COLOR 3,
jobname COLOR COL_GROUP,
'Scheduled in Background' COLOR 3. "error processing
gv_time = starttime-sdlstrttm.
gv_date = starttime-sdlstrtdt.
ENDIF.
Above code will schedule the report zbackground in background.
Note:
the program schduled in background will not be able to access any data present on your presentation server. data should be provided either by the program schhedulling it in foreground or it has to be thr in application server.
Regards,
Ravi -
SUBMIT REPORT AS A BACKGROUND JOB
Hi all,
I am executing one report in foreground in that report i want to submit one report which should be executed in background only. how it is possible to execute 2nd report in <b>background mode</b> only.
Regards
deepakThis is the Basic code to Achieve that.
Call Function 'JOB_OPEN'
SUBMIT RSBDCBTC
via background Job <Job info>
With QIE = <QID Returned by BDC_OPEN_Group FM>
AND RETURN.
Call Function 'JOB_CLOSE'
2) Also go through this
DATA: lv_job_name LIKE tbtco-jobname,
lv_job_nr LIKE tbtco-jobcount,
lv_job_released TYPE c,
lv_job_start_sofort TYPE c,
lv_print_parameters TYPE pri_params.
lv_job_name = 'Z_BGPROGRAM'.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = lv_job_name
IMPORTING
jobcount = lv_job_nr
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF syst-subrc = 0.
" submit job with all the selection screen params...
SUBMIT (lv_job_name)
WITH applfile = applfile " these are the parameters of the background program
WITH p_lines = p_lines
USER syst-uname " you must use this
VIA JOB lv_job_name NUMBER lv_job_nr AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = lv_job_nr
jobname = lv_job_name
strtimmed = 'X'
IMPORTING
job_was_released = lv_job_released
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 syst-subrc <> 0.
MESSAGE i162(00) WITH
'An error occured while closing the background job.'.
STOP.
ENDIF.
ENDIF.
ENDIF.
SKIP 1.
WRITE: / 'Background process', lv_job_name , 'called successfully' NO-GAP.
WRITE: / 'You can check the job in transaction SM37'.
Thanks -
Default Layout for a report running in background
Dear Friends,
I have created a layout for report ME2L and set as default layout (for every user)....
Foreground execution picked the DEFAULT layout but when am trying to execute the same report in background, default layout is not picked but the STANDARD layout is shown in the spool
Could you please suggest me how can i use same report layout for foreground as well as background
Thanks in Advance
AnaAtanu dey,
If you wnat to download excel in back ground
You have to download in application server only.
EX:
DATA : v_filepath(80) VALUE '/data/sapdata/inc/error_log/pme_br/',
c_coma VALUE ',' .
OPEN DATASET v_filepath FOR OUTPUT IN TEXT MODE.
IF sy-subrc EQ 0.
LOOP AT i_errors_bat.
CONCATENATE i_errors_bat-plant c_coma
i_errors_bat-zzvendor c_coma
INTO v_string.
TRANSFER v_string TO v_filepath.
ENDLOOP.
CLOSE DATASET v_filepath.
Note : you can download in presentation server also.
but it requires lot of authorizations and have to use
FTP commands.
Reason is Apllication server in back ground has to
recognize the from which system request came.
Better go for OPEN DATA sets.
Don't forget to reward if useful..... -
MMBE Execute in Background - Spool Request Missing Header Information
Greetings,
While reviewing differences between MMBE and MMBE_OLD in ECC 6.0 upgrade test environment it was discovered that when MMBE (RMMMBESTN) is executed in background the spool request does not display the material number, description, material type , UoM and Base UoM. I created a message to SAP.
Has anyone else had this issue?That you can execute transactions in background is just a standard functionality, which certainly makes sense for reports that have something to do, that run long, need a lot performance etc.
But MMBE..........I really never had the idea to run MMBE in background. to get the result online I just have to click the execute button, to run in background I habe to click the menu, click the run in background, click the run immediatly, click okay .....
and then I would need to open the job to find the spool etc etc.
all for just the stock overview of one single material.
I really would never had spend a thought that somebody would do this effort.
Why do YOU need to do this?
I am really curious what SAP answers you -
FM not executing in background mode sometimes
Hi,
I'm using one Z function module for Production order confirmations which inturn calls 'BAPI_PRODORD_COMPLETE_TECH'.
There is 'BAPI_TRANSACTION_COMMIT' and 'BAPI_TRANSACTION_ROLLBACK' also present.
My issue is, this functionality works perfectly fine when I execute the program in foreground mode, but does not go through sometimes when I schedule it in background.
Note : Its not completely skiping the entries in background mode. It works sometimes and sometimes doesn't.
Can anyone comment if they have faced similar issues ?
Regards,
ShivaHi !
In my opinion it fails, when there is a popup coming from the BAPI.
We have the issue that when we process in background the orders where a popup should be shown (e.g. the popup asking if setting TECO is OK although reprocessing records exist).
When we reprocess our IDOC (which are calling that BAPI) in BD87, the popup is even shown in BD87 !
Any idea how to tell the BAPI to ignore such messages and still set the TECO ?
Any other way to set the TECO ?
thx a lot !
Maybe you are looking for
-
I can't stop my song from looping back to the beginning
I have created some backing tracks for a swing band that has lost its rhythm section and have to date played them back (via a big speaker) using Logic pro X on a macbook air. I want to use my ipad instead as it's smaller and handier when you have to
-
How can I do backups on internal disc while sharing an external USB drive?
Hi, On my Airport Utility there are two lines: "Time Capsule Disc", and below (indented) "Data". (When I plug an external USB drive I can see it in this window as well) Clicking (selecting) the first line, on the right hand side I can see the disc de
-
There was an error downloading your purchased music. The disk could not be read from or written to. Does anyone know what this means? I purchased 2 films and cant watch them ;( I wonder if I will be charged??????
-
Dear all, In below snapshot, i want value in line number 23 (Current stack) from line number 12. There is some value in stack nunber 12 , i want to use it into current stack 23. How to fetch value from stack number 12??? Is it possible with the help
-
How to create a 300 dpi pdf file?
I have to send a 300 dpi PDF file, and I'm using Adobe Reader XI. But I can't find a way to raise the resolution or the files I create. What can I do?