2006 Aug 09 10:53 AM
Hi,
I've converted my smartform to PDF document using CONVERT_OTF function module. I want to send this pdf file to a fax machine. I presume I'll have to use SO_OBJECT_SEND function module to do it. Does anybody have code to do so?
Regards,
Vijay
Message was edited by: vijay srikanth
2006 Aug 09 11:00 AM
hi srikanth,
check this prog BCS_EXAMPLE_2
REPORT bcs_example_2.
* This example shows how to send
* - a simple text provided in an internal table of text lines
* - and an attached PC document (in form of text lines itab)
* - to a fax number.
*
* All activities done via facade CL_BCS!
DATA: send_request TYPE REF TO cl_bcs.
DATA: text TYPE bcsy_text.
DATA: att_text TYPE bcsy_text.
DATA: document TYPE REF TO cl_document_bcs.
DATA: sender TYPE REF TO cl_sapuser_bcs.
DATA: recipient TYPE REF TO if_recipient_bcs.
DATA: bcs_exception type ref to cx_bcs.
data: sent_to_all type os_boolean.
START-OF-SELECTION.
PERFORM main.
*---------------------------------------------------------------------*
* FORM main *
*---------------------------------------------------------------------*
FORM main.
try.
* -------- create persistent send request ------------------------
send_request = cl_bcs=>create_persistent( ).
* -------- create and set document with attachment ---------------
* create document from internal table with text
APPEND 'Hello world!' TO text.
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = text
i_length = '12'
i_subject = 'test created by BCS_EXAMPLE_2' ).
* add attachment to document
REFRESH text.
APPEND 'This is an attachment' TO text.
CALL METHOD document->add_attachment
EXPORTING i_attachment_type = 'RAW'
i_attachment_subject = 'My attachment'
i_attachment_size = '21'
i_att_content_text = text.
* add document to send request
CALL METHOD send_request->set_document( document ).
* --------- set sender -------------------------------------------
* note: this is necessary only if you want to set the sender
* different from actual user (SY-UNAME). Otherwise sender is
* set automatically with actual user.
sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD send_request->set_sender
EXPORTING i_sender = sender.
* --------- add recipient (fax) -----------------------
* create recipient - please replace fax number !!!
recipient = cl_cam_address_bcs=>create_fax_address(
i_country = 'DE'
i_number = '09999-123456' ).
* add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
* ---------- send document ---------------------------------------
CALL METHOD send_request->send(
exporting
i_with_error_screen = 'X'
receiving
result = sent_to_all ).
if sent_to_all = 'X'.
write text-003.
endif.
COMMIT WORK.
* -----------------------------------------------------------
* * exception handling
* -----------------------------------------------------------
* * replace this very rudimentary exception handling
* * with your own one !!!
* -----------------------------------------------------------
catch cx_bcs into bcs_exception.
write: 'Fehler aufgetreten.'(001).
write: 'Fehlertyp:'(002), bcs_exception->error_type.
exit.
endtry.
ENDFORM.
Message was edited by: Chandrasekhar Jagarlamudi
2006 Aug 09 11:01 AM
2006 Aug 09 11:05 AM
2006 Aug 09 11:25 AM
Hi all,
All these are just sending plain texts as faxes. I was looking at sending smartforms (specifically their PDFs) as Faxes to fax numbers. I saw this FM CONVERT_OTF_AND_FAX has anybody tried out this FM, does this work for all scenarios?
Regards,
Vijay
Message was edited by: vijay srikanth
Message was edited by: vijay srikanth