Friday, March 7, 2014

Transport Programs Within SAP System

RDDIMPDP SAP Report - Dispatcher for Transport Programs Within SAP System
RDDIMPDP is a standard ABAP report available within your SAP system (depending on your version and release level). Below is the standard documentation available for this report and a few details of other objects it interacts with such as tables, function modules, includes etc. If you would like to see the full code listing simply enter RDDIMPDP into the relevant SAP transaction such as SE38 or SE80

Although this basic information may have limited use other that for reference, within the comments section below there is also an opportunity for anyone to add useful hints, information and links to existing content specific to this abap report. This page will therfore over time start to contain a useful amount of information that can be found quickly, simply by searching on the object name, RDDIMPDP.

SAP Documentation for program RDDIMPDP
DESCRIPTION 

Tasks of the transport dispatcher program RDDIMPDP 
Each export from a source system and each import into a target system can be split into different phases or transport steps. Some of these steps are performed by external programs (tp and R3trans) and some by ABAP programs within the system. The task of the program RDDIMPDP is to start and monitor all steps performed by ABAP programs. 
The external transport control program tp uses entries in the tables TRBAT and TRBATC to pass information on the transport steps. This information includes the type of transport step (function), the transport requests involved and possibly the client where the transport step is performed. tp then triggers an SAP event of the transport dispatcher to start RDDIMPDP as a background job in client 000. 
To perform the transport steps, RDDIMPDP starts the corresponding ABAP programs in separate background processes. Information on the background processes that have been started is placed in the table TRJOB. This table is then used later to check the status of the processes. If a step ends successfully, or if it runs with errors, then an appropriate entry is made in the tables TRBAT and TRBATC. tp analyzes this information and then deletes it from the tables TRBAT and TRBATC. 

Client-specific transport steps 
Transport steps are usually performed in client 000, since the corresponding programs mostly edit cross-client data only. Only the export and import of ADO objects (application-defined objects), such as number ranges, takes place in other clients (the export in the source client of the corresponding transport request or change request; the import in the same client as the export, if no target client is specified).
The program RDDIMPDP in client 000 recognizes that an action must be
performed in another client and triggers a client-specific SAP event.
This starts RDDIMPDP as a background job in this client. RDDIMPDP then starts the corresponding ABAP program in a separate background job. 

Names of the background jobs 
Use this overview of the various background jobs involved in the transport to monitor the progress of the transport in the Job Overview (Tools -> CCMS -> Jobs -> Maintenance (Transaction SM37)). 

Note 
If you also want to display jobs that are not scheduled for a definite start time, enter * in the field or after event: on the job overview selection screen. 
The transport dispatcher RDDIMPDP is scheduled as an event-controlled background job. To help identification, the name of the job contains the client where it is scheduled. The triggering SAP event is also client-specific. 
Client Job name triggering event with parameter 
000 RDDIMPDP SAP_TRIGGER_RDDIMPDP 
nnn RDDIMPDP_CLIENT_nnn SAP_TRIGGER_RDDIMPDP_CLIENT nnn 
The ABAP programs started by RDDIMPDP depend on the transport step entered in the function field of the table TRBAT: 
Function Job name Description of the transport step 
J RDDMASGL Activates ABAP Dictionary objects 
M RDDMASGL Activates matchcodes and lock objects 
S RDDDIS0L Analyzes the database objects for conversion 
N RDDGEN0L Converts database objects 
Y RDDGEN0L Converts matchcode tables 
X RDDDIC0L Exports ADO objects 
D RDDDIC1L Imports ADO objects 
E RDDVERSE Executes pre-export methods (such as 
creation of versions) 
W RDDVERSI Creates versions before the import 
V RDDVERSL Updates version management before import 
F RDDVERSK Creates versions after the import 
R RDDEXECL Executes post-import methods 
G RDDDIC3L Generates ABAP programs and screens 

PRECONDITION 
To enable the transport to run without errors, the program RDDIMPDP must be scheduled as a background job in client 000 and in all clients where data is being imported or exported. This job is scheduled automatically when you use the standard client copy tools to create a new client. However, you can schedule the job at any time, for example, if you only find out that it is not scheduled when the transport is already running. 
To schedule the program RDDIMPDP as a background job, log on to the appropriate client as a user with CTS administration authorization and execute the program RDDNEWPP in the ABAP Editor (Tools -> ABAP Workbench -> Development -> ABAP Editor (transaction SE38)). 
RDDIMPDP starts the transport steps in separate background processes. This means that there must be (at least) two background processes available in the R/3 System (profile parameter rdisp/wp_no_btc). If the system runs on multiple application servers you can distribute these background processes across them. 
The transport control program tp must be able to communicate with the message server of the SAP System to be able to trigger the SAP event for starting RDDIMPDP. This is guaranteed if tp is started on an application server of the SAP System where the export or import takes place.
This is always the case for imports and exports started within the SAP
System (from the Transport Organizer or the Transport Management
System). For imports started at the operating system level, it depends on the host where tp is called.
For more information on communication between tp and the message
server, see Note 11677 in the SAPNet - R/3 Frontend.
Documentation extract taken from SAP system, Copyright (c) SAP AG


Includes used within report:

INCLUDE RDDPRIPI.


Tables used within report and the associated select statement:

  SELECT * FROM trbat INTO CORRESPONDING FIELDS OF TABLE lt_trbat_all
         WHERE trkorr = gc_head_entry.
  SELECT * FROM trbats APPENDING CORRESPONDING FIELDS OF TABLE lt_trbat_all
         WHERE trkorr = gc_head_entry.
        SELECT trkorr FROM trbats INTO lv_trkorr UP TO 1 ROWS
                            WHERE sid = ps_header-sid
                            AND   ( client = sy-mandt
                            OR      client = space )
                            AND   function =  ps_header-function
                            AND   trkorr <> gc_head_entry
                            AND   ( status = gc_status_beg
                            OR      status = gc_status_run ).
        SELECT trkorr FROM trbat INTO lv_trkorr UP TO 1 ROWS
                            WHERE trkorr <> gc_head_entry
                            AND   function =  ps_header-function
                            AND   ( retcode = gc_old_status_beg
                            OR      retcode = gc_old_status_run )
                            AND   ( client = sy-mandt
                            OR      client = space ).
          SELECT trkorr FROM trbatc INTO lv_trkorr UP TO 1 ROWS
                              WHERE function = ps_header-function
                              AND   client = sy-mandt
                              AND   ( retcode = gc_old_status_beg
                              OR      retcode = gc_old_status_run ).
    SELECT SINGLE FOR UPDATE * FROM trbat INTO CORRESPONDING FIELDS OF ls_trbat_all
       WHERE trkorr   = ps_header-trkorr
       AND   function = ps_header-function.
    SELECT SINGLE FOR UPDATE * FROM trbats INTO CORRESPONDING FIELDS OF ls_trbat_all
       WHERE sid      = ps_header-sid
       AND   client   = ps_header-client
       AND   function = ps_header-function
       AND   trkorr   = ps_header-trkorr.
    SELECT jobcount FROM trjobs UP TO 1 ROWS INTO lv_jobcount
           WHERE sid      = ps_header-sid
           AND   function = ps_header-function.
    SELECT jobcount FROM trjob UP TO 1 ROWS INTO lv_jobcount
           WHERE function = ps_header-function.
    SELECT jobcount FROM trjobs INTO TABLE lt_jobcount
           WHERE sid      = ps_header-sid
           AND   function = ps_header-function.
    SELECT jobcount FROM trjob INTO TABLE lt_jobcount
           WHERE function = ps_header-function.
            SELECT SINGLE client FROM e070c INTO lv_mandt
              WHERE trkorr = lr_request->trkorr.
      SELECT * FROM trbats INTO CORRESPONDING FIELDS OF TABLE pt_request
               WHERE sid           = ps_header-sid
               AND   function      = ps_header-function
               AND   trkorr        <> gc_head_entry
               AND   status        = pv_status         .
        SELECT * FROM trbat INTO CORRESPONDING FIELDS OF TABLE pt_request
             WHERE trkorr   <> gc_head_entry
             AND   function = ps_header-function
             AND   retcode  = lv_retcode
             AND   client   <> trexe_use_trbatc_clnt.
        SELECT * FROM trbatc INTO TABLE pt_request_c
             WHERE function = ps_header-function
             AND   retcode  = lv_retcode.
        SELECT * FROM trbat INTO CORRESPONDING FIELDS OF TABLE pt_request
             WHERE trkorr   <> gc_head_entry
             AND   function = ps_header-function
             AND   retcode  = lv_retcode.
      SELECT * FROM trbats INTO CORRESPONDING FIELDS OF TABLE pt_request
               WHERE sid           = ps_header-sid
               AND ( client        = pv_client
                 OR  client        = trexe_cascade_clnt )
               AND   function      = ps_header-function
               AND   trkorr        <> gc_head_entry
               AND   status        = pv_status         .
      SELECT * FROM trbat INTO CORRESPONDING FIELDS OF TABLE pt_request
           WHERE trkorr   <> gc_head_entry
           AND   function = ps_header-function
           AND   retcode  = lv_retcode
           AND ( client   = pv_client
             OR  client   = trexe_cascade_clnt ).
        SELECT * FROM trbatc INTO TABLE pt_request_c
             WHERE function = ps_header-function
             AND   client   = pv_client
             AND   retcode  = lv_retcode.
      SELECT * FROM trbats INTO CORRESPONDING FIELDS OF TABLE pt_request
               WHERE sid           = ps_header-sid
               AND   client        = pv_client
               AND   function      = ps_header-function
               AND   trkorr        <> gc_head_entry
               AND   status        = pv_status         .
      SELECT * FROM trbat INTO CORRESPONDING FIELDS OF TABLE pt_request
           WHERE trkorr   <> gc_head_entry
           AND   function = ps_header-function
           AND   retcode  = lv_retcode
           AND   client   = pv_client.
        SELECT * FROM trbatc INTO TABLE pt_request_c
             WHERE function = ps_header-function
             AND   client   = pv_client
             AND   retcode  = lv_retcode.
    SELECT SINGLE trfunction FROM e070
      INTO lv_trfunction
      WHERE trkorr = pv_trkorr.
    SELECT SINGLE FOR UPDATE * FROM trbat INTO ls_trbat
      WHERE trkorr = gc_lock_entry AND function = gc_lock_func.
  SELECT * FROM trbatc INTO TABLE lt_trbatc.
    SELECT * FROM trbat INTO TABLE lt_trbat.


Function Modules used within report and the associated call statement:

CALL FUNCTION 'TRINT_AUTHCHECK_TRANSP_DISP'
  EXCEPTIONS
    no_authorization = 01.
  CALL FUNCTION 'TR_SYS_PARAMS'
    IMPORTING
      systemname = gv_sysname
    EXCEPTIONS
      OTHERS     = 01.
  CALL FUNCTION 'TRINT_ANALYSE_TRBAT_LOGNAME'
    EXPORTING
      iv_logname       = ps_header-logname
    IMPORTING
      ev_process_count = lv_process_count_c.
      CALL FUNCTION 'SHOW_JOBSTATE'
        EXPORTING
          jobcount         = lr_jobcount->*
          jobname          = ps_header-fd-job
        IMPORTING
          aborted          = lv_aborted
          finished         = lv_finished
          preliminary      = lv_preliminary
          ready            = lv_ready
          running          = lv_running
          scheduled        = lv_scheduled
        EXCEPTIONS
          jobcount_missing = 07
          jobname_missing  = 08
          job_notex        = 07.
      CALL FUNCTION 'BP_JOB_DELETE'
        EXPORTING
          forcedmode = lv_forcedmode
          jobcount   = lr_jobcount->*
          jobname    = ps_header-fd-job
        EXCEPTIONS
          OTHERS     = 0.
      CALL FUNCTION 'BP_JOB_DELETE'
        EXPORTING
          forcedmode = lv_forcedmode
          jobcount   = lr_jobcount->*
          jobname    = ps_header-fd-job
        EXCEPTIONS
          OTHERS     = 0.
        CALL FUNCTION 'TRINT_CHECK_TRANSP_DISP'
          EXPORTING
            iv_client        = lv_mandt
            iv_weak_check    = 'X'
          IMPORTING
            ev_not_scheduled = lv_not_scheduled
            ev_jobname       = lv_jobname
          EXCEPTIONS
            invalid_client   = 01.
        CALL FUNCTION 'TRINT_CHECK_TRANSP_DISP'
          EXPORTING
            iv_client        = lv_mandt
            iv_weak_check    = 'X'
          IMPORTING
            ev_not_scheduled = lv_not_scheduled
            ev_jobname       = lv_jobname
          EXCEPTIONS
            invalid_client   = 01.
  CALL FUNCTION 'TRINT_ANALYSE_TRBAT_LOGNAME'
    EXPORTING
      iv_logname       = ps_header-logname
    IMPORTING
      ev_process_count = lv_proc_count
      ev_hostname      = lv_hostname.
*   call function 'SUBST_START_BATCHJOB'
    CALL FUNCTION 'UPGRUNT_START_BATCHJOB'
      EXPORTING
        jobname      = ps_header-fd-job
        repname      = ps_header-fd-prog
        varname      = ps_header-fd-vari
        iv_params    = lt_params
        authcknam    = lv_authcknam
        batchhost    = lv_batchhost
        language     = lv_langu
        priparams    = gs_pri_params
        iv_schedever = 'X'
      IMPORTING
        jobcount     = lv_jobcount
        rc_start     = lv_returncode.
 
  CALL FUNCTION 'TRINT_TRIGGER_TRANSP_DISP'
    EXPORTING
      iv_client    = lv_mandt
    EXCEPTIONS
      raise_failed = 01.
 
    CALL FUNCTION 'STRF_SETNAME_TEMPPROT'
      EXPORTING
        acttype       = ps_header-fd-log
        dirtype       = lv_dirtype
        sysname       = lv_sysname
        trkorr        = pv_trkorr
        trbat_logname = pv_logname
      IMPORTING
        file          = lv_file.
 
    CALL FUNCTION 'STRF_SETNAME_TEMPPROT_SINGLE'
      EXPORTING
        acttype       = ps_header-fd-log
        dirtype       = lv_dirtype
        sysname       = lv_sysid
        trbat_logname = pv_logname
      IMPORTING
        file          = lv_file.
 
  CALL FUNCTION 'TRINT_WRITE_LOG'
    EXPORTING
      iv_log_type     = 'FILE'
      iv_logname_file = lv_file
    TABLES
      it_msgs         = lt_sprot_u
    EXCEPTIONS
      OTHERS          = 1.