Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Email With more than 255 characters in the row

former_member291753
Participant
0 Kudos
1,945

Hi experts,

My requirement is  to send email with more than 255 character in row in excel attachment.

I Found below link.

http://wiki.sdn.sap.com/wiki/display/Snippets/To+send+a+mail+attachment+with+more+than+255+character...

below is my code.

this is giving dump in  Fm  SCMS_STRING_TO_XSTRING because type mismatch. it should be string. but the string holds only 236 characters.

how to do this.

data:    objbin_final LIKE solisti1 OCCURS 10 WITH HEADER LINE,

data: i_contents_hex TYPE STANDARD TABLE OF solix WITH HEADER LINE,
contents_hex TYPE STANDARD TABLE OF solix WITH HEADER LINE,

       c_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
       c_ret TYPE c VALUE cl_abap_char_utilities=>cr_lf.

LOOP AT it_werks into wa_werks.
     CONCATENATE wa_werks-werks  wa_werks-lifnr             wa_werks-ebeln  wa_werks-waers wa_werks-netwr
                 wa_werks-ebelp  wa_werks-matnr        wa_werks-maktx      wa_werks-meins wa_werks-netpr wa_werks-peinh wa_werks-menge
                 wa_werks-stprs  wa_werks-dep_reqmts   wa_werks-pur_orders wa_werks-lbkum wa_werks-salk3 wa_werks-menge1
                 wa_werks-menge2 wa_werks-days
       INTO objbin_final-line SEPARATED BY c_tab.

     CONCATENATE  objbin_final c_ret INTO objbin_final.
     APPEND objbin_final.
     CLEAR objbin_final.
   ENDLOOP.


loop at  objbin_final.
    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
      EXPORTING
        text           = objbin_final-line->mismatch in type should be string
*      MIMETYPE       = ' '
*      ENCODING       =
     IMPORTING
       BUFFER         = objbin_final-line
*    EXCEPTIONS
*      FAILED         = 1
*      OTHERS         = 2
              .
    IF sy-subrc <> 0.
* Implement suitable error handling here
    ENDIF.

    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        buffer                = objbin_final-line
*      APPEND_TO_TABLE       = ' '
*    IMPORTING
*      OUTPUT_LENGTH         =
      tables
        binary_tab            = i_contents_hex
              .
loop at i_contents_hex.
   APPEND i_contents_hex TO contents_hex .
endloop.
refresh i_contents_hex.
   endloop.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
     EXPORTING
       document_data              = docdata
       put_in_outbox              = 'X'
       commit_work                = 'X'
     TABLES
       packing_list               = objpack
*      contents_bin               = objbin_final
       contents_hex               = contents_hex
       contents_txt               = objtxt
       receivers                  = 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.

Moderator message - FAQ. Un-marked as question

Message was edited by: Suhas Saha

2 REPLIES 2

former_member291753
Participant
0 Kudos
496

Dear Suhas,

This is not fair to delete the thread.

Even though this  FAQ but that not solving the issue i have tried the solutions posted 

if you know the solution why cant you answer this .

My requirement is  to send email with more than 255 character in row in excel attachment.

I Found below link.

http://wiki.sdn.sap.com/wiki/display/Snippets/To+send+a+mail+attachment+with+more+than+255+character...

below is my code.

this is giving dump in  Fm  SCMS_STRING_TO_XSTRING because type mismatch. it should be string. but the string holds only 236 characters.

how to do this.

data:    objbin_final LIKE solisti1 OCCURS 10 WITH HEADER LINE,

data: i_contents_hex TYPE STANDARD TABLE OF solix WITH HEADER LINE,
contents_hex TYPE STANDARD TABLE OF solix WITH HEADER LINE,

       c_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
       c_ret TYPE c VALUE cl_abap_char_utilities=>cr_lf.

LOOP AT it_werks into wa_werks.
     CONCATENATE wa_werks-werks  wa_werks-lifnr             wa_werks-ebeln  wa_werks-waers wa_werks-netwr
                 wa_werks-ebelp  wa_werks-matnr        wa_werks-maktx      wa_werks-meins wa_werks-netpr wa_werks-peinh wa_werks-menge
                 wa_werks-stprs  wa_werks-dep_reqmts   wa_werks-pur_orders wa_werks-lbkum wa_werks-salk3 wa_werks-menge1
                 wa_werks-menge2 wa_werks-days
       INTO objbin_final-line SEPARATED BY c_tab.

     CONCATENATE  objbin_final c_ret INTO objbin_final.
     APPEND objbin_final.
     CLEAR objbin_final.
   ENDLOOP.


loop at  objbin_final.
    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
      EXPORTING
        text           = objbin_final-line->mismatch in type should be string
*      MIMETYPE       = ' '
*      ENCODING       =
     IMPORTING
       BUFFER         = objbin_final-line
*    EXCEPTIONS
*      FAILED         = 1
*      OTHERS         = 2
              .
    IF sy-subrc <> 0.
* Implement suitable error handling here
    ENDIF.

    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        buffer                = objbin_final-line
*      APPEND_TO_TABLE       = ' '
*    IMPORTING
*      OUTPUT_LENGTH         =
      tables
        binary_tab            = i_contents_hex
              .
loop at i_contents_hex.
   APPEND i_contents_hex TO contents_hex .
endloop.
refresh i_contents_hex.
   endloop.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
     EXPORTING
       document_data              = docdata
       put_in_outbox              = 'X'
       commit_work                = 'X'
     TABLES
       packing_list               = objpack
*      contents_bin               = objbin_final
       contents_hex               = contents_hex
       contents_txt               = objtxt
       receivers                  = 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.

0 Kudos
496

Hello Raghu,

Did you check program BCS_EXAMPLE_7?

This is a demo program that sends some text to the email ID in the form of excel file.

if you check the program, subroutine, "perform create_content.". This is the place where it constructs the text. The data type considered here is of type String.

for a test purpose, you can populate the variable "lv_string" with 255 chars and check. I did it and I see all the characters in single row in excel.