2006 Dec 20 1:40 PM
I have to convert a script to pdf format and then download it to presentation server and then send it as an attachment by email ( to the external mail ids).
please help me with this.
waiting in anitcipation.
regards.
suki.
I have to convert a script to pdf format and then download it to presentation server and then send it as an attachment by email ( to the external mail ids).
please help me with this.
waiting in anitcipation.
regards.
suki.
2006 Dec 20 1:45 PM
Use...HRHAP_DOC_CONVERT_SMF_TO_PDF or SX_OBJECT_CONVERT_OTF_PDF
or CONVERT_OTF_2_PDF to convert data to PDF...
Use the below code to send an email...
FUNCTION Z_SEND_EMAIL.
*"----
""Local interface:
*" IMPORTING
*" VALUE(SENDER) LIKE SOUD3-USRNAM
*" VALUE(SUBJECT) LIKE SOOD1-OBJDES
*" REFERENCE(SUPPRESS_COMMIT) TYPE CHAR01 DEFAULT ''
*" TABLES
*" RECEIVERS
*" EMAIL_TEXT STRUCTURE SOLI OPTIONAL
*" EXCEPTIONS
*" ACTIVE_USER_NOT_EXIST
*" COMMUNICATION_FAILURE
*" COMPONENT_NOT_AVAILABLE
*" FOLDER_NOT_EXIST
*" FOLDER_NO_AUTHORIZATION
*" FORWARDER_NOT_EXIST
*" NOTE_NOT_EXIST
*" OBJECT_NOT_EXIST
*" OBJECT_NOT_SENT
*" OBJECT_NO_AUTHORIZATION
*" OBJECT_TYPE_NOT_EXIST
*" OPERATION_NO_AUTHORIZATION
*" OWNER_NOT_EXIST
*" PARAMETER_ERROR
*" SUBSTITUTE_NOT_ACTIVE
*" SUBSTITUTE_NOT_DEFINED
*" SYSTEM_FAILURE
*" TOO_MUCH_RECEIVERS
*" USER_NOT_EXIST
*" ORIGINATOR_NOT_EXIST
*" X_ERROR
*" OTHERS
*"----
************************************************************************
Modification Log: (Please Flag all changes with the Correction Number)
Date(MMDDYYYY) Programmer Corr. # TM ID
Description:
************************************************************************
3/18/04 SpechtBN D81K900520 Updated function module call
for so_object_send, exception
handling and commit work.
03/02/2005 miranddn D81K910999 Add option to suppress
COMMIT WORK statement. Interfering with form outputs. Entered as
optional parameter so that objects using this function can remain
unchanged and the function will behave normally for them.
************************************************************************
CLEAR: T_OBJECT_HD_CHANGE,
T_USER,
T_OBJCONT,
T_OBJHEAD,
T_OBJPARA,
T_OBJPARB,
T_RECEIVERS.
REFRESH: T_OBJCONT,
T_OBJHEAD,
T_OBJPARA,
T_OBJPARB,
T_RECEIVERS.
determine receivers:
LOOP AT RECEIVERS.
T_RECEIVERS-RCDAT = SY-DATUM.
T_RECEIVERS-RECESC = 'U'.
T_RECEIVERS-RECNAM = 'U-'.
T_RECEIVERS-RECEXTNAM = RECEIVERS.
T_RECEIVERS-SNDART = 'INT'.
T_RECEIVERS-SNDPRI = 1.
T_RECEIVERS-DELIVER = 'X'.
T_RECEIVERS-READ = 'X'.
T_RECEIVERS-ADR_NAME = RECEIVERS.
T_RECEIVERS-SORTFIELD = RECEIVERS.
T_RECEIVERS-SORTCLASS = 5.
T_RECEIVERS-SNDCP = ' '. " not a copy to ...
APPEND T_RECEIVERS.
ENDLOOP.
Message Header (including subject)
T_OBJECT_HD_CHANGE-OBJLA = SY-LANGU.
T_OBJECT_HD_CHANGE-OBJNAM = 'MESSAGE'.
Subject
T_OBJECT_HD_CHANGE-OBJDES = SUBJECT.
T_OBJECT_HD_CHANGE-OBJSNS = 'S'." sensitivity Std,Func,Priv. S,F,P
T_OBJECT_HD_CHANGE-VMTYP = 'R'. "object type T = transaction
T_OBJECT_HD_CHANGE-ACNAM = 'U'.
Sender
IF SENDER = SPACE.
T_USER-SAPNAM = SY-UNAME.
ELSE.
T_USER-SAPNAM = SENDER.
ENDIF.
CALL FUNCTION 'SO_NAME_CONVERT'
EXPORTING
NAME_IN = T_USER
IMPORTING
NAME_OUT = T_USER
EXCEPTIONS
OTHERS = 8.
IF SY-SUBRC NE 0.
T_USER-SAPNAM = 'SPECHTBN'.
ENDIF.
T_OBJPARA-NAME = 'MESSAGE'.
T_OBJPARA-LOW = SY-DATUM.
APPEND T_OBJPARA.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
FOLDER_ID = ' '
FORWARDER = ' '
OBJECT_FL_CHANGE = ' '
OBJECT_HD_CHANGE = t_object_hd_change
OBJECT_ID = ' '
OBJECT_TYPE = 'RAW'
OUTBOX_FLAG = ' '
OWNER = SENDER
STORE_FLAG = ' '
DELETE_FLAG = ' '
SENDER = ' '
CHECK_SEND_AUTHORITY = ' '
CHECK_ALREADY_SENT = ' '
GIVE_OBJECT_BACK =
ORIGINATOR = ' '
ORIGINATOR_TYPE = 'J'
LINK_FOLDER_ID = ' '
SEND_REQUEST_OID = ' '
IMPORTING
OBJECT_ID_NEW =
SENT_TO_ALL =
ALL_BINDING_DONE =
OFFICE_OBJECT_KEY =
ORIGINATOR_ID =
E_SEND_REQUEST_OID =
TABLES
OBJCONT = email_text
OBJHEAD = t_objhead
OBJPARA = t_objpara
OBJPARB = t_objparb
RECEIVERS = t_receivers
PACKING_LIST =
ATT_CONT =
ATT_HEAD =
NOTE_TEXT =
LINK_LIST =
APPLICATION_OBJECT =
EXCEPTIONS
ACTIVE_USER_NOT_EXIST = 1
COMMUNICATION_FAILURE = 2
COMPONENT_NOT_AVAILABLE = 3
FOLDER_NOT_EXIST = 4
FOLDER_NO_AUTHORIZATION = 5
FORWARDER_NOT_EXIST = 6
NOTE_NOT_EXIST = 7
OBJECT_NOT_EXIST = 8
OBJECT_NOT_SENT = 9
OBJECT_NO_AUTHORIZATION = 10
OBJECT_TYPE_NOT_EXIST = 11
OPERATION_NO_AUTHORIZATION = 12
OWNER_NOT_EXIST = 13
PARAMETER_ERROR = 14
SUBSTITUTE_NOT_ACTIVE = 15
SUBSTITUTE_NOT_DEFINED = 16
SYSTEM_FAILURE = 17
TOO_MUCH_RECEIVERS = 18
USER_NOT_EXIST = 19
ORIGINATOR_NOT_EXIST = 20
X_ERROR = 21
OTHERS = 22
.
IF SY-SUBRC <> 0.
case sy-subrc.
when 1.
raise ACTIVE_USER_NOT_EXIST.
when 2.
raise COMMUNICATION_FAILURE.
when 3.
raise COMPONENT_NOT_AVAILABLE.
when 4.
raise FOLDER_NOT_EXIST.
when 5.
raise FOLDER_NO_AUTHORIZATION.
when 6.
raise FORWARDER_NOT_EXIST.
when 7.
raise NOTE_NOT_EXIST.
when 8.
raise OBJECT_NOT_EXIST.
when 9.
raise OBJECT_NOT_SENT.
when 10.
raise OBJECT_NO_AUTHORIZATION.
when 11.
raise OBJECT_TYPE_NOT_EXIST.
when 12.
raise OPERATION_NO_AUTHORIZATION.
when 13.
raise OWNER_NOT_EXIST.
when 14.
raise PARAMETER_ERROR.
when 15.
raise SUBSTITUTE_NOT_ACTIVE.
when 16.
raise SUBSTITUTE_NOT_DEFINED.
when 17.
raise SYSTEM_FAILURE.
when 18.
raise TOO_MUCH_RECEIVERS.
when 19.
raise USER_NOT_EXIST.
when 20.
raise ORIGINATOR_NOT_EXIST.
when 21.
raise X_ERROR.
when 22.
raise OTHERS.
endcase.
ENDIF.
Begin of D81K910999
if suppress_commit is initial.
commit work.
else.
Do nothing
endif.
End of D81K910999
ENDFUNCTION.
2006 Dec 20 2:00 PM
Hi Rajendran,
convert your script spool to pdf using RSTXPDF4 and then you can mail.
Check this sample programs .
<a href="http://www.erpgenie.com/abap/pdf_creation.htm">http://www.erpgenie.com/abap/pdf_creation.htm</a>
<a href="http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm">http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm</a>
Regards,
Raghav
2006 Dec 20 4:07 PM
hi Suki,
Retrieve the OTF table from the FM CLOSE_FORM then , convert OTF to PDF using FM 'SX_OBJECT_CONVERT_OTF_PDF' then I attach and send mail with 'SO_NEW_DOCUMENT_ATT_SEND_API1'.
Regards,
SRI
2006 Dec 20 4:19 PM
2006 Dec 22 12:01 PM
hi,
First create the script form in the spool and then use the program RSTXPDFT4 to download the script to PDF format to a particular location. You can mail this attachment using the FM SO_NEW_DOCUMENT_ATT_SEND_API1.
Hope this helps.
Regards,
Richa