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: 

How to send email with excel file as ZIP attachent with out OOPs

former_member209120
Active Contributor
0 Kudos

How to convert internal table data into excel file and it should send it as a zip attachment with out using OOPs

1 ACCEPTED SOLUTION

pankaj_sandanshi
Explorer
0 Kudos

Hi,

first of all you need to convert xstring to binary and then binary to ftext like this

  CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'

    EXPORTING

      buffer     = xstring

    TABLES

      binary_tab = binary.

  DESCRIBE TABLE binary LINES lv_size.

  lv_size = lv_size * 255.

  CALL FUNCTION 'SCMS_BINARY_TO_FTEXT'

    EXPORTING

      input_length = lv_size

    TABLES

      binary_tab   = binary

      ftext_tab    = ftext

    EXCEPTIONS

      failed       = 1

      OTHERS       = 2.

9 REPLIES 9

Former Member
0 Kudos

Ramesh,

     here is a discussion made on the topic.

     http://scn.sap.com/thread/832484

Hope this helps,

~Athreya

pankaj_sandanshi
Explorer
0 Kudos

Hi,

first of all you need to convert xstring to binary and then binary to ftext like this

  CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'

    EXPORTING

      buffer     = xstring

    TABLES

      binary_tab = binary.

  DESCRIBE TABLE binary LINES lv_size.

  lv_size = lv_size * 255.

  CALL FUNCTION 'SCMS_BINARY_TO_FTEXT'

    EXPORTING

      input_length = lv_size

    TABLES

      binary_tab   = binary

      ftext_tab    = ftext

    EXCEPTIONS

      failed       = 1

      OTHERS       = 2.

0 Kudos

Pankaj,

After using the below code how we can make ZIP with Excel?

It is not working.

CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'

    EXPORTING

      buffer     = xstring

    TABLES

      binary_tab = binary.

  DESCRIBE TABLE binary LINES lv_size.

  lv_size = lv_size * 255.

  CALL FUNCTION 'SCMS_BINARY_TO_FTEXT'

    EXPORTING

      input_length = lv_size

    TABLES

      binary_tab   = binary

      ftext_tab    = ftext

    EXCEPTIONS

      failed       = 1

      OTHERS       = 2.

0 Kudos

0 Kudos

Susmitha,

I am asking how to ZIP with out using OOPs.

0 Kudos

Hi,

You can use this function GUI_EXEC.

Let say you want to use winzip to zip the file then what you should do like this:

use this command --> ' -min -a D:\WALCOTT.ZIP D:\MBARANG.TXT'

D:\MBARANG.TXT --> path to the file you want to Zip

D:\WALCOTT.ZIP --> result zip file

The command above is depends on the software you use to zip.

then

  DATA: cmdguiexec(150).

  cmdguiexec = cmd.

  CALL FUNCTION 'GUI_EXEC'

    EXPORTING

      command          = cmdguiexec.

Hope this help you.

Regards

Pankaj

0 Kudos

Pankaj,

My requirement.

1. Generate excel sheet as a ZIP file from internal table data.

2. Send mail with zip file as a attachment for the email ids assigned in the program.

3. This program runs in background.

This program should develop with out using OOPs.

0 Kudos

Why, specifically can you not use oops? Anyway, simply calling provided methods and using provided classes is not object oriented programming. You'd be hard put nowadays to write anything remotely technical without having to access some classes.

You can use abap2xlsx (a collection of classes) which produces a zipped xml format Excel file. Then use CL_BCS and associated classes to send the file. Simple solution. Elegant, supportable. Plenty of material on here on how to use these.

Unless you can come up with a good reason why you cannot use classes and methods to fulfil the business requirement (which is what matters, not some obscure nonsensical internal politics), I will lock this thread. There is no point in reinventing the wheel.

Oh, and here's the kicker: it is not possible to generate excel files in background without usings abap2xlsx without either a) investing a huge amount on time building your own xlsx constructor or b) spending money on a third party product. Tell that to your managers. The business doesn't care what technology you use so long as you fulfill the functionality requirements.

0 Kudos

Hi Ramesh,

If you find the solution of your requirement,Please share your code,because i have also same requirement.

Thanks