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: 

Internal table send as ZIP attachment

former_member194669
Active Contributor
0 Kudos

Hi,

Here is my requirement i need to send an internal table as ZIP file to an external id.

Any info?

10 REPLIES 10

Former Member
0 Kudos

You can use FM SXPG_CALL_SYSTEM and you need to maintain os command at SM69

Thanks

Seshu

0 Kudos

Seshu,

I have only internal table. for this how could i use SXPG comand?

(I don;t want to download into pre.server and make it zip)

a®s.

0 Kudos

Hello aRs,

Not sure about your requirement :

I have done like i will download the data into Application server and Used FM to zip the file >

Check the below code :

    • Download the internal table data to a file selected by user

DESCRIBE TABLE int_result_tab LINES sy-tfill.

IF sy-tfill GT 0.

IF sy-batch NE space.

OPEN DATASET p_file FOR OUTPUT IN TEXT MODE.

IF sy-subrc EQ 0.

LOOP AT int_result_tab.

TRANSFER int_result_tab TO p_file.

IF sy-subrc NE 0.

MESSAGE s000.

EXIT.

ENDIF.

ENDLOOP.

ELSE.

WRITE:/ 'Error Opening file ', p_file.

EXIT.

ENDIF.

CLOSE DATASET p_file.

    • compress the file and export to web using gzip utility

REFRESH: int_btcxpm.

CLEAR d_status.

MOVE p_file TO d_param.

CALL FUNCTION 'SXPG_CALL_SYSTEM'

EXPORTING

commandname = 'ZGZIP'

additional_parameters = d_param

IMPORTING

status = d_status

TABLES

exec_protocol = int_btcxpm

EXCEPTIONS

no_permission = 1

command_not_found = 2

parameters_too_long = 3

security_risk = 4

wrong_check_call_interface = 5

program_start_error = 6

program_termination_error = 7

x_error = 8

parameter_expected = 9

too_many_parameters = 10

illegal_command = 11

OTHERS = 12.

IF d_status = 'O'.

    • Parse the File Name and destination

CLEAR: d_file, d_folder, d_return, d_split1, d_split2.

CONCATENATE p_file '.gz' INTO d_file.

DO.

SPLIT d_file AT '/' INTO d_split1 d_split2.

IF sy-subrc NE 0 OR d_split2 EQ space.

d_file = d_split1.

EXIT.

ENDIF.

d_file = d_split2.

d_folder = d_split1.

ENDDO.

Thanks

Seshu

0 Kudos

Seshu,

Thanks for your reply. I need to zip internal table and mail to external id. In this case i could able to use SXPG command

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please have a look demo program GRAPHICS_IGS_ZIPPER_DEMO perhaps it may help.

If it doesn't help, please disregard.

Regards,

Ferry Lianto

former_member194669
Active Contributor
0 Kudos

Hi,

Problem resolved using class cl_abap_gzip & cl_document_bcs.

0 Kudos

Hi,

I have the similar requirment I need to send an internal table as an email attachment. But I need to send it as zip attachment so, please requesting you to post ur code here or explain hou u done this

0 Kudos

Hi you say that you have resolved this issue - please explain how you did it - thanks

0 Kudos

Hi

I have a similar requirment , please requesting you to post ur code here or explain hou u done this it would be a great help thank you.

Former Member
0 Kudos

Hi,

I have the same problem that 'sundeep singh' has. I need to send via email the information contained in an internal table, but I have to send it attached as an zip file.

Can anyone post the solution to this problem,

Thanks.