Skip to Content
Technical Articles

Upload a SAP Transport Request – Made Easy

If you are using third-party ABAP tools in your SAP systems or interested to move an ABAP package to your existing SAP system from another SAP system , you can use SAP Transport Request files.

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 :

1. Uploading Manually ( CG3Z ) :

An SAP Transport Request file contains 2 files :
first one starts with “R” character and second one stars with “K” character.

First one must be placed in server folder : “/usr/sap/trans/data/”
and second one must be placed in server folder : “/usr/sap/trans/cofiles/”

To upload this files to this locations on the SAP server, first you need to understand file path format :

Directions of slashes & path format can be different according to the operating system.
Use SAP transaction AL11 to display some folders and see path format :

And then use SAP transaction CG3Z to upload these files to the required locations on server, ( In my example Transport Request number was D21R902709 and D21 was the system ID of SAP system which is this files are exported from )

File names and server locations must be as below :

2. Uploading automatically via ABAP program below.

Just run this ABAP program , enter Transport Request number and select the local folder which contains files.

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.

( Note : it’s very easy to return this program to a Transport Request downloader as well, I can share ABAP code about it if you just message me )

Step 2 : Import Transport Request & Install (STMS) 

Go to SAP transaction STMS on your development system and use menu path Extras -> Other Requests -> Add as shown below :

The following screen will appear as a popup as below.
Enter the Transport Request number (D21R902709 in my example) and hit enter.

Tansport Request will be added to the queue , now you can select and import it to your system.
Installation is complete ,

Thanks reading !

Bulent Balci – Novaline Information Tech.

( P.S. This is a cross posted blog – For original source please click here )

 

3 Comments
You must be Logged on to comment or reply to a post.