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,
Julie

data: 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

Similar Messages

  • SendMail: can not send mail with body more than 1000 caracters

    Hi,
    I can not send mail with a body wich is more than 1000 caracters.
    FUNCTION SendMail(SMTPServerName IN STRING,                     
                        Sender IN STRING,                     
                        Recipient IN STRING,                     
                        CcRecipient IN STRING,                     
                        BccRecipient IN STRING,                     
                        Subject IN STRING,                     
                        Body IN STRING,                     
                        ErrorMessage OUT STRING,                     
                        Attachments IN ATTACHMENTS_LIST) RETURN NUMBER IS      
                        AttachmentList VARCHAR2(4000) := '';      
                        AttachmentTypeList VARCHAR2(2000) := '';   
                          BEGIN       ParseAttachment(Attachments,                      
                                                      AttachmentList);      
                                      RETURN JSendMail(SMTPServerName,
                                                       Sender,                       
                                                       Recipient,                       
                                                       CcRecipient,                       
                                                       BccRecipient,                       
                                                       Subject,                       
                                                       Body,                       
                                                       ErrorMessage,                       
                                                       AttachmentList); 

    Hi,
    I can not send mail with a body wich is more than 1000 caracters.
    FUNCTION SendMail(SMTPServerName IN STRING,                     
                        Sender IN STRING,                     
                        Recipient IN STRING,                     
                        CcRecipient IN STRING,                     
                        BccRecipient IN STRING,                     
                        Subject IN STRING,                     
                        Body IN STRING,                     
                        ErrorMessage OUT STRING,                     
                        Attachments IN ATTACHMENTS_LIST) RETURN NUMBER IS      
                        AttachmentList VARCHAR2(4000) := '';      
                        AttachmentTypeList VARCHAR2(2000) := '';   
                          BEGIN       ParseAttachment(Attachments,                      
                                                      AttachmentList);      
                                      RETURN JSendMail(SMTPServerName,
                                                       Sender,                       
                                                       Recipient,                       
                                                       CcRecipient,                       
                                                       BccRecipient,                       
                                                       Subject,                       
                                                       Body,                       
                                                       ErrorMessage,                       
                                                       AttachmentList); 

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

    Hi,
    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

  • Need help in EMAIL Sending -  more than 255 character length

    Hi Guys,
    Please help me in sending the Email attachment which has more than 255 character lengh using 'TXT format.
    if i create an internal table having a field of type char225.
    then break ur each record into many parts having len <= 255.
    how can i mingle both lines to single line in the output list.
    Please help me ..
    thanks in advance..
    Prabhu

    Hi,
    Check the following link:
    http://www.sap-img.com/abap/sending-email-with-attachment.htm
    Regards,
    Bhaskar

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

  • Sending mail with excel attachment-improper format

    Dear experts,
    I am sending a mail to outlook with an excel attachment. The mail is sent with attachment and the data, but all in one cell.
    I am using SO_NEW_DOCUMENT_ATT_SEND_API1. What parameters do i need to manipulate to have data in different columns of excel? I am using "packing_list" table of FM. But dont know the exact parameters to be passed. Can anyone help with the same please?
    Best regards and thanks!
    Sumit Nene.

    Hello Sumit,
    I am using same function module to send mail with excel attachment.
    Below I am attaching my own code for your reference.
    Data which u want to add in excel file is maintain in IT_OBJBIN i.e. document information.
    CLEAR :IMESSAGE,IT_OBJBIN,IT_OBJPACK,IT_RECLIST.
    REFRESH: IMESSAGE[ ] , IT_OBJBIN[ ]  , IT_OBJPACK[ ] ,  IT_RECLIST[ ].
    " populate the text for body of the mail
    CLEAR WA_IMESSAGE.
    CONCATENATE    'Board : ' P_BOARD ':' 'Please find  the excel attached for the list of Material whose routing is created'   INTO WA_IMESSAGE-LINE.
      APPEND WA_IMESSAGE TO IMESSAGE.
    "document information
      W_DOC_CHNG-OBJ_NAME = 'Excel'.
      IF NOT P_BOARD IS INITIAL.
        CONCATENATE    'Board : ' P_BOARD ':' 'List Of Routing Materials' INTO  W_DOC_CHNG-OBJ_DESCR.
      ELSE.
        CONCATENATE     'List Of' ' Routing Materials' INTO  W_DOC_CHNG-OBJ_DESCR.
      ENDIF.
      W_DOC_CHNG-SENSITIVTY = 'F'.  " ->Functional object
      " displaying  material , plant in the excel
      CONCATENATE 'BOARD NO : ' P_BOARD INTO WA_OBJBIN.
      APPEND WA_OBJBIN TO IT_OBJBIN.
      CONCATENATE 'MATERIAL' 'PLANT' 'DESCRIPTION' INTO WA_OBJBIN SEPARATED BY C_TAB.
      CONCATENATE C_RET WA_OBJBIN INTO WA_OBJBIN.
      APPEND WA_OBJBIN TO IT_OBJBIN.
      CLEAR : WA_OBJBIN.
      LOOP AT IT_DOWNLOAD INTO WA_DOWNLOAD. "It_orders is the internal table to be transferred to excel
        CONCATENATE WA_DOWNLOAD-MATNR WA_DOWNLOAD-WERKS WA_DOWNLOAD-DESC INTO WA_OBJBIN SEPARATED BY C_TAB.
        CONCATENATE C_RET WA_OBJBIN INTO WA_OBJBIN.
        APPEND WA_OBJBIN TO IT_OBJBIN.
      ENDLOOP.
      DESCRIBE TABLE IT_OBJBIN LINES V_LINES_BIN.   " no of lines for excel data
      " pack the data as RAW
      CLEAR WA_IT_OBJPACK-TRANSF_BIN.                     "Obj. to be transported not in binary form
      WA_IT_OBJPACK-HEAD_START = 1.                   "Start line of object header in transport packet
      WA_IT_OBJPACK-HEAD_NUM = 0.                     "Number of lines of an object header in object packet
      WA_IT_OBJPACK-BODY_START = 1.                   "Start line of object contents in an object packet
      WA_IT_OBJPACK-BODY_NUM = MESSAGE_LINES.         "Number of lines of the mail body
      WA_IT_OBJPACK-DOC_TYPE = 'RAW'.
      APPEND WA_IT_OBJPACK TO IT_OBJPACK.
      " pack the data as excel
      WA_IT_OBJPACK-TRANSF_BIN = 'X'.
      WA_IT_OBJPACK-HEAD_START = 1.
      WA_IT_OBJPACK-HEAD_NUM = 1.
      WA_IT_OBJPACK-BODY_START = 1.
      WA_IT_OBJPACK-BODY_NUM = V_LINES_BIN.         "no of lines of it_orders to give no of unprocessed orders
      WA_IT_OBJPACK-DOC_TYPE = 'XLS'.   " ->  excel fomat
      WA_IT_OBJPACK-OBJ_NAME = 'EXCEL ATTACHMENT'.
      " attachment name
      IF NOT P_BOARD IS INITIAL.
        CONCATENATE P_BOARD '.XLS' INTO WA_IT_OBJPACK-OBJ_DESCR.
      ELSE.
        CONCATENATE 'LIST' '.XLS' INTO WA_IT_OBJPACK-OBJ_DESCR.
      ENDIF.
      WA_IT_OBJPACK-DOC_SIZE = V_LINES_BIN * 255.
      APPEND WA_IT_OBJPACK TO IT_OBJPACK.
      " creating email id
      DATA: STR1 TYPE STRING,
          STR2 TYPE STRING,
          STR3 TYPE STRING,
          ITAB TYPE TABLE OF STRING.
      DATA : WA_I LIKE LINE OF ITAB.
      SPLIT P_EMAIL AT ',' INTO: TABLE ITAB.
    e-mail receivers.
      CLEAR WA_IT_RECLIST.
      LOOP AT ITAB INTO WA_I.
        WA_IT_RECLIST-RECEIVER = WA_I.
      WA_IT_RECLIST-RECEIVER = V_MAILADDR.
        WA_IT_RECLIST-EXPRESS =  'X'.
        WA_IT_RECLIST-REC_TYPE = 'U'. "->  Internet address
        APPEND WA_IT_RECLIST TO IT_RECLIST.
        CLEAR WA_IT_RECLIST.
      ENDLOOP.
      " sending mail
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA                    = W_DOC_CHNG
         PUT_IN_OUTBOX                    = 'X'
         COMMIT_WORK                      = 'X'
       IMPORTING
         SENT_TO_ALL                      =
         NEW_OBJECT_ID                    =
        TABLES
          PACKING_LIST                     = IT_OBJPACK
         OBJECT_HEADER                    =
         CONTENTS_BIN                      = IT_OBJBIN
         CONTENTS_TXT                      = IMESSAGE
         CONTENTS_HEX                     =
         OBJECT_PARA                      =
         OBJECT_PARB                      =
          RECEIVERS                        = IT_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
      COMMIT WORK.
      IF SY-SUBRC = 0.
        MESSAGE I001 WITH 'Routing is Created for Board' P_BOARD 'and Mail send on e-mail id :' P_EMAIL.
      ENDIF.

  • Problem in excel format while sending mail with excel attachment.

    Hi Gurus ,
    I am sending a email with Excel attachment using FM SO_DOCUMENT_SEND_API1 or SO_NEW_DOCUMENT_ATT_SEND_API1.
    I am able to send a mail with excel attachment with a piece of code which I got from SDN itself.
    But the problem is when I am trying to open the attachment, <b>A pop up comes which says that it is not in recognizable format. Would you like to open it?
    and several other lines of caution.</b>
    When i choose to open it, i get the correct data in one excel sheet. Certain vertical lines of the excel sheet is missing. <b>But no data is missing. </b>
    I am attaching the code below. Can any one please tell me where is the problem in this code ?
    Thanx in advance
    types: begin of t_mara,
    matnr type mara-matnr,
    matkl type mara-matkl,
    mtart type mara-mtart,
    meins type mara-meins,
    end of t_mara.
    data: gt_mara type table of t_mara,
    wa_mara like line of gt_mara,
    it_packing_list type table of SOPCKLSTI1,
    wa_packing_list like line of it_packing_list,
    it_receivers type table of SOMLRECI1,
    wa_receivers like line of it_receivers,
    it_mailbody type table of SOLISTI1,
    wa_mailbody like line of it_mailbody,
    it_attachment type table of SOLISTI1,
    wa_attachment like line of it_attachment.
    data: la_doc type SODOCCHGI1.
    constants:
    con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
    con_cret type c value cl_abap_char_utilities=>CR_LF.
    * get material
    select matnr matkl mtart meins
    into table gt_mara
    from mara
    up to 25 rows.
    * Populate the subject/generic message attributes
    la_doc-obj_langu = sy-langu.
    la_doc-obj_descr = 'Material Details' . "Mail Header
    la_doc-sensitivty = 'F'.
    la_doc-doc_size = 1.
    * Add the recipients email address
    CLEAR wa_receivers.
    REFRESH it_receivers.
    wa_receivers-receiver = 'PCSDEVL'.
    wa_receivers-rec_type = 'U'.
    wa_receivers-com_type = 'INT'.
    wa_receivers-notif_del = 'X'.
    wa_receivers-notif_ndel = 'X'.
    APPEND wa_receivers to it_receivers.
    * Mail Body
    CLEAR wa_mailbody.
    REFRESH it_mailbody.
    wa_mailbody-line = 'Please find the attachment'.
    APPEND wa_mailbody to it_mailbody.
    * Mail attachmwnt
    CLEAR wa_attachment.
    REFRESH it_attachment.
    CONCATENATE 'MATNR' 'MATKL' 'MTART' 'MEINS'
    INTO wa_attachment SEPARATED BY con_tab.
    CONCATENATE con_cret wa_attachment INTO wa_attachment.
    APPEND wa_attachment to it_attachment.
    LOOP AT gt_mara INTO wa_mara.
    CONCATENATE wa_mara-matnr wa_mara-matkl
    wa_mara-mtart wa_mara-meins
    INTO wa_attachment SEPARATED BY con_tab.
    CONCATENATE con_cret wa_attachment INTO wa_attachment.
    APPEND wa_attachment to it_attachment.
    ENDLOOP.
    * Describe the body of the message
    CLEAR wa_packing_list.
    REFRESH it_packing_list.
    wa_packing_list-transf_bin = space.
    wa_packing_list-head_start = 1.
    wa_packing_list-head_num = 0.
    wa_packing_list-body_start = 1.
    wa_packing_list-body_num = 1.
    wa_packing_list-doc_type = 'RAW'.
    APPEND wa_packing_list to it_packing_list.
    * Create attachment notification
    wa_packing_list-transf_bin = 'X'.
    wa_packing_list-head_start = 1.
    wa_packing_list-head_num = 1.
    wa_packing_list-body_start = 1.
    DESCRIBE TABLE it_attachment LINES wa_packing_list-body_num.
    wa_packing_list-doc_type = 'XLS'. " To word attachment change this as 'DOC'
    wa_packing_list-obj_descr = ' '.
    concatenate wa_packing_list-doc_type 'file' into wa_packing_list-OBJ_DESCR
    separated by space.
    wa_packing_list-doc_size = wa_packing_list-body_num * 255.
    APPEND wa_packing_list to it_packing_list.
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    EXPORTING
    document_data = la_doc
    PUT_IN_OUTBOX = 'X'
    * SENDER_ADDRESS = SY-UNAME
    * SENDER_ADDRESS_TYPE = 'B'
    COMMIT_WORK = 'X'
    * IMPORTING
    * SENT_TO_ALL =
    * NEW_OBJECT_ID =
    * SENDER_ID =
    tables
    packing_list = it_packing_list
    * OBJECT_HEADER =
    CONTENTS_BIN = it_attachment
    CONTENTS_TXT = it_mailbody
    * CONTENTS_HEX =
    * OBJECT_PARA =
    * OBJECT_PARB =
    receivers = it_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
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.

    REPORT  Zex5 LINE-SIZE 255 LINE-COUNT 255 .
    class CL_ABAP_CHAR_UTILITIES definition load. "-->
    TABLES : vbap.
    SELECT-OPTIONS: s_vbeln FOR vbap-vbeln.
    DATA : BEGIN OF itab OCCURS 1,
           vbeln LIKE vbap-vbeln,
           posnr LIKE vbap-posnr,
           matnr LIKE vbap-matnr,
           END OF itab.
    parameters : p_email like somlreci1-receiver
    DATA: tlines type i.
    DATA: itmessage   LIKE solisti1 OCCURS 1 WITH HEADER LINE. "Ok
    DATA: itattach    LIKE solisti1 OCCURS 2 WITH HEADER LINE. "Ok
    DATA: itpacklist  LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
    DATA: itreclist   LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
    data: itattachment like solisti1 OCCURS 2 WITH HEADER LINE.
    start-of-selection.
      SELECT vbeln posnr matnr
             FROM vbap
             INTO TABLE itab
             WHERE vbeln IN s_vbeln.
    **Make the internal table data to be compatible in excel format .
      PERFORM BUILD_XLS_FORMAT.
    **Populate message of body text.
      clear itmessage.
      refresh itmessage.
      itmessage = 'Please find attached Excel file'.
      append itmessage.
      PERFORM send_mail_as_xls_attachment tables itmessage
                                                 itattach
             using p_email 'Excel Attachment' 'TXT'    " 'XLS'
              using p_email 'TEXT Attachment' 'TXT'    " 'XLS'
                            'TestFileName'
                            'SalesOrders' .
    *&      Form  BUILD_XLS_FORMAT
          text
    -->  p1        text
    <--  p2        text
    form BUILD_XLS_FORMAT.
    previosuly we were using for unicode ..now replaced
    **Declare constants for the spacing .
    *Constants : con1 type x value '0D',
               con2 type x value '09'.
      Constants : con1 type c
            value CL_ABAP_CHAR_UTILITIES=>CR_LF,
            con2 type c
            value CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
    **For the Header descriptions.
      Concatenate 'SalesORdNo'
                  'Item'
                  'Materialno' into itattach separated by con2.
      Concatenate con1 itattach into itattach.
      Append itattach.
    **Now align the items in the itab as above .
      Loop at Itab.
        concatenate itab-vbeln
                    itab-posnr
                    itab-matnr into itattach separated by con2.
        concatenate con1 itattach into itattach .
        Append itattach.
      endloop.
    endform.                    " BUILD_XLS_FORMAT
    *&      Form  send_mail_as_xls_attachment
          text
         -->P_ITMESSAGE  text
         -->P_ITATTACH  text
         -->P_P_EMAIL  text
         -->P_0116   text
         -->P_0117   text
         -->P_0118   text
         -->P_0119   text
    form send_mail_as_xls_attachment tables   p_itmessage
                                              p_itattach
                                     using    p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription.
      Data : xdocdata like sodocchgi1,
             xcnt type i.
    *Fill the document data.
      xdocdata-doc_size = 1.
    *Populate the subject/generic message attributes.
      xdocdata-obj_name  = 'SAPRPT'.
      xdocdata-obj_langu = sy-langu.
      xdocdata-obj_descr = p_mtitle.
    *Fill the document data and fetch size of attachment.
      clear xdocdata.
      read table itattach index xcnt.
      xdocdata-doc_size = ( xcnt - 1 ) * 255 + strlen( itattach ).
    xdocdata-doc_size =  ( xcnt - 1 ) * 255.
      xdocdata-obj_name  = 'SAPRPT'.
      xdocdata-obj_langu = sy-langu.
      xdocdata-obj_descr = p_mtitle.
      clear itattachment. refresh itattachment.
         itattachment[] = p_itattach[].
    *Describe the body of the message.
      clear itpacklist. refresh itpacklist.
      itpacklist-transf_bin = 'X'.
      itpacklist-head_start = '1'.
      itpacklist-head_num = '0'.
      itpacklist-body_start = '1'.
      describe table itattachment lines itpacklist-body_num .
      itpacklist-doc_type = 'TXT'.
    itpacklist-doc_type = 'XLS'.
      append itpacklist.
    *Create attachment notification.
      itpacklist-transf_bin = 'X'.
      itpacklist-head_start = '1'.
      itpacklist-head_num = '1'.
      itpacklist-body_start = '1'.
      describe table itattachment lines itpacklist-body_num .
      itpacklist-doc_type = p_format.
      itpacklist-obj_name = p_filename.
      itpacklist-obj_descr = p_attdescription.
      itpacklist-doc_size = itpacklist-body_num * 255 .
      append itpacklist.
    *FIll the receivers list.
      Clear itreclist. refresh itreclist.
      itreclist-receiver = p_email.
      itreclist-rec_type = 'U'.
      itreclist-com_type = 'INT'.
      itreclist-notif_del = 'X'.
      itreclist-notif_ndel = 'X'.
    *itreclist-notif_read = 'X'.
      append itreclist.
    *CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    EXPORTING
      document_data                    = xdocdata
      PUT_IN_OUTBOX                    = 'X'
      commit_work    = 'X'
      SENDER_ADDRESS                   = SY-UNAME
    tables
       packing_list                    = itpacklist
       CONTENTS_BIN                    = itattachment
       CONTENTS_TXT                    = itmessage
       receivers                       = itreclist
    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.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = xdocdata
          PUT_IN_OUTBOX              = 'X'
        TABLES
          packing_list               = itpacklist
          CONTENTS_BIN               = itattachment
          CONTENTS_TXT               = itmessage
          receivers                  = itreclist
        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.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    endform.                    " send_mail_as_xls_attachment
    Just execute the above code and let me know.
    What is the sap version u r using .
    Vijay

  • Error in Sending Mail with excel attachment

    Hi All,
    While sending a mail with excel attachment it is getting successfully send but when i am opening the excel it gives a popup saying "The file is not in recognizable format", and when i click OK the data is getting displayed.
    So anybody has any idea of how to remove the popup??
    I am using SO_NEW_DOCUMENT_ATT_SEND_API1 FM for sending the mail.
    Can anybody help me regarding this.
    Thanks
    Salish

    Hi,
    I was facing the issue when I did not populate the parameters packing_list, object_header,contents_bin, contents_txt of the FM
    SO_NEW_DOCUMENT_ATT_SEND_API1 properly.
    Also the possible cause could be the configuration in SCOT, not very sure about this. Check with the BASIS guy.
    Regards,
    Sagar

  • Problem when sending mails with excel attached

    Hi
      I'm tryin to send mails via SAPOffice with attached excel documents. I'm using FM SO_NEW_DOCUMENT_ATT_SEND_API1. I have a problem with the code. Here I post it:
    DATA:  ti_objbin    LIKE solisti1   OCCURS 150 WITH HEADER LINE,
    ti_objhex    LIKE solix      OCCURS 150 WITH HEADER LINE.
    DATA: BEGIN OF i_excel,
    sobid(8) TYPE c,
    tab1 TYPE X VALUE 09, "tab code
    name(80) TYPE c,
    tab2 TYPE X VALUE 09, "tab code
    city(40) TYPE c,
    tab3 TYPE X VALUE 09, "tab code
    kostl(10) TYPE c,
    tab4 TYPE X VALUE 09, "tab code
    ktext(20) TYPE c,
    tab5 TYPE X VALUE 09, "tab code
    fasig(10) TYPE c,
    tab6 TYPE X VALUE 09, "tab code
    ruta(255) TYPE c,
    fin  TYPE X VALUE 13, "carriage return
    END OF i_excel.
    i_excel-sobid        = wa_datos-sobid.
    i_excel-name         = wa_datos-name.
    i_excel-city         = wa_datos-city.
    i_excel-kostl        = wa_datos-kostl.
    i_excel-ktext        = wa_datos-ktext.
    i_excel-fasig        = wa_datos-fasig.
    i_excel-ruta         = wa_datos-ruta.
    WRITE i_excel TO ti_objbin-line.
    APPEND ti_objbin.
    CLEAR  ti_objbin.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data              = docdata
    put_in_outbox              = 'X'
    TABLES
    packing_list               = ti_objpack
    object_header              = ti_objhead
    contents_bin               = ti_objbin
    contents_txt               = ti_objtxt
    *      contents_hex               = ti_objhex
    receivers                  = ti_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.
    I have used this code before, in 4.6C release and it works fine, but now I'm on ECC5.0 and when i check the code, the next error message is generated: ""I_EXCEL" cannot be converted to a character-type field." If i try using MOVE i_excel TO i_objbin-line instead of WRITE, the error message changes to: ""TI_OBJBIN-LINE" and "I_EXCEL" are not mutually convertible in a Unicode program. program.". I have tried using ti_objhex table instead of ti_objbin in order to use 'context_hex' parameter (instead of 'context_bin') on FM, but i get the same result.
    I've been searching any other FM to do this, and i've found more FM of SOI1 function group but i didn´t get the expected result. So i need to send the message with the excel attached, using this FM or any other, but I need some help.  Anyone can help me?
    Thanks and Regards

    hi this is a simple example to send the excel sheet as a mail
    TABLES: ekko.
    PARAMETERS: p_email   TYPE somlreci1-receiver .
    TYPES: BEGIN OF t_ekpo,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
    END OF t_ekpo.
    DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
          wa_ekpo TYPE t_ekpo.
    TYPES: BEGIN OF t_charekpo,
      ebeln(10) TYPE c,
      ebelp(5)  TYPE c,
      aedat(8)  TYPE c,
      matnr(18) TYPE c,
    END OF t_charekpo.
    DATA: wa_charekpo TYPE t_charekpo.
    DATA:   it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
            t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            w_cnt TYPE i,
            w_sent_all(1) TYPE c,
            w_doc_data LIKE sodocchgi1,
            gd_error    TYPE sy-subrc,
            gd_reciever TYPE sy-subrc.
    *START_OF_SELECTION
    START-OF-SELECTION.
      Retrieve sample data from table ekpo
      PERFORM data_retrieval.
      Populate table with detaisl to be entered into .xls file
      PERFORM build_xls_data_table.
    *END-OF-SELECTION
    END-OF-SELECTION.
    Populate message body text
      perform populate_email_message_body.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_message
                                          it_attach
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'XLS'
                                          'filename'
                                 changing gd_error
                                          gd_reciever.
      Instructs mail send program for SAPCONNECT to send email(rsconn01)
      PERFORM initiate_mail_execute_program.
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp aedat matnr
       UP TO 10 ROWS
        FROM ekpo
        INTO TABLE it_ekpo.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  BUILD_XLS_DATA_TABLE
          Build data table for .xls document
    FORM build_xls_data_table.
      data: ld_store(50) type c.  "Leading zeros
      CONSTANTS: con_cret(5) TYPE c VALUE '0D',  "OK for non Unicode
                 con_tab(5) TYPE c VALUE '09'.   "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    *constants:
       con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
       con_cret type c value cl_abap_char_utilities=>CR_LF.
      CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR' INTO it_attach SEPARATED BY con_tab.
      CONCATENATE con_cret it_attach  INTO it_attach.
      APPEND  it_attach.
      LOOP AT it_ekpo INTO wa_charekpo.
    *Modification to retain leading zeros
      inserts code for excell REPLACE command into ld_store
      =REPLACE("00100",1,5,"00100")
        concatenate '=REPLACE("' wa_charekpo-ebelp '",1,5,"'
                                 wa_charekpo-ebelp '")' into ld_store .
      concatenate ld_store into .xls file instead of actual value(ebelp)
        CONCATENATE wa_charekpo-ebeln ld_store  wa_charekpo-aedat wa_charekpo-matnr  INTO it_attach SEPARATED BY con_tab.
        CONCATENATE con_cret it_attach  INTO it_attach.
        APPEND  it_attach.
      ENDLOOP.
    ENDFORM.                    " BUILD_XLS_DATA_TABLE
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    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.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      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 it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      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 it_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.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      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               = it_message
                receivers                  = t_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.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          Instructs mail send program for SAPCONNECT to send email.
    FORM initiate_mail_execute_program.
      WAIT UP TO 2 SECONDS.
      SUBMIT rsconn01 WITH mode = 'INT'
                    WITH output = 'X'
                    AND RETURN.
    ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    *&      Form  POPULATE_EMAIL_MESSAGE_BODY
           Populate message body text
    form populate_email_message_body.
      REFRESH it_message.
      it_message = 'Please find attached a list test ekpo records'.
      APPEND it_message.
    endform.                    " POPULATE_EMAIL_MESSAGE_BODY
    regards,
    venkat.

  • Need more than 255 character to show data in print program

    Hi All,
      I am using read_text FM. We have 8 lines in itab almost 2000 character.
    Now I want to show it in my smartforms. I used concatenate lines of itab into result separated by space.
    But here I am getting only 255 character in our result. Can any body help me out to resolve this problem.
    Thanks,
    Rakesh

    Hi,
    No need to use the FM Read_text. use include text instead of text element and pass the required field value combination, then SAP will automatically display it.
    Pass the details to
    Text Name
    Text Object
    Text ID
    Language
    Regards
    Shiva

  • Problem in sending email with attachment more than 32kb through utl_mail

    Hi friends
    I am able to send an email with attachment upto 32kb using utl_mail.
    But whenever I increase the size of attachment from 32kb, it prompts me an error.
    ===============================================
    ORA-20001: The following error has occured:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ===============================================
    i have also used LONG RAW instead of RAW, bu still the problem is same.
    please help me in solving this issue.
    Thanks in advance,
    Ankur

    Yeah that's an issue with UTL_MAIL it only has 3 procedures, and none of them let you send data to the SMTP server incrementally. To send files larger than 32k you will need to switch over to using UTL_SMTP directly or via a helper package such as the [DEMO_MAIL package|http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html] available from otn.

  • Sending mail with excel attachment

    Hi
    I need to send my a mail thru pl/sql procedure wit h an excel attachment
    I used the elow code. when trying to open the excel getting error in it .
    can anyone help out
    create or replace PROCEDURE send_mail_not IS
    v_mailConn utl_smtp.connection;
    v_err VARCHAR2(1000);
    v_message VARCHAR2(3000);
    crlf VARCHAR2(2) := CHR(13) || CHR(10);
    v_attachment varchar2(200);
    p_from_mail_id varchar2(200);
    p_to_mail_id varchar2(200);
    p_subject varchar2(200);
    BEGIN
    p_from_mail_id:= '[email protected]';
    p_to_mail_id :='[email protected]';
    p_subject :='error msg';
    v_attachment :='erer';
    v_mailconn := utl_smtp.open_connection('localhost', 25);
    utl_smtp.helo(v_mailconn, 'localhost');
    utl_smtp.mail(v_mailconn, '[email protected]');
    utl_smtp.rcpt(v_mailconn, '[email protected]');
    v_message := 'dfdfjkdflkdmf';
    dbms_output.put_line('Inside email procedure');
    v_message := 'Date: ' || TO_CHAR(SYSDATE, 'dd Mon yy hh24:mi:ss') || crlf ||
    'From: ' || p_from_mail_id || crlf || 'To: ' || '<' ||
    p_to_mail_id || '>' || crlf || 'Subject: ' ||
    p_subject || crlf ||
    'MIME-Version: 1.0'|| utl_tcp.crlf || -- use Mime mail standard
    'Content-Type: multipart/mixed;' || utl_tcp.crlf ||
    ' boundary="-----SECBOUND"'|| utl_tcp.crlf ||
    '-------SECBOUND'|| utl_tcp.crlf ||
    'Content-Type: text/html;'|| utl_tcp.crlf ||
    'Content-Transfer_Encoding: 8bit'|| utl_tcp.crlf ||
    utl_tcp.crlf ||
    v_message || utl_tcp.crlf || -- message body
    utl_tcp.crlf ||
    utl_tcp.crlf ||
    '-------SECBOUND'|| utl_tcp.crlf ||
    'Content-Type: text/plain;' || utl_tcp.crlf ||
    ' name="errr.log"'|| utl_tcp.crlf || -- file name that will hold the attached text
    'Content-Transfer_Encoding: 8bit'|| utl_tcp.crlf ||
    'Content-Disposition: attachment;'|| utl_tcp.crlf ||
    ' filename="error.xls"'|| utl_tcp.crlf ||
    utl_tcp.crlf ||
    v_attachment || utl_tcp.crlf || -- attachment
    utl_tcp.crlf ||
    '-------SECBOUND--' -- end mime mail
    utl_smtp.data(v_mailconn, v_message);
    utl_smtp.quit(v_mailconn);
    dbms_output.put_line('v_message');
    EXCEPTION
    WHEN OTHERS THEN
    v_err := sqlerrm;
    insert into pas.temp_trg values ('mail2', v_err, '');
    END send_mail_not;

    Your code had some syntactic errors... can you please try the below.. not tested.
    please let me know...
    CREATE OR REPLACE PROCEDURE send_mail_not
    IS
       v_mailconn       UTL_SMTP.connection;
       v_err            VARCHAR2 (1000);
       v_message        VARCHAR2 (3000);
       crlf             VARCHAR2 (2) := CHR (13) || CHR (10);
       v_attachment     VARCHAR2 (200);
       p_from_mail_id   VARCHAR2 (200);
       p_to_mail_id     VARCHAR2 (200);
       p_subject        VARCHAR2 (200);
    BEGIN
       p_from_mail_id := '[email protected]';
       p_to_mail_id := '[email protected]';
       p_subject := 'error msg';
       v_attachment := 'erer';
       v_mailconn := UTL_SMTP.open_connection ('localhost', 25);
       UTL_SMTP.helo (v_mailconn, 'localhost');
       UTL_SMTP.mail (v_mailconn, '[email protected]');
       UTL_SMTP.rcpt (v_mailconn, '[email protected]');
       v_message := 'dfdfjkdflkdmf';
       DBMS_OUTPUT.put_line ('Inside email procedure');
       v_message :=
             'Date: '
          || TO_CHAR (SYSDATE, 'dd Mon yy hh24:mi:ss')
          || crlf
          || 'From: '
          || p_from_mail_id
          || crlf
          || 'Subject: '
          || p_subject
          || crlf
          || 'To: '
          || p_to_mail_id
          || crlf
          || 'Mime-version: 1.0'
          || UTL_TCP.crlf
          ||                                             -- use Mime mail standard
            'Content-type: multipart/mixed;'
          || UTL_TCP.crlf
          || 'boundary="-----SECBOUND"'
          || UTL_TCP.crlf
          || '-------SECBOUND'
          || UTL_TCP.crlf
          || 'Content-Type: text/html;'
          || UTL_TCP.crlf
          || 'Content-Transfer_Encoding: 8bit'
          || UTL_TCP.crlf
          || UTL_TCP.crlf
          || v_message
          || UTL_TCP.crlf
          ||                                                       -- message body
            UTL_TCP.crlf
          || UTL_TCP.crlf
          || '-------SECBOUND'
          || UTL_TCP.crlf
          || 'Content-Type: text/plain;'
          || UTL_TCP.crlf
          || ' name="errr.log"'
          || UTL_TCP.crlf
          ||                         -- file name that will hold the attached text
            'Content-Transfer_Encoding: 8bit'
          || UTL_TCP.crlf
          || 'Content-Disposition: attachment;'
          || UTL_TCP.crlf
          || ' filename="error.xls"'
          || UTL_TCP.crlf
          || UTL_TCP.crlf
          || v_attachment
          || UTL_TCP.crlf
          ||                                                         -- attachment
            UTL_TCP.crlf
          || '-------SECBOUND--'                                  -- end mime mail
       UTL_SMTP.write_data (v_mailconn, v_message);
       UTL_SMTP.close_data (v_mailconn);
       UTL_SMTP.quit (v_mailconn);
       DBMS_OUTPUT.put_line ('v_message');
    EXCEPTION
       WHEN OTHERS
       THEN
          v_err := SQLERRM;
          INSERT INTO pas.temp_trg
               VALUES ('mail2', v_err, '');
    END send_mail_not;

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

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

  • 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

  • I need more than 255 charater value return from the table control screen.

    Hi guys,
    I used this function module to get the dynamic table control value changes, but it export me back only 255 character value.
    because the 'DYNPFIELDS' internal table structure hold only 255 character. kindly help me in this reg to get more than 255 character length.
    or any other solution.
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          DYNAME     = '/A1SSPC/USR_RALG_FILL'
          DYNUMB     = '1000'
        TABLES
          DYNPFIELDS = TBDYNPFIELDS.
    kindly provide me if you have any solution.
    reg,
    hari

    Hi,
    Try using the Text Editor for more info go throught the Control Examples
    Utilities--> Examples -->  Control Examples in SE38
    Regards
    Ramchander Rao.K

Maybe you are looking for

  • How to mount and get file on my external drive

    I have a external hdd drive(size 500GB) using FAT32 system. There are two partition actually. But I can only mount and read the one (disk1s2). (disk1s3) had existing file I want to read but I can't mount. How can I do? see below /dev/disk1    #:     

  • WRT54G2 V1 drops wired PC connection all the time

    I have a WRT54G2 Ver 1.0 unit with 1.02 firmware - I connect via a Linksys CM-100 cable modem to Comcast (in Houston - was Time Warner). My PC is wired to the router and is running 32-bit Vista Home Premium.  The internet connection drops on a regula

  • Long text in production order

    Hi All, I have enter some text in all my production order. Based on that txt can i pulled the orders in the report(in std report). Is there any report like this. Thanks and Regard, D.Dutta

  • Asset under construction balance incorrect.

    We have identified 2 AuCs where the balance on them is not correct.  for example, the asset had a small balance in the prev fiscal year.  the line items in the current year all add up to this balance, which should bring the balance to nil.  On the as

  • I'm sick of Drivers

    For the last three weeks I have tried to get my 5410i phone connected my PC with XP sp 2.after three of times of trying I got it too work twice. After down loading my pictures from the phone, each time I want to use the Nokia PC Suite 6.8.22.0 I have