on 04-03-2008 7:04 AM
Hi,
Can anyone tell me how to send the smartform output through fax?If possible can you send me a sample program for that?
Regards,
Hema
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have used FM's 'CONVERT_OTF_AND_FAX' and 'SO_OBJECT_SEND' to send the smartform o/p through fax.The first one is working fine.But for the second function module,the sy-subrc value is showing 9.
Even then I am able to send the o/p through fax.But the document is not coming in PDF format.It is coming in raw format.
Can anyone tell me why this is happening?
Regards,
Hema
Hi,
this is a standard include call these in your program it is used for FAX purpose.
Refer this sample code for using FM so_object_Send
*&---------------------------------------------------------------------*
*& Report Z_EMAIL
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT Z_EMAIL.
DATA: X_OBJECT_TYPE LIKE SOOD-OBJTP.
DATA: BEGIN OF X_OBJECT_HD_CHANGE.
INCLUDE STRUCTURE SOOD1.
DATA: END OF X_OBJECT_HD_CHANGE.
DATA: BEGIN OF X_OBJCONT OCCURS 10.
INCLUDE STRUCTURE SOLI.
DATA: END OF X_OBJCONT.
DATA: BEGIN OF X_OBJHEAD OCCURS 0.
INCLUDE STRUCTURE SOLI.
DATA: END OF X_OBJHEAD.
DATA: BEGIN OF RAW_HEAD.
INCLUDE STRUCTURE SORH.
DATA: END OF RAW_HEAD.
DATA: BEGIN OF X_RECEIVERS OCCURS 0.
INCLUDE STRUCTURE SOOS1.
DATA: END OF X_RECEIVERS.
PARAMETERS: RECEIVER LIKE X_RECEIVERS-RECNAM. " Name
*BUILD MESSAGE HEADER
MOVE 'Sort field goes here' TO X_OBJECT_HD_CHANGE-OBJSRT. " Sort field
MOVE 'Name of the object goes here' TO X_OBJECT_HD_CHANGE-OBJNAM. " Name
MOVE 'Document title goes here' TO X_OBJECT_HD_CHANGE-OBJDES. " Title
MOVE 'F' TO X_OBJECT_HD_CHANGE-OBJSNS. " Functional OBJECT
MOVE 'E' TO X_OBJECT_HD_CHANGE-OBJLA. " Language
* Object type of the new document
MOVE 'RAW' TO X_OBJECT_TYPE.
CLEAR X_OBJCONT.
MOVE 'Contents of mail' TO X_OBJCONT-LINE.
APPEND X_OBJCONT.
CLEAR X_OBJCONT-LINE. APPEND X_OBJCONT.
MOVE 'More contents' TO X_OBJCONT-LINE.
APPEND X_OBJCONT.
MOVE 'Still more contents'
to x_objcont-line.
APPEND X_OBJCONT.
MOVE ' ' TO X_OBJCONT-LINE.
APPEND X_OBJCONT.
* Specific header (Dependent on the object type, here RAW)
REFRESH X_OBJHEAD.
DESCRIBE TABLE X_OBJCONT LINES RAW_HEAD-RAWSIZ.
MOVE RAW_HEAD TO X_OBJHEAD.
APPEND X_OBJHEAD.
*RECEIVERS table
CLEAR X_RECEIVERS.
REFRESH X_RECEIVERS.
MOVE RECEIVER TO X_RECEIVERS-RECNAM. " Name
MOVE 'B' TO X_RECEIVERS-RECESC. " Receiver type
MOVE 'X' TO X_RECEIVERS-SNDCP. " Send as a copy
MOVE 'X' TO X_RECEIVERS-SNDEX. " EXPRESS DOCUMENT
APPEND X_RECEIVERS.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
* folder_id = 'OUTBOX'
* forwarder = x_forwarder
* object_fl_change = x_object_fl_change
OBJECT_HD_CHANGE = X_OBJECT_HD_CHANGE
* object_id = x_object_id
OBJECT_TYPE = X_OBJECT_TYPE
OUTBOX_FLAG = 'X'
OWNER = SY-UNAME
* store_flag = x_store_flag
* importing
* object_id_new = x_object_id_new
* sent_to_all = x_sent_to_all "May need to use
TABLES
OBJCONT = X_OBJCONT
OBJHEAD = X_OBJHEAD
* objpara = x_objpara
* objparb = x_objparb
RECEIVERS = X_RECEIVERS.
Regards
Sandipan
Hi Sandipan,
I have used this code in my program.It is giving sy-subrc value as 9 after executing the function module SO_OBJECT_SEND.
I don't know why this is happening.I have changed my program several times.But still I am getting this error.Could you please tell me any solution for this?
Regards,
Hema
Hi,
Can you check my code once.
form send_fax TABLES p_lt_tline structure tline
p_lt_itcpp structure itcpp
p_lt_otf structure itcoo
USING p_lv_telfx.
DATA: lt_tline TYPE TABLE OF tline WITH HEADER LINE,
lt_otf TYPE TABLE OF itcoo WITH HEADER LINE.
DATA: lt_record TYPE TABLE OF solisti1 WITH HEADER LINE,
lt_objpack TYPE TABLE OF sopcklsti1 WITH HEADER LINE, "For
"packing list for main document
lt_objtxt TYPE TABLE OF solisti1 WITH HEADER LINE, "To hold the
"message body of the email
lt_objbin TYPE TABLE OF solisti1 WITH HEADER LINE, "To hold
"the attachment data text of the email
lt_reclist TYPE TABLE OF somlreci1 WITH HEADER LINE. "For
"reciever information
Variables declaration
DATA: lv_binfile TYPE i.
Work area declarations
DATA: ls_originator TYPE SOOS1-RECEXTNAM,
ls_orinator_type TYPE SOOS1-RECESC,
ls_doc_chng TYPE sodocchgi1,
ls_buffer TYPE string. "To convert from 132 to 255
CONSTANTS: c_raw TYPE so_obj_tp VALUE 'RAW',
c_pdf TYPE so_obj_tp VALUE 'PDF',
c_255 TYPE i VALUE 255,
c_134 TYPE i VALUE 134,
c_x TYPE c VALUE 'X'.
DATA: X_OBJECT_TYPE LIKE SOOD-OBJTP.
DATA: BEGIN OF X_OBJECT_HD_CHANGE.
INCLUDE STRUCTURE SOOD1.
DATA: END OF X_OBJECT_HD_CHANGE.
DATA: lt_object_hd_change TYPE STANDARD TABLE OF SOOD1 WITH HEADER LINE.
DATA: ls_object_hd_change TYPE SOOD1.
DATA: BEGIN OF X_OBJCONT OCCURS 10.
INCLUDE STRUCTURE SOLI.
DATA: END OF X_OBJCONT.
DATA: lt_objcont TYPE STANDARD TABLE OF SOLI WITH HEADER LINE.
DATA: BEGIN OF X_OBJHEAD OCCURS 0.
INCLUDE STRUCTURE SOLI.
DATA: END OF X_OBJHEAD.
DATA: BEGIN OF RAW_HEAD.
INCLUDE STRUCTURE SORH.
DATA: END OF RAW_HEAD.
DATA: BEGIN OF X_RECEIVERS OCCURS 0.
INCLUDE STRUCTURE SOOS1.
DATA: END OF X_RECEIVERS.
DATA: BEGIN OF X_PACKING OCCURS 0.
INCLUDE STRUCTURE SOXPL.
DATA: END OF X_PACKING.
DATA: RECEIVER LIKE X_RECEIVERS-RECNAM.
data: begin of off_obj.
include structure soodk.
data: end of off_obj.
*DATA: lt_off_obj LIKE STANDARD TABLE OF off_obj.
DATA: lv_lines TYPE i.
data: boolean(1) type c.
DATA: ok LIKE boolean,
msgid type symsgid,
msgno type symsgno,
msgv1 type symsgv,
msgv2 type symsgv,
msgv3 type symsgv,
msgv4 type symsgv.
p_lt_itcpp-tddevice = 'TELEFAX' .
p_lt_itcpp-tdtelenum = p_lv_telfx .
CALL FUNCTION 'CONVERT_OTF_AND_FAX'
EXPORTING
faxoptions = p_lt_itcpp
user = sy-uname
IMPORTING
FAX_OK = ok
OFFICE_OBJID = off_obj
MSGID = msgid
MSGNO = msgno
MSGV1 = msgv1
MSGV2 = msgv2
MSGV3 = msgv3
MSGV4 = msgv4
tables
otf = p_lt_otf[].
*MOVE 'Sort field goes here' TO X_OBJECT_HD_CHANGE-OBJSRT. " Sort field
*MOVE 'Advance shipment notification' TO X_OBJECT_HD_CHANGE-OBJNAM.
*"Name
*MOVE 'Advance shipment notification' TO X_OBJECT_HD_CHANGE-OBJDES.
*"Title
*MOVE 'F' TO X_OBJECT_HD_CHANGE-OBJSNS. " Functional OBJECT
*MOVE 'E' TO X_OBJECT_HD_CHANGE-OBJLA. " Language
MOVE 'RAW' TO X_OBJECT_TYPE.
LOOP AT p_lt_tline.
TRANSLATE p_lt_tline USING '~'.
CONCATENATE ls_buffer p_lt_tline INTO ls_buffer.
ENDLOOP.
TRANSLATE ls_buffer USING '~'.
DO.
lt_record = ls_buffer.
APPEND lt_record.
SHIFT ls_buffer LEFT BY 255 PLACES.
IF ls_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
REFRESH: lt_reclist,
lt_objtxt,
lt_objbin,
lt_objpack.
lt_objcont[] = lt_record[].
x_objhead = 'Advance shipment notification'.
APPEND x_objhead.
DESCRIBE TABLE x_objhead LINES lv_lines.
READ TABLE x_objhead INDEX lv_lines.
*ls_doc_chng-obj_name = 'Advance shipment notification'.
*ls_doc_chng-obj_descr = 'Advance shipment notification'.
*ls_doc_chng-sensitivty = 'F'.
*ls_doc_chng-doc_size = lv_lines * 255 .
*MOVE 'Sort field goes here' TO ls_OBJECT_HD_CHANGE-OBJSRT. " Sort field
MOVE 'Advance shipment notification' TO ls_OBJECT_HD_CHANGE-OBJNAM.
"Name
MOVE 'Advance shipment notification' TO ls_OBJECT_HD_CHANGE-OBJDES.
"Title
MOVE 'F' TO ls_OBJECT_HD_CHANGE-OBJSNS. " Functional OBJECT
MOVE 'E' TO ls_OBJECT_HD_CHANGE-OBJLA. " Language
ls_object_hd_change-objlen = lv_lines * 255.
CLEAR X_PACKING-transf_bin.
X_PACKING-head_start = 1.
X_PACKING-head_num = 0.
X_PACKING-body_start = 1.
X_PACKING-body_num = lv_lines.
X_PACKING-objtp = c_raw.
X_PACKING-objlen = ls_object_hd_change-objlen.
APPEND X_PACKING.
APPEND lt_objcont.
CLEAR lt_objcont.
DESCRIBE TABLE lt_objcont LINES lv_lines.
READ TABLE lt_objcont INDEX lv_lines.
X_PACKING-transf_bin = c_x.
X_PACKING-head_start = 1.
X_PACKING-head_num = 1.
X_PACKING-body_start = 1.
X_PACKING-body_num = lv_lines.
X_PACKING-objtp = c_pdf.
*X_PACKING-obj_name = 'text1'.
X_PACKING-objdes = 'Advance shipment notification'.
*lt_objpack-doc_size = lv_lines * 255 + STRLEN( lt_objbin ).
X_PACKING-objlen = lv_lines * 255 + STRLEN( lt_objcont ).
APPEND X_PACKING.
CLEAR X_RECEIVERS.
REFRESH X_RECEIVERS.
MOVE p_lv_telfx TO X_RECEIVERS-RECNAM. " Name
MOVE 'B' TO X_RECEIVERS-RECESC. " Receiver type
MOVE 'X' TO X_RECEIVERS-SNDCP. " Send as a copy
MOVE 'X' TO X_RECEIVERS-SNDEX. " EXPRESS DOCUMENT
APPEND X_RECEIVERS.
*lt_reclist-receiver = p_lv_telfx.
*lt_reclist-rec_type = 'U'.
*lt_reclist-com_type = 'FAX'.
*lt_reclist-notif_del = c_x.
*lt_reclist-notif_ndel = c_x.
*APPEND lt_reclist.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
FOLDER_ID = ' '
FORWARDER = ' '
OBJECT_FL_CHANGE = ' '
OBJECT_HD_CHANGE = ls_object_hd_change
OBJECT_ID = ' '
OBJECT_TYPE = 'RAW'
OUTBOX_FLAG = 'X'
OWNER = SY-UNAME
STORE_FLAG = ' '
DELETE_FLAG = ' '
SENDER = ' '
CHECK_SEND_AUTHORITY = ' '
CHECK_ALREADY_SENT = ' '
GIVE_OBJECT_BACK =
ORIGINATOR = ls_originator
ORIGINATOR_TYPE = 'B'
LINK_FOLDER_ID = ' '
SEND_REQUEST_OID = ' '
IP_ENCRYPT = 'U'
IP_SIGN = 'U'
IP_REC_COUNT_ADD =
IMPORTING
OBJECT_ID_NEW =
SENT_TO_ALL =
ALL_BINDING_DONE =
OFFICE_OBJECT_KEY =
ORIGINATOR_ID =
E_SEND_REQUEST_OID =
TABLES
OBJCONT = lt_objcont
OBJHEAD = x_objhead
OBJPARA =
OBJPARB =
RECEIVERS = X_RECEIVERS
PACKING_LIST = X_PACKING
ATT_CONT =
ATT_HEAD =
NOTE_TEXT =
LINK_LIST =
APPLICATION_OBJECT =
EXCEPTIONS
ACTIVE_USER_NOT_EXIST = 1
COMMUNICATION_FAILURE = 2
COMPONENT_NOT_AVAILABLE = 3
FOLDER_NOT_EXIST = 4
FOLDER_NO_AUTHORIZATION = 5
FORWARDER_NOT_EXIST = 6
NOTE_NOT_EXIST = 7
OBJECT_NOT_EXIST = 8
OBJECT_NOT_SENT = 9
OBJECT_NO_AUTHORIZATION = 10
OBJECT_TYPE_NOT_EXIST = 11
OPERATION_NO_AUTHORIZATION = 12
OWNER_NOT_EXIST = 13
PARAMETER_ERROR = 14
SUBSTITUTE_NOT_ACTIVE = 15
SUBSTITUTE_NOT_DEFINED = 16
SYSTEM_FAILURE = 17
TOO_MUCH_RECEIVERS = 18
USER_NOT_EXIST = 19
ORIGINATOR_NOT_EXIST = 20
X_ERROR = 21
OTHERS = 22
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " send_fax
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.