REPORT YCHORIG .
TABLES: SSCRFIELDS, TADIR.
************************************************************************
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT 5(72) AAA.
SELECTION-SCREEN COMMENT /5(72) BBB.
SELECTION-SCREEN COMMENT /5(72) CCC.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF BLOCK BLOCK WITH FRAME.
SELECTION-SCREEN COMMENT /2(72) DDD.
SELECTION-SCREEN COMMENT /2(72) EEE.
SELECTION-SCREEN COMMENT /2(72) FFF.
SELECTION-SCREEN COMMENT /2(72) GGG.

SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: A LIKE E071-PGMID.
PARAMETERS: B LIKE E071-OBJECT.
PARAMETERS: C LIKE E071-OBJ_NAME.
SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN COMMENT /1(72) HHH.
SELECTION-SCREEN COMMENT /1(72) III.
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN PUSHBUTTON 3(30) MMM USER-COMMAND DISP.
SELECTION-SCREEN PUSHBUTTON 36(8) JJJ USER-COMMAND PROC.
SELECTION-SCREEN PUSHBUTTON 47(8) KKK USER-COMMAND EXIT.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT /1(72) LLL.

SELECTION-SCREEN END OF BLOCK BLOCK .
************************************************************************
INITIALIZATION.
  AAA = 'This program changes the specifyed object''s original system.'.
  BBB = 'The new SID will be the login SID.'.
  CCC = 'USE THIS PROGRAM WITH EXTREME CARE!!!'.
  DDD = 'Name of R/3 ABAP/4 Development Workbench object'.
  EEE = '|      Object type'.
  FFF = '|      |      Object name'.
  GGG = '|      |      |'.
  HHH = 'Example:'.
  III = 'R3TR PROG ZLOAD'.
  JJJ = 'PROCEED'.
  KKK = 'EXIT'.
  MMM = 'DISPLAY RECENT ORIGINAL SYSTEM'.
  LLL = ' '.

AT SELECTION-SCREEN.
  IF SSCRFIELDS-UCOMM = 'EXIT'.
    SET SCREEN 0.LEAVE SCREEN.
  ELSEIF SSCRFIELDS-UCOMM = 'PROC'.
    CLEAR TADIR.
    SELECT SINGLE * FROM TADIR WHERE PGMID = A AND OBJECT = B AND
    OBJ_NAME = C.
    IF TADIR-PGMID IS INITIAL.
      LLL = 'THIS OBJECT DOES NOT EXIST'.
    ELSE.
      IF SY-SYSID <> TADIR-SRCSYSTEM.
        TADIR-SRCSYSTEM = SY-SYSID.
        MODIFY TADIR.
        COMMIT WORK.
        LLL = 'THE ORIGINAL SYSTEM CHANGED TO:'.
        LLL+31(3) = SY-SYSID.
      ELSE.
   LLL = 'NO CHANGE: THE ORIGINAL SYSTEM AND LOGIN SYSTEM ARE THE SAME'.
      ENDIF.
    ENDIF.
  ELSEIF SSCRFIELDS-UCOMM = 'DISP'.
    CLEAR TADIR.
    SELECT SINGLE * FROM TADIR WHERE PGMID = A AND OBJECT = B AND
    OBJ_NAME = C.
    IF TADIR-PGMID IS INITIAL.
      LLL = 'THIS OBJECT DOES NOT EXIST'.
    ELSE.
      LLL = 'THE RECENT ORIGINAL SYSTEM IS: '.
      LLL+31(3) = TADIR-SRCSYSTEM.
    ENDIF.
  ENDIF.