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
Daniel
Hai! 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>
Similar Messages
-
Sending Emails with Attachments greater than 255 chars in 4.6C
Hi,
I have a requirement in which i have to send mails with attachments greater than 255 characters. The attachment would be a tab-delimited .TXT file. Since i am working on 4.6C, i don't have the luxury of using the FM 'SCMS_STRING_TO_FTEXT'.
It's very urgent. So any help in this regards would be greatly appreciated.
Thank you.
BalajiHi,
Internal table to be passed to SOLIST1 type int, table and then compress this table using fm "table_compress" with the compressed table then call fm "table_decompress" and pass this to function module SO_NEW_DOCUMENT_ATT_SEND_API1.
Keep in mind the following variable
i_packing_list-transf_bin = 'X'.
aRs -
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. -
@ FM to send email with width greater than 128 chars
Hi
Is there a FM which would send an e-mail with width greater than 128 chars.
Z-Send_email_attachemnt would limit the witdth to 128 char due to table EMAIL_TEXT LIKE table BTCXPGLOG.
BTCXPGLOG- field- Message(128)
Thanks.Hi,
look in SE38 with BCS_EXAMPLE_*
I can use 255 char.
Regards, Dieter -
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 -
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 -
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
NandaHi 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 -
Hi all,
I have tried everything to send an excel email attachment having line size >255 using function module SO_NEW_DOCUMENT_ATT_SEND_API1 .My internal table has 22 fields which is the ouput of a report.
I have tried compressing and decompressing and everything I knew and read but have not succeded. Please give me a solution.If possible a sample code which has really worked in sending out such data.
Thanks n Regards
ArchanaI marked the wrong question as answered.
-
How to display more than 255 chars in background job with ALV Grid ????
Hi All,
I am using ALV grid with OO.
I have used call screen for ALV grid display. I have to display more than 255 characters in width. While running it, I can see the list perfectly.
But in background mode, the list is truncated after 255 chars.
Can anybody help how to send complete list(width more than 255 chars) to spool.
Thanks and Regards,
NehaHi SAP fan,
<b>YES you can run the ALV report in background mode.
To run the report in background do F9 instead of F8, then give immediate and save.
Now goto Sm35 goto job overview and view the job listed
Choose the job and press the spool button. It will show the list created on the next page. When u clcik the list u can see the ALV output.
To see this the job should be in the finished status.
How to define Periodic Jobs
1.Execute transaction SM36
2.Define Job name, Job class, Target server
3.Click on 'START CONDITION' button
4.Click on 'Date/Time' button
5.Enter Scheduled start DATE & TIME. Check mark 'Periodic Job' field. Click on 'Period values' button and select 'Hourly' or 'Dialy' or 'Weekly' or 'Monthly' or Other period and SAVE. Go back to main screen.
6.Click on 'STEPS' button and enter Program name and Variant under box 'ABAP Program'. Click on 'Print Specification' button and enter Printer name under 'Output device' and SAVE
7.Click on SAVE button until you get message on bottom of the screen that describes 'Job XYZ saved with status: Scheduled'.
8.Click on 'Job overview' button or execute SM37 transaction.
9.Select the appropriate 'Job name', 'User name', 'Job Status' & Schedule date under 'Job start condition' and click on 'Execute' button or press F8.
10.You will now see all your scheduled JOBS.
<b>Case: 2</b>
You can Run in Background but make sure it is alv list, not alv Grid FM. if you are uisng alv list not problem , but if you are using alv grid then you can code like this..
if sy-batch = ' '.
call 'REUSE_ALV_GRID_DISPLAY'.
else.
call 'REUSE_ALV_LIST_DISPLAY'.
endif.
if you are using OO alv then write this code..
CALL METHOD cl_gui_alv_grid=>offline
RECEIVING e_offline = off.
IF off IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
ENDIF.
<b>Case: 3</b>
if you are using OO ALV.
Just before creating the custom container check for the following condition.
Batch or Web Reporting
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
CREATE OBJECT o_custcontainer
EXPORTING
container_name = lc_custcontrol
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
ENDIF.
You can see the output in Spool in transaction SP01.</b>
Good Luck and thanks
AK -
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 -
Diskuse.exe crashes when path & filename is longer than 255 chars
Hi All,
I am trying to use diskuse.exe v1.3 from Win2003 Reskit to report over 1TB of data. My problem is that diskuse crashes and does not complete. Just before the crash I get an error:
WARNING: Could not get SID for g:\personalfolders\adodds\my personal data\CML late relapse\Outcome of Second Allogeneic Transplants Using Reduced Intensity Conditioning Following Relapse after an Initial Allogeneic Transplant. -- Shaw et al. 108 (11)_ 3660 -- ASH Annual Meeting Abstracts.pdf
The path and filename is longer than 255 chars which I suspect is causing the crash.
The command I am using is:
diskuse.exe g:\personalfolders /s /t /e:diskuse_errors.txt /f:diskuse_g.csv /q
Note I dont really care if some directories/files get missed in reporting if there are errors, I just want diskuse to continue and give me its best effort.
I assume this us a bug.. has anyone come across it before? any solutions or workarounds?
Late addition to the above issue...
If I run diskuse on my XP workstation against the same volume I get a drwatson error. The error codes are:
EventType : BEX P1 : diskuse.exe P2 : 0.0.0.0 P3 : 3ea0a0de
P4 : unknown P5 : 0.0.0.0 P6 : 00000000 P7 : 00000000
P8 : c0000409 P9 : 00000000 \Hi Gelliott,
We deeply understand your concern and we are sorry for the inconvenience to you.
As Microsoft continues to collect product feedback from the online ContactUs form for the product development groups, you could send your feedback to them.
Here are the channels:
Submitting suggestions for product enhancement:
Legitimate Wishes fit into the following guidelines:
• Enhancement or feature addition to existing Microsoft products
• Reproducible problem or bug with current version that needs resolution
• Cannot find documentation of feature within the help files
• Difficulty using the product
• All beta products
• Product packaging complaints
• Added accessibility feature for a Microsoft product
These can be submitted here:
http://www.microsoft.com/usability/enroll.mspx
Besides, as far as I know, there is no such a dedicated forum for Resource kit.
Thanks for the understanding.
This posting is provided "AS IS" with no warranties, and confers no rights. -
Attaching files greater than 100mb
if you purchase the full version of adobe forms central are you able to attach files greater than 100mb
However...the talk of 100MB suggests you don't actually have Acrobat. This is indeed a fixed limit if you are a subscriber to PDF Pack (CreatePDF), and the way around it is to get Acrobat.
-
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 -
Is it possible to create a Large Text Field in OCOD, more than 255 Char?
Is it possible to Create a Long Text Field (more than 255 Char Long) as like Description field in OCOD?
Not at this time.
-
Is it possible to Create a Long Text Field (more than 255 Char Long)?
Is it possible to Create a Long Text Field (more than 255 Char Long) as like Description field in Service Request Object??
Thanks!Hi
User can only create custom Long text field (255 Charcter) . Currently system does not support custom note creation
Maybe you are looking for
-
Payment wizard does not allow to increase Document Amount
Hi Experts, I'm am trying to overwrite document amount in step 6 of Payment wizard but in SAP Business One 9.0 PL 11 is not possible to increase the original Amount of Document, it is possible only to overwrite with a minor amount. Is that correct ?
-
How to save as .cvs instead of plain .txt?
Hi, I am new at the whole LabVIEW thing. I'm sorry if this was posted before, but I can't find this with search. After acquiring data, how do I create a .cvs file with timestamp (comma separated value) with LabVIEW? What VI or VIs should I use? T
-
How can I force Firefox to remember a password etc having told it "no thanks" at the beginning
The site in question does not, as far as I know, stop passwords etc from being remembered. When I first started with the site I believe I declined the option to have my password remembered. I would like to reverse that decision. Is there a way of doi
-
A scrolling field in front of a stable background.
How do you make a scrollable field in front of a stable background. I am looking to make a page that has pics and text on top of a stable background. As the background is a gradient it seems easier than just making a really long page that would make
-
Hi All, Can anyone tell me how to generate a reference to the structure dynamically without using statement 1) GENERATE SUB-ROUTINE POOL and 2) passing the referebce to field-symbol My structure fields are present in an interna