Error when opening the PDF attachment
Hi,
We are able to successfully send the PDF attachment to external email id from SAP SCRIPT:
but when we are opening the PDF attachment we are getting the following error:
"Adobe Reader could not open because it is not either a supported file type or the file has been damaged ..etc.."
Is any logic need to write for the above or any parameters are missing .
Can any one help...
Thanks in advance.
Hi Ramana,
Just try below given example code.....In which I have just different function Module to convert from OFT to PDF....
AT END OF VSTEL.
IF R_EMAIL = 'X'.
*--Opening Layout set for Printing
PERFORM CLOSE_FORM.
SELECT SINGLE SMTP_ADDR INTO V_EMAIL
FROM ADR6
WHERE ADDRNUMBER = T_ADRC-ADDRNUMBER.
CLEAR T_LIPS.
READ TABLE T_LIPS WITH KEY VBELN = T_LIKP-VBELN.
CLEAR T_VBAK.
READ TABLE T_VBAK WITH KEY VBELN = T_LIPS-VGBEL.
CLEAR V_ADRNR.
SELECT SINGLE ADRNR
INTO V_ADRNR
FROM T001
WHERE BUKRS = T_VBAK-BUKRS_VF.
REFRESH T_CC_EMAIL.
CLEAR T_CC_EMAIL.
SELECT SMTP_ADDR INTO TABLE T_CC_EMAIL
FROM ADR6
WHERE ADDRNUMBER = V_ADRNR.
SELECT SINGLE smtp_addr
INTO cc_email
FROM adr6
WHERE addrnumber = v_adrnr.
IF T_TO_EMAIL[] IS INITIAL.
CLEAR T_CC_EMAIL.
REFRESH T_CC_EMAIL.
ENDIF.
PERFORM BUILD_PDF_DATA_TABLE.
Populate message body text
PERFORM POPULATE_EMAIL_MESSAGE_BODY.
CONCATENATE T_LIKP-VSTEL '-' 'Warehouse Release' INTO V_SUBJECT SEPARATED BY SPACE.
Send file by email as .xls speadsheet
PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
TABLES IT_MESSAGE
PT_CONTENTS_BIN "LINES "it_attach
USING V_EMAIL
V_SUBJECT
'PDF'
'Delivery'
'Deliveries'
CHANGING GD_ERROR
GD_RECIEVER.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
ENDIF.
ENDAT.
***---/End by sagun
ENDLOOP. "loop at t_likp.
***---/added by sagun 25.05.2007
IF R_EMAIL = 'X'.
WRITE /01 SY-ULINE(180).
WRITE :/55 'End of Report'.
ENDIF.
***---/end by sagun
ENDFORM. " PRINT_DELIVERY
*& Form close_form
text
--> p1 text
<-- p2 text
FORM CLOSE_FORM .
IF R_PRINT = 'X'. " added by sagun 24.05.2007
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
OTFDATA =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF. " added by sagun 24.05.2007
IF R_EMAIL = 'X'.
*otf_table like itcoo occurs 0 with header line
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = .
TABLES
OTFDATA = HOTFDATA
EXCEPTIONS
UNOPENED = 3.
ENDIF.
ENDFORM. " close_form
*& Form BUILD_PDF_DATA_TABLE
text
--> p1 text
<-- p2 text
FORM BUILD_PDF_DATA_TABLE .
DATA : LC_FORMAT(3) TYPE C VALUE 'PDF'.
DATA: lt_tline TYPE tp_tline_standard_table,
DATA : L_BIN_FILESIZE TYPE I,
PC_CONTENTS_BIN_LINES TYPE I.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = LC_FORMAT
IMPORTING
BIN_FILESIZE = L_BIN_FILESIZE
TABLES
OTF = HOTFDATA
LINES = LINES
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
IF SY-SUBRC = 0.
CALL FUNCTION 'QCE1_CONVERT'
TABLES
T_SOURCE_TAB = LINES
T_TARGET_TAB = PT_CONTENTS_BIN
EXCEPTIONS
CONVERT_NOT_POSSIBLE = 1
OTHERS = 2.
IF SY-SUBRC = 0.
DESCRIBE TABLE PT_CONTENTS_BIN LINES PC_CONTENTS_BIN_LINES.
ELSE.
... -->
ENDIF.
ELSE.
An OTF conversion error occured
-->
ENDIF.
ENDFORM. " BUILD_PDF_DATA_TABLE
*& Form POPULATE_EMAIL_MESSAGE_BODY
text
--> p1 text
<-- p2 text
FORM POPULATE_EMAIL_MESSAGE_BODY .
REFRESH IT_MESSAGE.
IT_MESSAGE = 'Please find enclosed here with our Warehouse Release Document(s)'.
APPEND IT_MESSAGE.
CLEAR IT_MESSAGE.
APPEND IT_MESSAGE.
APPEND IT_MESSAGE.
APPEND IT_MESSAGE.
APPEND IT_MESSAGE.
IT_MESSAGE = 'For United Phosphorous Inc.'.
APPEND IT_MESSAGE.
CLEAR IT_MESSAGE.
APPEND it_message.
APPEND it_message.
APPEND it_message.
IT_MESSAGE = 'TEST EMAIL from 520 clinet please ignore it'.
APPEND IT_MESSAGE.
ENDFORM. " POPULATE_EMAIL_MESSAGE_BODY
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
text
-->PIT_MESSAGE text
-->PIT_ATTACH text
-->P_EMAIL text
-->P_MTITLE text
-->P_FORMAT text
-->P_FILENAME text
-->P_ATTDESCRIPTION text
-->P_SENDER_ADDRESS text
-->P_SENDER_ADDRES_TYPE text
<--P_ERROR text
<--P_RECIEVER text
FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES PIT_MESSAGE
PIT_ATTACH
USING P_EMAIL
P_MTITLE
P_FORMAT
P_FILENAME
P_ATTDESCRIPTION
P_SENDER_ADDRESS
P_SENDER_ADDRES_TYPE
CHANGING P_ERROR
P_RECIEVER.
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 ,
LD_ATTFILENAME TYPE SO_OBJ_DES ,
LD_SENDER_ADDRESS LIKE SOEXTRECI1-RECEIVER,
LD_SENDER_ADDRESS_TYPE LIKE SOEXTRECI1-ADR_TYP,
LD_RECEIVER LIKE SY-SUBRC.
p_filename = 'INVOICE'.
LD_EMAIL = P_EMAIL.
LD_MTITLE = P_MTITLE.
LD_FORMAT = P_FORMAT.
LD_ATTDESCRIPTION = P_ATTDESCRIPTION.
LD_ATTFILENAME = P_FILENAME.
LD_SENDER_ADDRESS = P_SENDER_ADDRESS.
LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
Fill the document data.
W_DOC_DATA-DOC_SIZE = 1.
Populate the subject/generic message attributes
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
W_DOC_DATA-SENSITIVTY = 'F'.
Fill the document data and get size of attachment
CLEAR W_DOC_DATA.
READ TABLE PIT_ATTACH INDEX W_CNT.
W_DOC_DATA-DOC_SIZE =
( W_CNT - 1 ) * 255 + STRLEN( PIT_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[] = PIT_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.
LOOP AT T_TO_EMAIL WHERE EMAIL <> SPACE.
CLEAR T_RECEIVERS.
T_RECEIVERS-RECEIVER = T_TO_EMAIL-EMAIL.
T_RECEIVERS-REC_TYPE = 'U'.
T_RECEIVERS-COM_TYPE = 'INT'.
T_RECEIVERS-NOTIF_DEL = 'X'.
T_RECEIVERS-NOTIF_NDEL = 'X'.
APPEND T_RECEIVERS.
CLEAR T_RECEIVERS.
ENDLOOP.
copy email address
CLEAR T_RECEIVERS.
IF NOT T_RECEIVERS[] IS INITIAL.
LOOP AT T_CC_EMAIL.
T_RECEIVERS-RECEIVER = T_CC_EMAIL-EMAIL.
T_RECEIVERS-REC_TYPE = 'U'.
T_RECEIVERS-COM_TYPE = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
T_RECEIVERS-COPY = 'X'.
APPEND T_RECEIVERS.
CLEAR T_RECEIVERS.
ENDLOOP.
ENDIF.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOC_DATA
PUT_IN_OUTBOX = 'X'
SENDER_ADDRESS = LD_SENDER_ADDRESS
SENDER_ADDRESS_TYPE = LD_SENDER_ADDRESS_TYPE
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL = W_SENT_ALL
TABLES
PACKING_LIST = T_PACKING_LIST
CONTENTS_BIN = T_ATTACHMENT
CONTENTS_TXT = 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.
IF SY-SUBRC = 0.
FORMAT COLOR COL_NORMAL ON.
LOOP AT T_LOG.
WRITE :/03 T_LOG-VBELN,
19 SY-VLINE,
20 T_LOG-KUNNR,
34 SY-VLINE,
35 T_LOG-NAME1,
76 SY-VLINE,
77 T_LOG-EMAIL,
110 SY-VLINE,
111 'Email Sent Successfuly',
180 SY-VLINE.
ENDLOOP . "t_log
FORMAT COLOR COL_NORMAL OFF.
CLEAR T_LOG.
REFRESH T_LOG.
ENDIF.
IF SY-SUBRC NE 0.
CASE LD_ERROR.
WHEN 1.
V_ERROR = 'too_many_receivers' .
WHEN 2.
V_ERROR = 'Email address not found in Customer Master' .
WHEN 3.
V_ERROR = 'document_type_not_exist'.
WHEN 4.
V_ERROR = 'operation_no_authorization'.
WHEN 5.
V_ERROR = 'Email address not found in Customer Master'.
WHEN 6.
V_ERROR = 'x_error'.
WHEN 7.
V_ERROR = 'enqueue_error'.
WHEN 8.
V_ERROR = 'Error in sending email' .
ENDCASE.
FORMAT COLOR COL_NEGATIVE ON.
LOOP AT T_LOG.
WRITE :/03 T_LOG-VBELN,
19 SY-VLINE,
20 T_LOG-KUNNR,
34 SY-VLINE,
35 T_LOG-NAME1,
76 SY-VLINE,
77 T_LOG-EMAIL,
110 SY-VLINE,
111 V_ERROR,
180 SY-VLINE.
ENDLOOP . "t_log
FORMAT COLOR COL_NEGATIVE OFF.
CLEAR T_LOG.
REFRESH T_LOG.
ENDIF.
ENDFORM. " SEND_FILE_AS_EMAIL_ATTACHMENT
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
text
--> p1 text
<-- p2 text
FORM INITIATE_MAIL_EXECUTE_PROGRAM .
WAIT UP TO 2 SECONDS.
SUBMIT RSCONN01 WITH MODE = 'INT'
WITH OUTPUT = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
Reward Point If it usefull....
Cheers,
Sagun Desai....
Similar Messages
-
Error while opening the PDF attachment
HI SDN's
I have to send order confirmation thru mail as a pdf attachment as soon as order has been saved.
I have written the code and assigned to output type.
Here I am getting an error opening a converted pdf file with Adobe Reader
The error message reads:
Adobe Reader could not open "filename.PDF" because it is either not a supported file type or because the file has been corrupted (for example, it was sent as an email attachment and wasn't correctly decoded).
Any help would be appreciated.
Thanks in advance
VRhello, i have the same problem as VR's. The pdf file sent to my email is not able to open. You mentioned that this is only supported by early releases of Adobe. But anyhow, I followed your advice to have my spool converted to PDF, instead of OTF to PDF. But I get this error: Spool request 23595 contains no ABAP list data.
What exactly my transaction does is that, it makes use of a sapscript layout via VL02N using an output type. I retrieve the OTF data in CLOSE_FORM function module. OTF is then converted to PDF via SX_OBJECT_CONVERT_OTF_PDF, then send via email through SO_NEW_DOCUMENT_ATT_SEND_API1.
When I view the sent PDF file in my email, It cannot be opened.
I would appreciate your help guys! thank you very much. -
Error while opening the Pdf Attachment at the time sending mail ..
Hi Frn's ,
i am sending a mail with pdf attachment ... but the pdf is not opening ...it is giving error "There was and error opening this document . This file can not be open because it has no page ."
Please resolve the problem ...below is the code pasted ..
REPORT ZPRI_TEST_LDB.
DATA: it_pdf LIKE tline OCCURS 0 WITH HEADER LINE .
Spool to PDF conversions
DATA: gd_spool_nr LIKE tsp01-rqident,
gd_destination LIKE rlgrap-filename,
gd_bytecount LIKE tst01-dsize,
gd_buffer TYPE string.
DATA: w_recsize TYPE i.
DATA: gd_recsize TYPE i.
DATA: gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des.
data: gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
PARAMETER: p_email1 LIKE somlreci1-receiver
DEFAULT 'abc,
p_sender LIKE somlreci1-receiver
DEFAULT 'abc'.
perform write_output .
perform create_pdf .
PERFORM process_email .
FORM WRITE_OUTPUT .
write:'Listed below are the employees in your area who are due a Performance Appraisal'.
write:'during the month of May 2009 .A performance appraisal form can be found on-line'.
write: 'in the MUD template section .The Performance Appraisal is to be completed and' .
write:'discussed with the employee by the immediate supervisor .Signed forms should be '.
write: 'returned to the Human Resource Department by May 31,2009 .'.
skip 2 .
write: 'employee name' .
write: 'Job Date' .
write: 'Date of last appraisal' .
ENDFORM. " WRITE_OUTPUT
FORM CREATE_PDF .
DATA: spoolno LIKE tsp01-rqident.
DATA : p_repid LIKE sy-repid .
DATA: v_len TYPE i , v_len1 TYPE i .
DATA: v_temp(8) TYPE c .
DATA: p_uname LIKE sy-uname .
DATA: it_tsp01 TYPE STANDARD TABLE OF tsp01 WITH HEADER LINE .
DATA: it_pdf LIKE tline OCCURS 0 WITH HEADER LINE .
TABLES: tsp01.
data: var type c .
*-- STRUCTURES
DATA:
lc_rq2name LIKE tsp01-rq2name.
DATA:
mstr_print_parms LIKE pri_params,
mc_valid(1) TYPE c,
mi_bytecount TYPE i,
mi_length TYPE i,
mi_rqident LIKE tsp01-rqident.
*-- INTERNAL TABLES
DATA:
mtab_pdf LIKE tline OCCURS 0 WITH HEADER LINE,
mc_filename LIKE rlgrap-filename.
*-- SELECTION SCREEN
DATA:
p_linsz LIKE sy-linsz VALUE 132, " Line size
p_paart LIKE sy-paart VALUE 'X_65_132'. " Paper Format
*-- Setup the Print Parmaters
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
authority = space
copies = '1'
cover_page = space
data_set = space
department = space
destination = space
expiration = '1'
immediately = space
new_list_id = 'X'
no_dialog = 'X'
user = sy-uname
IMPORTING
out_parameters = mstr_print_parms
valid = mc_valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
*-- Explicitly set line width, and output format so that
*-- the PDF conversion comes out OK
mstr_print_parms-linsz = p_linsz.
mstr_print_parms-paart = p_paart.
importing variable value set at first time to restrict the infinite loop .
IMPORT var FROM MEMORY ID 'abc' .
var = var + 1 .
p_uname = sy-uname .
p_repid = sy-repid .
*checking variable to restricted scecond time exction of this block of code
IF var = 1 .
v_memid = 1 .
EXPORT var TO MEMORY ID 'abc' .
start ----p3d(02/13/2009)
EXPORT it_pernr it_pernr_quali v_memid it_pernr_status
p_file p_file1 rb_pres rb_app rb2 TO MEMORY ID 'bcd' .
EXPORT it_pernr it_pernr_quali v_memid it_pernr_status it_notqualified
p_file p_file1 rb_pres rb_app rb1 rb2 rb3 rb4 TO MEMORY ID 'bcd' .
EXPORT it_pernr it_pernr_quali v_memid it_pernr_status it_notqualified
p_file p_file1 rb_pres rb_app rb3 rb4 TO MEMORY ID 'bcd' .
end ----p3d(02/13/2009)
submitting the spool request
SUBMIT (p_repid) TO SAP-SPOOL
SPOOL PARAMETERS mstr_print_parms
WITHOUT SPOOL DYNPRO
AND RETURN.
ENDIF.
FREE MEMORY ID 'abc'.
FREE MEMORY ID 'bcd'.
*Calculating the lenth of report name
v_len = STRLEN( p_repid ) .
*consutrucing the database variable rq2name to search the spool request
IF v_len >= 9 .
CONCATENATE p_repid+0(9)
p_uname+0(3) INTO lc_rq2name .
ELSE.
v_len1 = 9 - v_len .
DO v_len1 TIMES .
CONCATENATE v_temp '_' INTO v_temp .
ENDDO.
CONCATENATE p_repid v_temp
p_uname INTO lc_rq2name .
ENDIF.
*selecting the spool request using the above consructed varibale
SELECT * FROM tsp01 INTO TABLE it_tsp01
WHERE rq2name = lc_rq2name .
*sorting the interbla table
SORT it_tsp01 BY rqcretime DESCENDING .
*reading the first spool request
READ TABLE it_tsp01 INDEX 1.
*converting the spool request into pdf
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = it_tsp01-rqident
dst_device = 'LP01'
TABLES
pdf = it_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
OTHERS = 12.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CHECK sy-subrc = 0.
Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf.
TRANSLATE it_pdf USING ' ~'.
CONCATENATE gd_buffer it_pdf INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM. " CREATE_PDF
FORM SEND_eMAIL using p_email .
REFRESH it_mess_bod.
Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = 'Attachname'.
CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'Message Body text, line 1'.
APPEND it_mess_bod.
it_mess_bod = 'Message Body text, line 2...'.
APPEND it_mess_bod.
If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_mess_bod
it_mess_att
using p_email
'Example .xls documnet attachment'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
ENDFORM. " SEND_MAIL
FORM process_email.
DESCRIBE TABLE it_mess_att LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email using p_email1 . .
perform send_email using p_email2.
ENDFORM.
FORM send_file_as_email_attachment tables it_message
it_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
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 ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
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,
w_cnt type i,
w_sent_all(1) type c,
w_doc_data like sodocchgi1.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = it_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE 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
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.
ENDFORM.
Thanks and Regards ..
Priyankhi this is the part of code ...
PERFORM process_email .
CHECK sy-subrc = 0.
Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf.
TRANSLATE it_pdf USING ' ~'.
CONCATENATE gd_buffer it_pdf INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM. " CREATE_PDF
FORM process_email.
DESCRIBE TABLE it_mess_att LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email using p_email1 . .
perform send_email using p_email2.
ENDFORM.
FORM SEND_eMAIL using p_email .
REFRESH it_mess_bod.
Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = 'Attachname'.
CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'Message Body text, line 1'.
APPEND it_mess_bod.
it_mess_bod = 'Message Body text, line 2...'.
APPEND it_mess_bod.
If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_mess_bod
it_mess_att
using p_email
'Example .xls documnet attachment'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
ENDFORM. " SEND_MAIL
FORM send_file_as_email_attachment tables it_message
it_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
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 ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
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,
w_cnt type i,
w_sent_all(1) type c,
w_doc_data like sodocchgi1.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = it_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE 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
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.
ENDFORM. -
Rundll32 error when opening a PDF attachment from Outlook 2010
The computer is a 32 bit Win7. Outlook is 2010 for business. Everything was working fine until 4 days ago. Now have to save the pdf to the desktop and open it from there.
Any ideas?
ThanksThe rundll32 error seems to have disappeared. Until this morning I had both this error and the rundll32. All other types of docs open fine. This one will open if saved to the desktop first, but not from Outlook.
-
Getting Adobe Lifecycle Error when opening the pdf document to provide comments
Hi All,
I am getting AdobeLifeCycle Error message when I am trying to give comments in the pdf document.
I have a workaround in place for the same but I want a permanent fix.
PFB the workaround for the same:
1.Delete the Adobe folder from the users local profile, under the following folders:
C:\Users\”login”\AppData\local
C:\Users\”login”\AppData\locallow
C:\Users\”login”\AppData\Roaming
2.Delete the contents of the temp file on the C Drive
Please let me know if some one has faced this issue and have been successful in finding a permanent fix.
Thanks & Regards,
Aniket DeshmukhPFB the error message:
Adobe LiveCycle Review Connector - File Not Found’ -
Outlook 2010 gives error when opening a PowerPoint attachment.
Outlook 2010 gives error when opening a PowerPoint attachment.
Hi All,
We have several VIP employees that are getting the following error on all PowerPoint documents that come as attachments from Outlook.
I have researched and tried the following steps and verified these settings are already applied.
I did find a work around but not a fix and our security team will NOT allow me to change this setting however if I uncheck the setting all employees can open the outlook attachment.
Any other ideas on a fix for this if I am unable to uncheck Enable Protected View.Hi Matthew,
This is a perennial problem, here is a thread which has a deep discussion about this issue:
http://social.technet.microsoft.com/Forums/office/en-US/07f710a5-a6ca-4256-8f27-6aac41a6b37e/outlook-2010-unable-to-open-word-excel-and-power-point-attachments-from-an-email?forum=outlook
It looks like nobady really find a solution there, the only workaround is what you have found - change the protected view setting in Trust Center. You will lose some security by doing this but it seems to be the only solid solution currently. -
Error When Opening the Setup/Transactions/ Sources Window
Hi All,
in Oracle E-Business Suite R12 Version
Error When Opening the Setup/Transactions/ Sources Window
APP-FND-01388: Cannot read value for profile option FND_DEVELOPER_MODE in routine &ROUTINE.
ORA-01403: no data found
FRM-40735: WHEN-CREATE-RECORD trigger raised unhandled exception ORA-06502.Amr,
Please see the suggested solutions in these docs.
App-Fnd-01388: Cannot Read Value For Profile Option Fnd_developer_mode In Routine [ID 563884.1]
R12: How To Avoid The Error Message APP-FND-01388 On Drilldown [ID 556668.1]
R12 APXINWKB Error APP-FND-01388 When Trying To Query Invoice [ID 864195.1]
APP-FND-01388 Cannot Read Profile Option FND_DEVELOPER_MODE In Benefits Service Center Form [ID 422182.1]
Thanks,
Hussein -
Error When Opening the Transactions/Transactions Window
Hi All,
in Oracle E-Business Suite R12 Version
Error When Opening the Transactions/Transactions Window
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "APPS.AR_MO_GLOBAL_CACHE", line 55
ORA-06512: at "APPS.ARP_STANDARD", line 2912
ORA-06512: at "APPS.ARP_GLOBAL", line 282
FRM-40735: PRE-FORM trigger raised unhandled exception ORA-06502
Can any body help about the error
Thanks in advance.Did you go through the below notes:
Note:125204.1, Note:153207.1 and Note:191306.1. -
Adobe reader XI crash and hangs when open the pdf file
After update the adobe reader xi 11.0.10, the reader always crashes and hangs when open the pdf file. Please help me how to do.
Ben Leung wrote:
HThis situation is started after I clear the pop up advertisement.
What kind of advertisement? In Adobe Reader? Can you post a screenshot of that: https://forums.adobe.com/thread/1070933
Regarding the crash, can you try disabling Protected Mode through the registry: download, unzip, then run the registry script https://files.acrobat.com/a/preview/49eeb48b-07c5-4502-984c-8a25259914fa -
FM GUI_UPLOAD gives PC036 "Error when opening the download file".
Dear all
I'm having a problem with a particular PC.
A program which calls FM GUI_UPLOAD gives the error PC036 "Error when opening the download file".
The file we are trying to upload is a text file, with tab delimiter.
If the same user executes the same program from another PCs, it works fine.
If another user executes the program in the "problematic" PC, it gives the error.
So, the problem is PC-related.
I checked SAP GUI Codepage, and was the same as other PCs.
I cheched regional configuration, and was also the same as other PCs.
The operating system is Windows XP, and the SAP GUI version is 7.10, File version 7100.2.7.3077, Build 967944 , Patch level 7.
SAP version is ECC6.
I searched across forums, SAP note, and the web, but I couldn't find anything.
I would be grateful if someone could give me ideas.
Thanks in advance
JordiHello. The user accounts are have same privilegies (like both are "Power users")? Also the file system are the same in both PC NTFS or FAT32 (today i'm find FAT32 in enterprise ) If NTFS may be some Domain politics are not allow to save file correctly, or space are not enough....Try check this first...Regards.
-
I just installed photoshop elements 11 on my Mac and am receiving an error when opening the organizer. It is stating that online services could not be initialized and that I need to reinstall. I tried that and it is still coming up. What do I do?
How did you uninstall it?
-
Error in opening the PDF file created from the smart form output.
Hi All,
i have a simple smart form which takes 3 values like customer no, name and no of times customer called and gives an out like
Customer 0001000000 with name Ravi called 5 times today.
I have to send this output to mail as an attachment.
for this i am coding as below.
******Call the SSF Function module
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = Form name
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = lv_fmname
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3
lv_partner_number = '0001000000'.
lv_name_org1 = 'Ravi'.
lv_z_no_calls_day = '5'.
lw_ctrlop-getotf = 'X'.
lw_ctrlop-no_dialog = 'X'.
lw_compop-tdnoprev = 'X'.
lw_compop-tddest = 'LP01'.
*******Call the Form Function module and get the OTF of form output
CALL FUNCTION lv_fmname
EXPORTING
name_org1 = lv_name_org1
partner_number = lv_partner_number
z_no_calls_day = lv_z_no_calls_day
control_parameters = lw_ctrlop
output_options = lw_compop
user_settings = ' '
IMPORTING
job_output_info = w_return
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
i_otf] = w_return-otfdata[.
*********Now here if i look in to the OTF data i got in debug it has the data i aniticipated along with some other data.
the output is in the format
TDPRINTCOM(2) TDPRINTPAR(70)
ST XXXX.. customer 0001000000 with
name.....
i have my data in the above format spread in three lines of the output otf table where XXXX... is some number.
***********To convert to PDF Format
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = lv_len_in
BIN_FILE =
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5
*********For testing purpose i created a file on the desktop with the the data in i_tline. it created PDF file but when i tried to open it it's giving an error.
i_objtxt = 'test with pdf-Attachment!'.
APPEND i_objtxt.
DESCRIBE TABLE i_objtxt LINES v_lines_txt.
READ TABLE i_objtxt INDEX v_lines_txt.
wa_doc_chng-obj_name = 'Smart Form'.
wa_doc_chng-obj_descr = 'Frequent Caller Alert_Day'.
wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + STRLEN( i_objtxt ).
*********Creating the Entry for the document
CLEAR i_objpack-transf_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_txt.
i_objpack-doc_type = 'RAW'.
APPEND i_objpack.
i_objbin] = i_tline[.
DESCRIBE TABLE i_objbin LINES v_lines_bin.
READ TABLE i_objbin INDEX v_lines_bin.
i_objhead = 'Frequentcaller list_Day.pdf'.
APPEND i_objhead.
************Creating the entry for the attachment.
CLEAR : i_objpack.
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'ATTACHMENT'.
i_objpack-obj_descr = 'FCA'.
i_objpack-doc_size = v_lines_bin * 255 .
APPEND i_objpack.
CLEAR i_reclist.
i_reclist-receiver = 'mail id'.
i_reclist-rec_type = 'U'.
APPEND i_reclist.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = i_objpack
object_header = i_objhead
contents_bin = i_objbin
contents_txt = i_objtxt
receivers = i_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
This is all i am doing.
It is sending a mail with the attachment but we are not able to open the attachment. it's giving an error like file is damaged and couldn't be repaired.
I serched in the forum but i couldn't get the answer.
I suspect there is a problem in getting the OTF data..
Please help me in resolving this issue....
Thanks in advance.
RKCheck the sample , and see where you made the mistake.
REPORT ZPDF_MAIl.
DATA:
w_fm_name TYPE rs38l_fnam,
w_bin_filesize TYPE i,
w_filesize TYPE i,
w_lines_txt TYPE i,
w_lines_bin TYPE i.
DATA:
wa_ctrlop TYPE ssfctrlop,
wa_outopt TYPE ssfcompop,
wa_objhead TYPE soli_tab,
wa_buffer TYPE string,
wa_doc_chng TYPE sodocchgi1.
DATA:
BEGIN OF t_mail_ids OCCURS 0,
mailid TYPE ad_smtpadr,
END OF t_mail_ids,
t_otfdata TYPE ssfcrescl,
t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
t_pdf_tab TYPE tline OCCURS 0 WITH HEADER LINE,
t_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Z195_TEST'
IMPORTING
fm_name = w_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc EQ 0.
ENDIF. " IF sy-subrc EQ 0.
wa_ctrlop-getotf = 'X'.
wa_ctrlop-no_dialog = 'X'.
wa_outopt-tdnoprev = 'X'.
CALL FUNCTION w_fm_name
EXPORTING
control_parameters = wa_ctrlop
output_options = wa_outopt
user_settings = 'X'
IMPORTING
job_output_info = t_otfdata
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc EQ 0.
ENDIF. " IF sy-subrc EQ 0.
t_otf[] = t_otfdata-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = w_bin_filesize
TABLES
otf = t_otf
lines = t_pdf_tab
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5.
IF sy-subrc EQ 0.
ENDIF. " IF sy-subrc EQ 0.
LOOP AT t_pdf_tab.
TRANSLATE t_pdf_tab USING '~'.
CONCATENATE wa_buffer t_pdf_tab INTO wa_buffer.
ENDLOOP.
TRANSLATE wa_buffer USING '~'.
DO.
t_record = wa_buffer.
APPEND t_record.
SHIFT wa_buffer LEFT BY 255 PLACES.
IF wa_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
t_objtxt = ' To Change the COR, Use the Transaction ZCOR_CHANGE'.
APPEND t_objtxt.
t_objtxt = ' Check the Attached PDF file for COR'.
APPEND t_objtxt.
DESCRIBE TABLE t_objtxt LINES w_lines_txt.
READ TABLE t_objtxt INDEX w_lines_txt.
READ TABLE t_objtxt INDEX w_lines_txt.
wa_doc_chng-obj_name = 'COR Display'.
wa_doc_chng-expiry_dat = sy-datum + 10.
CONCATENATE 'COR' "w_cornr
'-' "w_stat_descr w_action_desc
INTO wa_doc_chng-obj_descr SEPARATED BY space.
wa_doc_chng-sensitivty = 'F'.
wa_doc_chng-doc_size = w_lines_txt * 255.
CLEAR t_objpack-transf_bin.
t_objpack-head_start = 1.
t_objpack-head_num = 0.
t_objpack-body_start = 1.
t_objpack-body_num = w_lines_txt.
t_objpack-doc_type = 'RAW'.
APPEND t_objpack.
t_objpack-transf_bin = 'X'.
t_objpack-head_start = 1.
t_objpack-head_start = 1.
t_objpack-head_num = 0.
t_objpack-body_start = 1.
DESCRIBE TABLE t_objbin LINES w_lines_bin.
READ TABLE t_objbin INDEX w_lines_bin.
t_objpack-doc_size = w_lines_bin * 255 .
t_objpack-body_num = w_lines_bin.
t_objpack-doc_type = 'PDF'.
t_objpack-obj_name = 'COR'.
t_objpack-obj_descr = 'COR Test'.
* concatenate 'COR' w_cornr into t_objpack-obj_descr
* separated by space.
APPEND t_objpack.
*LOOP AT t_mail_ids.
CLEAR t_reclist.
t_reclist-receiver = 'INTENATEMAIL'.
t_reclist-rec_type = 'U'.
APPEND t_reclist.
*ENDLOOP.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = t_objpack
object_header = wa_objhead
contents_bin = t_objbin
contents_txt = t_objtxt
receivers = t_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 EQ 0.
ENDIF. -
Error when reading a pdf attachment file in sap inbox
Hi all,
I have created a RFC which sends mail from an external user to my sap inbox with attachment.
the problem is with the PDF attachment where when i received the mail in my sap inbox in sbwp, it says that there is an error that it wasnt correctly decode.
I used the class cl_document_bcs...
and used the method add_attachment...
would plz help me outthis is my code
FUNCTION ZMAIL_READ.
*"*"Local Interface:
*" IMPORTING
*" VALUE(SUBJECT) TYPE SO_OBJ_DES
*" VALUE(TEXT) TYPE STRING
*" VALUE(SENDER) TYPE ADR6-SMTP_ADDR
*" VALUE(RECEIVER) TYPE ADR6-SMTP_ADDR
*" VALUE(ATTACHMENTS) TYPE Z_T_XATTACH OPTIONAL
*" EXPORTING
*" VALUE(MESSAGE) TYPE STRING
DATA: lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
lo_bcs_send_request TYPE REF TO cl_bcs,
l_send type ADR6-SMTP_ADDR ,
l_rec type ADR6-SMTP_ADDR .
data: it_text type table of soli,
wa_text type soli.
DATA: lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
DATA: lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL.
DATA: lv_recipient_uid TYPE uname,
lv_recipient_mail TYPE adr6-smtp_addr.
data: lo_message type ref to cx_send_req_bcs value is initial,
text_val type string.
data: it_userlist type table of BAPIUSNAME,
wa_userlist type BAPIUSNAME.
data: it_selection_range type table of BAPIUSSRGE,
wa_selection_range type BAPIUSSRGE.
data: wa_attachment TYPE ZXATTACH,
attachment_sub type SO_OBJ_DES.
DATA: xstr type xstring,
str TYPE string,
str1 type string,
it_str2 type table of soli,
wa_STR2 TYPE SOLI.
DATA: LOC_CONV TYPE REF TO CL_ABAP_CONV_IN_CE,
wa_solix type solix,
it_solix type table of solix,
wa_soli type soli,
it_soli type table of soli.
data result TYPE boolean.
data: i_ext(10) type c,
i_type type soodk-objtp.
wa_text-line = text.
append wa_text to it_text.
CLASS cl_bcs DEFINITION LOAD.
try.
lo_send_request = cl_bcs=>create_persistent( ).
catch cx_send_req_bcs.
endtry.
* Message body and subject
data: lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
try.
lo_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = it_text
i_subject = subject ).
catch cx_send_req_bcs.
catch cx_document_bcs.
catch cx_address_bcs.
endtry.
loop at attachments into wa_attachment.
attachment_sub = wa_attachment-file_name.
it_str2 = wa_attachment-attach.
loop at it_str2 into wa_str2.
str1 = wa_str2-line.
try.
CALL FUNCTION 'SSFC_BASE64_DECODE'
EXPORTING
B64DATA = str1
* B64LENG =
* B_CHECK =
IMPORTING
BINDATA = xstr
* EXCEPTIONS
* SSF_KRN_ERROR = 1
* SSF_KRN_NOOP = 2
* SSF_KRN_NOMEMORY = 3
* SSF_KRN_OPINV = 4
* SSF_KRN_INPUT_DATA_ERROR = 5
* SSF_KRN_INVALID_PAR = 6
* SSF_KRN_INVALID_PARLEN = 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.
ENDIF.
catch cx_sy_dyn_call_illegal_type.
endtry.
CALL METHOD CL_ABAP_CONV_IN_CE=>CREATE
EXPORTING
INPUT = xstr
ENCODING = 'UTF-8'
* REPLACEMENT = '?'
* IGNORE_CERR = ABAP_TRUE
RECEIVING
CONV = loc_CONV.
TRY.
CALL METHOD LOC_CONV->READ
IMPORTING
DATA = STR.
CATCH CX_SY_CONVERSION_CODEPAGE.
CATCH CX_SY_CODEPAGE_CONVERTER_INIT.
CATCH CX_PARAMETER_INVALID_TYPE.
CATCH CX_PARAMETER_INVALID_RANGE.
ENDTRY.
wa_solix-line = xstr.
append wa_solix to it_solix.
wa_soli-line = str.
append wa_soli to it_soli.
endloop.
try.
CALL FUNCTION 'SA_KW_RFC_FILENAME_EXT_GET'
EXPORTING
AREA = 'IWBSOLAR'
MIMETYPE = wa_attachment-type
IMPORTING
EXTENSION = i_ext
catch cx_sy_dyn_call_illegal_type.
endtry.
i_type = i_ext.
if i_ext <> 'pdf'.
try.
lo_document->add_attachment(
EXPORTING
i_attachment_type = i_type
i_attachment_subject = attachment_sub
i_att_content_hex = it_solix ).
CATCH cx_document_bcs.
endtry.
clear wa_solix.
refresh it_solix.
else.
TRY.
CALL METHOD LO_DOCUMENT->ADD_ATTACHMENT
EXPORTING
I_ATTACHMENT_TYPE = i_type
I_ATTACHMENT_SUBJECT = attachment_sub
* I_ATTACHMENT_SIZE =
* I_ATTACHMENT_LANGUAGE = SPACE
I_ATT_CONTENT_TEXT = it_soli
* I_ATT_CONTENT_HEX =
* I_ATTACHMENT_HEADER =
CATCH CX_DOCUMENT_BCS .
ENDTRY.
ENDIF.
endloop.
try.
lo_send_request->set_document( lo_document ).
CATCH cx_send_req_bcs.
endtry.
wa_selection_range-PARAMETER = 'address'.
wa_selection_range-field = 'e_mail'.
wa_selection_range-sign = 'I'.
wa_selection_range-option = 'EQ'.
wa_selection_range-low = receiver.
append wa_selection_range to it_selection_range.
try.
CALL FUNCTION 'BAPI_USER_GETLIST'
* EXPORTING
* MAX_ROWS = 0
* WITH_USERNAME = ' '
* IMPORTING
* ROWS =
TABLES
SELECTION_RANGE = it_selection_range
* SELECTION_EXP =
USERLIST = it_userlist
* RETURN =
catch cx_sy_dyn_call_illegal_type.
endtry.
read table it_userlist into wa_userlist index 1.
try.
lo_sender = cl_cam_address_bcs=>create_internet_address( sender ).
lo_send_request->set_sender(
EXPORTING
i_sender = lo_sender ).
catch cx_send_req_bcs.
catch cx_document_bcs.
catch cx_address_bcs.
return.
endtry.
try.
lo_recipient = cl_sapuser_bcs=>create( wa_userlist-USERNAME ).
lo_send_request->add_recipient(
EXPORTING
i_recipient = lo_recipient ).
* i_express = 'X' ).
catch cx_send_req_bcs.
catch cx_document_bcs.
catch cx_address_bcs.
endtry.
try.
** Send email
LO_SEND_REQUEST->SET_SEND_IMMEDIATELY( 'X' ).
lo_send_request->send( EXPORTING
i_with_error_screen = ' '
RECEIVING
result = result ).
COMMIT WORK.
CATCH CX_DOCUMENT_BCS.
CATCH CX_SEND_REQ_BCS INTO lo_message.
CATCH CX_ADDRESS_BCS.
text_val = lo_message->IF_MESSAGE~GET_TEXT( ).
endtry.
if result = 'X'.
message = 'E-Mail sent'.
else.
message = 'E-Mail not sent'.
endif.
ENDFUNCTION. -
[N95 8GB]Out of Memory error when opening 15MB pdf...
What is the file size limit when opening a pdf file? I have a 15MB pdf file that cause 'Out of memory' error when I opened it with the PDF Reader that comes with the phone.
Thanks.Hi,
It seems that problem is file specific, so could you please share a file with me. I sending you a private message.
Regards,
Anoop -
Blank error when opening a PDF in Acrobat Standard 9
I get a Blank Error every time i try to open a PDF in Adobe Acrobat Standard 9. How do I get rid of it?
Update:
Opened the Pdf and found out that the certified signature has become invalid.
Maybe you are looking for
-
How to use DATE in the where clause
I need to select list of records from a table where available date is greater than or equal to current date. Below is the table structure and select query used to get the list of records CREATE TABLE TEMP (ITEM_ID NUMBER(20),ITEM_NAME VARCHAR2(100),C
-
Is it possible to change the placeholder '?' in PreparedStatement
PreparedStatement pstmt = con.prepareStatement("UPDATE MPLOYEES SET SALARY = ? WHERE ID = ?");here '?' is a placeholder, is it possible to change it to something like '*'
-
Will a Mac mini work with a scart to VGA adaptor? My TV doesn't have a VGA or DVI socket, but I have found an adapter on the internet, will it work with the Mac mini?
-
Thank you
-
!s by songs disappear when played
The latest iTunes issue is that, after moving all my songs to iCloud (i have iTunes Match) and removing them my Macbook, an ! shows up by the song. When I go to play the song, I am asked if I want to locate the song. I hit Cancel, the song plays, and