Hlp reqd: Urgent!!!! An Excel attachment Having recs more than 255 char len
Hi.. I am using the FM "SO_NEW_DOCUMENT_ATT_SEND_API1" for sending a outlook mail with excel sheet as an attachment.
The records having length upto 255 chars are coming properly in diff rows(which means the carriage return is considered).
But when records have more than 255 chars, then the chars exceeding 255 length are coming in a single row of excel sheet which means the carraige returns are not considered.
Hope my issue is explained clearly....request every one to provide the solution as early as possible.
Regards
Nanda
Hi Nanda,
build your XLS internal table X as usual (more then 255 char). Then format the table
X to a new one Y with line size 255. (You can do your own routine or use the FM SWA_STRING_FROM_TABL and SWA_STRING_TO_TABLE in sequence; sorry but I'm on 4.6C and didn't find a FM in order to format directly the internal table from line size XXXX to the desired line size).
sample code:
t_att_tab with line size 4000 containing the excell data with carriage return and so on
objbin with line size 255 used in FM SO_NEW_DOCUMENT_ATT_SEND_API1
data: d_string type string.
call function 'SWA_STRING_FROM_TABLE'
exporting
character_table = t_att_tab
NUMBER_OF_CHARACTERS =
line_size = 4000
KEEP_TRAILING_SPACES = ' '
CHECK_TABLE_TYPE = ' '
importing
character_string = d_string
exceptions
no_flat_charlike_structure = 1
others = 2
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
call function 'SWA_STRING_TO_TABLE'
exporting
character_string = d_string
APPEND = ' '
line_size = 255
CHECK_TABLE_TYPE = ' '
importing
character_table = objbin
TOTAL_LENGTH =
LINE_SIZE_USED =
LINES_FILLED =
LAST_LINE_LENGTH =
exceptions
no_flat_charlike_structure = 1
others = 2
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
It works!!!
Paolo
Similar Messages
-
Attach xls file with more than 255 chars
Hi all,
I'm trying to send an .xls file as attachement whose row contains more than 255 chars with FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'.
When preparing the attached table, I tried to separate the tables like this:
loop at itab.
concatenate itab-col_1 itab-col_2 itab-col_3 into it_attach
separted by cl_abap_char_utilities=>horizontal_tab.
append it_attach.
concatenate itab-col_4 itab-col_5 itab-col_6 into it_attach
separted by cl_abap_char_utilities=>horizontal_tab.
append it_attach.
concatenate IT_ATTACH cl_abap_char_utilities=>newline into it_attach.
append it_attach.
endloop.
I am able to send this xls as attachment, but when open it in excel/notepad,
it is so strange that there are so many spaces before the contents itab-col_4 which is unexpected.
It is expected that the file is tab-delimited with continuous column 1-6.
Any things went wrong?
Many Thanks!Thanks.
I tried the first method to convert the byte to string, but a short dumps is resulted,
DATA: con_tab TYPE x,
sep TYPE string.
con_tab = '09'.
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
in_xstring = con_tab
IMPORTING
out_string = sep.
so I use back my original method to concatenate the columns as suggested, i.e.
concatenate itab-col_1 tab itab-col_2 tab itab-col_3 tab into it_attach
append it_attach.
concatenate itab-col_4 tab itab-col_5 tab itab-col_6 into it_attach.
append it_attach.
concatenate it_attach cl_abap_char_utilities=>newline into it_attach.
append it_attach.
but the outcome is still the same, i.e. ...many leading space before itab-col_4
any more ideas? Many Thanks -
Send an attachment in email with length more than 255 char per line
Hi All,
I have to send an attachment in email with length more than 255 char per line. I dont want to break the line after 255 char and add it in another line.
Please suggest me any function module which can perform this.
Thank you all.I looked at all threads in the forum, there was about 5 or 6 identical questions, but surprise, nobody knows! It seems that SO_NEW_DOCUMENT_ATT_SEND_API1 function module does not allow more than 255 characters by line.
It would surprise me a lot if there is no workaround !
As it is very easy to add any binary attachment which is like a very long line, PDF for example (several kilobytes), via the function module above (lots of examples in the forum), I would advise you to try to use the same way, i.e. use the contents_bin parameter instead of the contents_txt parameter (convert the text into binary) and add the line feeds yourself (okay I know, it's not very smart).
Last thing, this function module is deprecated, and we should use BCS classes, maybe they work better. -
How to transfer data more than 255 char from excel sheet to internal table.
Hello Experts,
I have a requirement where i have a text field in the excel sheet of more than 255 char and need to be updated in the text element. To do that i need to transfer the excel sheet data to an internal table where one of the field is more than 255 char.
in the standard function module it works only upto 255 char. Can you help me if we have some other way to get more than 255 char in the internal table from excel sheet.
Thanks in Advance.
BR,
RaJ.Using .xls, it is not possible transfer data more than 255 characters from excel sheet. However if the excel sheet is saved as Comma Delimited format or Tab Delimited format, then using GUI_DOWNLOAD function module data more than 255 characters can be transferred.
File name should be : .csv (Comma Delimited format) or .txt (Tab Delimited format)
File Type would still remain 'ASC' while calling function module GUI_DOWNLOAD
Also In the internal table declare the field type as String or LCHAR.
Eg:
TYPES: begin of ty_file,
col_a TYPE string,
end of ty_file.
DATA: i_file type standard table
of ty_file
with header line
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\test.csv'
TABLES
DATA_TAB = i_file -
hi all,
Good morning.
My requirement is to send a report as an excel attatchment to the respective managers mail box. For this I am using the function module SO_DOCUMENT_SEND_API1 as follows.
call function 'SO_DOCUMENT_SEND_API1'
exporting
document_data =
put_in_outbox =
sender_address =
sender_address_type =
commit_work =
tables
packing_list =
object_header =
contents_bin =
contents_txt =
receivers =
exceptions
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
others = 8.
Here the problem is contents_bin is of type SOLISTI1 which takes max 255 characters, As my report columns occupies more than 400 characters, I am unable to get all the column values in excel attachement.
Can anyone please help me to get all the column values in the excel attachment.
Thanks in Advance.Hi,
Please check the following extract of a sample program I had executed.It deals with how to handle more that 255 chars in excel att in FM SO_DOCUMENT_SEND_API1
Hope this helps....
CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE X VALUE '09'. "OK for non Unicode
data : Begin of wa_output ,
BUFFER(1000) TYPE C, " data to be written into xls format
End of wa_output.
data : gt_output LIKE wa_output OCCURS 0 WITH HEADER LINE.
data : FIELDNAME_OFFSET TYPE I.
Attachement contents
DATA: BEGIN OF wa_att_cont.
INCLUDE STRUCTURE solisti1.
DATA: END OF wa_att_cont.
DATA: lt_att_cont LIKE wa_att_cont OCCURS 0.
data : begin of zdfies occurs 0.
include structure dfies.
data : end of zdfies.
data : begin of it_field occurs 0,
fldname(40) type c,
end of it_field.
data : yfilname like RLGRAP-FILENAME value 'C:\Documents and
Settings\'.
data : ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
data : flag type i.
********************************Variables*****************************
DATA: lv_count TYPE i, " count
lv_forwarder LIKE soud-usrnam, " Forwarder.
lv_lines TYPE i. " no of lines
********************************Structures****************************
DATA: w_doc_data LIKE sodocchgi1,
w_sent_all(1) TYPE c,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ.
******Structure for Folder ID
DATA: BEGIN OF wa_folder_id.
INCLUDE STRUCTURE soodk.
DATA: END OF wa_folder_id.
Folder Contents, change attributes
DATA: BEGIN OF wa_object_fl_change.
INCLUDE STRUCTURE sofm1.
DATA: END OF wa_object_fl_change.
******Object definition, change attributes
DATA: BEGIN OF wa_object_hd_change.
INCLUDE STRUCTURE sood1.
DATA: END OF wa_object_hd_change.
******Object ID
DATA: BEGIN OF wa_object_id.
INCLUDE STRUCTURE soodk.
DATA: END OF wa_object_id.
******Object Defintion.
DATA: BEGIN OF wa_sood.
INCLUDE STRUCTURE sood.
DATA: END OF wa_sood.
******User Definition
DATA: BEGIN OF wa_soud.
INCLUDE STRUCTURE soud.
DATA: END OF wa_soud.
******Sent to all flag.
DATA: BEGIN OF wa_sonv.
INCLUDE STRUCTURE sonv.
DATA: END OF wa_sonv.
******Mail contents
DATA: BEGIN OF wa_objcont.
INCLUDE STRUCTURE solisti1.
DATA: END OF wa_objcont.
******Mail header.
DATA: BEGIN OF wa_objhead.
INCLUDE STRUCTURE soli.
DATA: END OF wa_objhead.
******Para A
DATA: BEGIN OF wa_objpara.
INCLUDE STRUCTURE soparai1.
DATA: END OF wa_objpara.
******Para B
DATA: BEGIN OF wa_objparb.
INCLUDE STRUCTURE soparbi1.
DATA: END OF wa_objparb.
******Receivers list
DATA: BEGIN OF wa_receivers.
INCLUDE STRUCTURE somlreci1.
DATA: END OF wa_receivers.
Pack list
DATA: BEGIN OF wa_packlist.
INCLUDE STRUCTURE sopcklsti1.
DATA: END OF wa_packlist.
DATA: BEGIN OF wa_att_head.
INCLUDE STRUCTURE soli.
DATA: END OF wa_att_head.
********************internal tables******************************
DATA: lt_objcont LIKE wa_objcont OCCURS 0, "mail contents
lt_objhead LIKE wa_objhead OCCURS 0, "mail header
lt_objpara LIKE wa_objpara OCCURS 0, "Paragraph A
lt_objparb LIKE wa_objparb OCCURS 0, "Paragraph B
lt_receivers LIKE wa_receivers OCCURS 0," receiver list
lt_packlist LIKE wa_packlist OCCURS 0,"Pack list
lt_att_head LIKE wa_att_head OCCURS 0."Attachment Header
**************************Constants***********************************
CONSTANTS: lc_kreuz LIKE sonv-flag VALUE 'X', "Outbox flag,
lc_colon(1) TYPE c VALUE ':',
lc_raw(3) TYPE c VALUE 'RAW',
lc_f(1) TYPE c VALUE 'F',
lc_u(1) TYPE c VALUE 'U'.
DATA: w_cnt TYPE i.
data : wa_edition like t_edition.
DATA : i_strlen TYPE i,
i_off TYPE i ,
i_len TYPE i VALUE 254,
i_totlen TYPE i,
lv_fill_space TYPE i,
lv_split_times TYPE i,
lv_len TYPE i.
**>> Populate the attachment contents.*
LOOP AT gt_output INTO wa_output.
i_strlen = strlen( wa_output ) .
IF i_strlen LE 254.
CONCATENATE con_cret wa_output-buffer
INTO wa_output-buffer.
APPEND wa_output-buffer TO lt_att_cont.
ELSE. " i.e the data is more than 255 characters
DO 4 TIMES.
i_totlen = i_off + i_len .
IF i_totlen = 254.
wa_att_cont = wa_output+i_off(i_len).
CONCATENATE con_cret wa_att_cont
INTO wa_att_cont.
APPEND wa_att_cont TO lt_att_cont.
ELSE.
wa_att_cont = wa_output+i_off(i_len). "splitting more than 255
APPEND wa_att_cont TO lt_att_cont.
ENDIF.
IF i_totlen GE i_strlen.
CLEAR : i_off .
EXIT.
ELSE.
i_off = i_off + 254.
ENDIF.
ENDDO.
ENDIF.
CLEAR : wa_output.
ENDLOOP. -
Upload Excel file to itab with more than 255 chars
I want to upload an excel file to internal table with more than 255 characters in one of the field. However it restricts the upload to only 255 characters. Currently I am using the code
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
i_line_header = 'X'
i_tab_raw_data = wa_tab_raw_data
i_filename = p_file
TABLES
i_tab_converted_data = <fs_table>
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
where <Fs_table> is a dynamic structure in which one column is defined as string. We cannot use FM ALSM_EXCEL_TO_INTERNAL_TABLE as it has a restriction of only 50 characters and I dont want to create a Zstruture in the system.It wont work for excel file type.However, with FM Gui_Upload and use a text tab-delimited file we can upload long text.
Here is the code.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_files
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = <fs_table>
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17. -
Email attachment rows greater than 255 char get truncated
Hi
I am trying to code in 4.6C to email excel attachment with rows greater than 255, and the rows are being truncated using function module SO_NEW_DOCUMENT_ATT_SEND_API1.
I have searched the forum and can not find an actual solution to this on a 4.6c system.
Firstly is it possible to send an excel attachment with rows that have rows greater than 255, and secondly if yes have anyone seen any sample code which does this?
Many thanks
DanielHai! Check this coding out
Here the internal table l_tab_attach is temporary table which has a line size more than 255 chars.
Data: begin of l_tab_attach occurs 0,
line(300), "give what ever char length u want as a output
end of l_tab_attach
*concatenate all the header column and the its corresponding entries ie rows in this table l_tab_attach.
peform send_email table t_message
l_tab_attach
'FORM send_file_as_email_attachment TABLES pit_message
pit_attach
USING p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
CHANGING p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc,
w_new_obj_id TYPE sofolenti1-object_id,
t_objhead TYPE STANDARD TABLE OF solisti1 WITH HEADER LINE.
ld_mtitle = eml_subj.
ld_format = 'XLS'.
ld_attdescription = p_attdescription.
ld_attfilename = att_nam.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE l_tab_attach INDEX w_cnt.
w_doc_data-doc_size =
<b>( w_cnt - 1 ) * 255 + STRLEN( L_TAB_ATTACH-LINE ).</b>"this is important for lenght exceeding more that 255 char
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = pit_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE l_tab_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
REFRESH t_receivers.
LOOP AT mailto.
Add the recipients email address
CLEAR t_receivers.
t_receivers-receiver = mailto+3(48).
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
ENDLOOP.
CLEAR t_objhead.
REFRESH t_objhead.
t_objhead = att_nam.
APPEND t_objhead.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = l_tab_message
receivers = t_receivers
object_header = t_objhead
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM. " SEND_FILE_AS_EMAIL_ATTACHMENT
<b>Dont forget to give points if useful</b> -
Uploading excel file into internal table with field length more than 255
I am trying to upload the data from an excel file through function module 'TEXT_CONVERT_XLS_TO_SAP'.
I have tested by changing the field type from string, and char2000.
But it is accepting only 255 chars from the cell content.
How to get the total content of the field if it is more than 255 char.hi,
you can use any of the following procedures:
For uploading data from excel to internal table refer standard report RC1TCG3Z in se38 :
or
You can use the FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' itself. Please check if you have done it this way . But, this FM can be a little time consuming if the excel has large data, so you can use the FM u2018GUI_UPLOADu2019.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file1
i_begin_col = l_b1
i_begin_row = l_c1
i_end_col = l_b2
i_end_row = l_c2
TABLES
intern = lt_data
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE e018 DISPLAY LIKE 'i'.
ENDIF.
*---Removing the first heading fields from the file.
IF NOT lt_data[] IS INITIAL.
LOOP AT lt_data INTO lwa_data WHERE row = '0001'.
DELETE lt_data.
CLEAR lwa_data.
ENDLOOP.
*---Inserting the data from file the internal table
LOOP AT lt_data INTO lwa_data.
CASE lwa_data-col.
WHEN 1.
wa_file_wicopa-serial = lwa_data-value.
WHEN 2.
wa_file_wicopa-blart = lwa_data-value.
WHEN 3.
wa_file_wicopa-bldat = lwa_data-value.
WHEN 4.
wa_file_wicopa-budat = lwa_data-value.
ENDCASE.
AT END OF row.
APPEND wa_file_wicopa TO gt_file_wicopa.
CLEAR wa_file_wicopa.
ENDAT.
CLEAR lwa_data.
ENDLOOP.
ENDIF.
ENDIF.
or
DATA: it_test TYPE STANDARD TABLE OF alsmex_tabline WITH HEADER LINE.
DATA :v_start_col TYPE i VALUE '1',
v_start_row TYPE i VALUE '1',
v_end_col TYPE i VALUE '256',
v_end_row TYPE i VALUE '65536',
v_text TYPE repti.
* Funtion Module to upload values from excel to the Internal table
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = v_start_col
i_begin_row = v_start_row
i_end_col = v_end_col
i_end_row = v_end_row
TABLES
intern = it_test
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Or
You can use FM u201CTEXT_CONVERT_XLS_TO_SAPu201D.
DATA : i_raw TYPE truxs_t_text_data.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
i_tab_raw_data = i_raw
i_filename = p_path
TABLES
i_tab_converted_data = itab
EXCEPTIONS
conversion_failed = 1
OTHERS = 2
hope it will help u
regards
rahul -
More than 255 characters required in excel send as attachment in mail.
Hi Experts,
I have a requirement to send displayed list in an ALV report as attachment in excel through mail. I have used FM SO_DOCUMENT_SEND_API1. Now the problem is my excel data in more than 255 characters in a line. It is about 400 characters.But it is taking upto 255 characters in the internal table which is passed to parameter contents_bin . This is because the internal table is of type SOLISTI1. But the excel should hold atleast 400 characters as per my requirement. How to overcome this issue ? Please suggest me...
Regards,
SURYASay your records are exactly 400 length (I am saying 400 for sake of simplifying things, in reality record lengths can be variable and have to be calculated using STRLEN)
You will cut the first record at 255 length and put it in first row. You will put next 145 characters in 2nd row, followed by newline characters (hex 0D and 0A) at positions 146 & 147 (which indicates end of record for excel, so that it puts next record in a new excel row).
The second record will start from 148th character in second row till 255, that is 108 characters and will extend into 3rd row till 400 - 108 = 292th character followed by newline characters (hex 0D and 0A) at postions 293 & 294, followed by contents of 3rd record and so on and so forth.
If you records are of variable length you can also think of always blank padding them to create a record of such a fixed length that always your records are lesser than that and fit into it. This will leave some blank spaces at the end of each record in excel, which may be fine. -
Excel 2007 to Sql server table. Column with more than 255 characters.
Hi there,
I am facing a problem while converting data from Excel 2007 to SQL server 2005 table. I am using BIDS 2005.I have an excel file where one particular column has more than 255 characters. I use OLEDB connection for excel file as there is no driver for Excel
2007 in BIDS2005. I am using Microsoft Office 12.0 Access Database Engine OLE DB Provider for Excel file.
Next, I changed advanced properties for the column to DT_NTEXT. But when I am getting errors on execution. They are:
[OLE DB Source [1949]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E21.
[OLE DB Source [1949]] Error: Failed to retrieve long data for column "action".
[OLE DB Source [1949]] Error: There was an error with output column "action" (2046) on output "OLE DB Source Output" (1959). The column status returned was: "DBSTATUS_UNAVAILABLE".
[OLE DB Source [1949]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "output column "action" (2046)" failed because error code 0xC0209071 occurred, and the error row disposition on "output column "action"
(2046)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
Please advise on how can I deal with columns having more than 255 characters in Excel file.
Thanks!Here is what your connection string should look like for excel source
Provider
=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\temp\test.xls;Extended
Properties="EXCEL 8.0;HDR=YES";
http://sqlworkday.blogspot.com/ -
How to send text file as an email attachment havin more than 255 characters
My requirement is to generate a text file and to send this text file as E-mail attachment. I am using FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' to send the E-mail. but here the limitation is the number of characters per line must not be more than 255 characters whereas in my case it is exceeding 1000 characters per line. could anyone please suggest me what should i do now ? Each field in the text file has to be tab delimited.
Simplest might well be to use javamail API instead of the two tags that Sites provides, e.g. see email - Sending mail attachment using Java - Stack Overflow for a full example.
Phil -
Sending mail with excel more than 255 character in a line
Dears,
In my program , I use SO_NEW_DOCUMENT_ATT_SEND_API1 to send email with EXCEL attacment.
But when i want output a line more than 255 characters in the excel I met the problem, it only appeared 255 characters
describe table mailbin lines tab_lines.
mailpack-transf_bin = c_checked.
mailpack-head_start = 1.
mailpack-head_num = 1.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = c_xls.
mailpack-obj_name = space.
mailpack-obj_descr = lv_mail_title. "the excel file name
mailpack-doc_size = tab_lines * 255.
append mailpack.
* Sending the document
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = maildata
put_in_outbox = space
commit_work = c_checked
tables
packing_list = mailpack
object_header = mailhead
contents_bin = mailbin
contents_txt = mailtxt
receivers = mailrec
exceptions
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
others = 99.
But i have to output those characters in one line.
Anyone could help me?
Thanks a lot.
Sincerely,
Juliedata: objpack like sopcklsti1 occurs 2 with header line.
data: objhead like solisti1 occurs 1 with header line.
data: objbin like solisti1 occurs 10 with header line,
is_objbin type solisti1 .
data: objtxt like solisti1 occurs 10 with header line,
is_objtxt type solisti1 .
data: l_tab(1) type c value cl_abap_char_utilities=>horizontal_tab,
con_cret type c value cl_abap_char_utilities=>cr_lf.
data: tab_lines like sy-tabix,
: tab_lines1 like sy-tabix.
data : lenth_string type string,
s_string type string.
data : L type i, i type i,cplen type i, balance type i,
before describe table mailbin lines tab_lines ... Use below logic.
Loop at your_internaltable.
concatenate field_1
field_2
field_3
into lenth_string separated by l_tab.
concatenate lenth_string con_cret into lenth_string.
concatenate s_string lenth_string into s_string.
endloop.
L = strlen( s_string ).
i = 0.
cplen = 255.
balance = l.
do.
if balance <= 0.
exit.
endif.
if balance < 255.
cplen = balance.
else.
cplen = 255.
endif.
objbin = s_string+i(cplen).
i = i + cplen.
balance = balance - cplen.
append objbin.
enddo.
...... after this use ur exesting code....describe table mailbin lines tab_lines and so
describe table objbin lines tab_lines1.
clear objpack-transf_bin.
objpack-transf_bin = ' '.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = tab_lines1.
objpack-obj_langu = 'E'.
objpack-doc_type = 'XLS'.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
-tables
packing_list = objpack
object_header = objhead
contents_bin = objbin
receivers = reclist
Regards,
Sri.
Edited by: sridhar arjunan on Jul 28, 2009 4:22 PM
Edited by: sridhar arjunan on Jul 28, 2009 4:23 PM -
Anyone knows how to send a attach with more than 255 characters in 4.6c ?
Hi everyone,
i´m tring to send a email with attach , my problem is that i have a itab with 2500 characters per line,
and the FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' have the structure SOLISTI1 thats supports only 255 char. i tried to converto to PDF and XLS ,but when i open the attach only appers the first 255 char in each line only. any ideia for that issue?
Thanks,
Shimada
Edited by: Fernando Shimada on May 5, 2009 8:28 PMhere is part of my code that i tried:
first: i write the lines of my itab and after did that
CALL FUNCTION 'SAVE_LIST'
EXPORTING
list_index = '0'
TABLES
listobject = list_object.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = list_asci
listobject = list_object
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
APPEND LINES OF t_saida TO t_objbin.
DESCRIBE TABLE t_objbin LINES v_lines_ane.
second: do a alv report and tried to convert to pdf ,but the pdf have the same problem
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
it_fieldcat = t_fieldcat[]
is_layout = w_layout
is_print = wa_pr
TABLES
t_outtab = t_alv
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
w_sp = sy-msgv1.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = w_sp
no_dialog = ' '
dst_device = 'LOCL'
IMPORTING
pdf_bytecount =
TABLES
pdf = t_pdf
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK sy-subrc = 0.
Transfer the 132-long strings to 255-long strings
LOOP AT t_pdf.
TRANSLATE t_pdf USING '~'.
CONCATENATE gd_buffer t_pdf INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~'.
DO.
t_objbin = gd_buffer.
APPEND t_objbin.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Create Message Body Title and Description
t_objtxt-line = 'teste'.
APPEND t_objtxt.
DESCRIBE TABLE t_objtxt LINES v_lines_txt.
READ TABLE t_objtxt INDEX v_lines_txt.
wa_doc_chng-obj_name = 'smartform'.
wa_doc_chng-expiry_dat = sy-datum + 2.
wa_doc_chng-obj_descr = 'smartform'.
wa_doc_chng-sensitivty = 'F'.
wa_doc_chng-doc_size = v_lines_txt * 255.
Main Text
CLEAR t_objpack-transf_bin.
t_objpack-head_start = 1.
t_objpack-head_num = 0.
t_objpack-body_start = 1.
t_objpack-body_num = v_lines_txt.
t_objpack-doc_type = 'RAW'.
APPEND t_objpack.
Anexos
t_objpack-transf_bin = 'X'.
t_objpack-head_start = 1.
t_objpack-head_num = 0.
t_objpack-body_start = 1.
DESCRIBE TABLE t_objbin LINES v_lines_bin.
READ TABLE t_objbin INDEX v_lines_bin.
t_objpack-doc_size = v_lines_bin * 255 .
t_objpack-body_num = v_lines_bin.
t_objpack-doc_type = 'PDF'.
t_objpack-obj_name = 'smart'.
t_objpack-obj_descr = 'test'.
APPEND t_objpack.
CLEAR t_reclist.
t_reclist-receiver = Email.
t_reclist-rec_type = 'U'.
APPEND t_reclist.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = t_objpack
object_header = t_objhead
contents_bin = t_objbin
contents_txt = t_objtxt
receivers = t_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
WRITE:/ 'Error When Sending the File', sy-subrc.
ELSE.
WRITE:/ 'Mail sent'.
ENDIF. -
Attachment with more than 255 columns
Hi together,
i want to send a mail in background with an attachment with more than 255 columns through the function module SO_DOCUMENT_SEND_API1 . The required content-structure of this function module have 255 columns......
I try it also with the function module SO_DOCUMENT_REPOSITORY_MANAGER with the method 'SEND'
but i can't suppress the popup of this function module.
Have anybody an solution for me ?
br
Markus
Edited by: Markus Garyant on Aug 21, 2008 3:39 PMAttachement table has a strucutre SOLISTI1 which can contain only 255 characters BUT you can use the CL_ABAP_CHAR_UTILITIES=>CR_LF for the new line and CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB for the column separater.
You need to concatenate this Separters in the attachment table.
Check out this example:
http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
Regards,
Naimesh Patel -
Using in clause having more than 4000 chars in a VO.
Hi Experts,
JDEV version 11.1.1.5.0
I have a problem passing a bind variable having length of more than 4000 chars in ADF for use in a IN clause.
For e.g the query is
select user_id from employees where user_name in (
SELECT column_value
FROM TABLE (CAST (in_list_char (nvl( 'apple,oranges',user_name) ) AS ChartableType)) A)
in_list_char is function returning an array of type ChartableType.
ChartableType is a type
create or replace TYPE "CHARTABLETYPE" as table of varchar2(4000);
It works if the bind value that I pass is of length less than 4000 chars.
Anything higher it breaks and throws ORA-01460: unimplemented or unreasonable conversion requested.
Have even tried changing the ChartableType varchar2 length to 32767..but no luck.
Any help would be appreciated.Hi Timo,
I am using a in clause as the value that I pass as a bind variable is not stored anywhere in the db for me to have a join or a subselect.
It's a comma separated string (comma separated user names) for which I would need to check against the employee table to fetch the user_id's .
An alternative would be to store those values in temp table and have a join.
But then I was trying to find an alternative , either having a OR clause or UNION dynamically appended to my VO
Any help is much appreciated.
Maybe you are looking for
-
Hello... I am new in this forum, so I am sorry if I post my question in wrong place. I have php web page and want to call my java classes i.e connect java to php. My java code will read from file some info. then will organize these info. finally, the
-
Second Display with 30" Display
Is it possible to use a second display with a 30" cinema display? The card has obviously dual DVI outputs.
-
30 pin to HDMI now not supported?
I Have a 30 pin to HDMI connector and I now get the error "this device is not supported" when I plug them in. Is there a way to fix this? It just started to happen and I can not fix it.
-
Restoring backed up data after Win7 recovery
did a total recovery from the HP Support Assistant - first backed up files to external hd thru same restarted computer as instructed, am ready to put back all my stuff from the external HD - HOW DO I DO THAT PROPERLY? I look at the external and I'm
-
Seeburger help required.
Hi All, In AS2 Sender Channel for Module Key BIC we provide Parameter name as destDelimiter and provide value for example ~*.# \n I am not able to understand destDelimiter concept. Can anybody explain me with example and also provide blog for t