How to send background program output to a printer
Hi !
I created a background report,running via a job in background. I need to display the output of the background report via two channels : a printer and an e
mail. I created the output of the report by using the command Write, and the output is printed to screen. However this solution is good for an online report and not for background report ? and my question is how to send the background report output to a printer in background .
Thanks
Moshe
Hi,
If you are using JOB_OPEN, JOB_SUBMIT & JOB_CLOSE to execute the program in background, then in the FM JOB_SUBMIT you have a parameter PRIPARAMS for which you need to pass a value.
Before that get all the Print Parameters using FM GET_PRINT_PARAMETERS. Then pass the same to PRIPARAMS.
This would solve the problem.
Best regards,
Prashant
Similar Messages
-
How to send concurrent program output file as an attachment in the notification mail
Hi All,
We are on Oracle apps version - 11.5.10.2
We have a requirement wherein we need to send the concurrent program output file as an attachment while sending the notification mail to the user.
Currently we have tried the approach wherein we are specifying the user id in the OPTIONS tab (Notifying the following people) while submitting the concurrent program.
But using this approach, the user gets only the URL of the output file in the notification mail and not the output file as an attachment.
Kindly let us know if anyone has incorporated the logic to send the output file as attachment in the notification mail.
Please Note - We do not want any custom code to be written to send the attachment.
Any pointers to this will be helpful.
Regards,
ShrutiHi All,
We are on Oracle apps version - 11.5.10.2
We have a requirement wherein we need to send the concurrent program output file as an attachment while sending the notification mail to the user.
Currently we have tried the approach wherein we are specifying the user id in the OPTIONS tab (Notifying the following people) while submitting the concurrent program.
But using this approach, the user gets only the URL of the output file in the notification mail and not the output file as an attachment.
Kindly let us know if anyone has incorporated the logic to send the output file as attachment in the notification mail.
Please Note - We do not want any custom code to be written to send the attachment.
Any pointers to this will be helpful.
Regards,
Shruti -
How to send a report output as a FAX ?
Hallo Experts,
How to send a report output as a FAX ?
Suppose if I have all the data in an internal table, I will show it as a normal list OR ALV list output.
In the application tool bar I should have a button, and by clicking it the output should go to the customer as FAX. How can I send it to a FAX ? Any Function modules ?
Please help me with an example program.
Regards,
Matt.Hi,
Hope the code given below helps you.
FORM SEND_FAX
TABLES DOC2FAX STRUCTURE TEST_DOC
USING COUNTRY
NUMBER.
DATA: SID(5) TYPE N.
DATA BEGIN OF POPT.
INCLUDE STRUCTURE ITCPO.
DATA END OF POPT.
DATA BEGIN OF PRES.
INCLUDE STRUCTURE ITCPP.
DATA END OF PRES.
CLEAR POPT.
POPT-TDCOPIES = 1. " one copy
* POPT-TDDEST = " done internaly by script,
* POPT-TDPRINTER = " do not fill !!!
POPT-TDNEWID = 'X'. " do not reuse old spool request
POPT-TDDATASET = 'TEST'(022). " fill as you want
POPT-TDSUFFIX1 = 'FAX'(023). " fill as you want
POPT-TDSUFFIX2 = SY-UNAME. " fill as you want
POPT-TDIMMED = 'X'. " send now
POPT-TDLIFETIME = 8. " keep 8 days in spool
POPT-TDTELENUM = NUMBER. " number without country code
POPT-TDTELELAND = COUNTRY. " country of recipient
POPT-TDCOVER = 'test fax'(024).
POPT-TDCOVTITLE = 'test fax'(024).
* POPT-TDIEXIT = 'X'.
CALL FUNCTION 'PRINT_TEXT'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX = ' '
ARCHIVE_PARAMS = ' '
DEVICE = 'TELEFAX' "<<< here we say: fax it !
DIALOG = 'X'
HEADER = HEADER
OPTIONS = POPT
IMPORTING
RESULT = PRES
TABLES
LINES = DOC2FAX
EXCEPTIONS
OTHERS = 01.
* do not bother with exception in sample code
* CANCELED = 01
* DEVICE = 02
* FORM = 03
* OPTIONS = 04
* UNCLOSED = 05
* UNKNOWN = 06
* FORMAT = 07
* TEXTFORMAT = 08
* EXTERNAL = 09.
IF SY-SUBRC = 0.
* arriving here means we could send:
SID = PRES-TDSPOOLID.
IF SID > '00000'.
MESSAGE S433 WITH SID.
ENDIF.
LEAVE .
ELSE.
* do not bother with exception in sample code
MESSAGE A400 WITH 'PRIN_TEXT'.
ENDIF.
ENDFORM. " SEND_FAX
Regards,
Siddarth -
How to send the report output to the application server in a excel file
Hello,
how to send the report output to the application server in a excel file.
and the report runs in background.
Thanks in advance.
SundeepDear Sundeep.
I'm providing you with the following piece of code ... Its working fine for me ... hopefully it suits your requirement ...
D A T A D E C L A R A T I O N *
TYPES: BEGIN OF TY_EXCEL,
CELL_01(80) TYPE C,
CELL_02(80) TYPE C,
CELL_03(80) TYPE C,
CELL_04(80) TYPE C,
CELL_05(80) TYPE C,
CELL_06(80) TYPE C,
CELL_07(80) TYPE C,
CELL_08(80) TYPE C,
CELL_09(80) TYPE C,
CELL_10(80) TYPE C,
END OF TY_EXCEL.
DATA: IT_EXCEL TYPE STANDARD TABLE OF TY_EXCEL,
WA_EXCEL TYPE TY_EXCEL..
E V E N T : S T A R T - O F - S E L E C T I O N *
START-OF-SELECTION.
Here you populate the Internal Table.
Display - Top of the Page.
PERFORM DISPLAY_TOP_OF_PAGE.
E V E N T : E N D - O F - S E L E C T I O N *
END-OF-SELECTION.
SET PF-STATUS 'GUI_STATUS'.
E V E N T : A T U S E R - C O M M AN D *
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'EXPORT'.
Exporting the report data to Excel.
PERFORM EXPORT_TO_EXCEL.
ENDCASE.
*& Form DISPLAY_TOP_OF_PAGE
text
--> p1 text
<-- p2 text
FORM DISPLAY_TOP_OF_PAGE .
SKIP.
WRITE: /05(128) SY-ULINE,
/05 SY-VLINE,
06(127) 'O R I C A'
CENTERED COLOR 1,
132 SY-VLINE.
WRITE: /05(128) SY-ULINE,
/05 SY-VLINE,
06(127) 'Shift Asset Depreciation - Period/Year-wise Report.'
CENTERED COLOR 4 INTENSIFIED OFF,
132 SY-VLINE.
WRITE: /05(128) SY-ULINE.
E X C E L O P E R A T I O N
CLEAR: IT_EXCEL[],
WA_EXCEL.
PERFORM APPEND_BLANK_LINE USING 1.
WA_EXCEL-cell_02 = ' XYZ Ltd. '.
APPEND WA_EXCEL TO IT_EXCEL.
CLEAR: WA_EXCEL.
WA_EXCEL-cell_02 = 'Shift Asset Depreciation - Period/Year-wise Report.'.
APPEND WA_EXCEL TO IT_EXCEL.
PERFORM APPEND_BLANK_LINE USING 1.
ENDFORM. " DISPLAY_TOP_OF_PAGE
*& Form APPEND_BLANK_LINE
text
-->P_1 text
FORM APPEND_BLANK_LINE USING P_LINE TYPE I.
DO P_LINE TIMES.
CLEAR: WA_EXCEL.
APPEND WA_EXCEL TO IT_EXCEL.
enddo.
ENDFORM.
*& Form EXPORT_TO_EXCEL
text
--> p1 text
<-- p2 text
FORM EXPORT_TO_EXCEL .
DATA: L_FILE_NAME(60) TYPE C.
Create a file name
CONCATENATE 'C:\' 'Shift_Depn_' SY-DATUM6(2) '.' SY-DATUM4(2)
'.' SY-DATUM+0(4) INTO L_FILE_NAME.
Pass the internal table (it_excel which is already populated )
to the function module for excel download.
CALL FUNCTION 'WS_EXCEL'
exporting
filename = L_FILE_NAME
tables
data = IT_EXCEL
exceptions
unknown_error = 1
others = 2.
if sy-subrc <> 0.
message e001(ymm) with 'Error in exporting to Excel.'.
endif.
ENDFORM. " EXPORT_TO_EXCEL
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When you click the button - Export to Excel ( GUI-Status) you'll be able to export the content of the Internal Table to an Excel file .......
Regards,
Abir
Don't forget to award Points * -
How to send the spool output to the specific user during ALE distribution
Hi All
In ALE internal order Configuration done by BAPI Method SAVEREPLICA Business object BUS2075whenever user changed the internal order which is moved to the destination system because of change data setting in data element fields.
I want to know how to send the spool output of the changed internal order to the specific user during ALE distribution.
Please help me to reslove the above issue
Thanks & Regards
KRISHGUNASolved by myself
-
How to send a text file to a printer?
Hi, I'm in dark on how to send a text file to a printer through Java Stored Procedure.
Here are what I tried so far (OS: win 2000, Oracle: 817 or 9i2):
1, Enable DOS command in Java Stored Proc. and try to send PRINT command there:
public static String Run(String Command){
try{
Runtime.getRuntime().exec(Command);
System.out.println("Command: " + Command);
return("0");
catch (Exception e){
System.out.println("Error running command: " + Command +
"\n" + e.getMessage());
return(e.getMessage());
public static void main(String args[]){
if (args.length == 1)
Run("print /D:\\\\enterprise\\john " + args[0]);
else System.out.println("Usage: java OSCommand filename");
PL/SQL wrapper:
CREATE OR REPLACE FUNCTION OSCommand_Run(p1 IN VARCHAR2) RETURN VARCHAR2 AUTHID CURRENT_USER AS LANGUAGE JAVA NAME 'OSCommand.Run(java.lang.String) return java.lang.String';
SQL command:
//print /D:\\machine\printer test.txt
I loaded the Java Stored Procedure into SYSDBS account, it failed silently, even though piece of code works fine in external JVM.
2, Use filePrinter:
public static String print(String printString) {
try{
String printerUNC = "\\\\machine\\printer";
FileWriter fw = new FileWriter(printerUNC);
PrintWriter pw = new PrintWriter(fw);
pw.println(printString);
fw.close();
return "OK";
}catch(Exception e){
e.printStackTrace();
return "Exception: " + e.getMessage();
public static void main(String[] args) {
try{
String printerUNC = "\\\\machine\\printer";
String printString = "Hello World";
FileWriter fw = new FileWriter(printerUNC);
PrintWriter pw = new PrintWriter(fw);
pw.println(printString);
fw.close();
}catch(Exception e){e.printStackTrace();}
I loaded it into SYSDBS too, and tried with this:
SQL> select MY_PRINT.PRINT('HELLO from Oracle') from dual;
MY_PRINT.PRINT('HELLOFROMORACLE')
Exception: No such file or directory
SQL> show user
USER is "SYS"
It works in external JVM too.
What's wrong with this?
Thanks for any help in advance,
CharlesAvi:
Thanks for your response!
I put the java code in SYS, 'cause I assume that account has max privilege. If the test is successful, I will move that to some user schema and then to deal with those privilege settings... But I'm unlucky.
I checked Ask Tom, this is what I got from http://asktom.oracle.com/pls/ask/f?p=4950:8:1619723::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:38012348052,%7Bprinter%7D:
... Print file from PL/SQL ...
If you are using Oracle8i, release 8.1 -- much can be done with Java. java
would be able to print directly from the server.
Looks like using Java to print out file is better than PL/SQL. But there's no more hint there! And, no new question can be asked there today either...
I'm wondering whether we can create a socket to a printer and send the characters there directly... Anyone has experience on this?
Thanks for all the help in advance,
Charles -
How to send ALV report Output through mail in background !
Hi ,
I had an ALV Report. I want to send this report output to patricular email id every day ! Presenty i do this manually. I run the report and send the output to the particular email address. Now i want to schecule the report daily in background and the out put of the report should be mailed to particular email ids in background itself. How can i do this ?
Is there and method or setting through which we can do this ?
RegardsHi Nau,
For this requirement you will have to write another program.
This program will convert the spool requests into PDF document and sends an email to the recipients that you specify.
These are the threads which are already posted in The SDN.
*http://wiki.sdn.sap.com/wiki/display/Snippets/Converts+spool+request+into+PDF+document+and+emails*
*<a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="353650"></a>*
*<a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="902985"></a>*
You need to use the Function module :
-- Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
I will provide you with the code to get this functionality.
*& Form SEND_EMAIL
form SEND_EMAIL .
DATA: t_mailpack TYPE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_mailhead TYPE solisti1 OCCURS 0 WITH HEADER LINE,
t_mailbin TYPE solisti1 OCCURS 0 WITH HEADER LINE,
t_mailtxt TYPE solisti1 OCCURS 0 WITH HEADER LINE,
t_mailrec TYPE somlreci1 OCCURS 0 WITH HEADER LINE.
DATA: wa_maildata TYPE sodocchgi1,
l_filename(50) TYPE c,
l_fldname(30) TYPE c,
l_fldval(100) TYPE c,
l_lines TYPE i,
l_text TYPE text128 .
DATA: w_email_subrc TYPE i.
DATA: w_ship like vbfa-vbeln.
CLEAR: wa_maildata,
t_mailtxt,
t_mailbin,
t_mailpack,
t_mailhead,
t_mailrec.
REFRESH: t_mailtxt,
t_mailbin,
t_mailpack,
t_mailhead,
t_mailrec.
*-- Fill output file
*- Fill header
CLEAR: t_mailbin.
* t_mailbin[] = pdf_tab[].
t_mailbin[] = it_att[]. "Uthaman
*This line is added to get the shipment no in Subject Line
SELECT SINGLE * FROM vbfa WHERE vbelv EQ nast-objky
AND vbtyp_v EQ c_vbtyp_v_j
AND vbtyp_n EQ c_vbtyp_n_8.
w_ship = vbfa-vbeln.
shift w_ship left deleting leading '0'.
*-- File name
if nast-kschl EQ 'ZFPL'.
CLEAR l_filename.
CONCATENATE 'Packing List -'
sy-datum+4(2) sy-datum+6(2) sy-datum(4) '.PDF' INTO l_filename.
*-- Creation of the document to be sent File Name
wa_maildata-obj_name = 'Packing List'.
*-- Mail Subject
CONCATENATE l_filename '-' 'Shipment No -' w_ship INTO wa_maildata-obj_descr SEPARATED BY space.
*-- Mail Contents
t_mailtxt-line = 'Packing List'.
APPEND t_mailtxt.
ENDIF.
if nast-kschl EQ 'ZFBA'.
CLEAR l_filename.
CONCATENATE 'Booking Advice -'
sy-datum+4(2) sy-datum+6(2) sy-datum(4) '.PDF'
INTO l_filename.
*-- Creation of the document to be sent File Name
wa_maildata-obj_name = 'Booking Advice'.
*-- Mail Subject
CONCATENATE l_filename '-' 'Shipment No -' w_ship INTO wa_maildata-obj_descr SEPARATED BY space.
*-- Mail Contents
t_mailtxt-line = 'Packing List'.
APPEND t_mailtxt.
ENDIF.
*-- Prepare Packing List
*-- Write Packing List (Main Subject)
CLEAR: l_lines, t_mailpack.
DESCRIBE TABLE t_mailtxt LINES l_lines.
* READ TABLE t_mailtxt INDEX l_lines.
t_mailpack-doc_size = ( l_lines - 1 ) * 255 + STRLEN( t_mailtxt ).
* CLEAR t_mailpack-transf_bin.
t_mailpack-transf_bin = ' '.
t_mailpack-head_start = 1.
t_mailpack-head_num = 0.
t_mailpack-body_start = 1.
t_mailpack-body_num = l_lines.
t_mailpack-doc_type = 'RAW'.
APPEND t_mailpack.
t_mailhead = l_filename.
APPEND t_mailhead.
*-- Write Packing List (Attachment)
CLEAR: l_lines, t_mailpack.
DESCRIBE TABLE pdf_tab[] LINES l_lines.
* READ TABLE pdf_tab INDEX l_lines.
t_mailpack-doc_size = ( l_lines - 1 ) * 255 + STRLEN( t_mailbin ).
t_mailpack-transf_bin = 'X'.
t_mailpack-head_start = 1.
t_mailpack-head_num = 1.
t_mailpack-body_start = 1.
t_mailpack-body_num = l_lines.
t_mailpack-doc_type = 'PDF'.
t_mailpack-obj_name = l_filename.
t_mailpack-obj_descr = l_filename.
t_mailpack-obj_langu = 'E'.
APPEND t_mailpack.
*-- Set recipients
tables : ztotcemail.
SELECT SINGLE * FROM vbfa WHERE vbelv EQ nast-objky
AND vbtyp_v EQ c_vbtyp_v_j
AND vbtyp_n EQ c_vbtyp_n_8.
CLEAR vttk.
SELECT SINGLE * FROM vttk WHERE tknum EQ vbfa-vbeln.
SELECT SINGLE * FROM ztotcemail WHERE tplst = vttk-tplst
AND lifnr = vttk-tdlnr.
IF SY-SUBRC EQ 0.
t_mailrec-receiver = ztotcemail-smtp_addr. "'Here you will give the email address'.
t_mailrec-rec_type = 'U'.
APPEND t_mailrec.
ENDIF.
**-- Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_maildata
put_in_outbox = 'X'
* commit_work = 'X' " N-16
TABLES
packing_list = t_mailpack
object_header = t_mailhead
contents_bin = t_mailbin[]
contents_txt = t_mailtxt[]
receivers = t_mailrec
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
w_email_subrc = sy-subrc.
IF sy-subrc EQ 0.
MESSAGE s000(zotc) WITH 'Email output sent successfully'.
ELSE.
MESSAGE s000(zotc) WITH 'Can not send email output'.
ENDIF.
endform. " SEND_EMAIL
Hope the above information will be helpful.
Regards,
Kittu -
How to send a SmartForm output as Email to external id?
I want the Smartform output to email to extrenal email-id.
I don't want the Smartform output as any kind of attachment, but the Smartform output needs to be shown on the main email body. Can anyone pls. help me out?First, thanks for your responses.
I haven't found the demo program 'BCS_EXAMPLE_6' in SAP 4.7. But then I got it in SAP 5.0 version. But this program only describes how to send Form output as PDF attachment with email. But this is well-known and I haven't asked for this. I want the Smartform output within the mail-body without attachment.
The weblog at "/people/pavan.bayyapu/blog/2005/08/30/sending-html-email-from-sap-crmerp seems a more logical one, though I have already tried it out. Here the html page creation and graphics load -- everything is going right. But this HTML page is being delivered as an Attachment within the email. The normal HTML Email is not coming. I think this technique wouldn't work with all mailing tools. Here in the weblog, Pavan has shown the example with Microsoft Outlook. But I have tested with Lotus Notes and Yahoo. And In both cases, the mail is coming with attached HTML file (in .mht format), but not as a notmal html mail without attachments. -
Hi All,
i have used CMS in SQL 2008 R2. i have added couple of servers in its group. i have executed a query & i need to send the query output in the form of email.
basically query is checking the rows count from couple of user tables in servers.
issue here is how to copy the data that is used by CMS? i need to work on automate the rows count in difft user table in db servers
could you please suggest how can i achieve this?Copy to what?
SELECT COUNT(*) FROM sys.objects
Running the above statement returns two columns (server name and count)
All the servers SS2005 and onwards , then use
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'name',
@recipients = '[email protected]',
@query = 'SELECT COUNT(*) FROM sys.objects',
@subject = 'Count rows'
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
How to send an analog output signal on same axis running a stepping motor umi 7764/ PCI7334
I am running a single axis stepping motor (which is working fine) but
for the application I need to be able to turn on and off a 5 volt
laser. It notes in the manual for the UMI 7764 that the the
analog output can be used as a general-purpose voltage output. I
would like to use it as such, but can't figure out what VI's actually
send messages to the board to output a 5 Volt signal.
Ideally I would use the analog output on the same axis that the
stepping motor is on, but if need be I could use one of the other axis
if this isn't possible (ie. it may not be possible to step and send
analog voltage output on same axis at same time). I have been
looking at the configuring DAQ and ADC stuff, but can't seem to make
sense if these actually control the analog output channel. I
think they just control the Analog input channels, but maybe I am
wrong.
Any help would be greatly appreciated
AndreHi,
It is possible to send analog output out of the same same DAC channel in which your stepper is connected, if you configure the stepper as open loop in MAX. I've tried it. This way you have the stepper output, analog output and encoder input acting independently. So you can use these seperately for different purposes, such as using the analog output for constant speed motors where speed or position control is not of much importance, encoder for positioning some other axes and stepper output for stepper control. With good programming skills, the NI motion controllers can thus be used for the most complex configurations. Great work NI !!! Nothing is impossible.
Regards,
Giridhar Rajan
Automation Engineer, Design
Cruiser Controls
Mumbai, India -
How to Email Concurrent Program Output to Email using Shell Script
Hi All,
Have a Nice Day,
I have a tricky requirement and i was not able to achieve, let me explain my requirement
I have created a PLSQL Concurrent Program named "Approval Update". This will do update and it display the number of rows updated.
Now i need to take this concurrent program output and it needs to be send it to the person who submits this program as an email using shell scripts.
I have referred meta link note as well as some OTN posts but I was not able to achieve this.
Please help me to complete this As soon as possible, Thanks in advance for your help.
Let me know if you need more clarifications.
Regards,
CSKI don't have much idea in shell scripts all i want is, in my shell script i need to get the parent concurrent program output and that needs to be emailed to the intended person.
Please help to to get the shell script commands for this.I do not have any shell script to share, sorry! If you want the query to get the parent request_id so you can get the log/out file name/location from then please refer to:
REQUESTS.sql Script for Parent/Child Request IDs and Trace File IDs [ID 280295.1]
http://etrm.oracle.com/pls/et1211d9/etrm_pnav.show_object?c_name=FND_CONC_REQ_SUMMARY_V&c_owner=APPS&c_type=VIEW
http://etrm.oracle.com/pls/et1211d9/etrm_pnav.show_object?c_name=FND_CONCURRENT_REQUESTS&c_owner=APPLSYS&c_type=TABLE -- LOGFILE_NAME & OUTFILE_NAME
Thanks,
Hussein -
How to send a file top the default printer?
Hello,
I have generated, using Java code, a certain HTML file and wrote it to a certain location on my local machine. I would like now to automatically send this file for the default printer for printing, this way the user won't have to manually open the file and select
file->print from the browser window and then print it.
How can I acomplish this?hi
good
how can you identify which file you r going to print and which file you r going to print.if you r going to print all the file from that particular location than you can do it through jsp, but i dont think it can be done automatically, the user has to select the particular location where you have stored the file in you hard disk and i will go for printing.
Thanks
mrutyun -
How to send adobe form output in mail as a attachment
i am get the adobe form output
how to attach in a mail ....
Regards
Anbu Bmy program is like this.............
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = 'YHRIN_WELCOME'
IMPORTING
e_funcname = lv_funcname
gs_output-nodialog = 'X'.
gs_output-preview = 'X'.
gs_output-getpdl = 'X'.
gs_output-getpdf = 'X'.
gs_output-dest = 'LP01'.
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = gs_output
EXCEPTIONS
CANCEL = 1
USAGE_ERROR = 2
SYSTEM_ERROR = 3
INTERNAL_ERROR = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DATA : gs_outputpara TYPE sfpdocparams.
DATA : ls_return TYPE fpformoutput .
gs_outputpara-langu = 'E'.
gs_outputpara-country = 'IN'.
CALL FUNCTION lv_funcname
EXPORTING
/1bcdwb/docparams = gs_outputpara
wa_data = wa_mail
IMPORTING
/1bcdwb/formoutput = ls_return
EXCEPTIONS
OTHERS = 1.
DATA lv_output TYPE sdokcntbins WITH HEADER LINE.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = ls_return-pdf "PDF file from function module
TABLES
binary_tab = lv_output .
*DATA : result TYPE sfpjoboutput WITH HEADER LINE .
CALL FUNCTION 'FP_JOB_CLOSE'
IMPORTING
e_result = result
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DATA : iv_len_in LIKE sood-objlen,
it_tline TYPE TABLE OF tline WITH HEADER LINE.
PERFORM pdf_file.
DATA: lt_imessage TYPE STANDARD TABLE OF solisti1 WITH HEADER LINE,
lt_iattach TYPE STANDARD TABLE OF solisti1 WITH HEADER LINE,
lt_ipacking_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
lt_ireceivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
lt_iattachment LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA : lt_record LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA : it_otf TYPE itcoo OCCURS 0 WITH HEADER LINE.
DATA: lv_email TYPE somlreci1-receiver
VALUE 'anbu.'.
PERFORM build_xls_data .
APPEND lt_iattach.
Populate message body text
CLEAR lt_imessage. REFRESH lt_imessage.
lt_imessage = 'Please find attached PDF file'.
APPEND lt_imessage.
Send file by email as .xls speadsheet
PERFORM send_email_with_xls TABLES lt_imessage
lt_iattach
USING lv_email
'PDF Attachment of an Employee'
'PDF'
'TestFileName'
'Employee Detail'.
Form BUILD_XLS_DATA
FORM build_xls_data .
DATA :lv_buffer TYPE string.
Convert PDF from 132 to 255.
LOOP AT it_tline.
Replacing space by ~
TRANSLATE it_tline USING ' ~'.
CONCATENATE lv_buffer it_tline INTO lv_buffer.
ENDLOOP.
replacing ~ by space
TRANSLATE lv_buffer USING '~'.
DO.
lt_record = lv_buffer.
Appending 255 characters as a record
APPEND lt_record.
SHIFT lv_buffer LEFT BY 255 PLACES.
IF lv_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
lt_iattach[] = lt_record[].
ENDFORM.
Form SEND_EMAIL_WITH_XLS
FORM send_email_with_xls TABLES pit_message
pit_attach
USING p_email
p_mtitle
p_format
p_filename
p_attdescription.
DATA: es_xdocdata LIKE sodocchgi1,
lv_xcnt TYPE i.
Fill the document data.
es_xdocdata-doc_size = 1.
Populate the subject/generic message attributes
es_xdocdata-obj_langu = sy-langu .
es_xdocdata-obj_name = 'SAPRPT' .
es_xdocdata-obj_descr = p_mtitle .
Fill the document data and get size of attachment
CLEAR es_xdocdata.
READ TABLE lt_iattach INDEX lv_xcnt.
es_xdocdata-doc_size =
( lv_xcnt - 1 ) * 255 + STRLEN( lt_iattach ).
es_xdocdata-obj_langu = sy-langu.
es_xdocdata-obj_name = 'SAPRPT'.
es_xdocdata-obj_descr = p_mtitle.
CLEAR lt_iattachment. REFRESH lt_iattachment.
lt_iattachment[] = pit_attach[].
Describe the body of the message
CLEAR lt_ipacking_list. REFRESH lt_ipacking_list.
lt_ipacking_list-transf_bin = space.
lt_ipacking_list-head_start = 1.
lt_ipacking_list-head_num = 0.
lt_ipacking_list-body_start = 1.
DESCRIBE TABLE lt_imessage LINES lt_ipacking_list-body_num.
lt_ipacking_list-doc_type = 'RAW'.
APPEND lt_ipacking_list.
Create attachment notification
lt_ipacking_list-transf_bin = 'X'.
lt_ipacking_list-head_start = 1.
lt_ipacking_list-head_num = 1.
lt_ipacking_list-body_start = 1.
DESCRIBE TABLE lt_iattachment LINES lt_ipacking_list-body_num.
lt_ipacking_list-doc_type = p_format.
lt_ipacking_list-obj_descr = p_attdescription.
lt_ipacking_list-obj_name = p_filename.
lt_ipacking_list-doc_size = lt_ipacking_list-body_num * 255.
APPEND lt_ipacking_list.
Add the recipients email address
CLEAR lt_ireceivers. REFRESH lt_ireceivers.
lt_ireceivers-receiver = p_email.
lt_ireceivers-rec_type = 'U'.
lt_ireceivers-com_type = 'INT'.
lt_ireceivers-notif_del = 'X'.
lt_ireceivers-notif_ndel = 'X'.
APPEND lt_ireceivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = es_xdocdata
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = lt_ipacking_list
contents_bin = lt_iattachment
CONTENTS_HEX = lv_output
contents_txt = lt_imessage
receivers = lt_ireceivers
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.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = '' AND RETURN.
ENDFORM. -
How to view background job output
Hi experts,
I excecuted one of my Z report in background mode, its finished successfully, i want to view the output. How to view this output.
Otherwise to view this ourput only in Basis people or what? if its so i will contact the basis person. Otherwise give some idea how to view this output.
Thnx,
MohanaMohana,
Go to sm37
give the job name or *
give the username
give the program name
execute it
now tick the program that you had executed in the background
click on the spool button on the top
You will get a ABAP list under the field type
click it.
You wil be able to see the output of the program that you had executed in the background.When a program is executed in the background mode you will be able to see the output in the List Display mode and moreover you will be able to see at the max only 19 fields when a report is executed in the background.
You can check the jobs that are running in the background and their status in the table TBTCO.
Thanks,
K.Kiran. -
How to send the Report output thru email
Dear All,
Is there a way to send the output of a abap report thru mail. I am sure it is there.
My report output is as following.
Emp Code : A01234
Name: XYZ
Email-ID: [email protected]
Dear XYZ,
You have Rs....... as outstanding. Please clear all dues by ..(date).
Thankyou,
asdf.
Please advice how to accomplish this. Send a sample source code if possible.
Regards,
Alok.Below you can find the sample code for sending the report as email.
Do use this as cross reference..
DATA: reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
listobject LIKE abaplist OCCURS 0 WITH HEADER LINE,
so_ali LIKE soli OCCURS 0 WITH HEADER LINE,
list_index LIKE sy-lsind VALUE 0,
packing_list LIKE sopcklsti1,
docdata LIKE sodocchgi1,
tab_lines TYPE i,
l_rqident LIKE tsp01-rqident,
att_type LIKE soodk-objtp.
objtxt[] = mail_text[].
IF p_skip_attach IS INITIAL. " INS SIR 3971 TODD
SYSTEM-CALL LOAD LISTLEVEL-STACK INTO wrkstack.
IF wrkstack[] IS INITIAL.
SKIP 2.
WRITE: /30 text-001 COLOR 5.
ENDIF.
ENDIF. " INS SIR 3971 TODD
Prepare Receipient List
REFRESH: reclist.
LOOP AT rcpnt_userids.
IF rcpnt_userids-l_adr_name NA '@'.
reclist-receiver = rcpnt_userids-usrnam.
reclist-rec_type = 'B'.
reclist-express = 'X'.
ELSE.
reclist-receiver = rcpnt_userids-l_adr_name.
reclist-rec_type = 'U'.
reclist-express = 'X'.
ENDIF.
APPEND reclist.
CLEAR reclist.
ENDLOOP.
Prepare Doc Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
docdata-obj_langu = sy-langu.
docdata-obj_name = 'ABAP Listing'.
docdata-obj_descr = subject.
docdata-sensitivty = 'O'.
Prepare OBJPACK
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
APPEND objpack.
att_type = 'ALI'.
DESCRIBE TABLE so_ali LINES tab_lines.
READ TABLE so_ali INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( so_ali ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = subject.
APPEND objpack.
SAP supplied API function module to send Message
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
TABLES
packing_list = objpack
object_header = objhead
contents_bin = so_ali
contents_txt = objtxt
receivers = reclist
EXCEPTIONS
too_many_reclist = 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.
IF sy-subrc <> 0.
MESSAGE i398(00) WITH 'SAP Office API Error'
sy-subrc
ENDIF.
Maybe you are looking for
-
Iomega external HDD - Should you eject them or just switch macbook off?
Greetings I have an Iomega eGo HDD (Mac Edition) which I connect to my macbook via Firewire 400 and backup using Time Machine. It doesn't have a power switch on the HDD. When I want to switch my macbook off should I right-click on the Iomega icon on
-
Changing billing (name only)
I asked ATT&T this morning how to change billing name. Everything else would stay same. They said to start the process on line then they would double check. I cannot find any way to change name on line. Any ideas?
-
Have to close chrome registration window 3 to 4 times before I successfully get into mozilla home page I recently installed the latest version 3.6 3.7 and get the same problem
-
SPP 4.10 - Installation Error 1606
Hi Everyone, i hope you can help me. We are trying to install The SPP 4.10 by Ancile on a Windows 2008 Server. During the Installation we are getting the following error: Error 1606. Could not access network location %SystemDrive%/inetpub\wwwroot\. T
-
Connecting Crystal reports with dashboards and passing parameters
Hi , Can anyone have any document on Connecting Crystal reports with dashboards and passing parameters. I would appreciate for this. Thank You.