Upload PDFs and attach to mail
Is it possible to create a program that can be used to upload a PDF document and then attach that PDF document to an email? I am aware that you can attch PDF's to an email, but not so aware of uploading the doucments from a PC.
For upload PDFs try with fm GUI_UPLOAD and use FILETYPE as 'BIN'.
a®
Similar Messages
-
Smartform output to pdf and send through mail
Hi,
I am able to save the output of the smartform as pdf file and able to send the pdf as attachment in mail.
But the problems are -
1 - As i have set the field - 'X' TO ls_control_param-getotf.
I am unable to view the print preview of the billing document and no spool is getting displayed. I want to see the print preview and create a spool and also generate a pdf file.
2- I am using the FM SO_DOCUMENT_SEND_API1 to send the mail of the pdf file. But i am getting the message like
"Cannot extract the embedded font 'FranklinGothalicITCBook'. Some charactersmay not display or print correctly" followed by "An error exists on this page. Acrobat may not display the page correctly".
Pls help me in resolving the issues.
Thanks,
RajuHi
I was worked on similar type of requirement. For your reference, please check the below piece of code which i have developed for my requirement.
FORM ENTRY USING RETCODE
US_SCREEN.
*Check if Nast key is initial or not
IF NAST-OBJKY IS NOT INITIAL.
*if nast-objkey is not initial than we need to get the smartform name
*which is ZSF_PURCHASE_ORDER01
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = C_FORM
IMPORTING
FM_NAME = G_FNAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
*if sy-subrc ne 0 than we need to update the nast entry with error
IF SY-SUBRC <> 0.
RETCODE = 1.
PERFORM NAST_PROTOCOL_UPDATE.
EXIT.
ENDIF.
*check if we need to take a print out
CLEAR W_CTRLOP.
IF SY-UCOMM = 'PREVOUTPUT'.
NAST-NACHA = '1'.
ENDIF.
OUTPUT TO PRINTER
IF NAST-NACHA = C_1. " Output to Printer
W_COMPOP-TDDEST = NAST-LDEST.
W_COMPOP-TDNEWID = 'X'.
W_COMPOP-TDIMMED = 'X'.
W_COMPOP-TDDELETE = 'X'.
W_COMPOP-TDLIFETIME = 1.
W_COMPOP-TDFINAL = 'X'.
W_CTRLOP-NO_DIALOG = 'X'.
W_CTRLOP-DEVICE = 'PRINTER'.
W_CTRLOP-PREVIEW = 'X'.
*Smartform is called and print program is done
CALL FUNCTION G_FNAME
EXPORTING
CONTROL_PARAMETERS = W_CTRLOP
OUTPUT_OPTIONS = W_COMPOP
USER_SETTINGS = ' '
WA_NAST = NAST
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
*if print program is successful we need to update the nast entry
IF SY-SUBRC EQ 0.
RETCODE = 0.
IF US_SCREEN EQ 'X'.
PERFORM NAST_PROTOCOL_UPDATE.
ELSEIF SY-SUBRC NE 0.
*if print program is not successful than we need to update the nast
*entry
RETCODE = 1.
PERFORM NAST_PROTOCOL_UPDATE.
EXIT.
ENDIF.
ENDIF.
OUTPUT TO MAIL
ELSEIF NAST-NACHA = C_5. " External Mail
We need to get the smartform into OTF file format
W_CTRLOP-GETOTF = 'X'.
IF NAST-TCODE = 'ZLE'.
W_COMPOP-TDDEST = 'LOCL'.
ENDIF.
CALL FUNCTION G_FNAME
EXPORTING
CONTROL_PARAMETERS = W_CTRLOP
OUTPUT_OPTIONS = W_COMPOP
USER_SETTINGS = ' '
WA_NAST = NAST
IMPORTING
JOB_OUTPUT_INFO = WA_RETURN
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
*update the nast entry accordingly
IF SY-SUBRC EQ 0.
RETCODE = 0.
IF US_SCREEN EQ 'X'.
PERFORM NAST_PROTOCOL_UPDATE.
ELSEIF SY-SUBRC NE 0.
RETCODE = 1.
PERFORM NAST_PROTOCOL_UPDATE.
EXIT.
ENDIF.
ENDIF.
*convert the smartform data into OTF file
DATAB[] = WA_RETURN-OTFDATA[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 134
ARCHIVE_INDEX = ' '
ASCII_BIDI_VIS2LOG = 'X'
PDF_DELETE_OTFTAB = ' '
IMPORTING
BIN_FILESIZE = BINFILESIZE
TABLES
OTF = DATAB[]
LINES = PDFTAB[]
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5.
*if file conversion fails we need to update the nast entry
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
LINE_WIDTH_SRC = 134
LINE_WIDTH_DST = 255
TRANSFER_BIN = 'X'
TABLES
CONTENT_IN = PDFTAB[]
CONTENT_OUT = PDF[]
EXCEPTIONS
ERR_LINE_WIDTH_SRC_TOO_LONG = 1
ERR_LINE_WIDTH_DST_TOO_LONG = 2
ERR_CONV_FAILED = 3
OTHERS = 4.
*if conversion fails update the nast entry accordingly
IF SY-SUBRC <> 0.
RETCODE = 1.
PERFORM NAST_PROTOCOL_UPDATE.
EXIT.
ENDIF.
Hope it helps... -
How to convert binary data to PDF and attach to the particular po
our client wants to attach the pdf coming from portal as attachment to that particular PO. From portal the pdf will come in binary format. Find how will we convert that binary data back to pdf and attach to the PO in R/3?
Hi,
You can downlaod Binary data into PDF using GUI_DOWNLOAD...pass the binary data and the BINSIZE...
santhosh -
How to upload pdf and doc/docx with ADF?
I am using 11.1.2.3.0,
I want to be able to upload pdf and/or word documents in my web application. Can anyone help me with a tutorial or a sample example because all what I am finding till now are related to processing photos but it is not my case.
Thank you in advance.I was just reading this, but this guy didn't fix his problem till the end of the thread.. However can you help me on how to implement at least the "uploadBean" class because he in his post showed only the jspx file and the "backing_uploadfile" bean. I understand I annoying you but I am new to this kind of stuff :) Thank you
-
If I buy Pages, will I be able I upload pdf and word files to websites?
If I buy Pages, will I be able I upload pdf and word files to websites?
Pages can export to PDF and .doc formats and send those via email, but it has no "upload" function. That is something you normally do with a browser or an ftp app.
-
Exporting a crystal report as PDF and Attaching to an email via code - Filename Issuses?
Post Author: alynch
CA Forum: .NET
I need to export a crystal report as a pdf and send it out via email. I have created a subroutine that works but the attached filename come up as "untitled.txt" so the receiving machine believes it is a text file. If I rename it on the recipients machine to a ".pdf" I can open it with acrobat and it looks OK. Does anyone know how to rename the file as a pdf prior to sending it out?
Thank You.
al
I have included a copy of the subroutine:
Dim repdoc As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
Dim diskOpts As New CrystalDecisions.Shared.DiskFileDestinationOptions()
Dim ExpOpts As CrystalDecisions.Shared.ExportOptions
Dim MailOpts As New CrystalDecisions.Shared.MicrosoftMailDestinationOptions()
repdoc = Me.CrystalReport11
repdoc.Load("C:\Documents and Settings\User\My Documents\Visual Studio 2005\Projects\WindowsApplication3\WindowsApplication3\CrystalReport1.rpt")
ExpOpts = repdoc.ExportOptions
With ExpOpts
.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.MicrosoftMail
.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat
End With
With MailOpts
.MailMessage = "Message"
.MailToList = "enter email adress here"
.MailSubject = "Attached is a PDF file - .net Export test "
End With
ExpOpts.DestinationOptions = MailOpts
Try
repdoc.Export()
Catch err As Exception
MessageBox.Show(err.ToString())
End Try
End SubPost Author: Knight
CA Forum: .NET
I had this same problem today, here's what I used. Its built in 2 parts. Step one loops throught and exports PDF copies of a traking report. Step 2 builds an email list from a SQl query and sends it.STEP ONE:Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 'Declare the some variables Dim row1 As DataRow Dim brokerID As String Dim brokername As String Dim brokerEmail As String Dim shipdate As String Dim crParameterFieldDefinitions As ParameterFieldDefinitions Dim crParameterFieldDefinition As ParameterFieldDefinition Dim crParameterValues As New ParameterValues() Dim crParameterDiscreteValue As New ParameterDiscreteValue() Dim crParameterFieldDefinitions1 As ParameterFieldDefinitions Dim crParameterFieldDefinition1 As ParameterFieldDefinition Dim crParameterValues1 As New ParameterValues() Dim crParameterDiscreteValue1 As New ParameterDiscreteValue() Dim CrReport As New CrystalReport1() ' Report Name Dim report As ReportDocument = "O:KNIFormats_ReportPrivateSMStageShipmentInfo" Dim CrExportOptions As ExportOptions Dim CrDiskFileDestinationOptions As New DiskFileDestinationOptions() Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions() Dim SHIPDATE123 As String SHIPDATE123 = _month & "/" & _day & "/" & year Dim db As String db = System.Configuration.ConfigurationSettings.AppSettings("Datalogin") Dim sqlCon As New SqlConnection sqlCon.ConnectionString = db Dim strsql1 As String strsql1 = "SELECT tblSOOrd_Hdr.BrokerCd, tblSO_Ord_Hdr.BrokerName, tblSM_Ship_Hdr.ShipDate " strsql1 &= "FROM tblSO_Ord_Hdr INNER JOIN tblSM_Ship_Hdr ON tblSO_Ord_Hdr.Locale = tblSM_Ship_Hdr.Locale AND tblSO_Ord_Hdr.OrdNo = tblSM_Ship_Hdr.OrdNo AND " strsql1 &= " tblSO_Ord_Hdr.RlsNo = tblSM_Ship_Hdr.RlsNo INNER JOIN tblSys_Cust_Broker ON tblSO_Ord_Hdr.BrokerCd = tblSys_Cust_Broker.BrokerCd " strsql1 &= "GROUP BY tblSO_Ord_Hdr.BrokerCd, tblSM_Ship_Hdr.ShipDate, tblSO_Ord_Hdr.BrokerName " strsql1 &= "HAVING (tblSM_Ship_Hdr.ShipDate = '" & SHIPDATE123 & "') " Dim da1 As New SqlDataAdapter(strsql1, sqlCon) Dim worktbl1 As DataTable worktbl1 = New DataTable("tblEmail") da1.Fill(worktbl1) da1.FillSchema(worktbl1, SchemaType.Source) If worktbl1.Rows.Count > 0 Then For Each row1 In worktbl1.Rows brokerID = CStr(row1("BrokerCd")).Trim brokername = CStr(row1("BrokerName")).Trim shipdate = CStr(row1("ShipDate")).Trim CrReport.Load() crParameterDiscreteValue.Value = shipdate crParameterFieldDefinitions = CrReport.DataDefinition.ParameterFields crParameterFieldDefinition = crParameterFieldDefinitions.Item("ShipDate") crParameterValues = crParameterFieldDefinition.CurrentValues crParameterValues.Clear() crParameterValues.Add(crParameterDiscreteValue) crParameterFieldDefinition.ApplyCurrentValues(crParameterValues) crParameterDiscreteValue1.Value = brokerID crParameterFieldDefinitions1 = CrReport.DataDefinition.ParameterFields crParameterFieldDefinition1 = crParameterFieldDefinitions1.Item("Broker") crParameterValues1 = crParameterFieldDefinition1.CurrentValues crParameterValues1.Clear() crParameterValues1.Add(crParameterDiscreteValue1) crParameterFieldDefinition1.ApplyCurrentValues(crParameterValues1) CrDiskFileDestinationOptions.DiskFileName = "c:Test_Folder20" & _year & "-" & _month & "-" & day & "" & brokername & ".pdf" CrFormatTypeOptions.FirstPageNumber = 1 ' Start Page in the Report CrFormatTypeOptions.LastPageNumber = 1000 ' End Page in the Report CrFormatTypeOptions.UsePageRange = True CrExportOptions = CrReport.ExportOptions With CrExportOptions .ExportDestinationType = ExportDestinationType.DiskFile .ExportFormatType = ExportFormatType.PortableDocFormat .DestinationOptions = CrDiskFileDestinationOptions .FormatOptions = CrFormatTypeOptions End With Try CrReport.Export() Catch err As Exception MessageBox.Show("DID NOT EXPORT") End Try Next MessageBox.Show("All PDF's exported succesfully") End If End SubSTEP 2: Private Sub Button3Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim row2 As DataRow Dim SHIPDATE123 As String SHIPDATE123 = _month & "/" & _day & "/" & year Dim db1 As String db1 = System.Configuration.ConfigurationSettings.AppSettings("Datalogin") Dim sqlCon As New SqlConnection sqlCon.ConnectionString = db1 Dim strsql2 As String strsql2 = "SELECT tblSOOrd_Hdr.BrokerCd, tblSys_Cust_Broker.BrokerName, tblSM_Ship_Hdr.ShipDate, tblSys_Cust_Broker.ContactEmail " strsql2 &= "FROM tblSO_Ord_Hdr INNER JOIN tblSM_Ship_Hdr ON tblSO_Ord_Hdr.Locale = tblSM_Ship_Hdr.Locale AND tblSO_Ord_Hdr.OrdNo = tblSM_Ship_Hdr.OrdNo AND " strsql2 &= " tblSO_Ord_Hdr.RlsNo = tblSM_Ship_Hdr.RlsNo INNER JOIN tblSys_Cust_Broker ON tblSO_Ord_Hdr.BrokerCd = tblSys_Cust_Broker.BrokerCd " strsql2 &= "GROUP BY tblSO_Ord_Hdr.BrokerCd, tblSM_Ship_Hdr.ShipDate, tblSys_Cust_Broker.ContactEmail, tblSys_Cust_Broker.BrokerName, tblSys_Cust_Broker.Email_ASN " strsql2 &= "HAVING (tblSM_Ship_Hdr.ShipDate = '" & SHIPDATE123 & "') AND (tblSys_Cust_Broker.Email_ASN = 1) AND (tblSys_Cust_Broker.ContactEmail <> '') " Dim da1 As New SqlDataAdapter(strsql2, sqlCon) Dim worktbl2 As DataTable worktbl2 = New DataTable("tblEmail12") da1.Fill(worktbl2) da1.FillSchema(worktbl2, SchemaType.Source) Dim brokerID As String Dim brokername As String Dim brokerEmail As String Dim shipdate As String If worktbl2.Rows.Count > 0 Then For Each row2 In worktbl2.Rows brokerID = CStr(row2("BrokerCd")).Trim brokername = CStr(row2("BrokerName")).Trim brokerEmail = CStr(row2("ContactEmail")).Trim shipdate = CStr(row2("ShipDate")).Trim Dim mail As New MailMessage Dim att As String att = "c:Test_Folder20" & _year & "-" & _month & "-" & _day & "" & brokername & ".pdf" 'set the addresses mail.From = New MailAddress("[email protected]") mail.To.Add(brokerEmail) mail.Attachments.Add(New Attachment(att)) 'set the content mail.Subject = "Shipment Tracking report from Knox Nursery for " & SHIPDATE123 mail.IsBodyHtml = True mail.Body = "
" mail.Body &= "This shipment update has been requested by:
" 'send the message Dim smtp As New SmtpClient smtp.Send(mail) ' MessageBox.Show("No Records Found", "Failed to send", MessageBoxButtons.OK, MessageBoxIcon.Stop Next Else MessageBox.Show("No broker have opted in", "No Emails Sent", MessageBoxButtons.OK, MessageBoxIcon.Information) End If MessageBox.Show("Emails sent... ", "Emails Sent", MessageBoxButtons.OK, MessageBoxIcon.Information) End Sub -
Spool no. data to PDF and then to mail
Hi all ,
My requirement is i have to display all the spool request no.'s for the particular user and from that user will select the particular spool no. . and that particular data has to convert into PDF and that PDF should go to mail id specified in selection screen.
now my prob. is when i am downloading the PDF on desktop it is opening with right data and when i am sending to mail id with the same internal table with PDF format , the file is corrupted and giving some error.
for ur reference here i am sending my code , please check and let me know .
thanks & regards,
Anil kumar .
TABLES: tsp01,
soextreci1.
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-020.
SELECT-OPTIONS : so_date1 FOR sy-datum OBLIGATORY,
so_time1 FOR sy-uzeit,
so_name1 FOR sy-uname,
so_splno FOR tsp01-rqident.
so_email FOR soextreci1-receiver OBLIGATORY.
PARAMETER : so_email TYPE soextreci1-receiver OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK b1.
DATA : l_addrnumber TYPE adr7-addrnumber,
l_persnumber TYPE adr7-persnumber,
l_mail TYPE adr6-smtp_addr.
DATA : BEGIN OF it_tsp01 OCCURS 0,
rqident TYPE tsp01-rqident,
rqowner TYPE tsp01-rqowner,
rqcretime TYPE tsp01-rqcretime,
rqclient TYPE tsp01-rqclient,
rqo1name TYPE tsp01-rqo1name,
END OF it_tsp01.
DATA : l_date_low TYPE char8,
l_date_high TYPE char8,
l_time_low TYPE char8,
l_time_high TYPE char8,
l_final_low TYPE char16,
l_final_high TYPE char16,
markfield VALUE ' '.
DATA : BEGIN OF l_final OCCURS 0,
sig TYPE c,
opt TYPE char2,
low TYPE char16,
high TYPE char16,
END OF l_final.
*PARAMETERS:
spoolno LIKE tsp01-rqident,
download AS CHECKBOX DEFAULT 'X',
DATA : p_file TYPE rlgrap-filename VALUE 'C:\temp\file.pdf'."#EC NOTEXT
DATA otf LIKE itcoo OCCURS 100 WITH HEADER LINE.
DATA cancel.
DATA pdf LIKE tline OCCURS 100 WITH HEADER LINE.
DATA it_pdf LIKE pdf OCCURS 0 WITH HEADER LINE.
DATA doctab LIKE docs OCCURS 1 WITH HEADER LINE.
DATA: numbytes TYPE i,
arc_idx LIKE toa_dara,
pdfspoolid LIKE tsp01-rqident,
jobname LIKE tbtcjob-jobname,
jobcount LIKE tbtcjob-jobcount,
is_otf.
DATA: client LIKE tst01-dclient,
name LIKE tst01-dname,
objtype LIKE rststype-type,
type LIKE rststype-type.
AT SELECTION-SCREEN OUTPUT.
SELECT SINGLE addrnumber
persnumber
FROM adr7
INTO (l_addrnumber,l_persnumber)
WHERE uname = sy-uname.
SELECT SINGLE smtp_addr
FROM adr6
INTO l_mail
WHERE addrnumber = l_addrnumber
AND persnumber = l_persnumber.
so_date1-sign = so_name1-sign = 'I'. "so_email-sign = 'I'.
so_date1-option = so_name1-option = 'BT'. "so_email-option = 'BT'.
so_date1-low = so_date1-high = sy-datum.
so_name1-low = so_name1-high = sy-uname.
so_email-low = so_email-high = l_mail.
APPEND : so_date1,so_name1.",so_email.
START-OF-SELECTION.
IF so_date1-low IS NOT INITIAL.
l_date_low = so_date1-low.
ENDIF.
IF so_date1-high IS NOT INITIAL.
l_date_high = so_date1-high.
ENDIF.
IF so_time1-low IS NOT INITIAL.
l_time_low = so_time1-low.
l_time_low+6(2) = '00'.
ENDIF.
IF so_time1-high IS NOT INITIAL.
l_time_high = so_time1-high.
l_time_high+6(2) = '00'.
ENDIF.
IF l_time_low IS NOT INITIAL.
CONCATENATE l_date_low l_time_low INTO l_final_low.
ELSE.
CONCATENATE l_date_low '00000000' INTO l_final_low.
ENDIF.
IF l_time_high IS NOT INITIAL .
IF so_date1-high IS NOT INITIAL.
CONCATENATE l_date_high l_time_high INTO l_final_high.
ENDIF.
ELSE.
CONCATENATE l_date_low '23595959' INTO l_final_high.
ENDIF.
l_final-sig = so_date1-sign.
l_final-opt = so_date1-option.
l_final-low = l_final_low.
l_final-high = l_final_high.
APPEND l_final.
CLEAR l_final.
SELECT rqident
rqowner
rqcretime
rqclient
rqo1name
FROM tsp01 INTO TABLE it_tsp01
WHERE rqcretime IN l_final
AND rqowner IN so_name1.
IF sy-subrc NE 0.
MESSAGE 'No data for the entered values' TYPE 'E'.
EXIT.
ENDIF.
CLEAR : so_name1,so_name1[],it_tsp01.
SORT it_tsp01 BY rqident.
LOOP AT it_tsp01.
WRITE : /1 sy-vline,
3 markfield AS CHECKBOX,
5(16) it_tsp01-rqident, 22 sy-vline,
23(10) it_tsp01-rqowner, 34 sy-vline,
35(16) it_tsp01-rqcretime, 52 sy-vline.
HIDE it_tsp01-rqident.
AT LAST.
WRITE : /1(52) sy-uline.
ENDAT.
ENDLOOP.
TOP-OF-PAGE.
WRITE: /1(52) sy-uline.
WRITE: /1 sy-vline,
5(16) 'Spool No.' COLOR COL_POSITIVE CENTERED , 22 sy-vline,
23(10) 'User' COLOR COL_POSITIVE CENTERED , 34 sy-vline,
35(16) 'Date' COLOR COL_POSITIVE CENTERED , 52 sy-vline.
WRITE: /1(52) sy-uline.
END-OF-SELECTION.
SET PF-STATUS '/BAY4/PDF'.
DATA : l_rqident TYPE tsp01-rqident,
l_count TYPE i VALUE '0'.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'PDF'.
CLEAR l_count.
DO.
CLEAR : markfield.
READ LINE sy-index FIELD VALUE markfield.
IF sy-subrc NE 0.
EXIT.
ENDIF.
CHECK markfield NE space.
IF l_count GT 0.
MESSAGE 'Please select only one check box' TYPE 'E'.
EXIT.
ENDIF.
l_rqident = it_tsp01-rqident.
l_count = l_count + 1.
ENDDO.
PERFORM get_pdf.
WHEN 'MAIL'.
CLEAR l_count.
DO.
CLEAR : markfield.
READ LINE sy-index FIELD VALUE markfield.
IF sy-subrc NE 0.
EXIT.
ENDIF.
CHECK markfield NE space.
IF l_count GT 0.
MESSAGE 'Please select only one check box' TYPE 'E'.
EXIT.
ENDIF.
l_rqident = it_tsp01-rqident.
l_count = l_count + 1.
ENDDO.
PERFORM get_pdf.
PERFORM send_mail.
ENDCASE.
*& Form get_pdf
text
--> p1 text
<-- p2 text
FORM get_pdf .
READ TABLE it_tsp01 WITH KEY rqident = l_rqident.
LOOP AT it_tsp01.
client = it_tsp01-rqclient.
name = it_tsp01-rqo1name.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = client
name = name
part = 1
IMPORTING
CHARCO =
CREATER =
CREDATE =
DELDATE =
MAX_CREDATE =
MAX_DELDATE =
NON_UNIQ =
NOOF_PARTS =
RECTYP =
SIZE =
STOTYP =
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4.
IF objtype(3) = 'OTF'.
is_otf = 'X'.
ELSE.
is_otf = space.
ENDIF.
IF is_otf = 'X'.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = l_rqident
no_dialog = ' '
DST_DEVICE =
PDF_DESTINATION =
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
OTF_PAGECOUNT =
btc_jobname = jobname
btc_jobcount = jobcount
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11.
ELSE.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = l_rqident
no_dialog = ' '
DST_DEVICE =
PDF_DESTINATION =
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
LIST_PAGECOUNT =
btc_jobname = jobname
btc_jobcount = jobcount
TABLES
pdf = pdf
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11.
ENDIF.
PERFORM download_w_ext(rstxpdft) TABLES pdf
USING p_file
'.pdf'
'BIN'
numbytes
cancel.
ENDFORM. " get_pdf
*& Form send_mail
text
--> p1 text
<-- p2 text
FORM send_mail .
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: PIT_ATTACH LIKE table of IT_ATTACH.
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.
DATA : 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.
DATA: a TYPE string,
t TYPE string.
a = 'FILE.PDF'.
t_object_header = a .
APPEND t_object_header.
DATA: p_email TYPE string.
CONSTANTS:
con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
con_cret TYPE c VALUE cl_abap_char_utilities=>cr_lf.
LOOP AT pdf.
TRANSLATE pdf USING ' ~'.
CONCATENATE pdf-tdformat pdf-tdline INTO it_attach SEPARATED BY space.
APPEND it_attach.
CLEAR : it_attach,pdf.
ENDLOOP.
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,
p_attdescription LIKE ld_attdescription,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
p_sender_address LIKE ld_sender_address,
ld_sender_address_type LIKE soextreci1-adr_typ,
p_sender_addres_type LIKE ld_sender_address_type,
ld_receiver LIKE sy-subrc.
RANGES : ld_email FOR somlreci1-receiver OCCURS 0.
ld_email[] = so_email[].
append ld_email.
ld_email = so_email.
ld_mtitle = 'PDF file for the Spool no'.
ld_format = 'pdf'.
ld_attfilename = 'filename'.
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 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
object_header = t_object_header
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.
SUBMIT rsconn01
WITH mode = 'INT'
WITH output = 'X'
AND
RETURN.
IF sy-subrc EQ 0.
MESSAGE 'PDF sent to specified mail id' TYPE 'I'.
LEAVE SCREEN.
ENDIF.Hi,
Try this program, it works for me perfectly:
REPORT Z_SENDFAX line-size 46 no standard page heading message-id so.
data g_list_content type solix_tab.
data g_text_content type soli_tab.
parameters:spool like sy-spono.
parameters:rec_fax type sadrfd-rec_fax.
parameters:title like sadrfd-rec_title.
parameters:name1 like sadrfd-rec_name1.
parameters:cover type c.
PARAMETERS: Zvbeln LIKE likp-vbeln.
start-of-selection.
perform create_text_content changing g_text_content.
perform create_list_content changing g_list_content.
perform send using g_text_content
g_list_content.
*& Form create_list_content
form create_list_content changing list_content type solix_tab.
perform get_list_from_spool changing list_content.
endform."create_list_content''
*& Form create_text_content''
form create_text_content changing text_content type soli_tab.
data:z_lin(200) type c.
append 'To,' to text_content.
concatenate 'To:' name1 into z_lin separated by space.
append z_lin to text_content.
concatenate 'End of delivery Notice for ' Zvbeln
into z_lin separated by space.
append z_lin to text_content.
convert the content from RAW to TXT''
CALL FUNCTION 'SO_RAW_TO_RTF'
TABLES
objcont_old = text_content
objcont_new = text_content
EXCEPTIONS
others = 0.
endform."create_text_content''
*& Form SEND''
Create the list-document and send it via FAX, Mail and RML''
form send using text_content type soli_tab
list_content type solix_tab.
data:z_lin(200) type c.
structures and internal tables for the send data''
data document_data type sodocchgi1.
data packing_list type table of sopcklsti1.
data receivers type table of somlreci1.
data contents_txt type soli_tab.
data contents_hex type solix_tab.
data packlist_wa type sopcklsti1.
data receiver_wa type somlreci1.
data packlist_counter type i.
data sent_to_all type sonv-flag.
data msg_ex(200) type c.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
main document''
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
document data contains information for the whole message''
document_data-obj_descr = 'Miscellaneous Delivery Notice'.
some text for the main document''
append 'Hi,' name1 to contents_txt.
concatenate 'To:' name1 into z_lin separated by space.
append z_lin to contents_txt.
concatenate 'Attached you will find the Delivery Notice for ' Zvbeln
into msg_ex separated by space.
append msg_ex to contents_txt.
append 'Attached you will find the Delivery Notice for ' Zvbeln to contents_txt.
packlist_counter = 1.
perform create_packlist_entry using contents_txt
'RAW'
changing packlist_wa
packlist_counter.
append packlist_wa to packing_list.
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
add a text attachment of type TXT''
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
perform create_packlist_entry using text_content
'TXT'
changing packlist_wa
packlist_counter.
append packlist_wa to packing_list.
append lines of text_content to contents_txt.
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
add the list attachment of type ALI''
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
packlist_counter = 1."because we will fill the hex table now''
perform create_packlist_entry using list_content
'ALI'
changing packlist_wa
packlist_counter.
append packlist_wa to packing_list.
append lines of list_content to contents_hex.
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
fill recipients tables''
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
perform create_fax_recipient changing receiver_wa.
append receiver_wa to receivers.
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
Send the document by calling the API1''
as of 6.10 either the flag 'commit_work' has to be set''
or a commit work statement has to be set somewhere after the call''
Sending won't work without this!''
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = document_data
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = sent_to_all
TABLES
packing_list = packing_list
contents_txt = contents_txt
contents_hex = contents_hex
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.
case sy-subrc.
when 0.
if sent_to_all is initial.
read table receivers index 1 into receiver_wa.
message i865 with receiver_wa-retrn_code.
else.
message s022.
endif.
when 1.
message i552.
when 2.
message i023 with document_data-obj_descr.
when 4.
message i471.
when others.
message i619.
endcase.
endform." SEND''
*& Form USE_SUBMIT''
<nowiki>* Use "submit <report> exporting list to memory"
form use_submit changing contents_hex type solix_tab.
data listobject type table of abaplist.
get the list object by calling the list in another report
F1 on submit gives more information
submit balvsd03 exporting list to memory and return.
import the list from memory and store it in table listobject
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
not_found = 1
others = 2.
if sy-subrc <> 0.
message e105 with 'LIST_FROM_MEMORY'.
endif.
free memory
CALL FUNCTION 'LIST_FREE_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
others = 1.
if sy-subrc <> 0.
message e105 with 'LIST_FREE_MEMORY'.
endif.
it's always necessary to compress the table.
SAPconnect will decompress it
CALL FUNCTION 'TABLE_COMPRESS'
TABLES
in = listobject
out = contents_hex
EXCEPTIONS
compress_error = 1
others = 2.
if sy-subrc <> 0.
message e105 with 'TABLE_COMPRESS'.
endif.
endform." USE_SUBMIT
*& Form WRITE_A_LIST
Create a new list within this report.
form write_a_list changing contents_hex type solix_tab.
data listobject type table of abaplist.
perform write_list.
Save the list and store table listobject
CALL FUNCTION 'SAVE_LIST'
EXPORTING
list_index = sy-lsind
TABLES
listobject = listobject
EXCEPTIONS
list_index_invalid = 1.
if sy-subrc = 1.
message e105 with 'SAVE_LIST'.
endif.
It's always necessary to compress the table
SAPconnect will decompress it
CALL FUNCTION 'TABLE_COMPRESS'
TABLES
in = listobject
out = contents_hex
EXCEPTIONS
compress_error = 1
others = 2.
if sy-subrc <> 0.
message e105 with 'TABLE_COMPRESS'.
endif.
endform." WRITE_A_LIST
*& Form GET_LIST_FROM_SPOOL
Get list from spool
form get_list_from_spool changing contents_hex type solix_tab.
data spool_number type rspoid.
data contents_bin type soli_tab.
data print_parameters type pri_params.
data valid type c.
write a list into spool
CALL FUNCTION 'GET_PRINT_PARAMETERS'
IMPORTING
out_parameters = print_parameters
valid = valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
others = 4.
if sy-subrc <> 0.
message e105 with 'GET_PRINT_PARAMETERS'.
elseif valid is initial.
return.
endif.
new-page print on parameters print_parameters no dialog.
perform write_list.
new-page print off.
spool_number = spool.
DATA:REAL_TYPE LIKE SOODK-OBJTP.
DATA:BUFFER_PDF LIKE TLINE OCCURS 0 WITH HEADER LINE.
you can also send OTF documents from spool with this function
module. The importing parameter real_type gives you the doc type
that you have to give to the send interface. The parameter is not
used here
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = spool_number
desired_type = 'RAW'
IMPORTING
REAL_TYPE = REAL_TYPE
TABLES
buffer = contents_bin
BUFFER_PDF = BUFFER_PDF
EXCEPTIONS
no_such_job = 1
job_contains_no_data = 2
selection_empty = 3
no_permission = 4
can_not_access = 5
read_error = 6
type_no_match = 7
others = 8.
*clear contents_bin[].
if sy-subrc <> 0.
message e105 with 'RSPO_RETURN_SPOOLJOB'.
endif.
CALL FUNCTION 'SO_RAW_TO_RTF'
TABLES
objcont_old = contents_bin
objcont_new = contents_bin
EXCEPTIONS
others = 0.
data:TRANSFER_BIN TYPE SX_BOOLEAN." occurs 0.
data:CONTENT_BIN TYPE SOLIX_TAB." occurs 0.
data:OBJHEAD TYPE SOLI_TAB.
data:LEN TYPE SO_OBJ_LEN.
*len = '255'.
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PRT'
EXPORTING
FORMAT_SRC = 'OTF'
FORMAT_DST = 'PRT'
devtype = 'POSTSCPT'
CHANGING
TRANSFER_BIN = TRANSFER_BIN
CONTENT_TXT = contents_bin
CONTENT_BIN = contents_hex
OBJHEAD = OBJHEAD
LEN = len.
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
FORMAT_SRC = 'OTF'
FORMAT_DST = 'PDF'
devtype = 'PRINTER'
CHANGING
TRANSFER_BIN = TRANSFER_BIN
CONTENT_TXT = contents_bin
CONTENT_BIN = contents_hex
OBJHEAD = OBJHEAD
LEN = len.
convert to hex table
CALL FUNCTION 'SO_SOLITAB_TO_SOLIXTAB'
EXPORTING
ip_solitab = CONTENT_BIN
IMPORTING
ep_solixtab = contents_hex.
endform." GET_LIST_FROM_SPOOL
*& Form WRITE_LIST
Write a list of SAPconnect conversion rules
form write_list.
data lt_scarr type table of scarr.
data carr type scarr.
select * from scarr into table lt_scarr.
format color = 1.
uline at /1(46).
write: / sy-vline,
'CARRID', 10 sy-vline,
'CARRNAME', 35 sy-vline,
'CURRCODE', 46 sy-vline.
format color = 2.
uline at /1(46).
loop at lt_scarr into carr.
write: / sy-vline,
carr-carrid, 10 sy-vline,
carr-carrname, 35 sy-vline,
carr-currcode, 46 sy-vline.
endloop.
uline at /1(46).
new-line.
endform." WRITE_LIST
*& Form create_packlist_entry
text
form create_packlist_entry using contents type standard table
format type so_obj_tp
changing packlist_wa type sopcklsti1
packlist_counter type i.
data tab_lines type i.
clear packlist_wa.
DATA FORM2 TYPE so_obj_tp.
get the table length of the attachment
describe table contents lines tab_lines.
set binary flag for binary content to mark that this packlist entry
is meant for table contents_hex and not for contents_bin
FORM2 = FORMAT.
if format = 'ALI'.
FORM2 = 'PRT'.
FORM2 = 'PDF'.
packlist_wa-transf_bin = 'X'.
endif.
attchment's description and format
concatenate form2 'Document' into
packlist_wa-obj_descr separated by space.
packlist_wa-doc_type = form2.
describe start and length in contents_txt or contents_hex
which table is meant is decided by the transf_bin flag set above
packlist_wa-body_start = packlist_counter.
packlist_wa-body_num = tab_lines.
increase counter to have the starting line for the next attachment
packlist_counter = packlist_counter + tab_lines.
endform." create_packlist_entry
*& Form create_int_recipient
text
*form create_int_recipient changing receiver type somlreci1.
field-symbols <receiver> type c.
data recipient_int type sadrud.
clear receiver.
fill address type specific recipient structure
cast structure to generic receiver field
assign recipient_int to <receiver> casting.
receiver-receiver = <receiver>.
set address type for INT
receiver-rec_type = 'U'.
*endform."create_int_recipient
*& Form create_fax_recipient
text
form create_fax_recipient changing receiver type somlreci1.
field-symbols <receiver> type c.
data recipient_fax type sadrfd.
data name type soud3.
clear receiver.
name-sapnam = sy-uname.
CALL FUNCTION 'SO_NAME_CONVERT'
EXPORTING
name_in = name
IMPORTING
name_out = name
EXCEPTIONS
others = 1.
if sy-subrc <> 0.
name-adrname = sy-uname.
endif.
fill address type specific recipient structure
recipient_fax-rec_fax = rec_fax."'7152414031'.
recipient_fax-rec_state = 'US'.
recipient_fax-rec_title = title."'Mr.'.
recipient_fax-rec_name1 = name1."'Ytamar Fondeur'.
recipient_fax-send_nam = name-adrname.
recipient_fax-send_cover = cover.
recipient_fax-FORM_LANGU = sy-langu.
cast structure to generic receiver field
assign recipient_fax to <receiver> casting.
receiver-receiver = <receiver>.
set address type for FAX
receiver-rec_type = 'F'.
endform."create_fax_recipient
*& Form create_rml_recipient
text
form create_rml_recipient changing receiver type somlreci1.
field-symbols <receiver> type c.
data recipient_rml type sadr7d.
clear receiver.
fill address type specific recipient structure
recipient_rml-sdest = 'C11'.
recipient_rml-umand = '001'.
recipient_rml-uname = 'MYUSER'.
cast structure to generic receiver field
assign recipient_rml to <receiver> casting.
receiver-receiver = <receiver>.
set address type for RML
receiver-rec_type = 'R'.
endform."create_rml_recipient -
Require PDF File attachment in Mail
Hi Experts,
I am doing the Proxy-XI-Mail scenario. I am sending the Mail related data like Content, Content_Type from R/3 to XI and configured the Mail receiver adapter.
R/3 coding:-
G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-CONTENT_TYPE = 'application/pdf;name="filename.pdf"'
G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-CONTENT = G_CONTENT
G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-FROM = From_Mail.
G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-TO = To_Mail.
and then calling the client proxy
ID Mail Receiver configu:-
Selected Use Mail Package option
Content encoding base64
Keep attachment option is also selected.
I am geeting the Filename.pdf in mail as attachment.
Problem is:- I am not able to open the attached PDF File and error is:- 'Adobe Reader could not open filename,pdf because it is either not a supported file type ot because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded'
I think some conversions may be required to convert the XML Payload data into PDF file format for the Mail receiver adapter.
Please suggest
Thanks & Regards
JageshHi Jagesh,
The content type of the Pdf has to be identified, in order to conver the pdf successfully, You need to perform the conversion usign the PayloadSwapBean the Module tab. You use this when you want to receive attachment using Mail adapter. You need to configure few steps in Module Configuration
There you need to mention your MIME header paramenters Content-Type, Content-Description.
How this can be configured and how process with PayloadSwapBean check the below link
http://help.sap.com/saphelp_nw04/helpdata/en/2e/bf37423cf7ab04e10000000a1550b0/frameset.htm
Module Processor
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/cd/5af7c0c994e24fb0d0088443513de2/content.htm
Regading MessageTransformBean, Migrating Dispatcher Classes
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/57/0b2c4142aef623e10000000a155106/frameset.htm
Regards,
Prasanna -
Creating pdf and attaching to email
Hello,
I am trying to write a script to help manual work and am stuck at below point:
When click save in SAP I get pdf document generated (nhremote). What I would like to do is to somehow automatically save it on my drive and attach it in the new email that is generated after each save.
Script end:
'session.findById("wnd[1]/usr/btnSPOP-VAROPTION1").press - SAVING the changes and pdf is generated at this point. takes some time to popup.
'Set MyApp = CreateObject("Outlook.Application")
'Set MyItem = MyApp.CreateItem(0) 'olMailItem
'With MyItem
'.To = "[email protected]"
'.Subject = "Subject"
'.ReadReceiptRequested = False
'.HTMLBody = RDD
'End With
'MyItem.Display
is there any way I can put action to save and attach saved file to the email? Also please keep in mind that the script is looped and it does this for many documents. Since NHREMOTE to generate pdf usually takes sometime and is a popup window I'm afraid it can be very complicated and mess up easily.Hello Gediminas,
try this:
'-Begin-----------------------------------------------------------------
'-Directives----------------------------------------------------------
Option Explicit
'-Variables-----------------------------------------------------------
Dim application, SapGuiAuto, connection, session, RepName
Dim WScr, MyApp, MyItem, FileName
'-Main----------------------------------------------------------------
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(1)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject application, "on"
End If
Set WScr = CreateObject("WScript.Shell")
If IsObject(WScr) Then
RepName = "PROGDELE"
FileName = "C:\Schnell\Dummy\" & RepName & ".pdf"
session.findById("wnd[0]/tbar[0]/okcd").text = "/nSE38"
session.findById("wnd[0]/tbar[0]/btn[0]").press
session.findById("wnd[0]/usr/ctxtRS38M-PROGRAMM").text = RepName
session.findById("wnd[0]/usr/btnSHOP").press
WScript.Sleep 500
WScr.AppActivate "ABAP Editor: Report " & RepName & " anzeigen"
WScript.Sleep 2000
session.findById("wnd[0]/usr/cntlEDITOR/shellcont/shell").SetFocus()
WScr.SendKeys "+{F5}" 'Customize Shift+F5 to File.ExportPDF
WScript.Sleep 250
wscr.SendKeys FileName
WScript.Sleep 250
wscr.SendKeys "{ENTER}"
WScript.Sleep 1000
Set MyApp = CreateObject("Outlook.Application")
If IsObject(MyApp) Then
Set MyItem = MyApp.CreateItem(0)
With MyItem
.To = "[email protected]"
.Subject = "Subject"
.ReadReceiptRequested = False
.Body = "Here comes the file"
.Attachments.Add FileName
End With
MyItem.Display
'MyItem.Send
Set MyItem = Nothing
Set MyApp = Nothing
End If
Set WScr = Nothing
End If
'-End-------------------------------------------------------------------
This script starts the TAC SE38 and loads the Report PROGDELE. It exports the report as PDF and sends the PDF file via e-mail to hugo.bambi.
All you have to do, to try this script, is to customize your SE38 view, that the shortcut Shift+F5 ist set to File.ExportPDF.
You see, it is possible to save a PDF from SAP and to send it as e-mail attachment . Also you see it is possible to handle SAP dialog windows. And it should be not a great problem to do this steps in loop for more than one document.
Let us know your result.
Cheers
Stefan -
To upload pdf and ms word document in VA01 header menu -TEXT tab
I want to upload local file (PDF and Word) in R/3-VA01-Text Header..
Can any one tell me the solution for that.Can any body tell me how search text in PDF
and MS Word document through Java code, any
body has code or any suggestion to giveYes.
First, you need to work out how to read each document type from Java.
E.g, for MS Word you could use Apache Jakarta POI - HWPF: http://jakarta.apache.org/poi/hwpf/index.html
Then, you use Apache Lucene to index and search.
See http://lucene.apache.org/java/docs/index.html
~D -
Creating or opening and attachment in Mail freezes the Dock
On my MBP, when opening or creating an attachment in Mail, the Dock becomes frozen.
Clicking on it has no effect and the white dot remains on Apps that have closed; it is totally frozen. (It acts like a picture of the Dock>)
Restarting clears it.
Sometimes, but not always, Logging out and back in clears it.
I reapplied the SL updater, this time starting up from the upgrade disk.
I have repaired permissions and run Preferential Treatment to look for corrupted preferences, no problem identified.HI Chris,
Quit Mail if it's open
Try dragging your Mail icon up off the Dock. It will go "poof" ... then open your Applications folder and launch Mail. If the Dock isn't cooperating, select the Mail icon and click: Keep in Dock.
If that doesn't work... even though you used PT, locate this file.
com.apple.Dock.plist
/Users/YourName/Library/Preferences. Drag that file from the Preferences folder to the Trash, empty the Trash and restart your Mac.
Carolyn
Message was edited by: Carolyn Samit -
PDF flyer with attached Data Form how do i upload pdf and submit data simultaneously?
Scenerio user downloads pdf flyer template with attached data form. user customizes flyer and fills out form. user clicks on custom "Submit" button to send form data to php form.
On submit, how can i upload the pdf flyer to our server AND still send the form data to php form?
maybe the local file(pdf) address is sent to the php form along with the form data, then i can use php to upload the file automatically.
any sugguestion???Hi Mr AP,
are you trying to do this in Reader or in Acrobat? If you're using Reader it won't work unless the form is reader-extended by either LC Reader Extensions on the server or by running it through Acrobat manually and extend the capabilities of the form for reader users (careful - the license of the latter is limited to 500 form recipients).
If you did try it in Reader with a non-extended form the behaviour you'd see is that it just won't work, so that might be your issue.
Cheers
Kai -
Hi all ,
My requirement is to upload a PDF file from desktop and mail that to some address ... how this can be achieved ...
Thanks in advance ,
Ganeshuse GUI_UPLOAD and upload the pdf to internal table and then use below f.m to covert it to 255 character
CALL FUNCTION 'QCE1_CONVERT'
TABLES
t_source_tab = i_tline
t_target_tab = so_ali[]
EXCEPTIONS
convert_not_possible = 1
OTHERS = 2.
then use below f.m to send mail..
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = objpack
contents_txt = objtxt[]
contents_bin = so_ali[]
*contents_hex = so_ali[]
receivers = reclist[]
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.
PERFORM mail.
MESSAGE 'Mail sent successfully' TYPE 'S'.
*SUBMIT RSCONN01 WITH MODE = MODE.
ENDIF. -
Converting spool to PDF and attaching in a mail
Hi ,
My requirement is I have to execute my program in background and the spool created should be sent to the user as an email attachment. Please help.
Moderator message: FAQ, please (re)search and try yourself before asking.
Edited by: Thomas Zloch on Jul 12, 2010 2:54 PMHi Sunanda,
You can schedule your program in background in SM36 Tcode. If you goto SM36, you can find one button 'Spool list recipient'. If you click that button, you can give the Recipient ID there.
Once the job is finished and spool is generated, that spool will be sent as an attachment to the recipient.
you can give external email address as well. (Press F4 in Recipient box).
Thanks,
J. -
Plain text and attachment in Mail Adapter (Receiver)
Hello,
we have to generate a mail in the mail-adapter with a specific text and an attachment.
The attachment is a document in pdf-format, that is generated inside an adapter-module out of the payload-document.
An additional text has to be added to the mail for the receiver in plain-text-format, like "Dear customer ... enclosed you will find ...".
Is it possible to mix plain-text and attachments in the mail adapter? Does anybody know how we can do that?
Regards,
ThorstenHi,
yes you can do it very easily inside the adapter module
if you're already using the adapter module then
you can just enhance it a little bit
you can add the pdf to the attachment section and
leave dear customer in the standard payload
you can even make it a little bit more dynamic
and create a module that will take the input from
the communication channel config (modules tab) - for example xml tag name in which you will specify
the dear customer (or any other text) and after this
the pdf creating can use the xml without this tag...
Regards,
michal
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions">XI FAQ - Frequently Asked Questions</a>
Maybe you are looking for
-
Interactive Crystal Report - (Opening another crystal report)
Hello Friends, I have crystal report designed using SAP Bex Query. This report shows multiple Key Figure on report. I would like to add fature that double click on each of key figure, should open another report {may be subreport} and values get
-
hello there, i am using labview's first call function inside a for loop, inside a sequence structure. inside the for loop the function works fine activating a true/false structure, however, when i attempt to do the same thing outside the for loop i g
-
Hello forum, I know - I am back again. But I am having all kinds of issues developing this ADF BC create form. Given the following scenario, can somebody please explain how he/she would set out to create the following ADF create form? You a have a db
-
How do i redownload a song i bought off the Music Store?
my osng is corrupted and it wont let me put it on my iPod because it gives me a -69 error. anyway, i want to know how to re download the song. it plays fine until the end when it starts to make my computer go really slow.
-
I accidentally deleted my service book entries on my BB Pearl 8100. How can I have them back?