02-01-2008 4:35 AM
hi everyone,
can anyone tell me how to create folders and zip files dynamically in SAP.
waitin for ur reply...
02-01-2008 4:38 AM
HI,
You need to use Class cl_gui_frontend_services.
Check the methods in the above class using transaction SE24 & use the same in your program.
Best regards,
Prashant
02-01-2008 4:45 AM
02-01-2008 4:57 AM
i checked this class but in 4.7 server this server is not in existence. so is there any alternative way of zipping the files.
02-01-2008 5:03 AM
Hi Anil
I guess it possible with Application server..
OPEN DATASET in_file FOR INPUT IN TEXT MODE FILTER....
and you need to give the file name as "*.GZ"..
-
ok got some code which will help you-------
Check the below code :
*
o 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.
*
o 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'.
*
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.