Invoice . PDF to customet by mail
Hi Gurus,
My requirement is to send the invoices in .PDF format during saving of invoice to customers automatically .
What settings need to be done .
Thanks
Hi,
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
Similar Messages
-
Can not open all .pdf files in Yahoo Mail.
Three computers using Windows XP and Internet Explorer can open all .pdf files in Yahoo
Mail. The fourth and newest Computer with XP Pro, Internet Explorer, and the latest Adobe
Reader can only open some, but not all, .pdf files in Yahoo Mail. Nothing happens when
the window is clicked to open file. How can this be fixed?Adobe Reader isn't my favorite, but neither are smug and uninformed assertions about Preview. There are PDFs that render only squares and marks under Preview (http://apple.stackexchange.com/questions/24209/this-pdf-displays-with-question-m arks-instead-of-letters), which is a common problem in MS Windows Office generated PDFs, so you may actually need Adobe Reader for Mac.
If you need to use Adobe Reader (as I do), then it may depend on the filesystem type where you save your PDF. For example, our Macs are network homed. Saving to desktop produced the error reported above no matter whether I used Safari:Save As, or the PDF save icon.
However, when I saved to a local drive (such as /tmp), then it worked. I don't know why file system makes a difference, unless Adobe is doing something with extended attributes that doesn't get written correctly to some filesystems.
Hope this helps. -
Facing problem with logo in the PDF attachment when sending mail...
hi friends,
i'm facing problem with logo in the PDF attachment to the mail.
my requirement:
1. enter spool number and mail id in the selection screen.
process:
1. now the program will fetch the spool data and converts it to PDF.
2. but when i'm trying to send mail with this PDF as attachment.
when i open the PDF file from the mail, logo is not coming properly (looks disturbed).
can anyone help me how to resolve this issue...
thanks in advance, murashali.hi dinakar, thanks for your mail...
logo looks good in spool/script/smartform.
even it look good when i download this spool to pdf and to the presentation server as pdf file.
i'm using CONVERT_OTFSPOOLJOB_2_PDF.
when i used CONVERT_ABAPSPOOLJOB_2_PDF, is gives a msg - 'spool number not found'.
here i'm using folloing code to pass pdf to the function module: SO_NEW_DOCUMENT_ATT_SEND_API1.
code:
Transfer the 132-long strings to 255-long strings
lt_mtab_pdf[] = pdf[].
LOOP AT lt_mtab_pdf INTO lwa_mtab_pdf.
TRANSLATE lwa_mtab_pdf USING ' ~'.
CONCATENATE lv_gd_buffer lwa_mtab_pdf INTO lv_gd_buffer.
CLEAR lwa_mtab_pdf.
ENDLOOP.
TRANSLATE lv_gd_buffer USING '~ '.
DO.
lwa_mess_att = lv_gd_buffer.
APPEND lwa_mess_att TO lt_mess_att.
CLEAR lwa_mess_att.
SHIFT lv_gd_buffer LEFT BY 255 PLACES.
IF lv_gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
NOTE: problem i believe is with ''. i'm getting this tilt symbol () in my pdf internal table. here in the above code the line TRANSLATE lv_gd_buffer USING '~ ' is changing the existing tilt to space. so my logo is getting disturbed.
even i tried with REPLACE this tilt with other char, but it doent work.
can you give any idea... -
Smartform to convert as pdf attachment and sending mail.
Program to convert smartform as PDF and send PDF as an atachment to email id.
********Variable Declarations ****************************
DATA: gv_form_name TYPE rs38l_fnam, " Used to store the function module generated by Smartform
gv_bin_filesize TYPE i, " Store the file size
gv_pos TYPE i,
gv_len TYPE i,
gv_tab_lines TYPE i.
*******Constants ******************************************
DATA : gc_text(11) TYPE c VALUE 'Form Output',
gc_tst(3) TYPE c VALUE 'TST',
gc_testing(7) TYPE c VALUE 'Testing'.
CONSTANTS : c_formname TYPE tdsfname VALUE 'ZSMART_T'. "Zsmart_t is the smartform name.
********Work Area Declarations ****************************
DATA: gs_docdata TYPE sodocchgi1, " Data of an object which can be changed
gs_ctrlop TYPE ssfctrlop, " Smart Forms: Control structure
gs_outopt TYPE ssfcompop, " SAP Smart Forms: Smart Composer (transfer) options
gs_otfdata TYPE ssfcrescl, " Smart Forms: Return value at end of form printing
gs_reclist TYPE somlreci1, " SAPoffice: Structure of the API Recipient List
gs_pdf_tab TYPE tline, " Workarea for SAP Script Text Lines
gs_objbin TYPE solisti1, " SAPoffice: Single List with Column Length 255
gs_objpack TYPE sopcklsti1. " SAPoffice: Description of Imported Object Components
********Internal tables Declarations ****************************
DATA: gt_reclist TYPE TABLE OF somlreci1, " SAPoffice: Structure of the API Recipient List
gt_pdf_tab TYPE TABLE OF tline, " SAPscript: Text Lines
gt_otf TYPE TABLE OF itcoo, " OTF Structure
gt_objbin TYPE TABLE OF solisti1, " SAPoffice: Single List with Column Length 255
gt_objpack TYPE TABLE OF sopcklsti1. " SAPoffice: Description of Imported Object Components
DATA: customer TYPE scustom,
bookings TYPE ty_bookings,
connections TYPE ty_connections.
CLEAR : gv_form_name,
gs_ctrlop,
gs_outopt,
gs_otfdata,
gv_bin_filesize,
gv_pos,
gv_len,
gv_tab_lines.
START-OF-SELECTION.
Generate Function Module name
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = c_formname
IMPORTING
fm_name = gv_form_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Assigning values to Form Control Structure and Form Composer
gs_ctrlop-getotf = 'X'.
gs_ctrlop-device = 'PRINTER'.
gs_ctrlop-preview = ''.
gs_ctrlop-no_dialog = 'X'.
gs_outopt-tddest = 'LP01'. "or 'LOCL'.
Getting the OTFDATA
CALL FUNCTION gv_form_name
EXPORTING
control_parameters = gs_ctrlop
output_options = gs_outopt
user_settings = ' '
customer = customer
bookings = bookings
connections = connections
IMPORTING
job_output_info = gs_otfdata
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Assigning the OTFDATA to OTF Structure table
CLEAR gt_otf.
gt_otf[] = gs_otfdata-otfdata[].
Convert the OTF DATA to SAP Script Text lines
CLEAR gt_pdf_tab.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = gv_bin_filesize
TABLES
otf = gt_otf
lines = gt_pdf_tab
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Assigning the Description of the object sent in the mail
CLEAR gs_docdata.
gs_docdata-obj_name = gc_tst.
gs_docdata-obj_descr = gc_testing.
Assigning the email id to Structure of the API Recipient List table
CLEAR : gt_reclist, gs_reclist.
IF internal mail id
gs_reclist-receiver = sy-uname.
GS_RECLIST-REC_TYPE = 'B'.
if external mail id
gs_reclist-receiver = mailid.com'.
gs_reclist-rec_type = 'U'.
APPEND gs_reclist TO gt_reclist.
Passing the SAP Script text lines to SAPoffice: Single List with Column Length 255 table
CLEAR : gs_objbin, gs_pdf_tab.
LOOP AT gt_pdf_tab INTO gs_pdf_tab.
gv_pos = 255 - gv_len.
IF gv_pos > 134. "length of pdf_table
gv_pos = 134.
ENDIF.
gs_objbin+gv_len = gs_pdf_tab(gv_pos).
gv_len = gv_len + gv_pos.
IF gv_len = 255. "length of out (contents_bin)
APPEND gs_objbin TO gt_objbin.
CLEAR: gs_objbin, gv_len.
IF gv_pos < 134.
gs_objbin = gs_pdf_tab+gv_pos.
gv_len = 134 - gv_pos.
ENDIF.
ENDIF.
ENDLOOP.
IF gv_len > 0.
APPEND gs_objbin TO gt_objbin.
ENDIF.
Filling the details in SAPoffice: Description of Imported Object Components table
DESCRIBE TABLE gt_objbin LINES gv_tab_lines.
CLEAR gs_objbin.
READ TABLE gt_objbin INTO gs_objbin INDEX gv_tab_lines.
IF sy-subrc = 0.
gs_objpack-doc_size = ( gv_tab_lines - 1 ) * 255 + STRLEN( gs_objbin ).
gs_objpack-transf_bin = 'X'.
gs_objpack-head_start = 1.
gs_objpack-head_num = 0.
gs_objpack-body_start = 1.
gs_objpack-body_num = gv_tab_lines.
gs_objpack-doc_type = 'PDF'.
gs_objpack-obj_name = 'ATTACHMENT'.
gs_objpack-obj_descr = 'test'.
APPEND gs_objpack TO gt_objpack.
ENDIF.
Sending the Form Output in the PDF format to email
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = gs_docdata
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = gt_objpack
contents_bin = gt_objbin
receivers = gt_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.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
WRITE 'Sent Successfully'.
ENDIF.
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
END-OF-SELECTION.Hi
Use function modules
CALL FUNCTION 'CONVERT_OTF'
and CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE' to convert as a pdf document
for sending mail CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
Regards,
Gopi -
Is there a way to create a PDF from outlook e-mail that does not embed the attachment? better, is there a way to convert the e-mail with attachement (not embeded) as pdf pages?
- Problem: I have 1400 e-mails with attachments that need to be converted into pdf and the attachments cannot be embeded.
System: PC Windows 7 using Acrobat X Prof. - Thank you!Hi ,
There is an option of embedding index for faster search while converting email to a PDF .
However I am not sure that will serve your purpose or not .
I would recommend you to get in touch with Microsoft support as well .
Meanwhile I'll work on it and get back to you in case I get a desired solution .
Regards
Sukrit Dhingra -
How to open a pdf attachment in imac mail
I am unable to open a PDF attachment in Mac Mail. There is not a PDF Icon in the email message. Is there a setting that should be checked?
I have a new iMac (less than a month old) with Mountain Lion.
Help would be greatly appreciated. ThanksIt is an actual PDF that is an attachment to an email. There is not a link to click on to open the attachment.
The attachment is a statement that I normally open, then print..
What I am seeing on the monitor is the heading portion of the email with the statement image, all on one page..It prints exactly as seen on the screen.
I have checked my Mail>Preferences>Viewing Tab."Display remote images in HTML" messages is checked..
Thanks for the help. -
Reading an PDF Attachment From Sender Mail Adapter
Hi All,
i am able to get a mail from my Mail Server, But my aim is need to Read an PDF attachment from the mail, in SXMB Moni i am getting the Payload with attachment, I have a created a module to convert that PDF to XML(Module is working fine in file to file sceneraio) .
In adapter should i need to use Payload Swap Bean Module also , because in sap help said that i need Select Keep Attachments. I want to know how that how to Push the PDF attachment to My Custom Module which is used to convert the PDF To XML.
If Payload Swap Bean Module needs to be Used , please tell me the Key Names and Key Values to be used.(swap.keyName,swap.keyValues)
Thanks and Regards,
Kamal
Note: Points will be awardedKamal...
See if this helps
[Module Name]
AF_Modules/PayloadSwapBean
[Module Parameters]
The following parameters are used for this module
swap.keyName the name of a supported attribute.
swap.keyValue the value of a partial string that is required
to appear.
The supported attributes (swap.keyName) include the payload attributes
such as payload-name, payload-description and any content attributes
such as content-type, content-disposition, content-description, etc.
Regards
Ravi Raman -
I cannot open a .pdf in an incoming mail (Outlook 2010) with Acrobat Pro XI. It will only allow "preview". I have to copy and paste the .pdf to my desktop and then open it. What do I do to restore the 2x click in Outlook to open the .pdf? As of now, I get the following bracket opening on screen when I click on the Acrobat icon for attachment within the email: Thank you
Adobe Acrobat has stopped working
Windows can check online for a solution to the problem.
-Check online for a solution and close the program
-Close the program
Problem signature:
Problem Event Name: APPCRASH
Application Name: Acrobat.exe
Application Version: 11.0.7.79
Application Timestamp: 536b812b
Fault Module Name: Acrobat.dll
Fault Module Version: 11.0.7.79
Fault Module Timestamp: 536b80ff
Exception Code: c0000005
Exception Offset: 00cbf281
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.txtHi Gary,
I have seen this issue occur with users who have this registry setting missing or have improper permissions.
When you double click the attachment to launch the pdf it is saved and opened from the temporary folder unless saved specifically to a location.
If you dont have the below mentioned registry key or improper permissions then attachments fail to open.
Please heck if the following reg key exists:
HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Security
or
HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\14.0\Outlook\Security
Value Name: OutlookSecureTempFolder
If the value exists, and if the value contains a valid path, Outlook 2010 uses that location for its temporary files.
If the registry value does not exist, or if the value points to an invalid location, Outlook 2010, Outlook 2007, or Outlook 2003 creates a new subdirectory under the Temporary Internet Files directory and then puts the temporary file in the new subdirectory. The name of the new subdirectory is unknown and is randomly generated, depending on your version of Outlook.
Please check the following key:
HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Security
Note the location for: OutlookSecureTempFolder key
Check if the same folder exists in the following location and if not create a corresponding folder in the location on C:\Users\<User account name>\Appdata\Local\Software\Microsoft\Windows\......
Regards,
Rave -
How to send a Script as a PDF file to an mail with out saving in local PC
HI Gurus,
I Know it for locla PC. i HAve converted the spool to pdf using CONVERT_ABAPSPOOLJOB_2_PDF and mailed using 'SO_DOCUMENT_SEND_API1'.
Give me teh alternative.
like storing in app serverHI Gurus,
I Know it for locla PC. i HAve converted the spool to pdf using CONVERT_ABAPSPOOLJOB_2_PDF and mailed using 'SO_DOCUMENT_SEND_API1'.
Give me teh alternative.
like storing in app server -
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 -
Some pdf attachments missing in mail 5.2
I fail to receive pdf attachments intermittently using Mail 5.2 running OS X 10.7.3 (Lion). When the attachments do not arrive, I see no paperclip in the attachments column. On a recent occasion, a colleague sent me three consecutive emails, each with 1-2 pdf files attached. The middle one (containing one pdf), shows no attachment in Mail. However, I know the attachment is there, because if I open it on my iPhone, I see the attachment. What's more, if I forward the email to myself from the iPhone, I can now see the attachment again. This has happened several times in the past as well. Any ideas?
I have the same problem, failing to receive pdf attachments intermittently using Mail 5.2 running OS X 10.7.3 (Lion), and not being counted among the attachments
Two times where I'm aware it happened, the sender had replied and included the attachments I had sent in my original message, and I'm wondering if those attachments somehow led to their own attachments not displaying and not even being counted in the e-mail window. "3 Attachments, 317 KB" displayed, but those were my three; clicking the "Save" drop-down menu listed only those 3 attachments of mine. In one case, I had them resend their attachments as a new e-mail, and that worked. Their 2 attachments totalled 941 KB, so Mail missed rather a lot by displaying just 317 KB. -
How to convert sapscript(Purchage order) inot pdf format & send in mail
Dear Gentlemen,
I got one req.
<b>convertion of sapscript(purchage order) to pdf format and send converted pdf format in the mail.</b>
Can anybody please give detail & proper way to achive this requriment.
It is very useful to me, I am thankful to everybody, give help in this matter.
Regards,
Vasuchk this one
http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
some function modules useful would be
CONVERT_OTF
SO_NEW_DOCUMENT_ATT_SEND_API1 to send mails with attachments
plzz refer to this link..it will solve ur problem
Re: Sending a PDF document as an attachment
sending the mail with PDF attachment -
Smartform - PDF attachment through E-mail issue
Hi,
A custom form and custom program was created to print the Purchase order information through ME21N, 22n and 23n.
It also has E-mail option. when output medium 5(Simple mail) and 7(External send), email will be send to respective mail-id's with the PDF attachment.
I have issue at the time of saving PO which processed with medium 5. when i save A popup appears "Express document update was terminated received from author". Brief message about it is
"Error Info... 00 671: ABAP/4 processor: COMMIT_IN_POSTING"
In Smartform driver program i am using below function modules to convert OTF into PDF and send through e-mail.
Function Module: CONVERT_OTF.
Function Module: SO_DOCUMENT_SEND_API1.
I am not sure, what i missed out. Can you guys tell is this the correct way to send PDF attachment through E-mail or i missed out any function module for commit.
Regards,
Hemanth.
Edited by: keerthipati hemanth on Jul 31, 2008 1:15 PM
<MOVED BY MODERATOR TO THE CORRECT FORUM>
Edited by: Alvaro Tejada Galindo on Jul 31, 2008 3:14 PMHi Hemant,
Below is the code for the downloading of the smartform into the PDF Format.
* Program Name : ZPPREP_SHOPFLOOR_VIEWER_ZOOM
REPORT zppeerep_shorepfloor_viewer_zoom.
* T A B L E S D E C L A R A T I O N
*---Tables Used.
TABLES: afpo,
mara,
marc,
aufk,
afko,
itcoo,
nast, "Messages
*nast, "Messages
tnapr, "Programs & Forms
addr_key,
arc_params, "Archive parameters
toa_dara. "Archive parameters
* I N T E R N A L T A B L E S D E C L A R A T I O N
*--Internal Tables Used.
* D A T A D E C L A R A T I O N
*--Global Variables Used.
DATA: ws_matnr LIKE afpo-matnr,
ws_werks LIKE aufk-werks,
ws_mtart LIKE mara-mtart,
ws_wrkst LIKE mara-wrkst,
ws_fname TYPE rs38l_fnam,
ws_ctrlp TYPE ssfctrlop,
ws_optns TYPE ssfcompop,
w_padest LIKE tsp03l-padest. "BMC01+
DATA: da_message_printed(1) TYPE c,
da_preview_processed(1) TYPE c,
repeat(1) TYPE c,
da_subrc LIKE sy-subrc.
DATA: w_otfdata TYPE ssfcrescl.
DATA: BEGIN OF it_itcoo OCCURS 0.
INCLUDE STRUCTURE itcoo.
DATA: END OF it_itcoo.
DATA: w_otf TYPE itcoo.
*--Data Declaration for Printing Layout
DATA: ls_itcpo TYPE itcpo.
DATA: lf_repid TYPE sy-repid.
DATA: lf_device TYPE tddevice.
DATA: cf_retcode TYPE sy-subrc.
DATA: ls_recipient TYPE swotobjid.
DATA: ls_sender TYPE swotobjid.
DATA: ls_control_param TYPE ssfctrlop.
DATA: ls_composer_param TYPE ssfcompop.
DATA: ls_addr_key LIKE addr_key.
DATA: w_screen(1) TYPE c.
DATA: xscreen(1) TYPE c.
DATA: da_mess LIKE vbfs OCCURS 0 WITH HEADER LINE.
* C O N S T A N T S
CONSTANTS: c_fas1(8) TYPE c VALUE 'PRINTFAS',
c_fas2(15) TYPE c VALUE 'PRINTFASDRAWING',
c_wip1(8) TYPE c VALUE 'PRINTWIP',
c_wip2(15) TYPE c VALUE 'PRINTWIPDRAWING'.
* S E L E C T I O N - S C R E E N.
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-bl1.
* Production order
PARAMETERS: p_aufnr LIKE afpo-aufnr OBLIGATORY.
SELECTION-SCREEN END OF BLOCK bl1.
START-OF-SELECTION.
*--Begin of Commenting "
*--Get Partially processed orders
MOVE: sy-mandt TO nast-mandt,
'V1' TO nast-kappl,
p_aufnr TO nast-objky,
p_aufnr TO nast-parnr,
sy-langu TO nast-spras,
sy-datum TO nast-erdat,
'1' TO nast-nacha,
'3' TO nast-vsztp,
'X' TO nast-manue,
sy-uname TO nast-usnam,
'DFLT' TO nast-ldest,
sy-langu TO nast-tdspras,
'Shop Floor Papers' TO nast-tdcovtitle,
'1' TO nast-tdarmod,
'BUS2032' TO nast-objtype.
*--Printer settings
CALL FUNCTION 'WFMC_PREPARE_SMART_FORM'
EXPORTING
pi_nast = nast
pi_repid = sy-repid
IMPORTING
pe_returncode = cf_retcode
pe_itcpo = ls_itcpo
pe_device = lf_device
pe_recipient = ls_recipient
pe_sender = ls_sender.
MOVE-CORRESPONDING ls_itcpo TO ls_composer_param.
ls_control_param-device = 'PRINTER'.
ls_control_param-no_dialog = 'X'.
ls_control_param-preview = 'X'.
ls_control_param-getotf = ls_itcpo-tdgetotf.
ls_control_param-langu = sy-langu.
*--End of Commenting "
*--Start of Addition "
CLEAR: ws_werks.
SELECT SINGLE werks
INTO ws_werks
FROM aufk
WHERE aufnr = p_aufnr.
CLEAR: ws_matnr.
SELECT SINGLE plnbez
INTO ws_matnr
FROM afko
WHERE aufnr = p_aufnr.
CLEAR: marc.
SELECT SINGLE matgr
INTO marc-matgr
FROM marc
WHERE matnr = ws_matnr
AND werks = ws_werks.
*--End of Addition "
* CHECK NOT ws_matnr IS INITIAL.
IF NOT ws_matnr IS INITIAL.
*--Start of Addition
SELECT SINGLE matgr
INTO marc-matgr
FROM marc
WHERE matnr = ws_matnr
AND werks = ws_werks.
*--Start of Addition BY Rapidigm01_01+
ELSE.
marc-matgr = c_wip1.
ENDIF.
*--End Of Addition BY Rapidigm01_01+
*--End of Addition "
END-OF-SELECTION.
PERFORM call_smartform.
* F O R M R O U T I N E S
*& Form call_smartform
* text
FORM call_smartform.
CLEAR: ws_ctrlp, ws_optns, ws_fname.
*--Start of Addition "
TRANSLATE marc-matgr TO UPPER CASE.
IF marc-matgr = c_fas1 OR
marc-matgr = c_fas2.
PERFORM call_paper_a.
ELSEIF marc-matgr = c_wip1 OR
marc-matgr = c_wip2.
PERFORM call_paper_b.
ENDIF.
*--End of Addition "
ENDFORM. "call_smartform
*& Form call_paper_a
* text
FORM call_paper_a.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
*>>BC SPARTA03 DATE: 19/05/2008
* formname = 'ZPPSF_SHOP_FLOOR_PAPER_A' "Rapidigm03_01-
formname = 'ZPPSF_SHOP_FLOOR_PAPER_C' "Rapidigm03_01-
*<<EC SPARTA03 DATE: 19/05/2008
* formname = 'ZPPSF_SHOP_FLOOR_PAPER_A_2893' "Rapidigm03_01+
IMPORTING
fm_name = ws_fname
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
CHECK NOT ws_fname IS INITIAL.
CLEAR w_otfdata.
ls_control_param-getotf = 'X'.
CALL FUNCTION ws_fname
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
user_settings = ' '
is_nast = nast
aufnr = p_aufnr
flag_orig = 'X'
IMPORTING
job_output_info = w_otfdata
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
LOOP AT w_otfdata-otfdata INTO w_otf.
APPEND w_otf TO it_itcoo.
ENDLOOP.
CALL FUNCTION 'HR_IT_DISPLAY_WITH_PDF'
TABLES
otf_table = it_itcoo.
ENDFORM. "call_paper_a
*& Form call_paper_b
* text
FORM call_paper_b.
DATA: ws_doknr TYPE draw-doknr,
ws_dokvr TYPE draw-dokvr.
CLEAR: ws_doknr, ws_dokvr.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZPPSF_SHOP_FLOOR_PAPER_B'
IMPORTING
fm_name = ws_fname
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
CHECK NOT ws_fname IS INITIAL.
CLEAR w_otfdata.
ls_control_param-getotf = 'X'.
CALL FUNCTION ws_fname
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
user_settings = ' '
is_nast = nast
aufnr = p_aufnr
doknr = ws_doknr
dokvr = ws_dokvr
flag_orig = 'X'
IMPORTING
job_output_info = w_otfdata
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
LOOP AT w_otfdata-otfdata INTO w_otf.
APPEND w_otf TO it_itcoo.
ENDLOOP.
CALL FUNCTION 'HR_IT_DISPLAY_WITH_PDF'
TABLES
otf_table = it_itcoo.
ENDFORM. "call_paper_b -
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... -
Smartform as PDF attachment to a mail.
Hi,
Can anyonce briefly explain me how the output of a smartform can be attached as a PDF file to a mail.
Ques 1: Do we need to pass any explicit value to the smart form generated function module. If so, what is the value and to which parameter do we need to pass.
Ques 2: As far as i know OTF is converted to PDF. If this is so please explain how this is done.
Ques 3: How can a PDF document be made as an attachment, to a mail.
If anyone can provide me an example it would be very great.
Thanks & Regards,
Goutham.Hi,
Go through the following code:
REPORT z_smtf_pdf_and_email_aks01.
DATA: x_ctrl_p TYPE ssfctrlop,
x_output_data TYPE ssfcrescl.
DATA: it_docs LIKE docs OCCURS 0 WITH HEADER LINE,
it_lines LIKE tline OCCURS 0 WITH HEADER LINE,
it_packing LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
*-----Initialisation
x_ctrl_p-no_dialog = 'X'.
x_ctrl_p-getotf = 'X'.
x_ctrl_p-langu = sy-langu.
Internal Tables Declaration *
DATA: it_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_pcklist LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
it_mess LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
it_table LIKE solix OCCURS 0 WITH HEADER LINE.
DATA: it_soli LIKE soli OCCURS 0 WITH HEADER LINE.
*-----Work area declaration
DATA: wa_doc_data TYPE sodocchgi1.
Variable Declaration *
DATA: v_lines_txt TYPE i,
v_lines_bin TYPE i,
v_lines TYPE i,
v_fname TYPE rs38l_fnam,
v_size TYPE i,
v_filename TYPE rlgrap-filename.
Start of selection event *
START-OF-SELECTION.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Z_SMTF_TEST_AKS01'
IMPORTING
fm_name = v_fname.
CALL FUNCTION v_fname
EXPORTING
control_parameters = x_ctrl_p
IMPORTING
job_output_info = x_output_data.
*-----Calling fumction module to convert output to pdf.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize = v_size
TABLES
otf = x_output_data-otfdata
doctab_archive = it_docs
lines = it_lines.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 134
IMPORTING
bin_filesize = v_size
TABLES
otf = x_output_data-otfdata
lines = it_lines
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
line_width_dst = 255
TABLES
content_in = it_lines
content_out = it_soli
EXCEPTIONS
err_line_width_src_too_long = 1
err_line_width_dst_too_long = 2
err_conv_failed = 3
OTHERS = 4.
CALL FUNCTION 'ZFUNC_CONVERT_DATA_ODC01'
EXPORTING
iv_byte_mode = 'X'
TABLES
it_data = it_lines
et_data = it_table.
*-----To caluculate total number of lines of internal table
DESCRIBE TABLE it_table LINES v_lines.
*-----Function module to download the output file.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
bin_filesize = v_size
filename = ' '
filetype = 'BIN'
IMPORTING
act_filename = v_filename
TABLES
data_tab = it_lines.
*-----Create Message Body and Title and Description
it_mess =
'i have successfully converted smartform from otf format to pdf' .
" and i have attached that in mail'.
APPEND it_mess.
wa_doc_data-obj_name = 'smartform'.
wa_doc_data-expiry_dat = sy-datum + 10.
wa_doc_data-obj_descr = 'smartform'.
wa_doc_data-sensitivty = 'F'.
wa_doc_data-doc_size = v_lines * 255.
APPEND it_pcklist.
*-----PDF Attachment
it_pcklist-transf_bin = 'X'.
it_pcklist-head_start = 1.
it_pcklist-head_num = 0.
it_pcklist-body_start = 1.
it_pcklist-doc_size = v_lines_bin * 255 .
it_pcklist-body_num = v_lines.
it_pcklist-doc_type = 'PDF'.
it_pcklist-obj_name = 'smartform'.
it_pcklist-obj_descr = 'smart_desc'.
it_pcklist-obj_langu = 'E'.
it_pcklist-doc_size = v_lines * 255.
APPEND it_pcklist.
*-----Giving the receiver email-id
CLEAR it_receivers.
it_receivers-receiver = '[email protected]'
it_receivers-rec_type = 'U'.
APPEND it_receivers.
CLEAR it_receivers.
it_receivers-receiver = '[email protected]'.
it_receivers-rec_type = 'U'.
APPEND it_receivers.
CLEAR it_receivers.
it_receivers-receiver = '[email protected]'.
it_receivers-rec_type = 'U'.
APPEND it_receivers.
*-----Calling the function module to sending email
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_pcklist
contents_txt = it_mess
contents_hex = it_table
receivers = it_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.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
WITH rfcgroup = 'iwdf7ytc_YD3_94'
AND RETURN.
REFRESH: it_receivers,
it_mess,
it_pcklist.
ENDIF.
Reward points if helpful answer.
Ashvender
Maybe you are looking for
-
Hi Everyone, On the A/R Invoice PLD I created, I am showing both the Item No. and the Customer/Vendor Catalog No. I selected both fields from teh A/R Invoice - Rows table. However, on one of my invoices teh Customer/Vendor Catalog No. is not coming
-
Publish calendars in iCal 4.0.4?
In one of the recent upgrades, iCal changed from publishing calendars to "sharing" them. I want to embed an html snippet with my iCal in it, but if I can no longer publish my calendar it won't work. Is there a way in iCal 4.0.4 to publish a calendar,
-
Why can I not install fonts? Office for Mac will not recognize them?
My wife and I tried many times to install several fonts that we could use in Microsoft Office for Mac. Even though it said they were installed in the Mac, we could not see them in Word. We are new to the Apple products. We are not novice computer use
-
How do I change the timing in a title effect?
I am using the "Dramatic" text generator that creates text boxes that fly onto the screen. I love the look but need to change the timing of the text boxes to coincide with the V/O. Is this possible or just yet ANOTHER failure of FCP X?
-
"couldn't update this book because it contains no openable nongenerated files"
I need help with an error message "couldn't update this book because it contains no openable nongenerated files" when trying to create a book in Framemaker 12. Not sure what is happening but I am a new framemaker user so it could be operator error.