SM69 dan komut yaratılabılır ve bu komutlara bakılabılır bunlar op sistem bazında calısan komutlardır .
DATA : gv_sour_dirname LIKE rsmrgstr-path,
gv_dest_dirname LIKE rsmrgstr-path,
gv_filenm LIKE rsmrgstr-name,
gt_file_list LIKE rsfillst OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF gt_result OCCURS 0 .
INCLUDE STRUCTURE btcxpm .
DATA: END OF gt_result.
DATA: gv_source_file(100),
gv_target_file(100),
gv_params TYPE sxpgcolist-parameters,
gv_command LIKE sxpgcolist-parameters,
gv_exitcode TYPE btcxpgexit.
PARAMETERS: "p_sour(100) DEFAULT '/data/interfaces/sapb2p/za/eis/tmp/',
"p_dest(100) DEFAULT '/data/interfaces/sapb2p/za/eis/delivery/'.
p_sour(100) DEFAULT '/XIinterfaces/B2D/ZA/EIS/tmp/',
p_dest(100) DEFAULT '/XIinterfaces/B2D/ZA/EIS/delivery/'.
START-OF-SELECTION.
CALL FUNCTION 'STRING_UPPER_LOWER_CASE'
EXPORTING
delimiter = ''
string1 = p_sour
IMPORTING
string = p_sour
EXCEPTIONS
not_valid = 1
too_long = 2
too_small = 3
OTHERS = 4.
CALL FUNCTION 'STRING_UPPER_LOWER_CASE'
EXPORTING
delimiter = ''
string1 = p_dest
IMPORTING
string = p_dest
EXCEPTIONS
not_valid = 1
too_long = 2
too_small = 3
OTHERS = 4.
gv_sour_dirname = p_sour.
gv_dest_dirname = p_dest.
CALL FUNCTION 'SUBST_GET_FILE_LIST'
EXPORTING
dirname = gv_sour_dirname
filenm = gv_filenm
* PATTERN = ''
TABLES
file_list = gt_file_list
EXCEPTIONS
access_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ELSE.
LOOP AT gt_file_list WHERE name NE '.' AND name NE '..'.
CLEAR: gv_source_file,
gv_target_file,
gv_params.
CONCATENATE gv_sour_dirname gt_file_list-name
INTO gv_source_file.
CONCATENATE gv_dest_dirname gt_file_list-name
INTO gv_target_file.
CONCATENATE gv_source_file
gv_target_file
INTO gv_params
SEPARATED BY space.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = 'ZMOVE'
additional_parameters = gv_params
IMPORTING
exitcode = gv_exitcode
TABLES
exec_protocol = gt_result
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
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry = 13
jobcount_generation_error = 14
OTHERS = 15.
IF sy-subrc <> 0.
ELSE.
CLEAR gv_params.
gv_params = gv_target_file.
PERFORM f_zip_file USING gv_params CHANGING gv_command.
ENDIF.
ENDLOOP.
ENDIF.
*&---------------------------------------------------------------------*
*& Form f_zip_file
*&---------------------------------------------------------------------*
FORM f_zip_file USING p_params CHANGING p_command.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = 'ZGZIP'
additional_parameters = p_params
IMPORTING
exitcode = gv_exitcode
TABLES
exec_protocol = gt_result
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
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry = 13
jobcount_generation_error = 14
OTHERS = 15.
IF sy-subrc <> 0.
ELSE.
CLEAR gv_params.
gv_params = gv_source_file.
PERFORM f_delete_file USING gv_params.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form f_delete_file
*&---------------------------------------------------------------------*
FORM f_delete_file USING p_params.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = 'ZDELETE'
additional_parameters = p_params
IMPORTING
exitcode = gv_exitcode
TABLES
exec_protocol = gt_result
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
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry = 13
jobcount_generation_error = 14
OTHERS = 15.
IF sy-subrc <> 0.
ENDIF.
ENDFORM.
Ustteki komutlarla tasıma zipleme ve silme isleri yapılabılır .Farklı komutlar ekleyerek yapılacaklar cogaltılabılır .
CG3Y -- >> download from app server
CG3Z -- >> upload to app server
No comments:
Post a Comment