How to handle more than 255 char in excel att. in FM SO_DOCUMENT_SEND_API1

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.

Similar Messages

  • 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,
    Neha

    Hi 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

  • 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

  • How to handle more than 250 characters in excel attachment

    hi,
    i lokesh, actually i am sending a excel attachment through mail. i am using " SO_DOCUMENT_SEND_API1" function module, one problem what i facing is , this function module handle only 250 characters, i need to display more than 250 characters. pls any one knows about this, pls let me know.
    regards
    lokesh t

    Hi,
    Xls allows only 250 char.
    Cheers

  • 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

  • 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.

  • A field to be displayed in portal legth of 3 and r/3 more than 255 char

    Hi all,
    Kindly give me reply, I need to display one structure in portal, in this one field is of length 255 char.
    Need to change it to more than 255 characters but it should be display in portal as 3 or 5 char length only, can accept more than 255 char lengtjh.
    thanks & regards,
    Chandra sekhar.

    Hi Chandra sekhar,
    A similar kind of a probelm is explained in the link below:
    Link:
    The other requirement of displaying it as 3 - 5 chararcter field in portal can be done by creating the iView as required.
    Regards,
    Pranav.

  • 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

  • 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

  • How can i see the URL which has  length more than 255 chars in fucnction

    Hello Every body....
      I am facing one problem....I have a function module which returns URL in one table
      but in the function module display i am able to see only 255 characters,but the URL is more than 255 Characters..How can i see the URL which has the length more than 255 characters..
    In the Table the fields url length is 4000 chars.....
    but display it is showing only 255 chars.....
    Please Help me...??????????

    Hello,
    Have you tried breaking your structure into 255 chunks? I don't know what the structure you are moving from looks like, but you should be able break it back up into the SOLI structure. The end of a line in SOLI doesn't create a Carriage Return/Line Break. You have to insert these yourself like in the following:
    * Create document
          clear mail_line.
          move 'This is a test E-Mail'(d01) to mail_line.
          concatenate mail_line
                      cl_abap_char_utilities=>newline
                      into mail_line.
          append mail_line to l_mailtext.
    What kind of attachment are you wanting to create - a text tab delimited file for reading in a spreadsheet application such as excel? You might try reassembling your data table into a single string with newlines where you need them. Then use function module SCMS_STRING_TO_FTEXT to turn it back into SOLI. This is what I have done in the past. I'm afraid without knowing more about your source structure and attachment type, this is about all I can tell you.
    Vasanth

  • How to accomodate more than 255 characters in character field

    HI All
    i need to accomodate more than 255 characters in character field. How can i do that ?
    thanks in advance!!!

    Hi,
    You can try the following things:
    1. Use a datatype STRING and check it will work.
    2. In se11 transaction goto datatype and search for char* in data elements.
    You will find predefined data types ,you can make use of it.
    For eg. char2000,char3000,char4000 etc.
    Hope this will help.
    Regards,
    Nitin.

  • LINK TO URL FOR SENDING MAIL Doesnot work if more than 255 chars

    Hi Experts ,
    I am Using Link to URL to open the mail browser with details passed as below
    lv_refr = mailto:<mail_addr>?Subject=<subjectof mail>&body=<text of the mail>.
    Above one works fine as long as  length is LE 255 chars
    if length lv_refr GE 255 does not work any more . I have body (Mail text) more than 500 chars . How can go about this issue ?
    Please reply
    Patil

    >
    Matt Ferguson wrote:
    > Hi Thomas
    >
    > Got a guestion! pertaining to this URL cutting off in emails.
    >
    > The situation is that we have a workflow in which a task sends out email, in the email the URL does not display the whole link.
    > Can you help me display the whole URL when the workflow send out the EMAIL. 
    >
    > regards
    > MAtt
    The same solution that I suggested above applies here. Build your email message as a single string.  Line lenght won't matter.  Then convert the string to the binary table.  The binar table won't be restricted to 255 character line lenghts - and in fact wont' care about line lenghts at all.  Your long URL in your hyperlink will be fine.

  • 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.

  • How to embed more than 393 chars in form fields

    how to embed more than 1000 character in the field.
    I have written a xsl template which is about 2 pages in length.
    How do I embed it in the word template fields.

    1. create a new template and flag it as sub template
    2. import this in rtf using <?import:xdo://APPCODE.TEMPLATE_CODE.lang.TERR?>
    where
    APPCODE is the Application code you assigned to the subtemplate in the Template Manager. For example, if you associated this template with the Receivables application, enter "AR".
    TEMPLATE_CODE is the template Code you assigned to the subtemplate in the Template Manager. For example, AR_CommonComponents.
    lang is the two-letter ISO 639 language code for the template language you specified for the subtemplate in the Template Manager (for example, English is "en"). This entry must be lowercase.
    TERR is the two-letter ISO 3166 country code for the template territory you specified for the subtemplate in the Template Manager (for example, United States of America is "US"). This entry must be uppercase.
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for

  • How to control or manipulate a report parameter through SSRS Custom Code

    Hi, In reporting services 2005 or 2008, is it possible to control the parameters inside the custom code of a report? for example: Let's say I have a parameter that displays the following value: Red Green Blue In typical scenario I can select one of t

  • How to view Illustrator File Version in Windows XP Explorer windows

    On a Mac (Leopard or Snow Leopard) I can add a Version filter to the Finder Windows List Views so I can see what versions my Illustrator Files are saved at and I can see the version and the application that created it if I Get Info on the file. In wi

  • Mid 2010 imac as a monitor for a windows PC

    Yes I know there is an article saying it;s do-able with a minidisplay port to minidisplay port cable and putting the imac in target display mode with cmd-F2 BUT my question is, my gfx board has a display port, and I know they make displayport to mini

  • Brightness differences between Menus and Video Tracks

    I am trying to learn DVD Studio Pro 3. My project has a "roster" menu that leads to several submenus. I want an animated transition from the "roster" menu, to each of the submenus. I built each of the animations in After Effects. They all start with

  • Requisition users are not belonging to any purchasing organization

    hi friends, im using oracle 11i. as per our organization policy, requisition users should be able to make Receipts (for expense items only, not any inventory items) i.e. they will do receiving transactions. they are already assigned with Receiving re