2015 Jan 21 8:47 AM
hello,
i am picking up the attachment from ftp server and sending mail to external address but in mail the structure of the file is not as required or i can say it is changed while sending the mail any suggestion for the issue below are the inputs.
DATA : T_MAILHEX TYPE SOLI_TAB,
SOLI_TAB is CHAR 255
P.S files are also attached
thanks in advance.
2015 Jan 21 12:06 PM
Hi,
Try this (I am using cl_bcs )
The file is treated as binary data so we get every thing including control characters (http://en.wikipedia.org/wiki/Control_character)
Add the file as attachment.
FORM mail_1_prep_10
USING
it_data TYPE table
CHANGING
ob_document_bcs TYPE REF TO cl_document_bcs .
CONSTANTS: c_path type string VALUE '\\<some share>\Reqformat.txt' .
DATA: mess TYPE string .
DATA: dataset_name TYPE string .
dataset_name = c_path .
OPEN DATASET dataset_name FOR INPUT IN BINARY MODE MESSAGE mess.
DATA: bin_data TYPE xstring .
READ DATASET dataset_name INTO bin_data .
CLOSE DATASET dataset_name .
DATA: it_solix TYPE solix_tab .
CALL METHOD cl_bcs_convert=>xstring_to_solix
EXPORTING
iv_xstring = bin_data
RECEIVING
et_solix = it_solix.
DATA: attachment_subject TYPE so_obj_des .
DATA: attachment_type TYPE so_obj_tp .
CALL METHOD cl_bcs_utilities=>split_path
EXPORTING
iv_path = dataset_name
IMPORTING
ev_name = attachment_subject.
CALL METHOD cl_bcs_utilities=>split_name
EXPORTING
iv_name = attachment_subject
IMPORTING
ev_extension = attachment_type.
TRY.
CALL METHOD ob_document_bcs->add_attachment
EXPORTING
i_attachment_type = attachment_type
i_attachment_subject = attachment_subject
i_att_content_hex = it_solix.
CATCH cx_document_bcs .
ENDTRY.
ENDFORM . "mail_1_prep_10
The file retain its structure when arrived to my Outlook .
hello,
i am picking up the attachment from ftp server and sending mail to external address but in mail the structure of the file is not as required or i can say it is changed while sending the mail any suggestion for the issue below are the inputs.
DATA : T_MAILHEX TYPE SOLI_TAB,
SOLI_TAB is CHAR 255
P.S files are also attached
thanks in advance.
2015 Jan 21 10:05 AM
Hi Bhupesh,
Take the data one internal tbale with all fields as text and use below method for sending email.
TRY
.
cl_bcs_convert=>string_to_solix(
EXPORTING
iv_string = wf_string
iv_codepage = '4103' "suitable for MS Excel, leave empty
iv_add_bom = 'X' "for other doc types
IMPORTING
et_solix = i_binary_content
ev_size = wf_size ).
CATCH cx_bcs.
MESSAGE e445(so).
ENDTRY.
Regards,
Pravin
2015 Jan 21 10:50 AM
tried with dis one also but no luck issue is with the
T_MAILHEX TYPE SOLI_TAB, cuse it have line type CHAR 255
and my structure have char 1024 so for SOLI_TAB o/p it is wrapping the text that is why i m getting such pattern as per my conclusion what is your opinion.
P.S
thanks for reply
2015 Jan 21 12:06 PM
Hi,
Try this (I am using cl_bcs )
The file is treated as binary data so we get every thing including control characters (http://en.wikipedia.org/wiki/Control_character)
Add the file as attachment.
FORM mail_1_prep_10
USING
it_data TYPE table
CHANGING
ob_document_bcs TYPE REF TO cl_document_bcs .
CONSTANTS: c_path type string VALUE '\\<some share>\Reqformat.txt' .
DATA: mess TYPE string .
DATA: dataset_name TYPE string .
dataset_name = c_path .
OPEN DATASET dataset_name FOR INPUT IN BINARY MODE MESSAGE mess.
DATA: bin_data TYPE xstring .
READ DATASET dataset_name INTO bin_data .
CLOSE DATASET dataset_name .
DATA: it_solix TYPE solix_tab .
CALL METHOD cl_bcs_convert=>xstring_to_solix
EXPORTING
iv_xstring = bin_data
RECEIVING
et_solix = it_solix.
DATA: attachment_subject TYPE so_obj_des .
DATA: attachment_type TYPE so_obj_tp .
CALL METHOD cl_bcs_utilities=>split_path
EXPORTING
iv_path = dataset_name
IMPORTING
ev_name = attachment_subject.
CALL METHOD cl_bcs_utilities=>split_name
EXPORTING
iv_name = attachment_subject
IMPORTING
ev_extension = attachment_type.
TRY.
CALL METHOD ob_document_bcs->add_attachment
EXPORTING
i_attachment_type = attachment_type
i_attachment_subject = attachment_subject
i_att_content_hex = it_solix.
CATCH cx_document_bcs .
ENDTRY.
ENDFORM . "mail_1_prep_10
The file retain its structure when arrived to my Outlook .
2015 Jan 22 7:14 AM
thanks for reply i want to ask that i am pick up the file from FTP so open data set will work for ftp or not and i think
CONSTANTS: c_path type string VALUE '\\<some share>\Reqformat.txt' .
this path you are mentioning for the GUI not FTP.
2015 Jan 22 12:43 PM
Hi,
We have Microsoft windows net work and we used shared folder '\\<some share>\Reqformat.txt'
This is using UNC (http://en.wikipedia.org/wiki/Path_%28computing%29)
This works also in background job .
Assuming that when using FTP you can get the file content as binary data (bin_data) you can use the code from this point.
DATA: it_solix TYPE solix_tab .
CALL METHOD cl_bcs_convert=>xstring_to_solix
EXPORTING
iv_xstring = bin_data
RECEIVING
et_solix = it_solix.
the rest of the code......
Is the FTP server part of your local network ?
regards.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |