Uploading Transport Requests to an SAP CAL System
Veröffentlicht am 12. Juli 2019 von | ABAP | AMDP |
In the SAP Cloud Appliance Library (CAL), you can use SAP's latest systems in the cloud with little effort. Some of the systems are free for certain purposes, and are great for learning new technologies. Especially the DEV systems can be used well for this purpose.
If you are a normal developer and get such a system, you will soon reach the point where you want to import or create transports. This is possible in principle, but you need access at the level of the Linux operating system.
I have written a simple program to copy the transport files directly from the client computer to the transport directories (trans/cofiles and trans/data) via the SAP GUI. This makes life much easier.
If necessary, the paths in the source code must be adjusted.
"---------------------------------------------------------------------*
" Report Z_UPLOAD_TRANSPORT
"---------------------------------------------------------------------*
" select the K-File (e.g. K900028.A4H) in the file selection dialog.
"---------------------------------------------------------------------*
REPORT z_upload_transport.
DATA lt_filetable TYPE filetable.
DATA lv_rc TYPE i.
data lv_source_path type SAPB-SAPPFAD.
data lv_target_path type SAPB-SAPPFAD.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Upload transport file'
file_filter = 'K*'
CHANGING
file_table = lt_filetable
rc = lv_rc
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
read table lt_filetable into data(ls_file) index 1.
data(lv_path_length) = strlen( ls_file-filename ) - 11 .
lv_source_path = ls_file-filename.
data(lv_filename) = lv_source_path+lv_path_length(11).
lv_target_path = |/usr/sap/trans/cofiles/{ lv_filename }|.
CALL FUNCTION 'ARCHIVFILE_CLIENT_TO_SERVER'
EXPORTING
path = lv_source_path
TARGETPATH = lv_target_path
EXCEPTIONS
OTHERS = 3 .
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
LV_SOURce_path+lv_path_length(1) = 'R'.
lv_filename(1) = 'R'.
lv_target_path = |/usr/sap/trans/data/{ lv_filename }|.
CALL FUNCTION 'ARCHIVFILE_CLIENT_TO_SERVER'
EXPORTING
path = lv_source_path
TARGETPATH = lv_target_path
EXCEPTIONS
OTHERS = 3 .
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.