Application Development and Automation 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: 
Read only

Implement CL_ABAP_GZIP

Former Member
0 Likes
1,107

Hi,

I know this is not a new topic in this Forum but there is no node which shows how it is implemented. I need help on how to use this class to ZIP a file and output to Local Workstation. The source data is from a SAP table.

Anyone could help me on this?

Thank you.

8 REPLIES 8
Read only

Former Member
0 Likes
859

Try this thread

Thanks,

Shashi Reddy

Read only

0 Likes
859

hmm.. doesn't seems to be what I'm actually looking for. i have code some sample here


REPORT  ZCOMPRESS.

TABLES : VBAP.

DATA : BEGIN OF XTAB OCCURS 0,
         VBELN(10)   TYPE C,  SP01(1)  TYPE C,
         POSNR(10)   TYPE C,
       END OF XTAB.

*-- Here is the constant for TAB
CLASS CL_ABAP_CHAR_UTILITIES DEFINITION LOAD.
CONSTANTS: C_CON_TAB TYPE C VALUE
           CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.

SELECT * FROM VBAP UP TO 1000000 ROWS.
  MOVE-CORRESPONDING VBAP TO XTAB.
  MOVE C_CON_TAB          TO XTAB-SP01.
  APPEND XTAB.  CLEAR : XTAB.
ENDSELECT.

*-- Download FM
*-- Here the file (Test-raw.txt) is the raw un-compress
*-- version

*-- I need to output it as a zip file ?

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    FILENAME                = 'D:TempTest-raw.txt'
    FILETYPE                = 'ASC'
  TABLES
    DATA_TAB                = XTAB
  EXCEPTIONS
    FILE_OPEN_ERROR         = 1
    FILE_READ_ERROR         = 2
    NO_BATCH                = 3
    GUI_REFUSE_FILETRANSFER = 4
    INVALID_TYPE            = 5
    NO_AUTHORITY            = 6
    UNKNOWN_ERROR           = 7
    BAD_DATA_FORMAT         = 8
    HEADER_NOT_ALLOWED      = 9
    SEPARATOR_NOT_ALLOWED   = 10
    HEADER_TOO_LONG         = 11
    UNKNOWN_DP_ERROR        = 12
    ACCESS_DENIED           = 13
    DP_OUT_OF_MEMORY        = 14
    DISK_FULL               = 15
    DP_TIMEOUT              = 16
    OTHERS                  = 17.

I need the downloaded file to be a compressed zip file. Any idea?

Read only

0 Likes
859

for the zip question you have an example in SDN:

- download area

- code sample

- Technologies

- ABAP code samples

The name of the document is:

<b>"Abap class to gzip and gunzip.pdf"</b>

as for the FTP have a look at sap standard program:

RSFTP002

if not u can check this link u may get some idea

Read only

0 Likes
859

Hi,

Downloading a file can be doen via this kind of code

call method CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD

EXPORTING

FILENAME = p_filename

CHANGING

DATA_TAB = p_table

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

GUI_REFUSE_FILETRANSFER = 3

INVALID_TYPE = 4

NO_AUTHORITY = 5

UNKNOWN_ERROR = 6

HEADER_NOT_ALLOWED = 7

SEPARATOR_NOT_ALLOWED = 8

FILESIZE_NOT_ALLOWED = 9

HEADER_TOO_LONG = 10

DP_ERROR_CREATE = 11

DP_ERROR_SEND = 12

DP_ERROR_WRITE = 13

UNKNOWN_DP_ERROR = 14

ACCESS_DENIED = 15

DP_OUT_OF_MEMORY = 16

DISK_FULL = 17

DP_TIMEOUT = 18

FILE_NOT_FOUND = 19

DATAPROVIDER_EXCEPTION = 20

CONTROL_FLUSH_ERROR = 21

NOT_SUPPORTED_BY_GUI = 22

ERROR_NO_GUI = 23

others = 24.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Eddy

PS.

Did you (and your colleagues) put yourself on the SDN world map already? Pls check

/people/eddy.declercq/blog/2006/06/14/from-the-grumpy-old-man-hoy-en-el-mundo

for detai

Read only

0 Likes
859

hi kishan,

I've actually visited both the thread but none can actually help in my case. As for the PDF document, I can't seems to locate it from the 2 thread you've sent.

thanks & regards,

-ah tiang-

Read only

0 Likes
859

hi eddy,

Thanks for your effort here but I need to ZIP up the file before downloading it. The download function module is working fine but what I need is to implement the CL_ABAP_GZIP to zip the download file before downloading it.

thank you and regards;

- ah tiang -

Read only

0 Likes
859

just check one more...

Read only

0 Likes
859

wow... this guy is creating his own class for the zip function. not sure if i need to create this entire class to have the job done, but if yes then i have to study his coding 1 by 1. hmm... anyone who has done this kind of task before please help.

anyway thanks a lot kishan.