Da es sich um ein Programm handelt, hat Thomas schon die Lösung genannt (Se38 /Versionsvergleich). Interessant wird es jedoch, wenn es keinen Versionsvergleich für ein Transportobjekt gibt (z.B. Smartforms).
Moin Thomas,
Wie?
Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& YBC_RUN_R3TRANS_COMMAND
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ybc_run_r3trans_command.
DATA:tabl TYPE TABLE OF tab512 WITH HEADER LINE,
tpcmd(256).
DATA sep(1).
DATA tr_path(256).
DATA t_script TYPE TABLE OF tab512.
DATA s_script TYPE tab512.
DATA fn TYPE string.
PARAMETERS p_trkorr TYPE trkorr DEFAULT 'NSPK900039'.
PARAMETERS p_work(40) DEFAULT 'c:\000'.
* Get APPSERVERS Path separator ***
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_SEP'
ID 'VALUE' FIELD sep.
* Get Executable PATH
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_CT_RUN'
ID 'VALUE' FIELD tr_path.
* EXPORT
* CLIENT = 001
* COMPRESS = " "
* FILE = "C:\000\R900056.NSP"
* USE COMMANDFILE NSPK900056
* EXPORT
* CREATECOFILE (ist nich das Selbe Format)
s_script-wa = 'EXPORT'.APPEND s_script TO t_script.
s_script-wa = 'COMPRESS = " "'.APPEND s_script TO t_script.
CONCATENATE 'FILE = "' p_work sep 'R' p_trkorr+4 '.' sy-sysid '"' INTO s_script-wa. APPEND s_script TO t_script.
CONCATENATE 'USE COMMANDFILE' p_trkorr INTO s_script-wa SEPARATED BY space. APPEND s_script TO t_script.
CONCATENATE p_work sep 'expo.txt' INTO fn.
OPEN DATASET fn FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT t_script INTO s_script.
TRANSFER s_script-wa TO fn.
ENDLOOP.
CLOSE DATASET fn.
* R3trans -w NSPK900039.log -v -u 18 C:\000\EXPO.txt
clear tpcmd .
concatenate tr_path sep 'R3Trans.exe' into tpcmd.
concatenate tpcmd '-w Jens.log -v -u 18' fn into tpcmd separated by space.
REFRESH tabl.
CALL 'SYSTEM' ID 'COMMAND' FIELD tpcmd ID 'TAB' FIELD tabl-*sys*.
LOOP AT tabl.
WRITE : / tabl-wa COLOR COL_TOTAL.
ENDLOOP.
Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& Report ZXTRANS
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zxtrans.
DATA:tabl TYPE TABLE OF tab512 WITH HEADER LINE,
tpcmd(2048).
DATA lv_workdir(256).
DATA sep(1).
DATA tr_path(256).
DATA t_script TYPE TABLE OF tab512.
DATA s_script TYPE tab512.
DATA fn(256) .
DATA p1(256) .
DATA l_value TYPE text255.
PARAMETERS p_trkorr TYPE trkorr DEFAULT 'NPLK900036'.
PARAMETERS p_work(20) DEFAULT 'DIR_XTRANS'.
** Get APPSERVERS Path separator ***
*CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_SEP'
* ID 'VALUE' FIELD sep.
CALL FUNCTION 'RSPO_R_SAPGPARAM'
EXPORTING
name = 'DIR_SEP'
IMPORTING
value = l_value
EXCEPTIONS
error = 1
OTHERS = 2.
sep = l_value.
* Get Workdir
SELECT SINGLE dirname FROM user_dir INTO lv_workdir WHERE aliass EQ p_work.
CONCATENATE lv_workdir sep INTO lv_workdir.
tr_path = lv_workdir.
* EXPORT
* CLIENT = 001
* COMPRESS = " "
* FILE = "/usr/sap/NPL/interface/Xtrans/R900056.NSP"
* USE COMMANDFILE NSPK900056
* EXPORT
* CREATECOFILE (ist nich das Selbe Format)
s_script-wa = 'EXPORT'.APPEND s_script TO t_script.
s_script-wa = 'COMPRESS = " "'.APPEND s_script TO t_script.
CONCATENATE 'FILE = "' tr_path 'R' p_trkorr+4 '.' sy-sysid '"' INTO s_script-wa. APPEND s_script TO t_script.
CONCATENATE 'USE COMMANDFILE' p_trkorr INTO s_script-wa SEPARATED BY space. APPEND s_script TO t_script.
CONCATENATE lv_workdir 'ExportCMD.txt' INTO fn.
OPEN DATASET fn FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT t_script INTO s_script.
TRANSFER s_script-wa TO fn.
ENDLOOP.
CLOSE DATASET fn.
* R3trans -w /path/NSPK900039.log -v -u 18 /path/ExportCMD.txt
CLEAR: tpcmd,p1 .
CONCATENATE tr_path 'R3trans' INTO tpcmd.
CONCATENATE tpcmd '-w' lv_workdir INTO p1 SEPARATED BY space.
CONCATENATE p1 p_trkorr '.log' INTO tpcmd.
CONCATENATE tpcmd '-v -u 18' fn INTO tpcmd SEPARATED BY space.
REFRESH tabl.
CALL 'SYSTEM' ID 'COMMAND' FIELD tpcmd ID 'TAB' FIELD tabl-*sys*.
LOOP AT tabl.
WRITE : / tabl-wa COLOR COL_TOTAL.
ENDLOOP.