on 08-21-2007 4:55 PM
Hi all,
Iam using the function module SO_DOCUMENT_SEND_API1 to email purchase order through driver program.
the code goes like this:
first iam calling the function module of smartform
CALL FUNCTION lv_fm_name
where iam passing the desired paramets.
from where iam taking the otfdata returned from the fm
like:
IMPORTING
job_output_info = w_return
where w_return is declared as TYPE ssfcrescl.
then iam writing this code
i_otf[] = w_return-otfdata[].
DELETE w_return-otfdata WHERE tdprintcom = '//'.
READ TABLE i_otf WITH KEY tdprintcom = 'EP'.
my_tabix = sy-tabix + 1.
INSERT lines of w_return-otfdata INTO i_otf INDEX my_tabix.
then iam calling the fm
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
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.
then converting it to 255 using
DATA: gd_buffer TYPE string.
DATA: w_cnt TYPE i,
i_record LIKE solix OCCURS 0 WITH HEADER LINE.
LOOP AT i_tline.
TRANSLATE i_tline USING ' ~'.
CONCATENATE gd_buffer i_tline INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
i_record-line = gd_buffer.
APPEND i_record.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
the to test whether its converting into pdf iam using the fm
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = bin_filesize
filename = 'C:\TESTPDF.PDF'
filetype = 'BIN'
TABLES
data_tab = i_record.
then calling my main fm
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_chng
put_in_outbox = 'X'
sender_address = sender
sender_address_type = 'INT'
commit_work = 'X'
TABLES
packing_list = it_packing_list
object_header = w_objhead
CONTENTS_BIN = I_OBJBIN
contents_txt = i_objtxt
contents_hex = i_objbin
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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
all the parametrs for the above fm are passed correctly like populating it_packing_list,w_objhead, i_objtxt, i_objbin,it_receivers.iam using this fm because i need to pass sender email id.
the first problem iam facing is when iam using the fm gui_download iam not able to view the smartform
the error is "adobe reader could not open "test.pdf" as it is not supported etc..."
second is same problem iam facing while trying to open the attachment in pdf which is emailed to reciever.
i think there is some problem in converting 132 to 255 characters.
can some one please help on this.(might be a problem where iam passing DO
i_record-line = gd_buffer.)
thanks in advance.
regards
sunil
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = <b>255 "132</b>
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
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.
I guess it will solve your problem.
CLose the thread if your question is answered.
Regards,
SaiRam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks sairam for your feedback.
i have tried ur changes and when iam passing the contents of i_tline to
contents_hex table of SO_DOCUMENT_SEND_API1.Iam getting an error or the pdf is coming empty.
Please give ur suggestions as how can we correctly convert the contents of i_tline which is of type tline structure (tdformat dt char2,tdline char 132) to contents_hex which is of type solix structure(line,DT raw255).
thanks
Sunil
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.