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: 

Zipping Files

Former Member
0 Kudos

Hi,

Can anyone help me in compressing two flat files using zip in SAP?

Regards

Shankar

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You'll likely need to look into code resembling this. you will need to look at the parms to pass ZIP and put them in the PARAMETER

Field to determine the definition of input and output file names


CALL METHOD cl_gui_frontend_services=>execute
  EXPORTING
*    DOCUMENT               = 
    application            = 'ZIP.EXE'
    PARAMETER              = 'filename1, filename2 '
    default_directory      = 'C:\your_directory'
*    MAXIMIZED              = 'X'
*    MINIMIZED              =
*    SYNCHRONOUS            =
    operation              = 'OPEN'
  EXCEPTIONS
    cntl_error             = 1
    error_no_gui           = 2
    bad_parameter          = 3
    file_not_found         = 4
    path_not_found         = 5
    file_extension_unknown = 6
    error_execute_failed   = 7
    OTHERS                 = 8.
 
IF sy-subrc  0.
  sy-subrc = sy-subrc.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

2 REPLIES 2

Former Member
0 Kudos

You'll likely need to look into code resembling this. you will need to look at the parms to pass ZIP and put them in the PARAMETER

Field to determine the definition of input and output file names


CALL METHOD cl_gui_frontend_services=>execute
  EXPORTING
*    DOCUMENT               = 
    application            = 'ZIP.EXE'
    PARAMETER              = 'filename1, filename2 '
    default_directory      = 'C:\your_directory'
*    MAXIMIZED              = 'X'
*    MINIMIZED              =
*    SYNCHRONOUS            =
    operation              = 'OPEN'
  EXCEPTIONS
    cntl_error             = 1
    error_no_gui           = 2
    bad_parameter          = 3
    file_not_found         = 4
    path_not_found         = 5
    file_extension_unknown = 6
    error_execute_failed   = 7
    OTHERS                 = 8.
 
IF sy-subrc  0.
  sy-subrc = sy-subrc.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.