Sending ALV report(As a attachment ) through EMail
Dear Friends,
Could anyone please help me to solve this problem.
I need to send ALV report <b>as an attachment</b> to External mail-id as well as SAP USER ID..The user wants to schedule this ABAP program in background, at the end the final output should be send to his ID. I facing problem to locate correct Functional Module....
I would like to thank, if anyone give some idea on this issue also if possible a sample code.
Thanks in advance
With Reg
Babu
HI Kamal Babu
After sending your ABAP List to the spool request (SP01), you can use the SAP standard spool PDF conversion program.
RSTXPDFT4 - This report program converts ABAP List to PDF files.
Or Just try this sample code:
After running the background jobs, send the spool to the SAP users Office Mail Box.
REPORT ZMAILSPOOL.
INCLUDE LBTCHDEF.
Include the Business Object Repository object
INCLUDE <CNTN01>.
DATA ABAPNM LIKE SY-REPID.
DATA BEGIN OF LOCAL_JOB.
INCLUDE STRUCTURE TBTCJOB.
DATA END OF LOCAL_JOB.
DATA BEGIN OF LOCAL_STEP_TBL OCCURS 10.
INCLUDE STRUCTURE TBTCSTEP.
DATA END OF LOCAL_STEP_TBL.
Data declarations for the mail recipient
DATA RECIPIENT TYPE SWC_OBJECT.
DATA RECIPIENT_OBJ LIKE SWOTOBJID.
SWC_CONTAINER CONTAINER.
Data declarations for the background job
PARAMETERS ABAPNAME(20) DEFAULT 'ZTEST1'.
PARAMETERS EMPFNAME LIKE SY-UNAME DEFAULT SY-UNAME.
ABAPNM = ABAPNAME.
LOCAL_JOB-JOBNAME = ABAPNAME.
Generate recipient object (see report RSSOKIF1 for an example)
1. Create the recipient:
IF EMPFNAME <> SPACE.
"** 1.1 Generate an object reference to a recipient object
SWC_CREATE_OBJECT RECIPIENT 'RECIPIENT' SPACE.
"** 1.2 Write the import parameters for method
"** recipient.createaddress into the container
"** and empty the container
SWC_CLEAR_CONTAINER CONTAINER.
"** Set address element (internal user 'JSMITH')
SWC_SET_ELEMENT CONTAINER 'AddressString' EMPFNAME.
"** Set address type (internal user)
SWC_SET_ELEMENT CONTAINER 'TypeId' 'B'.
"** 1.3 Call the method recipient.createaddress
SWC_CALL_METHOD RECIPIENT 'CreateAddress' CONTAINER.
"** Issue any error message generated by a method exception
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO.
ENDIF.
SWC_CALL_METHOD RECIPIENT 'Save' CONTAINER.
SWC_OBJECT_TO_PERSISTENT RECIPIENT RECIPIENT_OBJ.
ENDIF.
Recipient has been generated and is ready for use in a
background job
CALL FUNCTION 'JOB_OPEN'
exporting
DELANFREP = ' '
JOBGROUP = ' '
jobname = LOCAL_JOB-JOBNAME
SDLSTRTDT = NO_DATE
SDLSTRTTM = NO_TIME
IMPORTING
JOBCOUNT = LOCAL_JOB-JOBCOUNT
EXCEPTIONS
CANT_CREATE_JOB = 1
INVALID_JOB_DATA = 2
JOBNAME_MISSING = 3
OTHERS = 4
if sy-subrc <> 0.
WRITE: / 'JOB_OPEN PROBLEM ', SY-SUBRC.
ELSE.
WRITE: / 'JOB OPEN SUCCESS',
LOCAL_JOB-JOBNAME, LOCAL_JOB-JOBCOUNT.
endif.
CALL FUNCTION 'JOB_SUBMIT'
exporting
ARCPARAMS =
authcknam = SY-UNAME
COMMANDNAME = ' '
OPERATINGSYSTEM = ' '
EXTPGM_NAME = ' '
EXTPGM_PARAM = ' '
EXTPGM_SET_TRACE_ON = ' '
EXTPGM_STDERR_IN_JOBLOG = 'X'
EXTPGM_STDOUT_IN_JOBLOG = 'X'
EXTPGM_SYSTEM = ' '
EXTPGM_RFCDEST = ' '
EXTPGM_WAIT_FOR_TERMINATION = 'X'
jobcount = LOCAL_JOB-JOBCOUNT
jobname = LOCAL_JOB-JOBNAME
LANGUAGE = SY-LANGU
PRIPARAMS = ' '
REPORT = ABAPNM
REPORT = 'ZTEST1'
VARIANT = ' '
IMPORTING
STEP_NUMBER = LOCAL_JOB-STEPCOUNT
EXCEPTIONS
BAD_PRIPARAMS = 1
BAD_XPGFLAGS = 2
INVALID_JOBDATA = 3
JOBNAME_MISSING = 4
JOB_NOTEX = 5
JOB_SUBMIT_FAILED = 6
LOCK_FAILED = 7
PROGRAM_MISSING = 8
PROG_ABAP_AND_EXTPG_SET = 9
OTHERS = 10
if sy-subrc <> 0.
WRITE: / 'JOB_SUBMIT PROBLEM ', LOCAL_JOB-JOBCOUNT,
LOCAL_JOB-JOBNAME, ABAPNAME, SY-SUBRC.
endif.
IF EMPFNAME <> SPACE.
CALL FUNCTION 'JOB_CLOSE'
exporting
AT_OPMODE = ' '
AT_OPMODE_PERIODIC = ' '
CALENDAR_ID = ' '
EVENT_ID = ' '
EVENT_PARAM = ' '
EVENT_PERIODIC = ' '
jobcount = LOCAL_JOB-JOBCOUNT
jobname = LOCAL_JOB-JOBNAME
LASTSTRTDT = NO_DATE
LASTSTRTTM = NO_TIME
PRDDAYS = 0
PRDHOURS = 0
PRDMINS = 0
PRDMONTHS = 0
PRDWEEKS = 0
PREDJOB_CHECKSTAT = ' '
PRED_JOBCOUNT = ' '
PRED_JOBNAME = ' '
SDLSTRTDT = NO_DATE
SDLSTRTTM = NO_TIME
STARTDATE_RESTRICTION = BTC_PROCESS_ALWAYS
STRTIMMED = 'X'
TARGETSYSTEM = ' '
START_ON_WORKDAY_NOT_BEFORE = SY-DATUM
START_ON_WORKDAY_NR = 0
WORKDAY_COUNT_DIRECTION = 0
RECIPIENT_OBJ = RECIPIENT_OBJ
TARGETSERVER = ' '
DONT_RELEASE = ' '
IMPORTING
JOB_WAS_RELEASED = 'X'
EXCEPTIONS
CANT_START_IMMEDIATE = 1
INVALID_STARTDATE = 2
JOBNAME_MISSING = 3
JOB_CLOSE_FAILED = 4
JOB_NOSTEPS = 5
JOB_NOTEX = 6
LOCK_FAILED = 7
OTHERS = 8
IF ( SY-SUBRC <> 0 ).
WRITE: / 'Job_Close Problem:', ABAPNAME, SY-SUBRC.
ELSE.
WRITE: / 'Job_Close done'.
ENDIF.
ELSE. "no empfname
ENDIF.
Cheers,
Vijay Raheja
Similar Messages
-
To send TXT file as an attachment through Email
Hi Experts,
I am working on requirement where i have to send a txt file as an attachment.
Could any one suggest me a solution.
Thanks and Regards,
Jeswanth KadaliHi,
Use the function module SO_NEW_DOCUMENT_ATT_SEND_API1.
We find it convenient to use a custom function module as a wrapper for that.
Here's the code.
FUNCTION Z_EMAILS_ATTACH.
""Local interface:
*" IMPORTING
*" VALUE(EMAIL_SUBJECT) LIKE SODOCCHGI1-OBJ_DESCR
*" VALUE(ATTACHMENT_SUBJECT) LIKE SOPCKLSTI1-OBJ_DESCR OPTIONAL
*" VALUE(ATTACHMENT_DOC_TYPE) TYPE SO_OBJ_TP OPTIONAL
*" REFERENCE(ATTACHMENT_HEADER) LIKE SOLISTI1 STRUCTURE SOLISTI1
*" TABLES
*" EMAIL_BODY STRUCTURE SOLISTI1
*" EMAIL_ATTACHMENT STRUCTURE SOLISTI1 OPTIONAL
*" RECEIVERS STRUCTURE SOMLRECI1
*" EXCEPTIONS
*" UNKNOWN_COMMUNICATION_TYPE
*" ERROR_SENDING_MAIL
*" EMPTY_ATTACHMENT
*" NO_ATTACHMENT_SUBJECT
*" USER_HAS_NO_EMAIL_ADDRESS
*" NO_RECEIVERS
NOTE
Single-testing when the tables passed to the function have reference
structure SOLISTI1 meets with a problem.
Entering non-blank rows into these tables is impossible, it seems.
This is believed to be because the single testing fails to cope with
the width of SOLISTI1-LINE [255 char].
For single testing, use CVDTLINE as the reference structure - it's
only 132 char. Then remember to change it back to SOLISTI1...
Based on Z_EMAIL_ATTACH which sends just one mail.
08.06.2007 JNM
DATA: document LIKE sodocchgi1.
DATA: packlist LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
DATA: contents LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA: header LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA: RECVLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.
DATA: NEXT_ROW LIKE SY-TABIX.
DATA: lines LIKE sy-tabix.
DATA: LAST_LINE_LENGTH TYPE I.
DATA: d_doc_size LIKE packlist-doc_size.
data: email_address type ad_smtpadr.
A user without an email address cannot email.
CALL FUNCTION 'Z_USER_EMAIL_ADDRESS'
EXPORTING
USER_NAME = SY-UNAME
IMPORTING
EMAIL_ADDRESS = email_address
EXCEPTIONS
UNKNOWN_USER = 1
NO_ADDRESS_KEY = 2
NO_ADDRESS_DATA = 3
NO_EMAIL_ADDRESS = 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
raising USER_HAS_NO_EMAIL_ADDRESS.
ENDIF.
Receivers?
describe table receivers lines lines.
if lines eq 0.
raise no_receivers.
endif.
initialization
CLEAR: CONTENTS, DOCUMENT, HEADER, PACKLIST, RECVLIST.
REFRESH: CONTENTS, HEADER, PACKLIST, RECVLIST.
attachment?
DESCRIBE TABLE EMAIL_ATTACHMENT LINES LINES.
IF LINES EQ 0 AND ATTACHMENT_SUBJECT CN SPACE.
RAISE EMPTY_ATTACHMENT.
ENDIF.
IF LINES NE 0 AND ATTACHMENT_SUBJECT CO SPACE.
RAISE NO_ATTACHMENT_SUBJECT.
ENDIF.
email body
concatenate 'SAP client:'
sy-host sy-sysid sy-mandt
into contents separated by space.
append contents.
clear contents.
append contents.
APPEND LINES OF EMAIL_BODY TO CONTENTS.
header - row for body
HEADER = 'BODY HEADER'.
APPEND HEADER.
packing list - row for body
PACKLIST-TRANSF_BIN = SPACE.
PACKLIST-HEAD_START = 1.
PACKLIST-HEAD_NUM = 1.
PACKLIST-BODY_START = 1.
DESCRIBE TABLE CONTENTS LINES PACKLIST-BODY_NUM.
NEXT_ROW = 1 + PACKLIST-BODY_NUM.
*packlist-doc_type = 'EXT'.
PACKLIST-DOC_TYPE = 'RAW'.
APPEND PACKLIST.
IF ATTACHMENT_SUBJECT CN SPACE. " if there's an attachment
attachment into contents
APPEND LINES OF EMAIL_ATTACHMENT TO CONTENTS.
DESCRIBE TABLE EMAIL_ATTACHMENT LINES LINES.
READ TABLE EMAIL_ATTACHMENT INDEX LINES.
LAST_LINE_LENGTH = STRLEN( EMAIL_ATTACHMENT ).
header - attachment
if attachment_header is initial.
HEADER = 'ATTACH'.
else.
header = attachment_header.
endif.
APPEND HEADER.
packing list - row for attachment
CLEAR PACKLIST.
case attachment_doc_type.
when 'XLS'.
PACKLIST-TRANSF_BIN = 'X'.
when others.
PACKLIST-TRANSF_BIN = SPACE.
endcase.
PACKLIST-HEAD_START = 2.
PACKLIST-HEAD_NUM = 1.
PACKLIST-BODY_START = NEXT_ROW.
if not attachment_doc_type is initial.
packlist-doc_type = attachment_doc_type.
else.
PACKLIST-DOC_TYPE = 'RAW'.
endif.
packlist-doc_type = 'EXT'.
PACKLIST-OBJ_DESCR = ATTACHMENT_SUBJECT.
PACKLIST-OBJ_NAME = 'ATTACHMENT'.
PACKLIST-BODY_NUM = LINES.
D_DOC_SIZE = LAST_LINE_LENGTH + ( 255 * ( LINES - 1 ) ).
PACKLIST-DOC_SIZE = D_DOC_SIZE.
APPEND PACKLIST.
ENDIF. "attachment
document
document-obj_name = 'EMAIL'.
DOCUMENT-OBJ_DESCR = EMAIL_SUBJECT.
document-obj_langu = sy-langu.
document-obj_expdat = sy-datum.
document-sensitivty = 'F'.
document-obj_prio = 9.
document-no_change = 'X'.
document-priority = 9.
document-expiry_dat = sy-datum.
ADD 1 TO: DOCUMENT-OBJ_EXPDAT, DOCUMENT-EXPIRY_DAT.
DESCRIBE TABLE contents LINES lines.
D_DOC_SIZE = LAST_LINE_LENGTH + ( 255 * ( LINES - 1 ) ).
document-doc_size = d_doc_size.
call the mail function
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = document
put_in_outbox = 'X'
commit_work = 'X'
TABLES
object_header = header
packing_list = packlist
contents_txt = contents
receivers = 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.
IF SY-SUBRC > 0.
RAISE ERROR_SENDING_MAIL.
ENDIF.
ENDFUNCTION.
Also remember that the SAP user sending the email must have an email address in the user details, so that SAP has something to put in the "From" field when creating the email.
That's why we use this:
FUNCTION Z_USER_EMAIL_ADDRESS.
""Local interface:
*" IMPORTING
*" REFERENCE(USER_NAME) TYPE SYUNAME DEFAULT SY-UNAME
*" EXPORTING
*" REFERENCE(EMAIL_ADDRESS) TYPE AD_SMTPADR
*" EXCEPTIONS
*" UNKNOWN_USER
*" NO_ADDRESS_KEY
*" NO_ADDRESS_DATA
*" NO_EMAIL_ADDRESS
tables:
adr6,
usr21,
usr02.
SAP logon data
select single *
from usr02
where bname = user_name.
if sy-subrc ne 0.
message i017(ZREP) with
'SAP user' user_name 'is unknown'
raising unknown_user.
endif.
SAP user address key
select single *
from usr21
where bname = user_name.
if sy-subrc ne 0.
message i017(ZREP) with
'No address data assigned to SAP user' user_name
raising no_address_key.
endif.
SAP user address
select single *
from adr6
where addrnumber = usr21-addrnumber and
persnumber = usr21-persnumber.
if sy-subrc ne 0.
message i017(ZREP) with
'No address data found for SAP user' user_name
raising no_address_data.
endif.
email_address = adr6-smtp_addr.
if email_address is initial.
message i017(ZREP) with
'No address data found for SAP user' user_name
raising no_email_address.
endif.
ENDFUNCTION.
John -
How to Send the result of a report to a user through email.
Hi,
We have a report. It creates quotation. It automatically sends the report to the printer.
in nace transction - for the particular quotation type - the output types are defined. The output types for printer, Fax, External Send and Edi is defined.For printer, the processing routine is zprogram.
I want to send this report to the user through email. What i have to do? Whether i have to modify the zprogram or i have to define seperately output types for email also, without modifying the program?
Pl try to give me replies as early as possible.
Thanks
Mallik.Hi,
Check this link.
function to send e-mail
Reward points if useful.
Cheers,
Swamy Kunche -
Convert spool to xls and send the attachment through email
Hello,
I have a requirement to convert spool to xls and then send the xls as an attachment through email,how sould i go about it,which fm can i use please advice..
Thanks.Please check the links
Re: Spool to XLS
Re: converting spool data to xls file format.
Regards
Satish Boguda -
Sending smartform as PDF attachment through email
Hi,
I have used the FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send the smartform as PDF attachment through email.In SOST transaction I can see that the mail has been sent to the reciepient,but the mail is not going to the mail box.What would be the reason for this?
Regards,
HemaThat should be the basis issue. They needs to do some settings. Please ask them to do so.
Pranav -
How to send zip file as attachment through email
Hi All,
I am having a requirement that I need to download the internal table data into .txt file and I need to zip the text file. And this zip files needs to send to the customer through email.
I am able download the data into .txt and able to zip the file. But I am not able send the .zip file through email.
I know that we can send .xls, .txt, .csv and also .ppt, .doc file types we can send as an attachement through abap program. But I don't know about .zip files. Is there any possibilty to send .zip file as an attachment thorugh email.
Can any one help me how to send a .zip file thorugh email as an attachment.
Regards,
vinodhi Vinod,
Can you please tell me how you have zipped the file.
I am having a text file in application server. I need to zip that file. Then the middleware moves it to Legacy system.
I used the following code. With this I am having the data in Binary format which my midleware cannot understand.
What I need on the whole is just to reduce the size of the file.
form ZIP_FILE .
DATA: lt_data TYPE TABLE OF x255,
lt_textdata TYPE TABLE OF x255.
DATA: ls_data LIKE LINE OF lt_data.
DATA: lv_dsn1(100) VALUE '/ECD/120/GIS/FTP/IB/DNBPAYDEX.TXT'.
DATA: lv_dsn3(100) VALUE '/ECD/120/GIS/FTP/IB/DNBPAYDEXZIP.zip'.
*DATA: lv_dsn3(100) VALUE '/interfaces/SM5/test.zip'. " Contains sample1.xls and sample2.xls
DATA: lv_file_length TYPE i.
DATA: lv_content TYPE xstring.
DATA: lo_zip TYPE REF TO cl_abap_zip.
CREATE OBJECT lo_zip.
Read the data as a string
clear lv_content .
OPEN DATASET lv_dsn1 FOR INPUT IN BINARY MODE.
READ DATASET lv_dsn1 INTO lv_content .
CLOSE DATASET lv_dsn1.
lo_zip->add( name = 'sample.TXT' content = lv_content ).
lv_content = lo_zip->save( ).
*clear lv_content .
Conver the xstring content to binary
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_content
IMPORTING
output_length = lv_file_length
TABLES
binary_tab = lt_data.
OPEN DATASET lv_dsn3 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT lt_textdata INTO ls_data.
TRANSFER ls_data TO lv_dsn3.
ENDLOOP.
CLOSE DATASET lv_dsn3.
IF sy-subrc EQ '0'.
MESSAGE s999(zfi_ap_gl) WITH text-t10.
ENDIF.
Can you please help.
Thanks Aravind -
Not Able to send pdf as attachment through email
Hi,
I am trying to send the generated pdf as attachment throught email and for the same i am referring to this blog
http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417100)ID1409662650DB01562818410448928630End?blog=/pub/wlg/8551
but when i am trying to send the mail using the method given in this blog , i am getting this error
com.sap.tc.adobe.pdfobject.core.PDFObjectRuntimeException: Processing exception during a "MergeData" operation. Request start time: Fri Dec 11 18:05:24 IST 2009 com.adobe.ProcessingException: PDF is not interactive. Data can only be imported into interactive forms. Exception Stack Trace: com.adobe.ProcessingException: PDF is not interactive
and at the backend i am getting the error as
#com.sun.mail.smtp.SMTPSendFailedException: 501 Bad address syntax
Can any one please help me out with a solution ?? Any suggestions are welcomed
Thanks a lot in advanceHi,
Thanks for your reply , but i cannot set the enabled property of the form as true as we are not using the licensed version of the live cycle designer . But if i try the example step by step then even by setting the enabled property as false , the pdf is generated and sent through the email and when i am trying to do the same thing in one of my applications its not working . The pdf is generated but as soon as i click on the button send mail the above told error is displayed .
There needs to be some other explaination for the error -
How do I send an attachment through email
How can I send an attachment through email.
This is not a firefox problem, but see analytical information in this link:
[http://www.ehow.com/how_4942_send-e-mail.html How to Send an E-mail Attachment]
thank you
Please mark "Solved" the answer that really solve the problem, to help others with a similar problem. -
How do you send a attachment through email on iPad 2
How do you send a attachment through email using iPad 2
How to Attach Photos and Videos to Emails on an iPhone or iPad
http://www.wikihow.com/Attach-Photos-and-Videos-to-Emails-on-an-iPhone-or-iPad
iPad Basics: Sending an Email With An Attachment
http://ipadacademy.com/2012/03/ipad-basics-sending-an-email-with-an-attachment
How to add, send and open iPad email attachments
http://www.iskysoft.com/apple-ipad/ipad-email-attachments.html
How to Send Multiple email Attachments from your iPad or iPhone
http://ipadacademy.com/2014/03/how-to-send-multiple-email-attachments-from-your- ipad-or-iphone
Cheers, Tom -
How to send an ouput as PDF attachment to email
Hi,
We have a 'Z' output for a delivery document. The output has the standard RLE_DELNOTE driver program and a Zsmart form assigned to it. We need to send the output as an attachment to email. Can some one please adivice how this can be achieved?
Thanks in advance
KatHi,
Plz try following steps.
1. Note the spool request No.
2. In T/code SE38, Enter The programme and execute.
3. In sub Object- Click Documentation and then do debuggung.
4.Enter spool request no and desired location and execute.
5. In ABAP Debugger- Use F8 key.
6. Select the desired location and file name and save.
View the desired output in PDF and can be sent through mail.
Hope this helps.
Regards,
Jaiprakash.P.T -
Simple code to send ALV display as XLS attachment to SAP inbox
Hi All,
Simple code to send ALV display as XLS attachment to SAP inbox.
Also i need to send only 200 records per attachement. So in this case i need send multiple attachment per mail
Thanks,
LokeshThe following code is used to send the internal table which u pass fo the ALV display to be send as excel sheet attachment
Internal table is it_attach[]
ld_email = po_email.
ld_mtitle = 'Email From Z377_EMAIL_XLS'.
ld_format = 'XLS'.
ld_attdescription = 'filename'.
ld_attfilename = 'Allot'.
ld_sender_address = ' '.
ld_sender_address_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[] = it_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 li_content 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 = li_content
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. -
Pls help:sending oracle reports with desformat=spreadsheet to email
Is there a way to send the reports with desformat=spreadheet to email(destype=mail). I tried to execute the commandline with destype=mail desname=[email protected] desformat=spreadsheet but I am getting a report with html type attachment. How could I make it xls(excel) instead of html
When having lots of repeating frames and fields placed in a complex pattern, the Oracle Reports doesn't know how to place them in the .xls cells.
You ought to have a second layout for the report (containing the same data) that would print when the desformat = spreadsheet and would be be rather simple in comparison to the one that would print when desformat=pdf/html.
In case you have several repeating frames it is best to have all the fields in those frames placed and vertically aligned on the same row in the layout, from left to right. This should give a reasonable output. -
How do I scan a photo to a file and then send the file as an attachment via email.
How do I scan a photo to a file and then send the file as an attachment via email.
All of this depends largely on what printer /software you have, which Email client you use and to some extent which OS you are running.
Most HP printers have HP Solution Center which is used to set up scanning,choosing where to save,etc. Once a file/photo is scanned and saved to the folder, open the folder.Select the file and at the top of the window should be the option to 'Email'.
******Clicking the Thumbs-Up button is a way to say -Thanks!.******
**Click Accept as Solution on a Reply that solves your issue to help others** -
Send ALV report as email attachment but in background scheduling mode
Hi All,
I have ALV report which runs fine in the foreground.
But i need to display it in the spool that is by scheduling in the background.
can i send an excel attachement as e-mail in the background scheduling? my report contains
10 columns and i need them in proper format on excel sheet attachment? plz help me out?if possible
give me abap code..HI,
Use the below link
Sending Mail to the schedular of Background Job
Thanks -
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
Maybe you are looking for
-
How do you uninstall Photoshop from one computer and retain the serial number?
I purchased Photoshop CS4 a few years ago which allowed me to use the serial number on two computers, however the initial laptop I installed it on suffered fatal injuries and couldn't be recovered. The problem is that Photoshop is still technically i
-
Erro while saving KP06, system gives error message
I have a issue with cost element planning. When requester is processing the transaction KP06, and he tries to save it, the system gives message stating Ledger 0 has fiscal year variant instead of V3 Details of message is Ledger 0 has fiscal year vari
-
In forms 9i how to make a grid populated based on varying no of rows and cl
Hi, I have a small query in oracle forms. I have a selection screen like HParm1 HParm2 HParm3 . . . . . Vparm1 Y/N Y/N Y/N . . . . VParm2 Y/N Y/N Y/N . . . . VParm3 Y/N Y/N Y/N . . . . I have three tables as Table 1 Field1 with values Hparm1 , Hparm2
-
Mostly what are issues we get for production support in hyperion essbase project ?
mostly what are issues we get for production support in hyperion essbase project ?
-
When I try to take a print out from documents in my mailbox, it tell´s me that it can not find the printer??. I have just downloaded epson iprint since I have an Epson wifi printer. The iprint did find and successful installed the printer. Somebody w