Вы находитесь на странице: 1из 32

11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki

Getting Started Store

Community WIKI SAP Community Welcome, Guest Login Register

ABAP Development / Transport Organizer

ABAP program to simulate transports


Created by Sandra Rossi, last modified by Smruti Ranjan Mohanty on Nov 12, 2013

Introduction
Screen captures
ABAP code

Introduction
During a project where many workbench programs and objects are created, it is not rare to have transport errors because of missing objects not transported yet because they were in other transport
requests.

This little program tries to detect them.

Right now, it can't detect "complex" errors like a program using a table field that has not been transported yet, it only works on missing objects.

You'll find many more information in the header comments of the ABAP program below.

Update by Sandra Rossi on 2012-10-24: there is a more recent version of the program supplied as an attachment to this wiki, it was built on a 7.11 system with 2 major extensions (it should take into
account BW objects and missing fields), but its development was stopped at an early stage and the program was tested only on a few transport requests. Please feel free to correct/improve this
program!!!

Screen captures

You'll have to log in to the target system if the RFC destination is not trusted, or does not have a fixeduser and password:

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 1/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki

Top ALV shows the transport requests entered on the selection screen. This is used to help understand messages in the middle ALV
Middle ALV is the most important part, it shows the status for all objects of the transport requests + the objects required by these first objects
Bottom ALV shows at the left the required objects, and at the right the objects from the transport requests that need these objects.

ABAP code
Important: this program requires the include from theABAP program to read where- used lists.

You may need to adjust the text pool (or maybe not): go to text symbols screen, click menu Adjust, accept to create all the texts proposed, save and activate the text symbols.

1 ********************
2 * Z_SIMULATE_DEV_TRANSPORT
3 *
4 * Current version : 1.01
5 * Version date : 2010‐11‐22
6 *
7 ********************

8 * REVISIONS
9 * 2010‐11‐22 1.01 : corrections ‐ Z_DEV_WHERE_USED_LIST also corrected
10 * 2010‐04‐30 1.00 : Official release
11 * 2009‐12‐13 0.01 : Creation
12 *
13 ********************
14 * SHORT OVERVIEW:
15 * Determines if a development workbench transport will fail.
16 * The program can be run before the transport request is released,
17 * so that to include missing objects.
18 *
19 * Selection screen contains the list of transport requests you want to
20 * transport and the target system (RFC destination).
21 *
22 * Result screen contains 3 parts:
23 * 1) ALV with transport requests of selection screen
24 * 2) ALV with each object of the transport
25 * request(s), with a status 0, 4 or 8, and the status text

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 2/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
26 * 3) lower one contains an ALV with relationships between objects
27 * and again warnings and errors
28 *
29 * Tested on SAPKB70013 system
30 *
31 *
32 ********************
33 * SELECTION SCREEN:
34 * If you don't have an RFC destination. You may also use
35 * HOSTNAME_SYSTEMID_INSTANCENUMBER notation (expl: mplsap101_T1V_00)
36 * (you'll have to login manually with user name and password once for
37 * each run)
38 * By default, SAP standard include sources are not analyzed, but you may
39 * request to do so if for example you want to transport SAP note
40 * corrections.
41 * If you will transport objects with the "overwrite srcinals"
42 * option, then select the P_SRCSYS option so that the detection is not
43 * performed (and so, you'll avoid incorrect error messages "source system
44 * is different").
45 *
46 *
47 ********************
48 * THE TOOL DETECTS THE FOLLOWING POSSIBLE ERRORS:
49 * (legend: TR means Transport Request)
50 * Checks that the subobjects required by the transported objects are
51 * either transproted in the same TR, or in a previous TR indicated
52 * in S_TRKORR, or already exist in the target system
53 * When it detects missing objects, it looks for the transport requests
54 * which contains these objects, and displays them. You can then run
55 * again the tool with these new transport requests
56 * If the object already exists in target system, checks that source system
57 * in the object directory entry is the same in the 2 systems
58 * Checks that the sequence of transport requests is correct
59 *
60 *
61 ********************
62 * TODO:
63 * 1) if required object exists in target system but is inactivate,
64 * program doesn't indicate an error
65 * 2) if transport of LIMU REPS with one source only for the first time,
66 * SAP will create a R3TR PROG but LIMU REPT will be missing, program
67 * doesn't indicate an error
68 * 3) add warning if some required objects are being modified in current
69 * system, in TRs that are not entered in selection screen. That would
70 * help identifying errors like a program which uses a table field
71 * not yet transported
72 * 4) if the same TR contains both a new search help B using method

73 * table A, and table A field is changed to refer to search help B,


74 * SAP will try to activate table before search help. They should be
75 * transported in separate TRs.
76 *
77 * False positive:
78 * A) as all RFC calls are considered as normal function module calls,
79 * program indicates an error if the function module doesn' t exist in
80 * the target system (though it should not test it when it is called
81 * in another system, but it 's too much difficult to know)
82 *
83 *
84 ********************
85 * REQUIRED CUSTOM TOOLS:
86 * ‐ Where‐used list (cross references) = include Z_DEV_WHERE_USED_LIST
87 *
88 *
89 ********************

90 * Standard function modules used:

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 3/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
91 * SRTT_GET_REMOTE_TADIR_ENTRY : read TADIR table
92 * TR_CHECK_TYPE : get frame object (MESS ‐> MSAG, PROG ‐> PROG, FUNC ‐> FUGR, etc.)
93 * TRINT_CHECK_LOCKS : get the TR which locks a given object
94 * TRINT_OBJECT_NAMESPACE_INFO : identify if object is custom
95 * TRINT_RESOLVE_OBJ : get subobjects of a given object
96 * (R3TR PROG ZZZ ‐> LIMU DYNP ZZZ...1200, LIMU REPS ZZZTOP, etc.,
97 * but R3TR MSAG ‐> nothing, and all LIMU ‐> LIMU unchanged, no error)
98
99 INCLUDE Z_DEV_WHERE_USED_LIST.
100 TYPE‐POOLS ICON.
101 PARAMETERS P_TARGET TYPE RFCDEST.
102 * X = analyze standard programs
103 PARAMETERS P_INCSTD TYPE FLAG AS CHECKBOX.
104 * X = ignore errors "source system is different"
105 PARAMETERS P_SRCSYS TYPE FLAG AS CHECKBOX.
106 TABLES E070.
107 SELECT‐OPTIONS S_TRKORR FOR E070‐TRKORR.
108 * "time machine" : mostly used for test purposes
109 PARAMETERS P_TIMEMA TYPE TZNTIMESTP.
110 * dummy screen to display the 3 result ALVs
111 SELECTION‐SCREEN BEGIN OF SCREEN 1010.
112 * parameters p_dummy.
113 SELECTION‐SCREEN END OF SCREEN 1010.
114
115 TYPES TY_T_E071 TYPE TABLE OF E071 WITH DEFAULT KEY.
116 TYPES TY_RESULT_RC TYPE I.
117 CONSTANTS : BEGIN OF GCS_RESULT_RC,
118 OK TYPE TY_RESULT_RC VALUE 0,
119 WARN TYPE TY_RESULT_RC VALUE 4,
120 ERR TYPE TY_RESULT_RC VALUE 8,
121 END OF GCS_RESULT_RC.
122 TYPES : BEGIN OF TY_S_RESULT2,
123 OBJECT TYPE LCL_DEV_CROSS_REF=>TYPE_S_E071_OBJKEY,
124 END OF TY_S_RESULT2.
125 TYPES : BEGIN OF TY_S_RESULT,
126 OBJECT TYPE LCL_DEV_CROSS_REF=>TYPE_S_E071_OBJKEY,
127 TRKORR TYPE E070‐TRKORR,
128 RC TYPE TY_RESULT_RC,
129 ICON TYPE ICON_D,
130 MESSAGE TYPE STRING,
131 END OF TY_S_RESULT.
132 * 2010‐11‐22 scope of local lt_result2 variable from DISPLAY_RESULT
133 * subroutine, changed into global (bug found by Kihoori Oct 21)
134 * List of required objects + by which object(s) are they required
135 TYPES : BEGIN OF TY_GS_RESULT2,
136 OBJECT TYPE LCL_DEV_CROSS_REF=>TYPE_S_E071_OBJKEY,
137 RC TYPE TY_RESULT_RC,

138 SUBOBJECT TYPE LCL_DEV_CROSS_REF=>TYPE_S_E071_OBJKEY,


139 END OF TY_GS_RESULT2.
140 DATA GT_RESULT2 TYPE TABLE OF TY_GS_RESULT2.
141 ******************************
142 *CLASS lcl_salv_handler DEFINITION.
143 * PUBLIC SECTION.
144 * METHODS react_to_double_click
145 * FOR EVENT double_click
146 * OF cl_salv_events_table
147 * IMPORTING row column.
148 *ENDCLASS. "lcl_salv_handler DEFINITION
149 *
150 ******************************
151 *CLASS lcl_salv_handler IMPLEMENTATION.
152 * METHOD react_to_double_click.
153 * ENDMETHOD. "react_to_double_click
154 *ENDCLASS. "lcl_salv_handler IMPLEMENTATION

155 *****************************

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 4/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
156 CLASS LCL_SAP_FM DEFINITION.
157 PUBLIC SECTION.
158 CLASS‐METHODS TR_CHECK_TYPE
159 IMPORTING
160 WI_E071 TYPE E071
161 EXPORTING
162 WE_LOCK_KEY TYPE TLOCK_INT
163 WE_TADIR TYPE TADIR.
164 ENDCLASS. "lcl_sap_fm DEFINITION
165 *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
166 CLASS LCL_SAP_FM IMPLEMENTATION.
167 METHOD TR_CHECK_TYPE.
168 DATA LS_E071 TYPE E071.
169 * TR_CHECK_TYPE retourne vide si object = VARX !
170 * Avec VARI, ça retourne bien le programme
171 LS_E071 = WI_E071.
172 IF LS_E071‐OBJECT = 'VARX'.
173 LS_E071‐OBJECT = 'VARI'.
174 ENDIF.
175 CALL FUNCTION 'TR_CHECK_TYPE'
176 EXPORTING
177 WI_E071 = LS_E071
178 IMPORTING
179 WE_TADIR = WE_TADIR
180 WE_LOCK_KEY = WE_LOCK_KEY.
181 ENDMETHOD. "TR_CHECK_TYPE
182 ENDCLASS. "lcl_sap_fm IMPLEMENTATION
183 *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
184 TYPES : BEGIN OF TYPE_S_DOCU_KEY,
185 DOCU_ID TYPE DOKHL‐ID,
186 DOCU_OBJECT TYPE DOKHL‐OBJECT,
187 END OF TYPE_S_DOCU_KEY.
188 TYPES : BEGIN OF TYPE_S_TOBJ_KEY,
189 OBJECTNAME TYPE OBJH‐OBJECTNAME,
190 OBJECTTYPE TYPE OBJH‐OBJECTTYPE,
191 END OF TYPE_S_TOBJ_KEY.
192 TYPES : BEGIN OF TYPE_S_SOTT_KEY,
193 PAKET TYPE SOTR_PACK,
194 CONCEPT TYPE SOTR_CONC,
195 END OF TYPE_S_SOTT_KEY.
196 TYPES TYPE_SPAD(5) TYPE C.
197 TYPES : BEGIN OF TYPE_S_SPCS_KEY,
198 SPAD_TYPE TYPE TYPE_SPAD,
199 CODEPAGE TYPE TCP00‐CPCODEPAGE,
200 END OF TYPE_S_SPCS_KEY.
201 TYPES : BEGIN OF TYPE_S_SPSV_KEY,
202 SPAD_TYPE TYPE TYPE_SPAD,

203 SERVER TYPE TSPSV‐SERVER,


204 END OF TYPE_S_SPSV_KEY.
205 TYPES : BEGIN OF TYPE_S_SPDV_KEY,
206 SPAD_TYPE TYPE TYPE_SPAD,
207 DEVICE TYPE TSP03‐PADEST,
208 END OF TYPE_S_SPDV_KEY.
209 TYPES : BEGIN OF TYPE_S_SPLO_KEY,
210 SPAD_TYPE TYPE TYPE_SPAD,
211 PAPER_FORMAT TYPE TSP1D‐PAPART,
212 END OF TYPE_S_SPLO_KEY.
213 TYPES : BEGIN OF TYPE_S_PRIN_KEY,
214 SPAD_TYPE TYPE TYPE_SPAD,
215 PRINTER_TYPE TYPE TSP0A‐PATYPE,
216 END OF TYPE_S_PRIN_KEY.
217 TYPES : BEGIN OF TYPE_S_SLOM_KEY,
218 SPAD_TYPE TYPE TYPE_SPAD,
219 LOGICAL_OUTPUT_SYSTEM TYPE TSPLOMS‐NAME,

220 END OF TYPE_S_SLOM_KEY.

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 5/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
221 TYPES : BEGIN OF TYPE_S_SOMS_KEY,
222 SPAD_TYPE TYPE TYPE_SPAD,
223 READ_OUTPUT_SYSTEM TYPE TSPROMS‐NAME,
224 END OF TYPE_S_SOMS_KEY.
225 TYPES : BEGIN OF TYPE_S_SCP_KEY,
226 BCSET_ID TYPE SCPR_ID,
227 CATEGORY TYPE SCPR_CTGRY,
228 END OF TYPE_S_SCP_KEY.
229 TYPES : BEGIN OF TYPE_S_DYNP_KEY,
230 PROGRAM_NAME TYPE D020S‐PROG,
231 SCREEN_NUMBER TYPE D020S‐DNUM,
232 END OF TYPE_S_DYNP_KEY.
233 TYPES : BEGIN OF TYPE_S_VARI_KEY,
234 VARIANT_NAME TYPE VARI‐VARIANT,
235 PROGRAM_NAME TYPE VARI‐REPORT,
236 END OF TYPE_S_VARI_KEY.
237 TYPES : BEGIN OF TYPE_S_MESS_KEY,
238 MSG_CLASS_NAME TYPE T100‐ARBGB,
239 MSG_NUMBER TYPE T100‐MSGNR,
240 END OF TYPE_S_MESS_KEY.
241 TYPES : BEGIN OF TYPE_S_METH_KEY,
242 CLASS_NAME TYPE SEOCLSNAME,
243 METHOD_NAME TYPE SEOCPDNAME,
244 END OF TYPE_S_METH_KEY.
245 TYPES : BEGIN OF TYPE_S_WDYC_KEY,
246 WEBDYNPRO_NAME TYPE WDY_COMPONENT_NAME,
247 CONTROLLER_NAME TYPE WDY_CONTROLLER_NAME,
248 END OF TYPE_S_WDYC_KEY.
249 TYPES : BEGIN OF TYPE_S_WDYV_KEY,
250 WEBDYNPRO_NAME TYPE WDY_COMPONENT_NAME,
251 VIEW_NAME TYPE WDY_VIEW_NAME,
252 END OF TYPE_S_WDYV_KEY.
253 TYPES : BEGIN OF TYPE_S_WAPP_KEY,
254 APPL_NAME TYPE O2APPLNAME,
255 PAGE_NAME TYPE O2PAGE,
256 END OF TYPE_S_WAPP_KEY.
257 TYPES : BEGIN OF TYPE_S_WBOBJ_KEY,
258 OBJ_NAME TYPE E071‐OBJ_NAME,
259 OBJECT TYPE E071‐OBJECT,
260 S_DOCU TYPE TYPE_S_DOCU_KEY,
261 INCLUDE TYPE PROGNAME,
262 TRKORR TYPE TRKORR,
263 S_TOBJ TYPE TYPE_S_TOBJ_KEY,
264 S_SOTT TYPE TYPE_S_SOTT_KEY,
265 S_SPCS TYPE TYPE_S_SPCS_KEY,
266 S_SPSV TYPE TYPE_S_SPSV_KEY,
267 S_SPDV TYPE TYPE_S_SPDV_KEY,

268 S_SPLO TYPE TYPE_S_SPLO_KEY,


269 S_PRIN TYPE TYPE_S_PRIN_KEY,
270 S_SLOM TYPE TYPE_S_SLOM_KEY,
271 S_SOMS TYPE TYPE_S_SOMS_KEY,
272 S_SCP TYPE TYPE_S_SCP_KEY,
273 FILE TYPE CTS_GUID32,
274 S_DYNP TYPE TYPE_S_DYNP_KEY,
275 S_VARI TYPE TYPE_S_VARI_KEY,
276 S_MESS TYPE TYPE_S_MESS_KEY,
277 S_METH TYPE TYPE_S_METH_KEY,
278 S_WDYC TYPE TYPE_S_WDYC_KEY,
279 S_WDYV TYPE TYPE_S_WDYV_KEY,
280 S_WAPP TYPE TYPE_S_WAPP_KEY,
281 END OF TYPE_S_WBOBJ_KEY.
282
283 TYPES : BEGIN OF TY_S_REQUEST,
284 SORT TYPE NUMC4,

285 E070 TYPE E070,

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 6/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
286 END OF TY_S_REQUEST.
287 TYPES SOFT_OR_HARD TYPE C LENGTH 1.
288 TYPES : BEGIN OF TYPE_S_E071_REL,
289 REQUEST TYPE TY_S_REQUEST,
290 OBJECT TYPE LCL_DEV_CROSS_REF=>TYPE_S_E071_OBJKEY,
291 SOFT_OR_HARD TYPE SOFT_OR_HARD,
292 MMMM TYPE FLAG,
293 SUBREQUEST TYPE TY_S_REQUEST,
294 SUBOBJECT TYPE LCL_DEV_CROSS_REF=>TYPE_S_E071_OBJKEY,
295 END OF TYPE_S_E071_REL.
296 TYPES TYPE_T_E071_KEY TYPE SORTED TABLE OF LCL_DEV_CROSS_REF=>TYPE_S_E071_OBJKEY
297 WITH UNIQUE KEY
298 PGMID OBJECT OBJ_NAME.
299 TYPES GTYP_T_E071 TYPE TABLE OF E071.
300 TYPES TY_T_TRKORR TYPE TABLE OF E070‐TRKORR.
301 *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
302 DEFINE MAC_COLLECT.
303 PERFORM COLLECT USING &1 &2 &3 &4 &5.
304 END‐OF‐DEFINITION.
305 *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
306 DATA GT_E071_DONT_EXIST_IN_TARGET TYPE TY_T_E071.
307 DATA: BEGIN OF GS_CLUSTER_CONTENT,
308 LASTGENTIME TYPE TZNTIMESTP,
309 T_E070 TYPE TABLE OF E070 WITH DEFAULT KEY,
310 T_E071 TYPE TY_T_E071,
311 END OF GS_CLUSTER_CONTENT.
312 FIELD‐SYMBOLS <LS_RESULT2> TYPE TY_S_RESULT2.
313 FIELD‐SYMBOLS <LS_RESULT> TYPE TY_S_RESULT.
314 DATA GT_RESULT TYPE TABLE OF TY_S_RESULT.
315 DATA GO_SPLITTER_CONTAINER TYPE REF TO CL_GUI_SPLITTER_CONTAINER.
316 DATA GO_SPLITTER_CONTAINER_2 TYPE REF TO CL_GUI_CONTAINER.
317 DATA GO_CONTAINER_REQUEST TYPE REF TO CL_GUI_CONTAINER.
318 DATA GO_CONTAINER_ERROR TYPE REF TO CL_GUI_CONTAINER.
319 DATA GO_CONTAINER_REQUIREDBY TYPE REF TO CL_GUI_CONTAINER.
320 DATA GO_ALV_REQUEST TYPE REF TO CL_SALV_TABLE.
321 DATA GO_ALV_ERROR TYPE REF TO CL_SALV_TABLE.
322 DATA GO_ALV_REQUIREDBY TYPE REF TO CL_SALV_TABLE.
323 *DATA go_event_handler TYPE REF TO lcl_salv_handler.
324 DATA LT_E071 TYPE TABLE OF E071.
325 DATA GT_REQUEST TYPE TABLE OF TY_S_REQUEST.
326 DATA GS_REQUEST_INITIAL TYPE TY_S_REQUEST.
327 DATA GT_E071_KEY TYPE TABLE OF TYPE_S_E071_REL.
328 DATA GT_E071_KEY_SORTED TYPE TYPE_T_E071_KEY.
329 *DATA: BEGIN OF gth_error OCCURS 0,
330 * text(30) TYPE c,
331 * pgmid TYPE e071‐pgmid,
332 * object TYPE e071‐object,

333 * obj_name TYPE e071‐obj_name,


334 * END OF gth_error.
335 DATA GT_E070_START TYPE TABLE OF E070.
336 DATA GS_E070_START TYPE E070.
337
338 *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
339 INITIALIZATION.
340 * disable HIGH field for transport request select‐options
341 TYPE‐POOLS SSCR.
342 DATA: RESTRICT TYPE SSCR_RESTRICT,
343 OPT_LIST TYPE SSCR_OPT_LIST,
344 ASS TYPE SSCR_ASS.
345 CLEAR OPT_LIST.
346 MOVE 'S_TRKORR' TO OPT_LIST‐NAME.
347 OPT_LIST‐OPTIONS‐EQ = ' X'.
348 APPEND OPT_LIST TO RESTRICT‐OPT_LIST_TAB.
349 CONCATENATE SY‐SYSID ' K9' INTO S_TRKORR‐LOW.

350 APPEND S_TRKORR.

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 7/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
351 ASS‐NAME = 'S_TRKORR'.
352 ASS‐KIND = 'S'.
353 ASS‐SG_MAIN = 'I'.
354 ASS‐SG_ADDY = SPACE.
355 ASS‐OP_MAIN = 'S_TRKORR'.
356 APPEND ASS TO RESTRICT‐ASS_TAB.
357 CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
358 EXPORTING
359 RESTRICTION = RESTRICT
360 EXCEPTIONS
361 OTHERS = 1.
362 * set default variant to initialize selection screen fields
363 IF SY‐SLSET IS INITIAL.
364 DATA G_VARIANT TYPE RSVAR‐VARIANT.
365 CONCATENATE 'US' SY‐UNAME INTO G_VARIANT.
366 CALL FUNCTION 'RS_SUPPORT_SELECTIONS'
367 EXPORTING
368 REPORT = SY‐CPROG "actual program name
369 VARIANT = G_VARIANT "default variant name
370 EXCEPTIONS
371 VARIANT_NOT_EXISTENT = 1
372 VARIANT_OBSOLETE = 2
373 OTHERS = 3.
374 IF SY‐SUBRC = 1.
375 CALL FUNCTION 'RS_SUPPORT_SELECTIONS'
376 EXPORTING
377 REPORT = SY‐CPROG "actual program name
378 VARIANT = 'SAPDEFAULT' "default variant name
379 EXCEPTIONS
380 VARIANT_NOT_EXISTENT = 0
381 VARIANT_OBSOLETE = 0
382 OTHERS = 0.
383 ENDIF.
384 ENDIF.
385
386 *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
387 AT SELECTION‐SCREEN OUTPUT.
388 IF SY‐DYNNR = 1010.
389 PERFORM DISPLAY_RESULT.
390 ENDIF.
391
392 *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
393 AT SELECTION‐SCREEN.
394 IF SY‐DYNNR = 1000 AND SY‐UCOMM = ' ONLI'.
395 * Sélectionner les ordres
396 * ‐ et ignorer les entrées qui sont des tâches
397 * TODO: ignore released requests (problématique à traiter car il n' y a pas de versioning dans les cross‐references)

398 * AND trstatus IN ('D','L'). "modifiable


399 SELECT * FROM E070 INTO TABLE GT_E070_START
400 WHERE TRKORR IN S_TRKORR
401 AND STRKORR = SPACE.
402 IF LINES( S_TRKORR ) <> LINES( GT_E070_START ).
403 MESSAGE E001(00) WITH 'You have entered tasks, replace them with requests'(015).
404 ENDIF.
405 * DATA ls_rfcsi TYPE rfcsi.
406 DATA L_LOGIN_COMPLETE TYPE SYDEBUG.
407 CALL FUNCTION 'RFC_LOGIN_INFO'
408 DESTINATION P_TARGET
409 IMPORTING
410 RFC_LOGIN_COMPLETE = L_LOGIN_COMPLETE
411 EXCEPTIONS
412 COMMUNICATION_FAILURE = 1
413 SYSTEM_FAILURE = 1.
414 IF SY‐SUBRC <> 0 OR L_LOGIN_COMPLETE <> 'Y'.

415 MESSAGE E001(00) WITH 'Invalid RFC destination or wrong user/password'(018).

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 8/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
416 ENDIF.
417 ENDIF.
418 *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
419 START‐OF‐SELECTION.
420 PERFORM MAIN2.
421 PERFORM PROCESS1.
422 PERFORM PROCESS2.
423 * Display results (ALV). Note: 1010 is a dummy screen
424 CALL SELECTION‐SCREEN 1010.
425 ASSERT 1 = 1.
426 *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
427 FORM COLLECT
428 USING
429 X TYPE LCL_DEV_CROSS_REF=>TYPE_S_E071_OBJKEY " object
430 SOFT_OR_HARD TYPE SOFT_OR_HARD
431 MMMM TYPE FLAG
432 Y TYPE LCL_DEV_CROSS_REF=>TYPE_S_E071_OBJKEY "subobject
433 SUBREQUEST TYPE TY_S_REQUEST.
434 DATA LS_E071 TYPE E071.
435 DATA LS_TADIR TYPE TADIR.
436 DATA L_LINES TYPE I.
437 DATA L_NAMECLASS TYPE C LENGTH 1.
438 DATA L_CASTING_OBJNAME TYPE TADIR‐OBJ_NAME.
439 DATA LS_E071_KEY TYPE TYPE_S_E071_REL.
440 * Collect only custom objects except if user asked to analyze standard too
441 * For this test, TRINT_OBJECT_NAMESPACE_INFO function module requires
442 * R3TR, so first convert LIMU into R3TR (and R3TR remains unchanged) by
443 * calling TR_CHECK_TYPE function module
444 LS_E071‐PGMID = Y‐PGMID.
445 LS_E071‐OBJECT = Y‐OBJECT.
446 LS_E071‐OBJ_NAME = Y‐OBJ_NAME.
447 CALL METHOD LCL_SAP_FM=>TR_CHECK_TYPE
448 EXPORTING
449 WI_E071 = LS_E071
450 IMPORTING
451 WE_TADIR = LS_TADIR.
452
453 * If target object doesn't exist in target system, then process it whatever it
454 * is custom or standard
455 READ TABLE GT_E071_DONT_EXIST_IN_TARGET
456 WITH KEY
457 PGMID = LS_TADIR‐PGMID
458 OBJECT = LS_TADIR‐OBJECT
459 OBJ_NAME = LS_TADIR‐OBJ_NAME
460 BINARY SEARCH
461 TRANSPORTING NO FIELDS.
462 IF SY‐SUBRC = 0.

463 L_NAMECLASS = 'C'.


464 ELSE.
465 CALL FUNCTION 'TRINT_OBJECT_NAMESPACE_INFO'
466 EXPORTING
467 IV_PGMID = LS_TADIR‐PGMID
468 IV_OBJECT = LS_TADIR‐OBJECT
469 IV_OBJNAME = LS_TADIR‐OBJ_NAME
470 IMPORTING
471 EV_NAMECLASS = L_NAMECLASS
472 EXCEPTIONS
473 OTHERS = 4.
474 ENDIF.
475 * nameclass may have values 'S' (standard) or 'C' (customer)
476 IF L_NAMECLASS = 'C' OR X IS INITIAL OR P_INCSTD = 'X'.
477 * Object is custom
478 READ TABLE GT_E071_KEY INTO LS_E071_KEY
479 WITH KEY

480 OBJECT = X

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 9/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
481 SUBOBJECT = Y.
482 IF SY‐SUBRC <> 0.
483 CLEAR LS_E071_KEY.
484 * Object was maybe in a TR, get it along with its sequence
485 READ TABLE GT_E071_KEY INTO LS_E071_KEY
486 WITH KEY
487 SUBOBJECT = X
488 SOFT_OR_HARD = SPACE
489 TRANSPORTING
490 SUBREQUEST.
491 LS_E071_KEY‐REQUEST = LS_E071_KEY‐SUBREQUEST.
492 CLEAR LS_E071_KEY‐SUBREQUEST.
493 LS_E071_KEY‐OBJECT = X.
494 LS_E071_KEY‐SOFT_OR_HARD = SOFT_OR_HARD.
495 LS_E071_KEY‐MMMM = MMMM.
496 IF SUBREQUEST IS INITIAL.
497 READ TABLE GT_E071_KEY INTO LS_E071_KEY
498 WITH KEY
499 SUBOBJECT = Y
500 SOFT_OR_HARD = SPACE
501 TRANSPORTING
502 SUBREQUEST.
503 ELSE.
504 LS_E071_KEY‐SUBREQUEST = SUBREQUEST.
505 ENDIF.
506 LS_E071_KEY‐SUBOBJECT = Y.
507 APPEND LS_E071_KEY TO GT_E071_KEY.
508 ENDIF.
509 ENDIF.
510 ENDFORM. "collect
511 *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ *
512 FORM MAIN2.
513 DATA LS_E071_KEY TYPE LCL_DEV_CROSS_REF=>TYPE_S_E071_OBJKEY.
514 DATA LS_E071 TYPE E071.
515 DATA LT_E070_BIS TYPE TABLE OF E070.
516 DATA X TYPE I.
517 DATA LT_RNG_TRKORR TYPE RANGE OF E070‐TRKORR.
518 DATA LS_RNG_TRKORR LIKE LINE OF LT_RNG_TRKORR.
519 DATA LS_EMPTY TYPE LCL_DEV_CROSS_REF=>TYPE_S_E071_OBJKEY.
520 DATA L_TRKORR TYPE E070‐TRKORR.
521 DATA LS_TRKORR LIKE LINE OF S_TRKORR.
522 DATA LS_REQUEST TYPE TY_S_REQUEST.
523 DATA L_TABIX TYPE SYTABIX.
524 DATA LS_E071_PREV TYPE E071.
525 DATA LS_REQUEST_PREV TYPE TY_S_REQUEST.
526 DATA LS_E071_REL TYPE TYPE_S_E071_REL.
527 DATA LT_E070 TYPE TABLE OF E070.

528 DATA LS_E070 TYPE E070.


529
530 * Build list of objects that exist in released transport requests
531 * of the current system, but that don't exist in target system
532 * This process is time consuming, so a buffering incremental method
533 * is used (it's time consuming only first time a target system is
534 * entered)
535 PERFORM GET_E071_DONT_EXIST_IN_TARGET
536 USING
537 P_TARGET
538 CHANGING
539 GT_E071_DONT_EXIST_IN_TARGET.
540 REFRESH LT_RNG_TRKORR.
541 LOOP AT GT_E070_START INTO LS_E070.
542 LS_RNG_TRKORR‐SIGN = 'I'.
543 LS_RNG_TRKORR‐OPTION = ' EQ'.
544 LS_RNG_TRKORR‐LOW = LS_E070‐TRKORR.

545 APPEND LS_RNG_TRKORR TO LT_RNG_TRKORR.

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 10/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
546 ENDLOOP.
547 * Determine and store sequence number of the TR in S_TRKORR
548 SORT GT_E070_START BY TRKORR.
549 REFRESH GT_REQUEST.
550 CLEAR LS_REQUEST.
551 LOOP AT S_TRKORR INTO LS_TRKORR.
552 READ TABLE GT_E070_START WITH KEY TRKORR = LS_TRKORR‐LOW BINARY SEARCH INTO LS_E070.
553 IF SY‐SUBRC = 0.
554 ADD 1 TO LS_REQUEST‐SORT.
555 LS_REQUEST‐E070 = LS_E070.
556 APPEND LS_REQUEST TO GT_REQUEST.
557 ENDIF.
558 ENDLOOP.
559 * List of requests and tasks containing objects to analyze
560 LT_E070_BIS = GT_E070_START.
561 * Take into account tasks not released yet that belong to entered
562 * transport requests (tasks: STRKORR <> blank; not released: TRSTATUS = ' D' or 'L')
563 SELECT * FROM E070 INTO TABLE LT_E070
564 WHERE STRKORR IN LT_RNG_TRKORR
565 AND TRSTATUS IN (' D','L'). "modifiable
566 APPEND LINES OF LT_E070 TO LT_E070_BIS.
567 LOOP AT LT_E070 INTO LS_E070.
568 LS_RNG_TRKORR‐SIGN = 'I'.
569 LS_RNG_TRKORR‐OPTION = ' EQ'.
570 LS_RNG_TRKORR‐LOW = LS_E070‐TRKORR.
571 APPEND LS_RNG_TRKORR TO LT_RNG_TRKORR.
572 ENDLOOP.
573 * Build list of objects ("initial objects") to transport
574 SELECT * FROM E071 INTO TABLE LT_E071
575 WHERE TRKORR IN LT_RNG_TRKORR
576 AND PGMID NE ' CORR'. "ignore CORR RELE lines, they pollute the result
577 * Store initial objects, along with the transport request (not the
578 * eventual task) to which they belong.
579 * If same object appears several times, only take into account first occurrence
580 * in the S_TRKORR sequence (smallest SORT)
581 * TODO: here I didn' t check when same object has 2 different keys (LIMU REPS
582 * and R3TR PROG for example)
583 SORT LT_E070_BIS BY TRKORR.
584 SORT GT_REQUEST BY E070‐TRKORR.
585 SORT LT_E071 BY PGMID OBJECT OBJ_NAME.
586 L_TABIX = 0.
587 DO.
588 IF L_TABIX > LINES( LT_E071 ).
589 EXIT.
590 ENDIF.
591 ADD 1 TO L_TABIX.
592 READ TABLE LT_E071 INTO LS_E071 INDEX L_TABIX.

593 IF SY‐SUBRC = 0.
594 * Get the transport request number when the object is in a non released task
595 CLEAR LS_E070.
596 READ TABLE LT_E070_BIS WITH KEY TRKORR = LS_E071‐TRKORR INTO LS_E070
597 BINARY SEARCH.
598 IF LS_E070‐STRKORR IS NOT INITIAL.
599 L_TRKORR = LS_E070‐STRKORR.
600 ELSE.
601 L_TRKORR = LS_E070‐TRKORR.
602 ENDIF.
603 * Get the first transport request in S_TRKORR in which the object appears first
604 * (when the object belongs to several transport requests)
605 READ TABLE GT_REQUEST WITH KEY E070‐TRKORR = L_TRKORR INTO LS_REQUEST
606 BINARY SEARCH.
607 ENDIF.
608 IF L_TABIX <= LINES( LT_E071 )
609 AND LS_E071‐PGMID = LS_E071_PREV‐PGMID

610 AND LS_E071‐OBJECT = LS_E071_PREV‐OBJECT

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 11/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
611 AND LS_E071‐OBJ_NAME = LS_E071_PREV‐OBJ_NAME.
612 * object appears twice, delete one occurrence
613 IF LS_REQUEST‐SORT <= LS_REQUEST_PREV‐SORT.
614 * keep current, delete previous
615 SUBTRACT 1 FROM L_TABIX.
616 DELETE LT_E071 INDEX L_TABIX.
617 ELSE.
618 * keep previous, delete current
619 DELETE LT_E071 INDEX L_TABIX.
620 * reposition for next iteration
621 LS_REQUEST = LS_REQUEST_PREV.
622 SUBTRACT 1 FROM L_TABIX.
623 ENDIF.
624 ELSEIF L_TABIX <> 1.
625 * each time a new object is to be processed, or after last object,
626 * add previous object
627 LS_E071_KEY‐PGMID = LS_E071_PREV‐PGMID.
628 LS_E071_KEY‐OBJECT = LS_E071_PREV‐OBJECT.
629 LS_E071_KEY‐OBJ_NAME = LS_E071_PREV‐OBJ_NAME.
630 MAC_COLLECT LS_EMPTY '' '' LS_E071_KEY LS_REQUEST_PREV.
631 ENDIF.
632 * current becomes "previous" for next iteration
633 LS_E071_PREV = LS_E071.
634 LS_REQUEST_PREV = LS_REQUEST.
635 ENDDO.
636 * Add subobjects (R3TR PROG may contain LIMU DYNP, etc.)
637 LOOP AT GT_E071_KEY INTO LS_E071_REL.
638 DATA LT_SUBOBJ TYPE TYPE_T_E071_KEY.
639 DATA LS_SUBOBJ TYPE LCL_DEV_CROSS_REF=>TYPE_S_E071_OBJKEY.
640 PERFORM GET_SUBOBJ USING LS_E071_REL‐SUBOBJECT LS_E071_REL‐SUBREQUEST CHANGING LT_SUBOBJ.
641 ENDLOOP.
642
643 REFRESH GT_E071_KEY_SORTED.
644 ENDFORM. "main2
645 *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
646 FORM GET_SUBOBJ
647 USING
648 IS_SUBOBJECT TYPE LCL_DEV_CROSS_REF=>TYPE_S_E071_OBJKEY
649 IS_SUBREQUEST TYPE TYPE_S_E071_REL‐SUBREQUEST
650 CHANGING
651 ET_SUBOBJ TYPE TYPE_T_E071_KEY.
652 DATA LT_T100 TYPE TABLE OF T100.
653 DATA LS_T100 TYPE T100.
654 DATA LT_VARID TYPE TABLE OF VARID.
655 DATA LS_VARID TYPE VARID.
656 DATA LS_E071_KEY TYPE LCL_DEV_CROSS_REF=>TYPE_S_E071_OBJKEY.
657 DATA LS_E071 TYPE E071.

658 DATA LT_VRSO_SOURCE TYPE TABLE OF VRSO.


659 DATA LS_VRSO TYPE VRSO.
660 IF IS_SUBOBJECT‐PGMID = 'R3TR'.
661 CASE IS_SUBOBJECT‐OBJECT.
662 WHEN 'MSAG'.
663 SELECT * FROM T100 INTO TABLE LT_T100 WHERE ARBGB = IS_SUBOBJECT‐OBJ_NAME.
664 LOOP AT LT_T100 INTO LS_T100.
665 LS_E071_KEY‐PGMID = 'LIMU'.
666 LS_E071_KEY‐OBJECT = 'MESS'.
667 CONCATENATE IS_SUBOBJECT‐OBJ_NAME LS_T100‐MSGNR INTO LS_E071_KEY‐OBJ_NAME.
668 MAC_COLLECT IS_SUBOBJECT '' 'X' LS_E071_KEY IS_SUBREQUEST.
669 ENDLOOP.
670 WHEN OTHERS.
671 * Call TRINT_RESOLVE_OBJ on each system to check existence of all subobjects
672 * If an object is a frame object (R3TR PROG, R3TR FUGR), consider that
673 * all its subobjects (LIMU DYNP, LIMU FUNC, etc.) belong to the same
674 * transport request

675 LS_E071‐OBJECT = IS_SUBOBJECT‐OBJECT.

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 12/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
676 LS_E071‐OBJ_NAME = IS_SUBOBJECT‐OBJ_NAME.
677 REFRESH LT_VRSO_SOURCE.
678 CALL FUNCTION 'TRINT_RESOLVE_OBJ'
679 EXPORTING
680 IS_E071 = LS_E071
681 TABLES
682 ET_VRSO = LT_VRSO_SOURCE
683 EXCEPTIONS
684 NOT_VERSIONABLE = 1
685 COMMUNICATION_ERROR = 2
686 OTHERS = 3.
687 LOOP AT LT_VRSO_SOURCE INTO LS_VRSO.
688 LS_E071_KEY‐PGMID = 'LIMU'.
689 LS_E071_KEY‐OBJECT = LS_VRSO‐OBJTYPE.
690 LS_E071_KEY‐OBJ_NAME = LS_VRSO‐OBJNAME.
691 MAC_COLLECT IS_SUBOBJECT '' 'X' LS_E071_KEY IS_SUBREQUEST.
692 ENDLOOP.
693 ENDCASE.
694 * 2010‐11‐22
695 * Line LIMU ADIR R3TRSOTR<name> transports implicitly R3TR SOTR <name>
696 * object so it must be added
697 ELSEIF IS_SUBOBJECT‐PGMID = 'LIMU' AND IS_SUBOBJECT‐OBJECT = 'ADIR'.
698 LS_E071_KEY‐PGMID = IS_SUBOBJECT‐OBJ_NAME+0(4).
699 LS_E071_KEY‐OBJECT = IS_SUBOBJECT‐OBJ_NAME+4(4).
700 LS_E071_KEY‐OBJ_NAME = IS_SUBOBJECT‐OBJ_NAME+8.
701 MAC_COLLECT IS_SUBOBJECT '' 'X' LS_E071_KEY IS_SUBREQUEST.
702 ENDIF.
703 CASE IS_SUBOBJECT‐OBJECT.
704 WHEN 'PROG' OR 'REPS' OR 'REPO'.
705 * propose automatically system variants
706 SELECT * FROM VARID CLIENT SPECIFIED
707 INTO TABLE LT_VARID
708 WHERE MANDT = '000' "system variants are only in client 000
709 AND REPORT = IS_SUBOBJECT‐OBJ_NAME
710 AND TRANSPORT = SPACE. "system variant
711 LOOP AT LT_VARID INTO LS_VARID.
712 LS_E071_KEY‐PGMID = 'LIMU'.
713 LS_E071_KEY‐OBJECT = 'VARX'.
714 CONCATENATE LS_VARID‐REPORT LS_VARID‐VARIANT INTO LS_E071_KEY‐OBJ_NAME RESPECTING BLANKS.
715 MAC_COLLECT IS_SUBOBJECT 'S' '' LS_E071_KEY IS_SUBREQUEST.
716 ENDLOOP.
717 ENDCASE.
718 ENDFORM. "get_subobj
719 *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ *
720 FORM PROCESS1.
721 DATA LS_E071_KEY TYPE TYPE_S_E071_REL.
722 * look for all required subobjects

723 LOOP AT GT_E071_KEY INTO LS_E071_KEY


724 WHERE MMMM IS INITIAL
725 AND SOFT_OR_HARD IS INITIAL.
726 DATA LO_EXC TYPE REF TO CX_ROOT.
727 DATA LT_OBJ TYPE LCL_DEV_CROSS_REF=>TYPE_T_E071_REL.
728 DATA LS_OBJ TYPE LCL_DEV_CROSS_REF=>TYPE_S_E071_REL.
729 REFRESH LT_OBJ.
730 TRY.
731 CALL METHOD LCL_DEV_CROSS_REF=>GET_REQOBJ
732 EXPORTING
733 IS_E071_KEY = LS_E071_KEY‐SUBOBJECT
734 IMPORTING
735 ET_E071_KEY = LT_OBJ.
736 CATCH CX_ROOT INTO LO_EXC.
737 LO_EXC‐>GET_LONGTEXT( ).
738 ENDTRY.
739 LOOP AT LT_OBJ INTO LS_OBJ.

740 MAC_COLLECT LS_E071_KEY‐SUBOBJECT LS_OBJ‐SOFT_OR_HARD

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 13/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
741 LS_E071_KEY‐MMMM LS_OBJ‐SUBOBJECT GS_REQUEST_INITIAL.
742 ENDLOOP.
743 ENDLOOP.
744 ENDFORM. "process1
745 *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
746 FORM PROCESS2.
747 DATA LT_E071_KEY TYPE TABLE OF TYPE_S_E071_REL.
748 DATA LS_E071_KEY TYPE TYPE_S_E071_REL.
749 DATA LS_E071_KEY_2 TYPE TYPE_S_E071_REL.
750 DATA LS_TRKORR LIKE LINE OF S_TRKORR.
751 DATA LS_REQUEST TYPE TY_S_REQUEST.
752 DATA OBJNAME TYPE VRSD_OLD‐OBJNAME.
753 DATA OBJTYPE TYPE VRSD_OLD‐OBJTYPE.
754 DATA LS_E071 TYPE E071.
755 DATA LT_VRSO_SOURCE TYPE TABLE OF VRSO.
756 DATA LT_VRSO_TARGET TYPE TABLE OF VRSO.
757 DATA LS_VRSO TYPE VRSO.
758 DATA L_STRING_OBJECT TYPE STRING.
759 DATA L_STRING_SUBOBJECT TYPE STRING.
760 DATA LS_TADIR TYPE TADIR.
761 DATA OBJNAME2 TYPE VRSD‐OBJNAME.
762 DATA OBJTYPE2 TYPE VRSD‐OBJTYPE.
763 DATA LT_VERSION_TARGET TYPE TABLE OF VRSD.
764 DATA LT_VERSNO_TARGET TYPE TABLE OF VRSN.
765 DATA LS_VERSION_TARGET TYPE VRSD.
766 DATA L_SPRSL TYPE T100‐SPRSL.
767 DATA LT_DOCU_TAB TYPE TABLE OF RPY_OBJTAB.
768 DATA LT_DOCU_TECH TYPE TABLE OF TLINE.
769 DATA L_NOT_FOUND TYPE FLAG.
770 DATA L_TRKORR TYPE E070‐TRKORR.
771 DATA L_LOCK TYPE FLAG.
772 DATA L_SRCSYSTEM_IN_CURRENT TYPE TADIR‐SRCSYSTEM.
773 DATA L_SRCSYSTEM_IN_TARGET TYPE TADIR‐SRCSYSTEM.
774
775 SORT GT_E071_KEY BY SUBOBJECT.
776 LT_E071_KEY = GT_E071_KEY.
777 DELETE ADJACENT DUPLICATES FROM LT_E071_KEY COMPARING SUBOBJECT.
778
779 * loop at all required objects
780 * (MMMM = 'X' when object is included in another one which is
781 * transported (expl: when R3TR MSAG is to be transported, all its
782 * messages (LIMU MESS) also exist with MMMM = 'X')
783 LOOP AT LT_E071_KEY INTO LS_E071_KEY
784 WHERE MMMM IS INITIAL.
785 * Initialize texts which will be used later
786 CONCATENATE LS_E071_KEY‐SUBOBJECT‐PGMID LS_E071_KEY‐SUBOBJECT‐OBJECT
787 LS_E071_KEY‐SUBOBJECT‐OBJ_NAME INTO L_STRING_SUBOBJECT

788 SEPARATED BY '‐'.


789 IF LS_E071_KEY‐SUBREQUEST IS NOT INITIAL.
790 CONCATENATE L_STRING_SUBOBJECT ' (' 'TR:'(001)
791 LS_E071_KEY‐SUBREQUEST‐E070‐TRKORR ')'
792 INTO L_STRING_SUBOBJECT.
793 ENDIF.
794 CONCATENATE LS_E071_KEY‐OBJECT‐PGMID LS_E071_KEY‐OBJECT‐OBJECT
795 LS_E071_KEY‐OBJECT‐OBJ_NAME INTO L_STRING_OBJECT
796 SEPARATED BY '‐'.
797 IF LS_E071_KEY‐REQUEST IS NOT INITIAL.
798 CONCATENATE L_STRING_OBJECT ' (' 'TR:'(001)
799 LS_E071_KEY‐REQUEST‐E070‐TRKORR ')'
800 INTO L_STRING_OBJECT.
801 ENDIF.
802
803 READ TABLE GT_RESULT ASSIGNING <LS_RESULT>
804 WITH KEY

805 OBJECT = LS_E071_KEY‐SUBOBJECT.

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 14/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
806 IF SY‐SUBRC <> 0.
807 APPEND INITIAL LINE TO GT_RESULT ASSIGNING <LS_RESULT>.
808 <LS_RESULT>‐OBJECT = LS_E071_KEY‐SUBOBJECT.
809 <LS_RESULT>‐TRKORR = LS_E071_KEY‐SUBREQUEST‐E070‐TRKORR.
810 ENDIF.
811
812 PERFORM CHECK_EXISTS USING LS_E071_KEY‐SUBOBJECT P_TARGET
813 CHANGING L_NOT_FOUND L_LOCK L_TRKORR L_SRCSYSTEM_IN_CURRENT
814 L_SRCSYSTEM_IN_TARGET.
815 IF LS_E071_KEY‐SOFT_OR_HARD IS INITIAL.
816 IF L_NOT_FOUND IS INITIAL
817 AND L_SRCSYSTEM_IN_CURRENT <> L_SRCSYSTEM_IN_TARGET.
818 IF P_SRCSYS IS INITIAL.
819 <LS_RESULT>‐RC = GCS_RESULT_RC‐ERR.
820 <LS_RESULT>‐ICON = ICON_RED_LIGHT.
821 ELSE.
822 <LS_RESULT>‐RC = GCS_RESULT_RC‐WARN.
823 <LS_RESULT>‐ICON = ICON_YELLOW_LIGHT.
824 ENDIF.
825 <LS_RESULT>‐MESSAGE = 'Object has a different source system ' &
826 'between the 2 systems (TW103)'(002).
827 ELSE.
828 <LS_RESULT>‐RC = GCS_RESULT_RC‐OK.
829 <LS_RESULT>‐ICON = ICON_GREEN_LIGHT.
830 IF LS_E071_KEY‐OBJECT IS INITIAL.
831 CONCATENATE 'OK as object is transported in TR'(003)
832 LS_E071_KEY‐REQUEST‐E070‐TRKORR
833 INTO <LS_RESULT>‐MESSAGE
834 SEPARATED BY SPACE.
835 ELSE.
836 * TODO: not sure that this code is okay (wrong condition or wrong text)
837 CONCATENATE 'OK as its using object'(004) L_STRING_OBJECT
838 'is transported in one of the TRs'(005)
839 INTO <LS_RESULT>‐MESSAGE
840 SEPARATED BY SPACE.
841 ENDIF.
842 ENDIF.
843 ELSE.
844 ************************
845 * Processing of required objects
846 ************************
847 IF LS_E071_KEY‐SUBREQUEST IS NOT INITIAL
848 AND LS_E071_KEY‐SUBREQUEST‐SORT = LS_E071_KEY‐REQUEST‐SORT.
849 <LS_RESULT>‐RC = GCS_RESULT_RC‐OK.
850 <LS_RESULT>‐ICON = ICON_GREEN_LIGHT.
851 <LS_RESULT>‐MESSAGE = 'OK as required and using objects are'
852 & ' in the same TR'(006).

853 ELSEIF LS_E071_KEY‐SUBREQUEST IS NOT INITIAL


854 AND LS_E071_KEY‐SUBREQUEST‐SORT < LS_E071_KEY‐REQUEST‐SORT.
855 <LS_RESULT>‐RC = GCS_RESULT_RC‐OK.
856 <LS_RESULT>‐ICON = ICON_GREEN_LIGHT.
857 CONCATENATE 'OK as using object is in earlier TR'(007)
858 LS_E071_KEY‐SUBREQUEST‐E070‐TRKORR 'before required object'(016)
859 INTO <LS_RESULT>‐MESSAGE
860 SEPARATED BY SPACE.
861 ELSE.
862 * If subobject is neither in current TR nor in one of previous TR (in S_TRKORR),
863 * make sure that it already exists in target system
864 * In case the object is " soft" required (missing package for example),
865 * transport request won't fail, so it's just a warning
866 IF L_NOT_FOUND = 'X'.
867 IF LS_E071_KEY‐SOFT_OR_HARD = 'S'.
868 <LS_RESULT>‐RC = GCS_RESULT_RC‐WARN.
869 <LS_RESULT>‐ICON = ICON_YELLOW_LIGHT.

870 CONCATENATE 'OK though required object is neither transported,'(017)

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 15/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
871 ' nor exists in target system, but it is not mandatory'(008)
872 INTO <LS_RESULT>‐MESSAGE.
873 ELSE.
874 <LS_RESULT>‐RC = GCS_RESULT_RC‐ERR.
875 <LS_RESULT>‐ICON = ICON_RED_LIGHT.
876 <LS_RESULT>‐MESSAGE = 'Required object does not exist in ' &
877 'target system'(009).
878 ENDIF.
879 * Required subobject is provided in one of the TRs in S_TRKORR, but this
880 * TR should be transported before
881 IF LS_E071_KEY‐SUBREQUEST IS NOT INITIAL
882 AND LS_E071_KEY‐SUBREQUEST‐SORT > LS_E071_KEY‐REQUEST‐SORT.
883 <LS_RESULT>‐RC = GCS_RESULT_RC‐WARN.
884 <LS_RESULT>‐ICON = ICON_YELLOW_LIGHT.
885 CONCATENATE <LS_RESULT>‐MESSAGE 'Required object is in TR '(010)
886 LS_E071_KEY_2‐SUBREQUEST‐E070‐TRKORR
887 INTO <LS_RESULT>‐MESSAGE.
888 ELSE.
889 * Propose a transport request containing the required object
890 * (so that user adds it to the list of transport requests (S_TRKORR)
891 IF L_NOT_FOUND IS INITIAL.
892 IF L_LOCK = 'X'.
893 <LS_RESULT>‐RC = GCS_RESULT_RC‐WARN.
894 <LS_RESULT>‐ICON = ICON_YELLOW_LIGHT.
895 CONCATENATE <LS_RESULT>‐MESSAGE
896 'Note: required object is locked in TR'(011)
897 L_TRKORR INTO <LS_RESULT>‐MESSAGE
898 SEPARATED BY SPACE.
899 ELSE.
900 <LS_RESULT>‐RC = GCS_RESULT_RC‐WARN.
901 <LS_RESULT>‐ICON = ICON_YELLOW_LIGHT.
902 CONCATENATE <LS_RESULT>‐MESSAGE
903 'Note: object exists in TR '(012) L_TRKORR
904 'for example'(013) INTO <LS_RESULT>‐MESSAGE
905 SEPARATED BY SPACE.
906 ENDIF.
907 ENDIF.
908 ENDIF.
909 ELSE.
910 <LS_RESULT>‐RC = GCS_RESULT_RC‐OK.
911 <LS_RESULT>‐ICON = ICON_GREEN_LIGHT.
912 <LS_RESULT>‐MESSAGE = 'OK as required object already exists in '
913 & 'target system'(014).
914 ENDIF.
915 ENDIF.
916 ENDIF.
917 ENDLOOP.

918 ENDFORM. "process2


919 *&amp;‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ *
920 *&amp; Form display_result
921 *&amp;‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ *
922 * text
923 *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ *
924 FORM DISPLAY_RESULT.
925 DATA LS_E071_KEY TYPE TYPE_S_E071_REL.
926 DATA LO_COLUMNS TYPE REF TO CL_SALV_COLUMNS_TABLE.
927 * DATA lo_events TYPE REF TO cl_salv_events_table.
928 TRY.
929 CREATE OBJECT GO_SPLITTER_CONTAINER
930 EXPORTING
931 PARENT = CL_GUI_CONTAINER=>SCREEN0
932 ROWS = 3
933 COLUMNS = 1.
934 GO_CONTAINER_REQUEST = GO_SPLITTER_CONTAINER‐>GET_CONTAINER( ROW = 1 COLUMN = 1 ).

935 GO_CONTAINER_ERROR = GO_SPLITTER_CONTAINER‐>GET_CONTAINER( ROW = 2 COLUMN = 1 ).

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 16/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
936 GO_CONTAINER_REQUIREDBY = GO_SPLITTER_CONTAINER‐>GET_CONTAINER( ROW = 3 COLUMN = 1 ).
937
938 * Remind the entered sequence of transport requests
939 CALL METHOD CL_SALV_TABLE=>FACTORY
940 EXPORTING
941 R_CONTAINER = GO_CONTAINER_REQUEST
942 IMPORTING
943 R_SALV_TABLE = GO_ALV_REQUEST
944 CHANGING
945 T_TABLE = GT_REQUEST.
946 LO_COLUMNS = GO_ALV_REQUEST‐>GET_COLUMNS( ).
947 LO_COLUMNS‐>SET_OPTIMIZE( ).
948 GO_ALV_REQUEST‐>DISPLAY( ).
949
950 * List of errors
951 CALL METHOD CL_SALV_TABLE=>FACTORY
952 EXPORTING
953 R_CONTAINER = GO_CONTAINER_ERROR
954 IMPORTING
955 R_SALV_TABLE = GO_ALV_ERROR
956 CHANGING
957 T_TABLE = GT_RESULT.
958 LO_COLUMNS = GO_ALV_ERROR‐>GET_COLUMNS( ).
959 LO_COLUMNS‐>SET_OPTIMIZE( ).
960 * lo_events = go_alv_error‐>get_event( ).
961 * CREATE OBJECT go_event_handler.
962 * SET HANDLER go_event_handler‐>react_to_double_click FOR lo_events.
963 * TRY.
964 * CALL METHOD go_alv_error‐>set_screen_status
965 * EXPORTING
966 * report = sy‐repid
967 * pfstatus = 'ALV'
968 * set_functions = cl_salv_table=>c_functions_all.
969 * CATCH cx_root.
970 * IF 0 = 1. ENDIF.
971 * ENDTRY.
972 GO_ALV_ERROR‐>DISPLAY( ).
973
974 DATA LS_RESULT2 TYPE TY_GS_RESULT2.
975 REFRESH GT_RESULT2.
976 LOOP AT GT_RESULT ASSIGNING <LS_RESULT>.
977 CLEAR LS_RESULT2.
978 LS_RESULT2‐OBJECT = <LS_RESULT>‐OBJECT.
979 LS_RESULT2‐RC = <LS_RESULT>‐RC.
980 * WRITE : / <ls_result>‐object‐pgmid, <ls_result>‐object‐object, <ls_result>‐object‐obj_name.
981 * CASE <ls_result>‐rc.
982 * WHEN gcs_result_rc‐ok.

983 * WRITE 'OK' COLOR 5.


984 * WHEN gcs_result_rc‐warn.
985 * WRITE 'OK' COLOR 7.
986 * WHEN gcs_result_rc‐err.
987 * WRITE 'KO' COLOR 6.
988 * ENDCASE.
989 * WRITE : <ls_result>‐message.
990 DATA L_APPENDED TYPE FLAG.
991 CLEAR L_APPENDED.
992 READ TABLE GT_E071_KEY INTO LS_E071_KEY
993 WITH KEY
994 SUBOBJECT = <LS_RESULT>‐OBJECT
995 BINARY SEARCH.
996 IF SY‐SUBRC = 0.
997 LOOP AT GT_E071_KEY INTO LS_E071_KEY
998 FROM SY‐TABIX
999 WHERE

1000 SUBOBJECT = <LS_RESULT>‐OBJECT.

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 17/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
1001 LS_RESULT2‐SUBOBJECT = LS_E071_KEY‐OBJECT.
1002 APPEND LS_RESULT2 TO GT_RESULT2.
1003 L_APPENDED = 'X'.
1004 * WRITE : / ' ', ls_e071_key‐object‐pgmid, ls_e071_key‐object‐object, ls_e071_key‐object‐obj_name.
1005 ENDLOOP.
1006 ENDIF.
1007 IF L_APPENDED IS INITIAL.
1008 APPEND LS_RESULT2 TO GT_RESULT2.
1009 ENDIF.
1010 ENDLOOP.
1011 *... Create requiredby ALV Instance
1012 CALL METHOD CL_SALV_TABLE=>FACTORY
1013 EXPORTING
1014 R_CONTAINER = GO_CONTAINER_REQUIREDBY
1015 IMPORTING
1016 R_SALV_TABLE = GO_ALV_REQUIREDBY
1017 CHANGING
1018 T_TABLE = GT_RESULT2.
1019 LO_COLUMNS = GO_ALV_REQUIREDBY‐>GET_COLUMNS( ).
1020 LO_COLUMNS‐>SET_OPTIMIZE( ).
1021 *... Display ALV
1022 GO_ALV_REQUIREDBY‐>DISPLAY( ).
1023 CATCH CX_SALV_MSG.
1024 ENDTRY.
1025 ENDFORM. "display_result
1026 *‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
1027 FORM CHECK_EXISTS
1028 USING
1029 LS_E071_KEY TYPE LCL_DEV_CROSS_REF=>TYPE_S_E071_OBJKEY
1030 I_TARGET TYPE RFCDEST
1031 CHANGING
1032 E_NOT_FOUND TYPE FLAG
1033 E_LOCK TYPE FLAG
1034 E_TRKORR TYPE E070‐TRKORR
1035 E_SRCSYSTEM_IN_CURRENT TYPE TADIR‐SRCSYSTEM
1036 E_SRCSYSTEM_IN_TARGET TYPE TADIR‐SRCSYSTEM.
1037 DATA LS_E071 TYPE E071.
1038 DATA OBJTYPE2 TYPE VRSD‐OBJTYPE.
1039 DATA OBJTYPE TYPE VRSD_OLD‐OBJTYPE.
1040 DATA OBJNAME2 TYPE VRSD‐OBJNAME.
1041 DATA LS_TADIR TYPE TADIR.
1042 DATA LT_VERSION_TARGET TYPE TABLE OF VRSD.
1043 DATA LT_VERSNO_TARGET TYPE TABLE OF VRSN.
1044 DATA LS_VERSION_TARGET TYPE VRSD.
1045 DATA L_SPRSL TYPE T100‐SPRSL.
1046 DATA LT_DOCU_TAB TYPE TABLE OF RPY_OBJTAB.
1047 DATA LT_DOCU_TECH TYPE TABLE OF TLINE.

1048 DATA LS_LOCK_KEY TYPE TLOCK_INT.


1049 DATA LT_TLOCK TYPE TABLE OF TLOCK.
1050 DATA LS_TLOCK TYPE TLOCK.
1051 TYPES : BEGIN OF TYPE_S_TRKORR,
1052 AS4DATE TYPE E070‐AS4DATE,
1053 AS4TIME TYPE E070‐AS4TIME,
1054 TRKORR TYPE E070‐TRKORR,
1055 END OF TYPE_S_TRKORR.
1056 DATA LT_TRKORR TYPE TABLE OF TYPE_S_TRKORR.
1057 DATA LS_TRKORR TYPE TYPE_S_TRKORR.
1058 DATA L_TIMESTAMP TYPE TZNTIMESTP.
1059 DATA L_TIMESTAMP2 TYPE TZNTIMESTP.
1060 CLEAR OBJTYPE2.
1061 CLEAR E_NOT_FOUND.
1062 CLEAR E_LOCK.
1063 CLEAR E_TRKORR.
1064 CLEAR E_SRCSYSTEM_IN_TARGET.

1065 CLEAR E_SRCSYSTEM_IN_CURRENT.

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 18/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
1066 LS_E071‐PGMID = LS_E071_KEY‐PGMID.
1067 LS_E071‐OBJECT = LS_E071_KEY‐OBJECT.
1068 LS_E071‐OBJ_NAME = LS_E071_KEY‐OBJ_NAME.
1069 CALL METHOD LCL_SAP_FM=>TR_CHECK_TYPE
1070 EXPORTING
1071 WI_E071 = LS_E071
1072 IMPORTING
1073 WE_TADIR = LS_TADIR
1074 WE_LOCK_KEY = LS_LOCK_KEY.
1075
1076 IF P_TIMEMA IS NOT INITIAL.
1077 * rechercher les OT qui contiennent l'objet, et prendre
1078 * la date et heure de l'OT le + ancien, ce qui donne
1079 * l'heure de création de l'OT donc de l'objet.
1080 PERFORM GET_CREATION_TIMESTAMP
1081 USING
1082 LS_TADIR‐PGMID
1083 LS_TADIR‐OBJECT
1084 LS_TADIR‐OBJ_NAME
1085 CHANGING
1086 L_TIMESTAMP.
1087 * Si l'on a transporté un REPS sans que PROG soit transporté, cela
1088 * crée tout de même une entrée PROG
1089 IF LS_E071‐OBJECT = 'REPS' OR LS_E071‐OBJECT = 'REPO'.
1090 PERFORM GET_CREATION_TIMESTAMP
1091 USING
1092 LS_E071‐PGMID
1093 LS_E071‐OBJECT
1094 LS_E071‐OBJ_NAME
1095 CHANGING
1096 L_TIMESTAMP2.
1097 IF L_TIMESTAMP2 IS NOT INITIAL AND L_TIMESTAMP2 < L_TIMESTAMP.
1098 L_TIMESTAMP = L_TIMESTAMP2.
1099 ENDIF.
1100 ENDIF.
1101 ENDIF.
1102 * Si l'objet a été créé après la date/heure choisis, considérer
1103 * qu'il n'existe pas
1104 IF P_TIMEMA IS NOT INITIAL AND L_TIMESTAMP >= P_TIMEMA.
1105 E_NOT_FOUND = 'X'.
1106 ELSE.
1107 CASE LS_E071_KEY‐PGMID.
1108 WHEN 'LIMU'.
1109 CASE LS_E071_KEY‐OBJECT.
1110 WHEN 'CINC' OR 'CLSD' OR 'CPRI' OR 'CPRO' OR 'CPUB' OR 'CUAD'
1111 OR 'DOMD' OR 'DTED' OR 'DYNP' OR 'ENQD' OR 'FUNC' OR 'INDX'
1112 OR 'METH' OR 'SHLD' OR 'SHLX' OR 'SQLD' OR 'TABD' OR 'TABT'

1113 OR 'TTYD' OR 'TYPD' OR 'VIED' OR 'VIET' OR 'WAPD' OR 'WDYC'


1114 OR 'WDYD' OR 'WDYV'
1115 OR 'REPO' OR 'REPS' OR 'REPT'.
1116 * Pour REPO, REPS, REPT, faut‐il tester PROG ou FUGR ou CLAS ou autre chose?
1117 * RS_PROGNAME_SPLIT ‐> si fugr_is_name = 'X' alors chercher existence de TADIR FUGR?
1118 OBJTYPE = LS_E071_KEY‐OBJECT.
1119 OBJNAME2 = LS_E071_KEY‐OBJ_NAME.
1120 REFRESH LT_VERSION_TARGET.
1121 CALL FUNCTION 'SVRS_GET_VERSION_DIRECTORY_46'
1122 DESTINATION I_TARGET
1123 EXPORTING
1124 OBJNAME = OBJNAME2
1125 OBJTYPE = OBJTYPE
1126 TABLES
1127 LVERSNO_LIST = LT_VERSNO_TARGET
1128 VERSION_LIST = LT_VERSION_TARGET
1129 EXCEPTIONS

1130 NO_ENTRY = 1

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 19/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
1131 OTHERS = 2.
1132 IF SY‐SUBRC <> 0.
1133 E_NOT_FOUND = 'X'.
1134 ELSE.
1135 READ TABLE LT_VERSION_TARGET INTO LS_VERSION_TARGET
1136 WITH KEY LOEKZ = 'I'.
1137 E_TRKORR = LS_VERSION_TARGET‐KORRNUM.
1138 ENDIF.
1139 WHEN 'INTD'.
1140 OBJTYPE = 'INTF'.
1141 OBJNAME2 = LS_E071_KEY‐OBJ_NAME.
1142 REFRESH LT_VERSION_TARGET.
1143 CALL FUNCTION 'SVRS_GET_VERSION_DIRECTORY_46'
1144 DESTINATION I_TARGET
1145 EXPORTING
1146 OBJNAME = OBJNAME2
1147 OBJTYPE = OBJTYPE
1148 TABLES
1149 LVERSNO_LIST = LT_VERSNO_TARGET
1150 VERSION_LIST = LT_VERSION_TARGET
1151 EXCEPTIONS
1152 NO_ENTRY = 1
1153 OTHERS = 2.
1154 IF SY‐SUBRC <> 0.
1155 E_NOT_FOUND = 'X'.
1156 ELSE.
1157 READ TABLE LT_VERSION_TARGET INTO LS_VERSION_TARGET
1158 WITH KEY LOEKZ = 'I'.
1159 E_TRKORR = LS_VERSION_TARGET‐KORRNUM.
1160 ENDIF.
1161 WHEN 'DEVP'.
1162 OBJTYPE2 = 'DEVC'.
1163 WHEN 'DOCU'.
1164 IF LS_E071_KEY‐OBJ_NAME(2) = 'TX'.
1165 OBJTYPE2 = 'DOCT'.
1166 ELSE.
1167 OBJTYPE2 = 'DOCV'.
1168 ENDIF.
1169 WHEN 'FUGT'.
1170 OBJTYPE2 = 'FUGR'.
1171 WHEN 'MESS'.
1172 *VRSD‐OBJTYPE
1173 *VRSD‐OBJNAME
1174 DATA L_OBJNAME_LONG TYPE VRSD‐OBJNAME.
1175 OBJTYPE2 = LS_E071_KEY‐OBJECT.
1176 OBJNAME2 = LS_E071_KEY‐OBJ_NAME.
1177 CALL FUNCTION 'SVRS_SHORT2LONG_NAME'

1178 EXPORTING
1179 OBJTYPE = OBJTYPE2
1180 OBJNAME_SHORT = OBJNAME2
1181 IMPORTING
1182 OBJNAME_LONG = L_OBJNAME_LONG.
1183 SELECT SINGLE SPRSL FROM T100 INTO L_SPRSL
1184 WHERE ARBGB = L_OBJNAME_LONG(20)
1185 AND MSGNR = L_OBJNAME_LONG+20(3).
1186 DATA L_CASTING_MSGNO TYPE SYMSGNO.
1187 L_CASTING_MSGNO = L_OBJNAME_LONG+20(3).
1188 CALL FUNCTION 'RPY_MESSAGE_COMPOSE'
1189 DESTINATION I_TARGET
1190 EXPORTING
1191 LANGUAGE = L_SPRSL
1192 MESSAGE_ID = L_OBJNAME_LONG(20)
1193 MESSAGE_NUMBER = L_CASTING_MSGNO
1194 EXCEPTIONS

1195 MESSAGE_NOT_FOUND = 1

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 20/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
1196 OTHERS = 2.
1197 IF SY‐SUBRC <> 0.
1198 E_NOT_FOUND = 'X'.
1199 ENDIF.
1200 CLEAR OBJTYPE2.
1201 WHEN 'MSAD'.
1202 OBJTYPE2 = 'MSAG'.
1203 WHEN 'SOTT' OR 'SOTU'.
1204 OBJTYPE2 = 'MSAG'.
1205 WHEN 'SQTT'.
1206 OBJTYPE2 = 'SQLS'.
1207 WHEN 'TTYX'.
1208 OBJTYPE2 = 'TTYP'.
1209 WHEN 'VARI' OR 'VARX'.
1210 OBJTYPE2 = 'PROG'.
1211 WHEN 'WAPP'.
1212 OBJTYPE2 = 'WAPA'. " ??
1213 WHEN 'ADIR' OR 'COMM' OR 'FSEL' OR 'MAPP' OR 'MCOD' OR 'PIFA' OR 'PIFH' OR 'XIND'.
1214 * Objets LIMU non gérés
1215 ENDCASE.
1216 WHEN 'R3TR'.
1217 OBJTYPE2 = LS_E071_KEY‐OBJECT.
1218 ENDCASE.
1219
1220 DATA L_OBJECT_CASTING TYPE E071‐OBJECT.
1221 DATA L_OBJNAME_CASTING TYPE E071‐OBJ_NAME.
1222 L_OBJECT_CASTING = LS_TADIR‐OBJECT.
1223 L_OBJNAME_CASTING = LS_TADIR‐OBJ_NAME.
1224 CALL FUNCTION 'SRTT_GET_REMOTE_TADIR_ENTRY'
1225 EXPORTING
1226 TADIR_OBJECT = L_OBJECT_CASTING
1227 TADIR_OBJNAME = L_OBJNAME_CASTING
1228 IMPORTING
1229 ET_TADIR = LS_TADIR
1230 EXCEPTIONS
1231 INVALID = 1
1232 OTHERS = 2.
1233 E_SRCSYSTEM_IN_CURRENT = LS_TADIR‐SRCSYSTEM.
1234 CALL FUNCTION 'SRTT_GET_REMOTE_TADIR_ENTRY'
1235 DESTINATION I_TARGET
1236 EXPORTING
1237 TADIR_OBJECT = L_OBJECT_CASTING
1238 TADIR_OBJNAME = L_OBJNAME_CASTING
1239 IMPORTING
1240 ET_TADIR = LS_TADIR
1241 EXCEPTIONS
1242 INVALID = 1

1243 OTHERS = 2.
1244 IF SY‐SUBRC <> 0 AND OBJTYPE2 IS NOT INITIAL.
1245 E_NOT_FOUND = 'X'.
1246 ENDIF.
1247 E_SRCSYSTEM_IN_TARGET = LS_TADIR‐SRCSYSTEM.
1248 ENDIF.
1249
1250 * rechercher l' OT dans le système courant où se trouve l 'objet
1251 *********************************
1252 * retourne la tâche ou l' OT dans lequel l 'objet est verrouillé
1253 CALL FUNCTION 'TRINT_CHECK_LOCKS'
1254 EXPORTING
1255 WI_LOCK_KEY = LS_LOCK_KEY
1256 TABLES
1257 WT_TLOCK = LT_TLOCK
1258 EXCEPTIONS
1259 EMPTY_KEY = 1

1260 OTHERS = 2.

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 21/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
1261 IF SY‐SUBRC = 0 AND LT_TLOCK[] IS NOT INITIAL.
1262 READ TABLE LT_TLOCK INTO LS_TLOCK INDEX 1.
1263 IF SY‐SUBRC = 0.
1264 E_TRKORR = LS_TLOCK‐TRKORR.
1265 E_LOCK = 'X'.
1266 * chercher l' OT si le retour est une tâche
1267 SELECT SINGLE STRKORR FROM E070 INTO E_TRKORR WHERE TRKORR = E_TRKORR.
1268 ENDIF.
1269 ELSE.
1270 * Si l'objet n'est pas verrouillé, rechercher l 'ordre de transport
1271 * libéré en dernier
1272 SELECT E070~AS4DATE E070~AS4TIME E070~TRKORR
1273 FROM E071
1274 INNER JOIN E070
1275 ON E071~TRKORR = E070~TRKORR
1276 INTO TABLE LT_TRKORR
1277 WHERE E071~PGMID = LS_E071_KEY‐PGMID
1278 AND E071~OBJECT = LS_E071_KEY‐OBJECT
1279 AND E071~OBJ_NAME = LS_E071_KEY‐OBJ_NAME
1280 ORDER BY
1281 E070~AS4DATE DESCENDING
1282 E070~AS4TIME DESCENDING
1283 %_HINTS ORACLE 'FIRST_ROWS(1)'.
1284 READ TABLE LT_TRKORR INTO LS_TRKORR INDEX 1.
1285 E_TRKORR = LS_TRKORR‐TRKORR.
1286 ENDIF.
1287 ENDFORM. "check_exists
1288 *&‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
1289 *& Form TABLSTRUC_FIELD
1290 *&‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
1291 FORM TABLSTRUC_FIELD USING IS_DD03P TYPE DD03P IS_E071_KEY TYPE LCL_DEV_CROSS_REF=>TYPE_S_E071_OBJKEY.
1292 DATA LS_E071_KEY TYPE LCL_DEV_CROSS_REF=>TYPE_S_E071_OBJKEY.
1293 * .APPEND_DU indique une récursivité, PRECFIELD est blanc. A ignorer.
1294 IF IS_DD03P‐FIELDNAME = '.APPEND_DU'.
1295 * .INCLU‐*** indique un include avec suffixe *** pour les composantes
1296 ELSEIF IS_DD03P‐FIELDNAME = ' .APPEND'
1297 OR IS_DD03P‐FIELDNAME(6) = ' .INCLU'.
1298 LS_E071_KEY‐PGMID = ' R3TR'.
1299 LS_E071_KEY‐OBJECT = 'TABL'.
1300 LS_E071_KEY‐OBJ_NAME = IS_DD03P‐PRECFIELD.
1301 MAC_COLLECT IS_E071_KEY 'H' '' LS_E071_KEY GS_REQUEST_INITIAL.
1302 * composantes avec type interne/longueur ont COMPTYPE = blanc
1303 * (bizarrement, parfois, ROLLNAME n' est pas à blanc!)
1304 ELSEIF NOT IS_DD03P‐COMPTYPE IS INITIAL.
1305 LS_E071_KEY‐PGMID = 'R3TR'.
1306 DATA L_LINK TYPE C LENGTH 1.
1307 L_LINK = 'H'.

1308 CASE IS_DD03P‐COMPTYPE.


1309 WHEN 'E'.
1310 LS_E071_KEY‐OBJECT = 'DTEL'.
1311 WHEN 'S'.
1312 LS_E071_KEY‐OBJECT = 'TABL'.
1313 WHEN 'L'.
1314 LS_E071_KEY‐OBJECT = 'TTYP'.
1315 WHEN 'R'. "type ref to
1316 CASE IS_DD03P‐REFTYPE.
1317 WHEN 'C'.
1318 LS_E071_KEY‐OBJECT = 'CLAS'.
1319 WHEN 'I'.
1320 LS_E071_KEY‐OBJECT = 'INTF'.
1321 WHEN 'E'.
1322 LS_E071_KEY‐OBJECT = 'DTEL'.
1323 WHEN 'S'. "structure or table
1324 LS_E071_KEY‐OBJECT = 'TABL'.

1325 WHEN 'L'.

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 22/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
1326 LS_E071_KEY‐OBJECT = 'TTYP'.
1327 WHEN SPACE. "undefined
1328 DATA L_TYPENAME TYPE TYPENAME.
1329 DATA L_TYPEKIND TYPE DDTYPEKIND.
1330 L_TYPENAME = IS_DD03P‐ROLLNAME.
1331 CALL FUNCTION 'DDIF_TYPEINFO_GET'
1332 EXPORTING
1333 TYPENAME = L_TYPENAME
1334 IMPORTING
1335 TYPEKIND = L_TYPEKIND.
1336 IF L_TYPEKIND IS NOT INITIAL.
1337 LS_E071_KEY‐OBJECT = L_TYPEKIND.
1338 ENDIF.
1339 WHEN 'B'.
1340 * reference to an internal data type, length, decimals ‐> IGNORE
1341 WHEN OTHERS.
1342 ASSERT IS_DD03P‐REFTYPE = 'D' "data
1343 OR IS_DD03P‐REFTYPE = 'O'. " object
1344 ENDCASE.
1345 WHEN 'N'. "structure inexistante (ou inactive) CI_*
1346 LS_E071_KEY‐OBJECT = 'TABL'.
1347 L_LINK = 'S'. "l'include ci_* peut ne pas exister
1348 WHEN OTHERS.
1349 MESSAGE X001(00).
1350 ENDCASE.
1351 IF LS_E071_KEY‐OBJECT IS NOT INITIAL.
1352 LS_E071_KEY‐OBJ_NAME = IS_DD03P‐ROLLNAME.
1353 MAC_COLLECT IS_E071_KEY L_LINK '' LS_E071_KEY GS_REQUEST_INITIAL.
1354 ENDIF.
1355 ENDIF.
1356 ENDFORM. "tablstruc_field
1357 *&‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
1358 *& Form GET_TABLE_TYPE
1359 *&‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
1360 FORM GET_TABLE_TYPE
1361 USING
1362 I_TABNAME
1363 CHANGING
1364 E_OBJECT.
1365 DATA L_TYPENAME TYPE TYPENAME.
1366 DATA L_GOTSTATE TYPE DDGOTSTATE.
1367 DATA L_TYPEKIND TYPE DDTYPEKIND.
1368 CLEAR E_OBJECT.
1369 L_TYPENAME = I_TABNAME.
1370 CALL FUNCTION 'DDIF_TYPEINFO_GET'
1371 EXPORTING
1372 TYPENAME = L_TYPENAME

1373 IMPORTING
1374 TYPEKIND = L_TYPEKIND
1375 GOTSTATE = L_GOTSTATE.
1376 E_OBJECT = L_TYPEKIND.
1377 ENDFORM. "get_table_type
1378 *&‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
1379 *& Form CONVERT_WBOBJ_KEY_INTO_E071
1380 *&‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
1381 FORM CONVERT_WBOBJ_KEY_INTO_E071
1382 USING
1383 IS_WBOBJ_KEY TYPE TYPE_S_WBOBJ_KEY
1384 CHANGING
1385 ES_E071_KEY TYPE LCL_DEV_CROSS_REF=>TYPE_S_E071_OBJKEY.
1386 DATA LS_KO100 TYPE KO100.
1387 * détermine si le type (PROG, CLAS, DYNP, etc.) correspond à R3TR ou à LIMU
1388 CALL FUNCTION 'TR_GET_PGMID_FOR_OBJECT'
1389 EXPORTING

1390 IV_OBJECT = IS_WBOBJ_KEY‐OBJECT

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 23/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
1391 IMPORTING
1392 ES_TYPE = LS_KO100
1393 EXCEPTIONS
1394 ILLEGAL_OBJECT = 1
1395 OTHERS = 2.
1396 CLEAR ES_E071_KEY.
1397 ES_E071_KEY‐PGMID = LS_KO100‐PGMID.
1398 ES_E071_KEY‐OBJECT = IS_WBOBJ_KEY‐OBJECT.
1399 CASE IS_WBOBJ_KEY‐OBJECT.
1400 * First we take care for objects that are unknown to RS_TOOL_ACCESS
1401 WHEN 'DOCU'.
1402 ES_E071_KEY‐OBJ_NAME(2) = IS_WBOBJ_KEY‐S_DOCU‐DOCU_ID.
1403 ES_E071_KEY‐OBJ_NAME+2 = IS_WBOBJ_KEY‐S_DOCU‐DOCU_OBJECT.
1404
1405 WHEN 'SOTT' OR 'SOTU'.
1406 ES_E071_KEY‐OBJ_NAME(30) = IS_WBOBJ_KEY‐S_SOTT‐PAKET.
1407 ES_E071_KEY‐OBJ_NAME+30 = IS_WBOBJ_KEY‐S_SOTT‐CONCEPT.
1408
1409 WHEN 'TOBJ'.
1410 CONCATENATE IS_WBOBJ_KEY‐S_TOBJ‐OBJECTNAME
1411 IS_WBOBJ_KEY‐S_TOBJ‐OBJECTTYPE
1412 INTO ES_E071_KEY‐OBJ_NAME.
1413
1414 WHEN 'MERG' OR 'RELE' OR 'COMM'.
1415 ES_E071_KEY‐OBJ_NAME = IS_WBOBJ_KEY‐TRKORR.
1416
1417 WHEN 'SPCS'.
1418 ES_E071_KEY‐OBJ_NAME = IS_WBOBJ_KEY‐S_SPCS‐CODEPAGE.
1419 WHEN 'SPSV'.
1420 ES_E071_KEY‐OBJ_NAME = IS_WBOBJ_KEY‐S_SPSV‐SERVER.
1421 WHEN 'SPDV'.
1422 SELECT SINGLE NAME FROM TSP03D INTO ES_E071_KEY‐OBJ_NAME
1423 WHERE PADEST = IS_WBOBJ_KEY‐S_SPDV‐DEVICE.
1424 WHEN 'SPLO'.
1425 ES_E071_KEY‐OBJ_NAME = IS_WBOBJ_KEY‐S_SPLO‐PAPER_FORMAT.
1426 WHEN 'PRIN'.
1427 ES_E071_KEY‐OBJ_NAME = IS_WBOBJ_KEY‐S_PRIN‐PRINTER_TYPE.
1428 WHEN 'SLOM'.
1429 ES_E071_KEY‐OBJ_NAME = IS_WBOBJ_KEY‐S_SLOM‐LOGICAL_OUTPUT_SYSTEM.
1430 WHEN 'SOMS'.
1431 ES_E071_KEY‐OBJ_NAME = IS_WBOBJ_KEY‐S_SOMS‐READ_OUTPUT_SYSTEM.
1432
1433 WHEN 'SCP1'.
1434 ES_E071_KEY‐OBJ_NAME = IS_WBOBJ_KEY‐S_SCP‐BCSET_ID.
1435 WHEN 'SCP2'.
1436 ES_E071_KEY‐OBJ_NAME = IS_WBOBJ_KEY‐S_SCP‐BCSET_ID.
1437

1438 WHEN 'FILE'.


1439 ES_E071_KEY‐OBJ_NAME = IS_WBOBJ_KEY‐FILE.
1440 WHEN 'REPO'.
1441 ES_E071_KEY‐OBJ_NAME = IS_WBOBJ_KEY‐INCLUDE.
1442 WHEN 'DYNP'.
1443 ES_E071_KEY‐PGMID = ' LIMU'.
1444 ES_E071_KEY‐OBJ_NAME+GC_PROG(GC_DYNP) = IS_WBOBJ_KEY‐S_DYNP‐SCREEN_NUMBER.
1445 ES_E071_KEY‐OBJ_NAME(GC_PROG) = IS_WBOBJ_KEY‐S_DYNP‐PROGRAM_NAME.
1446 WHEN 'VARI' OR 'VARX'.
1447 ES_E071_KEY‐OBJ_NAME+GC_PROG(GC_VARI) = IS_WBOBJ_KEY‐S_VARI‐VARIANT_NAME.
1448 ES_E071_KEY‐OBJ_NAME(GC_PROG) = IS_WBOBJ_KEY‐S_VARI‐PROGRAM_NAME.
1449 WHEN 'MESS'.
1450 ES_E071_KEY‐PGMID = ' LIMU'.
1451 CONCATENATE IS_WBOBJ_KEY‐S_MESS‐MSG_CLASS_NAME
1452 IS_WBOBJ_KEY‐S_MESS‐MSG_NUMBER
1453 INTO ES_E071_KEY‐OBJ_NAME.
1454 WHEN 'METH'.

1455 ES_E071_KEY‐PGMID = ' LIMU'.

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 24/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
1456 ES_E071_KEY‐OBJ_NAME+GC_CLAS(GC_METH) = IS_WBOBJ_KEY‐S_METH‐METHOD_NAME.
1457 ES_E071_KEY‐OBJ_NAME(GC_CLAS) = IS_WBOBJ_KEY‐S_METH‐CLASS_NAME.
1458 * Web Dynpro controller
1459 WHEN 'WDYC'.
1460 ES_E071_KEY‐OBJ_NAME+GC_WDYN(GC_WDYC) = IS_WBOBJ_KEY‐S_WDYC‐CONTROLLER_NAME.
1461 ES_E071_KEY‐OBJ_NAME(GC_WDYN) = IS_WBOBJ_KEY‐S_WDYC‐WEBDYNPRO_NAME.
1462 * Web Dynpro view
1463 WHEN 'WDYV'.
1464 ES_E071_KEY‐OBJ_NAME+GC_WDYN(GC_WDYV) = IS_WBOBJ_KEY‐S_WDYV‐VIEW_NAME.
1465 ES_E071_KEY‐OBJ_NAME(GC_WDYN) = IS_WBOBJ_KEY‐S_WDYV‐WEBDYNPRO_NAME.
1466 * Page/Controller of a BSP Application
1467 WHEN 'WAPD' OR 'WAPP'.
1468 ES_E071_KEY‐OBJ_NAME+GC_WAPA(GC_WAPP) = IS_WBOBJ_KEY‐S_WAPP‐PAGE_NAME.
1469 ES_E071_KEY‐OBJ_NAME(GC_WAPA) = IS_WBOBJ_KEY‐S_WAPP‐APPL_NAME.
1470 WHEN OTHERS.
1471 ES_E071_KEY‐OBJ_NAME = IS_WBOBJ_KEY‐OBJECT.
1472 ENDCASE.
1473 ENDFORM. "convert_wbobj_key_into_e071
1474 *&‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
1475 *& Form GET_CREATION_TIMESTAMP
1476 *&‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
1477 * Rechercher la date et l' heure de création d 'un objet
1478 * en se basant sur la date du premier ordre de transport qui
1479 * le contient
1480 FORM GET_CREATION_TIMESTAMP
1481 USING
1482 I_PGMID TYPE E071‐PGMID
1483 I_OBJECT TYPE E071‐OBJECT
1484 I_OBJ_NAME TYPE CLIKE
1485 CHANGING
1486 E_TIMESTAMP TYPE TZNTIMESTP.
1487 DATA L_TABLE TYPE DD02L‐TABNAME.
1488 DATA LT_OPTION TYPE TABLE OF RFC_DB_OPT.
1489 DATA LT_FIELD TYPE TABLE OF RFC_DB_FLD.
1490 DATA LTE_DATA TYPE TABLE OF TAB512.
1491 DATA LS_OPTION TYPE RFC_DB_OPT.
1492 DATA LS_FIELD TYPE RFC_DB_FLD.
1493 DATA L_DATA TYPE TAB512.
1494 DATA L_TRKORR TYPE E070‐TRKORR.
1495 CONCATENATE 'PGMID = ''' I_PGMID '''' INTO LS_OPTION‐TEXT.
1496 APPEND LS_OPTION TO LT_OPTION.
1497 CONCATENATE ' AND OBJECT = ''' I_OBJECT '''' INTO LS_OPTION‐TEXT.
1498 APPEND LS_OPTION TO LT_OPTION.
1499 CONCATENATE ' AND OBJ_NAME = ''' I_OBJ_NAME '''' INTO LS_OPTION‐TEXT.
1500 APPEND LS_OPTION TO LT_OPTION.
1501 LS_FIELD‐FIELDNAME = 'TRKORR'.
1502 APPEND LS_FIELD TO LT_FIELD.

1503 L_TABLE = 'E071'.


1504 CALL FUNCTION 'RFC_READ_TABLE'
1505 DESTINATION P_TARGET
1506 EXPORTING
1507 QUERY_TABLE = L_TABLE
1508 TABLES
1509 OPTIONS = LT_OPTION
1510 FIELDS = LT_FIELD
1511 DATA = LTE_DATA
1512 EXCEPTIONS
1513 TABLE_NOT_AVAILABLE = 1
1514 TABLE_WITHOUT_DATA = 2
1515 OPTION_NOT_VALID = 3
1516 FIELD_NOT_VALID = 4
1517 NOT_AUTHORIZED = 5
1518 DATA_BUFFER_EXCEEDED = 6
1519 OTHERS = 7.

1520 IF SY‐SUBRC <> 0.

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 25/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
1521 * MESSAGE ID SY‐MSGID TYPE SY‐MSGTY NUMBER SY‐MSGNO
1522 * WITH SY‐MSGV1 SY‐MSGV2 SY‐MSGV3 SY‐MSGV4.
1523 ENDIF.
1524 REFRESH LT_OPTION.
1525 LOOP AT LTE_DATA INTO L_DATA.
1526 IF LT_OPTION[] IS INITIAL.
1527 CONCATENATE 'TRKORR = ''' L_DATA '''' INTO LS_OPTION‐TEXT.
1528 ELSE.
1529 CONCATENATE ' OR TRKORR = ''' L_DATA '''' INTO LS_OPTION‐TEXT.
1530 ENDIF.
1531 APPEND LS_OPTION TO LT_OPTION.
1532 ENDLOOP.
1533 REFRESH LT_FIELD.
1534 LS_FIELD‐FIELDNAME = 'AS4DATE'.
1535 APPEND LS_FIELD TO LT_FIELD.
1536 LS_FIELD‐FIELDNAME = 'AS4TIME'.
1537 APPEND LS_FIELD TO LT_FIELD.
1538 REFRESH LTE_DATA.
1539 L_TABLE = 'E070'.
1540 * A noter qu' on ne peut utiliser la table E070CREATE qui n 'est pas
1541 * alimentée dans le cas de transport. Seule E070 contient la date
1542 * de création. AS4DATE et AS4TIME, qui sont normalement la date de
1543 * dernière modification, ne peuvent pas changer puisqu' on est dans
1544 * un système cible des OT qui sont libérés donc non modifiables
1545 * (alors que sur un système de dév, c 'est E070CREATE qui contient
1546 * la date de création, et AS4DATE la date de création ou date de
1547 * dernière modif)
1548 CALL FUNCTION 'RFC_READ_TABLE'
1549 DESTINATION P_TARGET
1550 EXPORTING
1551 QUERY_TABLE = L_TABLE
1552 TABLES
1553 OPTIONS = LT_OPTION
1554 FIELDS = LT_FIELD
1555 DATA = LTE_DATA
1556 EXCEPTIONS
1557 TABLE_NOT_AVAILABLE = 1
1558 TABLE_WITHOUT_DATA = 2
1559 OPTION_NOT_VALID = 3
1560 FIELD_NOT_VALID = 4
1561 NOT_AUTHORIZED = 5
1562 DATA_BUFFER_EXCEEDED = 6
1563 OTHERS = 7.
1564 IF SY‐SUBRC <> 0.
1565 * MESSAGE ID SY‐MSGID TYPE SY‐MSGTY NUMBER SY‐MSGNO
1566 * WITH SY‐MSGV1 SY‐MSGV2 SY‐MSGV3 SY‐MSGV4.
1567 ENDIF.

1568 SORT LTE_DATA BY TABLE_LINE ASCENDING.


1569 READ TABLE LTE_DATA INDEX 1 INTO E_TIMESTAMP.
1570 ENDFORM. "get_creation_timestamp
1571 *&‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
1572 *& Form GET_E071_DONT_EXIST_IN_TARGET
1573 *&‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*
1574 FORM GET_E071_DONT_EXIST_IN_TARGET
1575 USING
1576 P_TARGET TYPE RFCDEST
1577 CHANGING
1578 CT_E071 TYPE TY_T_E071.
1579 DATA L_TABLE TYPE DD02L‐TABNAME.
1580 DATA LT_OPTION TYPE TABLE OF RFC_DB_OPT.
1581 DATA LT_FIELD TYPE TABLE OF RFC_DB_FLD.
1582 DATA LTE_DATA TYPE TABLE OF TAB512.
1583 DATA LS_OPTION TYPE RFC_DB_OPT.
1584 DATA LS_FIELD TYPE RFC_DB_FLD.

1585 DATA L_DATA TYPE TAB512.

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 26/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
1586 DATA L_TRKORR TYPE E070‐TRKORR.
1587 TYPE‐POOLS CTSLG.
1588 DATA L_DIR_TYPE TYPE TSTRF01‐DIRTYPE.
1589 DATA LS_SETTINGS TYPE CTSLG_SETTINGS.
1590 DATA L_SUPPRESS_DELETED_STEPS TYPE FLAG.
1591 DATA LT_COMM_SYSTEMS TYPE TMSCSYSLST_TYP.
1592 DATA LS_COFILE TYPE CTSLG_COFILE.
1593 DATA L_USER TYPE E070‐AS4USER.
1594 DATA L_PROJECT TYPE TRKORR.
1595 DATA LT_E070 TYPE TABLE OF E070.
1596 DATA LT_E070_DONT_EXIST_IN_TARGET TYPE TABLE OF E070.
1597 DATA LS_E070 TYPE E070.
1598 DATA LT_E071 TYPE TABLE OF E071.
1599 DATA LT_E071_BIS TYPE TABLE OF E071.
1600 DATA LS_E071 TYPE E071.
1601 DATA LS_INDX TYPE INDX.
1602
1603 CONCATENATE 'ZZCROSS_' P_TARGET INTO LS_INDX‐SRTFD.
1604 IMPORT
1605 CONTENT TO GS_CLUSTER_CONTENT
1606 FROM DATABASE INDX(ZZ) ID LS_INDX‐SRTFD.
1607 IF SY‐SUBRC <> 0.
1608 CLEAR GS_CLUSTER_CONTENT.
1609 ENDIF.
1610 * CURRENT SYSTEM
1611 * Lire les OT libérés depuis la dernière date d' analyse.
1612 * IMPORTANT : cette requête fonctionne uniquement parce que
1613 * les OT sont importés dans le même système (pour gérer les
1614 * données mandant‐dépendantes telles les variantes) donc
1615 * l'import met à jour AS4DATE et AS4TIME à la date d' import
1616 * (qui est un petit peu supérieure à la date d 'export).
1617 * Sinon, pour connaître la date/heure d' export, il faudrait
1618 * passer par le module fonction TR_READ_GLOBAL_INFO_OF_REQUEST
1619 * pour lire la log de l'OT.
1620 SELECT * FROM E070 INTO TABLE LT_E070
1621 WHERE STRKORR = SPACE
1622 AND TRSTATUS IN (' R','N')
1623 AND ( AS4DATE > GS_CLUSTER_CONTENT‐LASTGENTIME(8)
1624 OR ( AS4DATE = GS_CLUSTER_CONTENT‐LASTGENTIME(8)
1625 AND AS4TIME > GS_CLUSTER_CONTENT‐LASTGENTIME+8 ) ).
1626 * SYSTEME CIBLE
1627 * Recherche des OT créés dans le système cible depuis la dernière date d' analyse
1628 REFRESH LT_OPTION.
1629 LS_OPTION‐TEXT = 'STRKORR = ''''' .
1630 APPEND LS_OPTION TO LT_OPTION.
1631 CONCATENATE 'AND ( AS4DATE > ''' GS_CLUSTER_CONTENT‐LASTGENTIME(8) '''' INTO LS_OPTION‐TEXT.
1632 APPEND LS_OPTION TO LT_OPTION.

1633 CONCATENATE 'OR ( AS4DATE = ''' GS_CLUSTER_CONTENT‐LASTGENTIME(8) '''' INTO LS_OPTION‐TEXT.


1634 APPEND LS_OPTION TO LT_OPTION.
1635 CONCATENATE 'AND AS4TIME > ''' GS_CLUSTER_CONTENT‐LASTGENTIME+8 ''' ) )' INTO LS_OPTION‐TEXT.
1636 APPEND LS_OPTION TO LT_OPTION.
1637 REFRESH LT_FIELD.
1638 LS_FIELD‐FIELDNAME = 'TRKORR'.
1639 APPEND LS_FIELD TO LT_FIELD.
1640 REFRESH LTE_DATA.
1641 L_TABLE = 'E070'.
1642 CALL FUNCTION 'RFC_READ_TABLE'
1643 DESTINATION P_TARGET
1644 EXPORTING
1645 QUERY_TABLE = L_TABLE
1646 TABLES
1647 OPTIONS = LT_OPTION
1648 FIELDS = LT_FIELD
1649 DATA = LTE_DATA

1650 EXCEPTIONS

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 27/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
1651 TABLE_NOT_AVAILABLE = 1
1652 TABLE_WITHOUT_DATA = 2
1653 OPTION_NOT_VALID = 3
1654 FIELD_NOT_VALID = 4
1655 NOT_AUTHORIZED = 5
1656 DATA_BUFFER_EXCEEDED = 6
1657 OTHERS = 7.
1658 IF SY‐SUBRC <> 0.
1659 * MESSAGE ID SY‐MSGID TYPE SY‐MSGTY NUMBER SY‐MSGNO
1660 * WITH SY‐MSGV1 SY‐MSGV2 SY‐MSGV3 SY‐MSGV4.
1661 ENDIF.
1662 * Y ajouter les OT analysés la fois précédente qui n 'étaient pas
1663 * encore dans le système cible
1664 IF LT_E070[] IS NOT INITIAL OR LTE_DATA[] IS NOT INITIAL.
1665 APPEND LINES OF GS_CLUSTER_CONTENT‐T_E070 TO LT_E070.
1666 SORT LT_E070 BY TRKORR ASCENDING.
1667 SORT LTE_DATA BY TABLE_LINE ASCENDING.
1668 LOOP AT LT_E070 INTO LS_E070.
1669 READ TABLE LTE_DATA
1670 WITH KEY
1671 TABLE_LINE = LS_E070‐TRKORR
1672 BINARY SEARCH
1673 TRANSPORTING NO FIELDS.
1674 IF SY‐SUBRC <> 0.
1675 APPEND LS_E070 TO LT_E070_DONT_EXIST_IN_TARGET.
1676 ENDIF.
1677 ENDLOOP.
1678
1679 GS_CLUSTER_CONTENT‐T_E070 = LT_E070_DONT_EXIST_IN_TARGET.
1680
1681 IF LT_E070_DONT_EXIST_IN_TARGET[] IS NOT INITIAL.
1682 SORT LT_E070_DONT_EXIST_IN_TARGET BY TRKORR.
1683 DELETE ADJACENT DUPLICATES FROM LT_E070_DONT_EXIST_IN_TARGET COMPARING TRKORR.
1684 * déterminer tous les objets contenus dans ces OT
1685 SELECT * FROM E071 INTO TABLE LT_E071
1686 FOR ALL ENTRIES IN LT_E070_DONT_EXIST_IN_TARGET
1687 WHERE TRKORR = LT_E070_DONT_EXIST_IN_TARGET‐TRKORR.
1688 IF LT_E071[] IS NOT INITIAL.
1689 * déterminer tous les OT contenant ces objets
1690 SORT LT_E071 BY PGMID OBJECT OBJ_NAME.
1691 DELETE ADJACENT DUPLICATES FROM LT_E071 COMPARING PGMID OBJECT OBJ_NAME.
1692 SELECT * FROM E071 INTO TABLE LT_E071_BIS
1693 FOR ALL ENTRIES IN LT_E071
1694 WHERE PGMID = LT_E071‐PGMID
1695 AND OBJECT = LT_E071‐OBJECT
1696 AND OBJ_NAME = LT_E071‐OBJ_NAME.
1697 SORT LT_E071 BY TRKORR.

1698 LOOP AT LT_E071_BIS INTO LS_E071.


1699 * NE GARDER QUE les (objets des) OT qui existent dans les 2 systèmes
1700 READ TABLE LT_E071
1701 WITH KEY
1702 TRKORR = LS_E071‐TRKORR
1703 BINARY SEARCH
1704 TRANSPORTING NO FIELDS.
1705 IF SY‐SUBRC = 0.
1706 DELETE LT_E071_BIS.
1707 ENDIF.
1708 ENDLOOP.
1709 * les objets des OT n' étant pas en cible, existent‐ils dans un autre OT qui
1710 * est en cible
1711 SORT LT_E071 BY PGMID OBJECT OBJ_NAME.
1712 SORT LT_E071_BIS BY PGMID OBJECT OBJ_NAME.
1713 LOOP AT LT_E071 INTO LS_E071.
1714 READ TABLE LT_E071_BIS

1715 WITH KEY

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 28/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki
1716 PGMID = LS_E071‐PGMID
1717 OBJECT = LS_E071‐OBJECT
1718 OBJ_NAME = LS_E071‐OBJ_NAME
1719 BINARY SEARCH
1720 TRANSPORTING NO FIELDS.
1721 IF SY‐SUBRC <> 0.
1722 APPEND LS_E071 TO CT_E071.
1723 ENDIF.
1724 ENDLOOP.
1725 ENDIF.
1726 ENDIF.
1727 SORT CT_E071 BY PGMID OBJECT OBJ_NAME.
1728 ENDIF.
1729 CONCATENATE SY‐DATUM SY‐UZEIT INTO GS_CLUSTER_CONTENT‐LASTGENTIME.
1730 EXPORT
1731 CONTENT FROM GS_CLUSTER_CONTENT
1732 TO DATABASE INDX(ZZ) ID LS_INDX‐SRTFD.
1733 ENDFORM. "get_e071_dont_exist_in_target

No labels

16 Comments
Guest
Hi Sandra,

thank you very much for posting this article. It helped me a lot.

But I have a very important question. Right now, I created an internal table with numerous s_trkorr and I want to run your application through all of them and then display the result in the three
ALV grids...

I just can't find the starting point...

Could you please give me a hint?


Kind regards,

Tommy

Sandra Rossi
Hi Tommy,

I'm not sure to understand. If you want to run the report from an external program with a given list of transport requests, you can do it with SUBMIT report WITH s_trkorr IN list AND
RETURN, where list is a range (DATA list TYPE RANGE OF trkorr), and you fill it with one line for each transport request from your internal table, by LOOP AT itab. list-sign = 'I', list-option =
'EQ', list-low = itab-trkorr APPEND list ENDLOOP).

sandra

Guest
Morning Sandra,

sorry for the late reply. That's right. I have a given list of transport requests and want to submit all of them to your program.

I will try your solution today and will let you know.

Thanks for your help

Tommy

Kihoon Bae
Hi Sandra,

I got an error ,"RMC_COMMUNICATION_FAILURE", when i try to fiind some missing objects from CTS which have many involved files.

So i've been looking for why this error occ ured and finally find out the reason.

In this code, the OUTTAB of 3rd ALV display function was declared locally in subroutine.

according to note 534857, you should declare your OUTTAB globally and not in subroutine.

Sandra Rossi
Hi Kihoori, thank you very much for your feedback. I have corrected the program based on your inputs + 2 minor corrections -> version 1.01

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 29/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki

Adrian Bruwer
Thanks Sandra

Once again an awesome development from you, but it's only for ECC. I'll have to wait a while or attempt to modify to 4.7

Regards, Adrian

Guest
Thanks for the great program, Sandra!

One thing I noticed when we ran the program is that it does not seem to catch missing Function Groups. For example, a function module is moved to the target sys tem but the function group
definition itself is not moved, and your program did not catch it. I wonder if this is a limitation. I did not have a chance to debug it yet, but can you please let me know your thought on this?
Thanks a lot in advance!

Alex

Sandra Rossi
Hi Alex,

thank you for your interest :-)

Well, it should have catched it. The relationship between function module and function group is determined in method GET_REQOBJ in these lines :

* Add main program


* LIMU METH YYYY XXXX ‐> Add R3TR CLAS YYYY
* LIMU DYNP YYYY XXXX ‐> Add R3TR PROG YYYY
* LIMU DYNP SAPLYYYY XXXX ‐> Add R3TR FUGR YYYY
* LIMU MESS YYYY XXX ‐> Add R3TR MSAG YYYY
* etc.
IF is_e071_key‐pgmid = 'LIMU'.
ls_e071_key‐pgmid = ls_tadir‐pgmid.
ls_e071_key‐object = ls_tadir‐object.
ls_e071_key‐obj_name = ls_tadir‐obj_name.
mac_collect is_e071_key 'H' '' ls_e071_key.
ENDIF.

You can check by debug at this place. I've made a check, it should work.

Maybe the issue is with the namespace, it always check Y and Z objects, but only check SAP namespace if you check the P_INCSTD parameter. I'm not sure how it behaves with /customer/
namespaces

sandra

Guest
Bonne idée ce programme. Et commenté en français en plus. Ouvrons de nouveaux horizons culturels à l'abaper moyen.

Merci madame Rossi.

Guy

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 30/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki

Boosa Srinivas
Hi Sandra,

Thank you for posting this and it is very useful.

I have found one problem when i am using this pr ogram, in method GET_REQOBJ you are using FM RS_PROGNAME_CONCATENATE. inside this function module for example : When we
are doing firstt ime transport we create some object and deleted the object which is saved in the same trasport. when ever we execute this program it is going into dump. because the
reference object is not found target system.

This is method inside the FM.

method GET_INSTANCE_BY_NAME .
data:
cifkey type seoclskey,
iref type ref to if_oo_clif_incl
cifkey = name.
call method get_instance_by_cifkey
exporting cifkey = cifkey
receiving cifref = iref
exceptions no_objecttype = 1
internal_error = 2
others = 3.
case sy-subrc.
when 0.
cifref = iref.
when 1.
raise no_objecttype.
when others.
raise internal_error.
endcase.
endmethod.

Please let me know if you can correct this

Regards,

Srini

Sandra Rossi
Hi Srini,
I saw that bug last week as I started to use this tool on my current project. In fact, I also saw many other problems. I will post new code in a few days. The bug you mention is that the transport
request contains a class that is deleted, workaround is to remove that class from the transport request if possible, or, if you can't wait for the new code, you may change it by ignoring the
classes from the transport requests that do not exist (R3TR CLAS entries, the class master table is SEOCLASS)
BR
Sandra

Ignacio Ortiz
Hi Sandra,

Thank you for your program. It´s so interesting for me.

I saw the last comments between Boosa and you, and i think that the Note 1444788 can help you with the Dump in the CLASS case.

I´m not sure because i can´t implement the Note yet, but i think i can try in next days and tell you the results (perhaps Boosa or you can test it early).

Regards.

Guest
Sandra,

Thanks for k eeping up with this thread. Did you have a chance to update this program based on the comments about the bugs? I do not see the updated header in the ABAP code, hence
wanted to check with you.

Thanks in advance!

~ Alex.

Sandra Rossi
Hi Alex,

I couldn't really test it fully, and my client stopped the project. Thank you to recall me that I promised it, but I can only post the last version that was run, that you can find in the attachments.

It compiles/runs only on a 7.11 system, takes into account BW objects, and there was a part added to detect missing fields, but it is still a very early version with probably many flaws. If you or
anyone can have a chance to spend time on it and update this wiki, I will be grateful to him/her.

Regards,
Sandra

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 31/32
11/2/2016 ABAP program to simulate transports - ABAP Development - SCN Wiki

Guest
Hello Sandra,

I cant find function TRINT_RESOLVE_OBJ in my system. Do you know what it is replaced with? I'm on netweaver 7.31 sp7.

Salai.

Sandra Rossi
Hi Salai,

You may replace it with SVRS_RESOLVE_E071_OBJ function module, same parameters. It should also work from release 7.0.

Sandra

Contact Us SAP Help Portal


Privacy Terms of Use Legal Disclosure Copyright Follow SCN

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+program+to+simulate+transports 32/32