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: 

Limited rows in table

former_member2492
Active Participant
0 Kudos

Hello,

I am trying to send the table content through email,however the table has 926 rows, not all rows and columns are displayed.I am trying to convert it to xstring and all the columns are displaying now but not all the rows only half .

Can anyone help me with this?

 LOOP AT lt_contents_bin.
 CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
 EXPORTING
 text = lt_contents_bin
 IMPORTING
 buffer = lt_contents
 EXCEPTIONS
 failed = 1
 OTHERS = 2.
*Converting the table contents from xstring to binary
 CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
 EXPORTING
 buffer = lt_contents
 APPEND_TO_TABLE = 'X'
 TABLES
 binary_tab = lt_contents_hex.

  LOOP AT lt_contents_hex.
      APPEND lt_contents_hex TO gt_contents_hex.
    ENDLOOP.
  ENDLOOP.

  gt_contents_text = lt_contents_text.
1 ACCEPTED SOLUTION

p244500
Active Contributor
0 Kudos

Hi

kindly used bellow program to send email with large table



DATA: lo_send_request    TYPE REF TO cl_bcs,

        lv_date(10),

        lv_text            TYPE char255, " Text

        lv_subject         TYPE so_obj_des,

        lo_document        TYPE REF TO cl_document_bcs,

        lv_binary_content  TYPE solix_tab,

        lv_size            TYPE so_obj_len,

        lv_string          TYPE string,

        lt_main_text       TYPE bcsy_text,

        lo_recipient       TYPE REF TO if_recipient_bcs,

        lv_sent_to_all     TYPE os_boolean,

        lo_bcs_exception   TYPE REF TO cx_bcs,

        lv_email           TYPE ad_smtpadr,

        lv_lines           TYPE i.

SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-010.
SELECT-OPTIONS: s_ercpt   FOR  catsxt_sf-email  NO INTERVALS .
SELECTION-SCREEN END OF BLOCK b2.
* Internal tables : move your internal table 

DATA : BEGIN OF gt_up_file OCCURS 0,
          line(200),
       END OF gt_up_file.

*Delimiters for spreadsheet attachment

  CLASS:cl_abap_char_utilities DEFINITION LOAD.

  CONSTANTS: gc_tab            TYPE c VALUE cl_bcs_convert=>gc_tab,

             gc_crlf           TYPE c VALUE cl_bcs_convert=>gc_crlf.

  DATA: gv_tab                 TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,

        gv_newline             TYPE c VALUE cl_abap_char_utilities=>newline,

        gv_line_feed           TYPE c VALUE cl_abap_char_utilities=>cr_lf.


  WRITE sy-datum TO lv_date DD/MM/YYYY.
  lv_lines = lines( gt_up_file ).
  IF lv_lines GT 65000.

    MESSAGE i000(zmm) WITH
    'Report has more than 65,000 lines. Email cannot be'
    'sent - Report can only be displayed.'
    'In order to email report,'
    'please change your selection criteria.'.

    EXIT.

  ENDIF.


  LOOP AT gt_up_file .

    CONCATENATE lv_string gt_up_file gc_crlf gv_newline

           INTO lv_string.

  ENDLOOP.

* --------------------------------------------------------------

* convert the text string into UTF-16LE binary data including

* byte-order-mark. Mircosoft Excel prefers these settings

* all this is done by new class cl_bcs_convert (see note 1151257)

  TRY.
      cl_bcs_convert=>string_to_solix(
        EXPORTING
          iv_string   = lv_string
          iv_codepage = '4103'  "suitable for MS Excel, leave empty
          iv_add_bom  = 'X'     "for other doc types
        IMPORTING
          et_solix  = lv_binary_content
          ev_size   = lv_size ).

    CATCH cx_bcs.

      MESSAGE e445(so).

  ENDTRY.

  TRY.


*     -------- create persistent send request ------------------------

      lo_send_request = cl_bcs=>create_persistent( ).


*     -------- create and set document with attachment ---------------

*     create document object from internal table with text

      lv_text = lv_date.

      APPEND lv_text TO lt_main_text.

      APPEND INITIAL LINE TO lt_main_text.

      lv_text = 'Customer Price List Attached'.

      APPEND lv_text TO lt_main_text.


      CONCATENATE 'Customer Price List' sy-datum  sy-uzeit

                             INTO lv_subject SEPARATED BY '_'.

      lo_document = cl_document_bcs=>create_document(

        i_type    = 'RAW'

        i_text    = lt_main_text

        i_subject = lv_subject ).


*     add the spread sheet as attachment to document object

      lo_document->add_attachment(

      i_attachment_type    = 'XLS'  "

      i_attachment_subject = lv_subject

      i_attachment_size    = lv_size

      i_att_content_hex    = lv_binary_content ).



*     add document object to send request

      lo_send_request->set_document( lo_document ).


*     --------- add recipient (e-mail address) -----------------------

*     create recipient object

      LOOP AT s_ercpt.

        lv_email = s_ercpt-low.

        lo_recipient = cl_cam_address_bcs=>create_internet_address(

        lv_email ).

*     add recipient object to send request

        lo_send_request->add_recipient( lo_recipient ).

      ENDLOOP.

*     ---------- send document ---------------------------------------

      lv_sent_to_all = lo_send_request->send( i_with_error_screen = 'X' ).


      COMMIT WORK.

      IF lv_sent_to_all IS INITIAL.

        MESSAGE s500(sbcoms) WITH ''.

      ELSE.

        MESSAGE s022(so).

      ENDIF.



*   ------------ exception handling ----------------------------------

    CATCH cx_bcs INTO lo_bcs_exception.

      MESSAGE i865(so) WITH lo_bcs_exception->error_type.

  ENDTRY.

Regards,

Nawa

47 REPLIES 47

r010101010
Active Participant

Hi,

You can try to use the OO option for to generate the attachement in Binary instead of the function modules. The classes to be used CL_DOCUMENT_BCS and CL_BCS. have a look at the below post on the attachement section: https://wiki.scn.sap.com/wiki/display/ABAP/Send+Emails+with+Attachments+of+any+Format

0 Kudos

from the description : have kept 100 documents in a Folder on my desktop,this dude uploads files from desktop I want it from my table

0 Kudos

an update I was able to send the email but still not showing all the columns using OO aproach

0 Kudos

do you know what possibly can be the couse why the email are not being sent?does it need to be maintained somewhere?how can that be avoided and send the email directly?

Sandra_Rossi
Active Contributor
0 Kudos

Your question misses lots of information.

SCMS_STRING_TO_XSTRING converts a STRING into UTF-8 (by default).

SCMS_XSTRING_TO_BINARY splits a XSTRING into a table of X lines.

But what types are your variables?

And what number of bytes do you pass to the parameter I_ATTACHMENT_SIZE of method ADD_ATTACHMENT?

0 Kudos
lt_contents TYPE STANDARD TABLE OF xstring WITH HEADER LINE,
lt_contents_bin TYPE STANDARD TABLE OF string WITH HEADER LINE, lt_contents_hex TYPE STANDARD TABLE OF solix WITH HEADER LINE,
lt_objpack-body_num = lv_tab_lines. lt_objpack-obj_descr = 'BoW'. lt_objpack-doc_type = 'TXT'. lt_objpack-doc_size = lv_tab_lines * 255. I do not use method ADD_ATTACHMENT,In the end I simply use FM: NEW_DOCUMENT_ATT_SEND_API1

0 Kudos

Johnu Blatvasky

1) What is "lv_tab_lines" ?

2) Do you pass:

LT_OBJPACK-TRANSF_BIN = 'X'.

0 Kudos

DATA: lv_tab_lines LIKE sy-tabix.

0 Kudos

about 1), I mean, how do you fill "lv_tab_lines"?

+ see the question 2 I have added in my previous comment

0 Kudos

yes exatcly like that,


DESCRIBE TABLE lt_objtxt LINES lv_tab_lines.READ TABLE lt_objtxt INDEX lv_tab_lines.
t_objpack-transf_bin = 'X'.
 lt_objpack-head_start = 1.
 lt_objpack-head_num = 0.
 lt_objpack-body_start = 1.
 lt_objpack-body_num = lv_tab_lines.
 lt_objpack-obj_descr = 'BoW'.
 lt_objpack-doc_type = 'TXT'.
 lt_objpack-doc_size = lv_tab_lines * 255.
 APPEND lt_objpack.

0 Kudos

What is lt_objtxt, how do you fill it?

0 Kudos

DATA: lt_objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.

the rest regarding lt_objtxt is above

0 Kudos

sorry, I don't find lt_objtxt "above"

0 Kudos
DESCRIBETABLE lt_objtxt LINES lv_tab_lines.READTABLE lt_objtxt INDEX lv_tab_lines.

0 Kudos

how do you fill it?

I'm trying to help you. Please attach the whole program in txt.ZIP format.

0 Kudos

email.txt

Please do so.Let me know

0 Kudos

Is it really the right version?

Form Send_mail.
  DATA: lt_objtxt    LIKE solisti1 OCCURS 10 WITH HEADER LINE.
  DESCRIBE TABLE lt_objtxt LINES lv_tab_lines.

lv_tab_lines will always be zero.

0 Kudos

As Sandra wrote:

  1. SCMS_STRING_TO_XSTRING is returning XSTRING type (you have it wrong).
  2. lt_objpack-doc_size definitely will not have size of x * 255. But xstrlen of xstring.
-- Tomas --

Tomas Buryanek Beware the header line! 😉

0 Kudos

I feel (but difficult to be sure) that your code is more or less fine.

1) But I wonder if it's normal to have this combination, can you try RAW instead of TXT ? (because your text is UTF-8, made of bytes):

  lt_objpack-transf_bin = 'X'.
  lt_objpack-doc_type = 'TXT'.

2) Are you sure that LT_CONTENTS_BIN is correct at the very start of your code?

0 Kudos

yes I know ,the prb is that I dont see all the rows,only some and I dont know why...

0 Kudos

How would you change my code using OO.Can you help me with this one?

0 Kudos

It's a very good idea to rewrite in OO, i.e. your own code + use CL_BCS, get rid of those obsolete header lines, simplify your code. You have lots of demo programs for BCS (BCS_EXAMPLE_*).

0 Kudos

Can you help mw with a working one,I have tried several,but I keep receiving this message email not sent to

0 Kudos

an update I was able to send the email but still not showing all the columns OO aproach

0 Kudos

You mean, the issue is now "reversed": your program shows all the lines, but not all the columns (initially, it used to show all the columns, but half the lines) ?

0 Kudos

do you know what possibly can be the couse why the email are not being sent?does it need to be maintained somewhere?how can that be avoided and send the email directly?

0 Kudos
Johnu Blatvasky Not in SOST or not received in your email client? There can be so many reasons. All have been discussed in the forum I guess.

0 Kudos

no I mean to send to multiple recipents ,somehow I am not able to send it to more than one person

0 Kudos
Johnu Blatvasky I don't understand how you can't find the answer in SCN, it has been discussed many many times...

p244500
Active Contributor
0 Kudos

Hi

kindly used bellow program to send email with large table



DATA: lo_send_request    TYPE REF TO cl_bcs,

        lv_date(10),

        lv_text            TYPE char255, " Text

        lv_subject         TYPE so_obj_des,

        lo_document        TYPE REF TO cl_document_bcs,

        lv_binary_content  TYPE solix_tab,

        lv_size            TYPE so_obj_len,

        lv_string          TYPE string,

        lt_main_text       TYPE bcsy_text,

        lo_recipient       TYPE REF TO if_recipient_bcs,

        lv_sent_to_all     TYPE os_boolean,

        lo_bcs_exception   TYPE REF TO cx_bcs,

        lv_email           TYPE ad_smtpadr,

        lv_lines           TYPE i.

SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-010.
SELECT-OPTIONS: s_ercpt   FOR  catsxt_sf-email  NO INTERVALS .
SELECTION-SCREEN END OF BLOCK b2.
* Internal tables : move your internal table 

DATA : BEGIN OF gt_up_file OCCURS 0,
          line(200),
       END OF gt_up_file.

*Delimiters for spreadsheet attachment

  CLASS:cl_abap_char_utilities DEFINITION LOAD.

  CONSTANTS: gc_tab            TYPE c VALUE cl_bcs_convert=>gc_tab,

             gc_crlf           TYPE c VALUE cl_bcs_convert=>gc_crlf.

  DATA: gv_tab                 TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,

        gv_newline             TYPE c VALUE cl_abap_char_utilities=>newline,

        gv_line_feed           TYPE c VALUE cl_abap_char_utilities=>cr_lf.


  WRITE sy-datum TO lv_date DD/MM/YYYY.
  lv_lines = lines( gt_up_file ).
  IF lv_lines GT 65000.

    MESSAGE i000(zmm) WITH
    'Report has more than 65,000 lines. Email cannot be'
    'sent - Report can only be displayed.'
    'In order to email report,'
    'please change your selection criteria.'.

    EXIT.

  ENDIF.


  LOOP AT gt_up_file .

    CONCATENATE lv_string gt_up_file gc_crlf gv_newline

           INTO lv_string.

  ENDLOOP.

* --------------------------------------------------------------

* convert the text string into UTF-16LE binary data including

* byte-order-mark. Mircosoft Excel prefers these settings

* all this is done by new class cl_bcs_convert (see note 1151257)

  TRY.
      cl_bcs_convert=>string_to_solix(
        EXPORTING
          iv_string   = lv_string
          iv_codepage = '4103'  "suitable for MS Excel, leave empty
          iv_add_bom  = 'X'     "for other doc types
        IMPORTING
          et_solix  = lv_binary_content
          ev_size   = lv_size ).

    CATCH cx_bcs.

      MESSAGE e445(so).

  ENDTRY.

  TRY.


*     -------- create persistent send request ------------------------

      lo_send_request = cl_bcs=>create_persistent( ).


*     -------- create and set document with attachment ---------------

*     create document object from internal table with text

      lv_text = lv_date.

      APPEND lv_text TO lt_main_text.

      APPEND INITIAL LINE TO lt_main_text.

      lv_text = 'Customer Price List Attached'.

      APPEND lv_text TO lt_main_text.


      CONCATENATE 'Customer Price List' sy-datum  sy-uzeit

                             INTO lv_subject SEPARATED BY '_'.

      lo_document = cl_document_bcs=>create_document(

        i_type    = 'RAW'

        i_text    = lt_main_text

        i_subject = lv_subject ).


*     add the spread sheet as attachment to document object

      lo_document->add_attachment(

      i_attachment_type    = 'XLS'  "

      i_attachment_subject = lv_subject

      i_attachment_size    = lv_size

      i_att_content_hex    = lv_binary_content ).



*     add document object to send request

      lo_send_request->set_document( lo_document ).


*     --------- add recipient (e-mail address) -----------------------

*     create recipient object

      LOOP AT s_ercpt.

        lv_email = s_ercpt-low.

        lo_recipient = cl_cam_address_bcs=>create_internet_address(

        lv_email ).

*     add recipient object to send request

        lo_send_request->add_recipient( lo_recipient ).

      ENDLOOP.

*     ---------- send document ---------------------------------------

      lv_sent_to_all = lo_send_request->send( i_with_error_screen = 'X' ).


      COMMIT WORK.

      IF lv_sent_to_all IS INITIAL.

        MESSAGE s500(sbcoms) WITH ''.

      ELSE.

        MESSAGE s022(so).

      ENDIF.



*   ------------ exception handling ----------------------------------

    CATCH cx_bcs INTO lo_bcs_exception.

      MESSAGE i865(so) WITH lo_bcs_exception->error_type.

  ENDTRY.

Regards,

Nawa

0 Kudos

one small question can you please tell me lt_contents_bin which is type TYPE STANDARDTABLEOF xstring WITHHEADERLINE

what should I equal it to?

p244500
Active Contributor
0 Kudos

Hi,

I assume your internal table will be with header line if its bellow code you can make it.


LOOP AT lt_contents_bin.
CONCATENATE lv_string lt_contents_bin gc_crlf gv_newline INTO lv_string.
endloop.



0 Kudos

No email is comming to me ,I gave my email to and removed the loop,is this correct?No email came to me,even though the message says email sent

        lv_email = 'myemail'.
        lo_recipient = cl_cam_address_bcs=>create_internet_address(
        lv_email ).
*     add recipient object to send request
        lo_send_request->add_recipient( lo_recipient ).

p244500
Active Contributor
0 Kudos

Hi,

you should provide full email address

lv_email ='myemail@gmail.com'. "or your company email

Then go to Tcode SOST and check it. your email will be there .

Regards,

Nawa

0 Kudos

well I do that but still no email,very stange.

When I open lo_send_request it is empty ,even if I add my email in the debugger it still does not send it.

Should the lv_email and lo_recipient be the same?

0 Kudos

an update I was alble to send the email but still not showing all the columns

p244500
Active Contributor
0 Kudos

Hi,

It can't be , using this program i send more than 40 columns.

Regards,

Nawa.

0 Kudos

do you know what possibly can be the couse why the email are not being sent?does it need to be maintained somewhere?how can that be avoided and send the email directly?