on 10-28-2010 6:19 AM
Hi ,
I am fetching smartform out from spool to string variable by using FM 'RSPO_RETURN_SPOOLJOB' and i am creating
reference and adding as attachment as shown below . My problem is i am not able to see the smartform out put data into my
attached pdf file . The attachment is coming as pdf but after double clicking on it showing error message as DATA CAN'T BE READ or FILE DAMAGE ERROR .Please help if any one knows about it.
I tried FM CONVERT_OTFSPOOLJOB_2_PDF for converting to PDF but it did not work .
DATA : pick_data TYPE soli_tab .
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = ls_spoolid
first_line = 1
last_line = 0
desired_type = 'RAW'
TABLES
buffer = lt_string.
LOOP AT lt_string INTO ls_string .
APPEND ls_string TO pick_data.
ENDLOOP.
APPEND 'Hello world!' TO lv_string1.
"creates reference for attachment
TRY.
CALL METHOD cl_document_bcs=>create_document
EXPORTING
i_type = 'PDF'
i_subject = 'Testing'
i_length = '12'
i_text = lv_string1
RECEIVING
result = lv_document
.
CATCH cx_document_bcs .
ENDTRY.
"Add attachment to mail
"----------------------------------------------------------------
"Adds the attachment to reference
TRY.
lv_document->add_attachment(
i_attachment_type = 'PDF'
i_attachment_subject = 'test_attachment'
* i_attachment_size = size
i_att_content_text = pick_data ). " changes pick_date to binary_content
CATCH cx_document_bcs .
ENDTRY.
Regards
Chetan
Edited by: kishan P on Oct 28, 2010 10:55 AM
Hi,
See sample program BCS_EXAMPLE_8 in SAP Note #1324547. You must use the BIN_FILE parameter when calling CONVERT_OTFSPOOLJOB_2_PDF.
Regards,
Aidan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Got the solution . But after double clicking on PDF file it is showing smartform output by 10 times more pages than usal pages.ie instead showing 3 pages it is showing same 3 pages 10 times.
Regards
Chetan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is the working code.
Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
Edited by: Rob Burbank on Oct 29, 2010 12:10 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check this link [http://wiki.sdn.sap.com/wiki/display/Snippets/ConvertsspoolrequestintoPDFdocumentand+emails]
BR,
Lokeswari.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.