on 08-10-2009 11:33 AM
Hi everybody,
I have created an Interactive Forms where I can input any new data.
When I click on the button for save the new data, I must also convert my Interactive Form in PDF for send it as attachment to email. When I have groped to convert the interactive form in a PDF file, I lost the data that I have inserted.
So I have created a Print Form through transaction SFP.
I recall the print form in background mode and gets the form of Interactive Data and requiring as import table OTF, but the OTF table is returned to me is different from that of a smartform and so I can not use the function module u2018CONVERT_OTFu2019.
Carryover in the code, you know give me directions?
With the code I'm used to create the PDF file and attach it to email, but the files that I receive by email can not I open it, probably because of an error in formatting during its creation.
I look forward to your advice,
Davide.
Dear sirs, I can provide this program schema to send PDF print form as an email attachment. Hope it will help a bit.
FUNCTION ZPDF_MAIL_SEND.
*"----
-
""Lokální rozhraní:
*" IMPORTING
*" VALUE(PDF) TYPE FPCONTENT
*" VALUE(EMAIL) TYPE AD_SMTPADR
*"----
-
DATA lt_att_content_hex TYPE solix_tab.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = pdf
TABLES
binary_tab = lt_att_content_hex.
CLASS cl_bcs DEFINITION LOAD.
DATA:
lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
lo_send_request = cl_bcs=>create_persistent( ).
*******************************************************
Message body and subject
DATA:
lt_message_body TYPE bcsy_text VALUE IS INITIAL,
lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
CALL FUNCTION 'ZREC_MAIL_GET_BODY'
IMPORTING
message_body = lt_message_body.
******************************************************
Message document
lo_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = lt_message_body
i_subject = 'Úloha: vyplňte prosím následující formulář' ).
******************************************************
Add attachment
DATA: lx_document_bcs TYPE REF TO cx_document_bcs VALUE IS INITIAL.
TRY.
lo_document->add_attachment(
EXPORTING
i_attachment_type = 'PDF'
i_attachment_subject = 'Formulář'
I_ATTACHMENT_SIZE =
I_ATTACHMENT_LANGUAGE = SPACE
I_ATT_CONTENT_TEXT =
I_ATTACHMENT_HEADER =
i_att_content_hex = lt_att_content_hex ).
CATCH cx_document_bcs INTO lx_document_bcs.
ENDTRY.
******************************************************
Pass the document to send request
lo_send_request->set_document( lo_document ).
Create sender
DATA: lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL.
lo_sender = cl_cam_address_bcs=>create_internet_address( email ).
Set sender
lo_send_request->set_sender(
EXPORTING
i_sender = lo_sender ).
******************************************************
Create recipient
DATA:
lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL.
lo_recipient = cl_sapuser_bcs=>create( sy-uname ).
Set recipient
lo_send_request->add_recipient(
EXPORTING
i_recipient = lo_recipient
i_express = 'X' ).
lo_send_request->add_recipient(
EXPORTING
i_recipient = lo_recipient
i_express = 'X' ).
******************************************************
Send email
DATA: lv_sent_to_all(1) TYPE c VALUE IS INITIAL.
TRY.
lo_send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = lv_sent_to_all
EXCEPTIONS
OTHERS = 1 ).
CATCH cx_send_req_bcs. .
CLEANUP.
ENDTRY.
COMMIT WORK.
MESSAGE 'Formulář byl odeslán' TYPE 'I'.
ENDFUNCTION.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I recall when the interactive form to obtain FPFORMOUTPUT-PDF, the function reports an error to me with sy-subrc = 1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
I have a similar requirement.I have to send an Adobe Form as an attachment to the external email id.I am successful in sending the form as an attachment to SAP USER ID.....Please let me know what exactly needs to be done in case I want to send the same PDF file to external email address istead of SAP USER ID.
Thanks in Advance,
Sarang
Hi,
as you are calling the Print form in background, the function module which you use will return a importing parameter FORMOUTPUT in which you have a PDF element which holds your adobe form in xstring format.
so you can read FORMOUTPUT-PDF into one variable and convert to binary then send as email.
Thanks,
Madhu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.