In my company, we produce some third-party ABAP applications & add-ons and installing & reqularly updating them via SAP Transport Request files.
I know there are many other blogs & documents about working with SAP Transport Request files on SCN or other sources in internet, but I still think it’s simpler then it seems on many pages, So I wanted to share my experience.
Also I share a small piece of ABAP code which helps to work faster and prevents naming mistakes.
What are SAP Transport Request files?
Let’s imagine you are installing a software to your personal computer like an anti-virus or gaming program.Steps are simple : First you download installation files and then you start installer program.
For SAP it’s similar, think Transport Request files as installation files and SAP Transaction STMS is the installer & importer for them.
Step 1 : Place SAP Transport Files on your SAP server
Before installing an ABAP add-on to your SAP system, first you need to place Transport Request files in required locations on your SAP server. It’s just like downloading the installation files of a game to your computer before installing it.There are 2 ways you can upload Transport Request files to your SAP server ,
first one is manually uploading the files by using SAP transaction code CG3Z
and second one is uploading by using a simple ABAP program
ABAP Code :
REPORT znovaline_tr_uploader.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(20) gv_rqt FOR FIELD p_req MODIF ID rq.
PARAMETERS : p_req LIKE e071-trkorr MODIF ID rq.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(20) gv_fld FOR FIELD p_folder
MODIF ID fl.
PARAMETERS :
p_folder(50) DEFAULT 'C:\SAP_TRANSPORT_FILES\' MODIF ID fl.
SELECTION-SCREEN END OF LINE.
DATA : gv_dir_trans_path LIKE cst_rswatch01_alv-dirname,
gv_slash ,gv_dotname_cofile(20), gv_dotname_data(20),
gv_path_cofile LIKE sapb-sappfad,
gv_path_data LIKE sapb-sappfad.
DATA gv_front_path_cofile LIKE sapb-sappfad.
DATA gv_front_path_data LIKE sapb-sappfad.
DATA gv_err.
INITIALIZATION.
gv_rqt = 'Transport Request :'.
gv_fld = 'Local Folder:'.
START-OF-SELECTION.
*--1-- Path of DIR_TRANS folder :
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_TRANS'
ID 'VALUE' FIELD gv_dir_trans_path.
* --2-- Slash type :
FIND '\' IN gv_dir_trans_path.
IF sy-subrc EQ 0.
gv_slash = '\'.
ELSE.
gv_slash = '/'.
ENDIF.
* --3-- Cofiles / Data File Paths :
CONCATENATE :
'K' p_req+4 '.' p_req(3) INTO gv_dotname_cofile,
gv_dir_trans_path gv_slash 'cofiles'
gv_slash gv_dotname_cofile
INTO gv_path_cofile,
'R' p_req+4 '.' p_req(3) INTO gv_dotname_data,
gv_dir_trans_path gv_slash
'data' gv_slash gv_dotname_data INTO gv_path_data.
* --4-- Upload
CONCATENATE p_folder gv_dotname_cofile
INTO gv_front_path_cofile.
CONCATENATE p_folder gv_dotname_data
INTO gv_front_path_data.
" Upload Cofile :
PERFORM upload_file
USING gv_path_cofile
gv_front_path_cofile
gv_err.
CHECK gv_err IS INITIAL.
" Upload Data :
PERFORM upload_file
USING gv_path_data
gv_front_path_data
gv_err.
FORM upload_file
USING ip_server_path
ip_front_path
ep_err.
DATA lv_server_path LIKE sapb-sappfad.
DATA lv_front_path LIKE sapb-sappfad.
CLEAR ep_err.
lv_server_path = ip_server_path.
lv_front_path = ip_front_path.
CALL FUNCTION 'ARCHIVFILE_CLIENT_TO_SERVER'
EXPORTING
path = lv_front_path
targetpath = lv_server_path
EXCEPTIONS
error_file = 1
no_authorization = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE :/ 'Error uploading file'.
ep_err = 'X'.
ENDIF.
ENDFORM.
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP S/4 HANA Logistics Team Lead
Contact : serkurumsal@yandex.com
Computer Engineer
ABAP Developer & SAP S/4 HANA Logistics Team Lead
Contact : serkurumsal@yandex.com
Social Plugin