Code: Alles auswählen.
DATA: UX_FILE LIKE AUTHB-FILENAME.
DATA: UX_FILE_NEW LIKE AUTHB-FILENAME.
DATA: T_IMEX TYPE TABLE OF BIFMIMEX WITH HEADER-LINE.
OPEN DATASET UX_FILE FOR INPUT IN TEXT MODE encoding default.
IF SY-SUBRC NE 0. "/ Datei konnte nicht geöffnet werden!
MESSAGE E992(RE) WITH UX_FILE.
ENDIF.
DO. "/ Zeilenweise Einlesen
CLEAR T_IMEX.
READ DATASET UX_FILE INTO T_IMEX.
IF SY-SUBRC NE 0. "/ kein Satz mehr
EXIT.
ENDIF.
APPEND T_IMEX.
ENDDO.
*
CLOSE DATASET UX_FILE.
*----------------------------------------------------------------------*
OPEN DATASET UX_FILE_NEW FOR OUTPUT IN TEXT MODE encoding default.
*
IF SY-SUBRC NE 0. "/ Datei konnte nicht geöffnet werden!
MESSAGE E992(RE) WITH UX_FILE_NEW.
ENDIF.
*
LOOP AT T_IMEX FROM 1. "/ Zeilenweise ausgeben
TRANSFER T_IMEX TO UX_FILE_NEW.
ENDLOOP.
*
CLOSE DATASET UX_FILE_NEW.
Code: Alles auswählen.
DATA: UX_FILE LIKE AUTHB-FILENAME.
DATA: UX_FILE_NEW LIKE AUTHB-FILENAME.
DATA: T_IMEX LIKE BIFMIMEX.
OPEN DATASET UX_FILE FOR INPUT IN TEXT MODE encoding default.
OPEN DATASET UX_FILE_NEW FOR OUTPUT IN TEXT MODE encoding default.
DO. "/ Zeilenweise Einlesen
READ DATASET UX_FILE INTO T_IMEX.
IF SY-SUBRC NE 0. "/ kein Satz mehr
EXIT.
ENDIF.
TRANSFER T_IMEX TO UX_FILE.
ENDDO.
CLOSE DATASET UX_FILE.
CLOSE DATASET UX_FILE_NEW.
Code: Alles auswählen.
data: g_command type sxpgcolist-name value 'Z_COPY',
g_params type sxpgcolist-parameters,
g_status type extcmdexex-status,
g_exitcode type extcmdexex-exitcode,
g_tab_prot like btcxpm occurs 0 with header line.
parameters: p_from type char100.
parameters: p_to type char100.
concatenate p_from p_to into g_params separated by space.
call function 'SXPG_COMMAND_EXECUTE'
exporting
commandname = g_command
additional_parameters = g_params
* OPERATINGSYSTEM = SY-OPSYS
* TARGETSYSTEM = SY-HOST
* DESTINATION =
* STDOUT = 'X'
* STDERR = 'X'
* TERMINATIONWAIT = 'X'
* TRACE =
* DIALOG =
importing
status = g_status
exitcode = g_exitcode
tables
exec_protocol = g_tab_prot
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.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.