The situation is familiar for any SAP consultant—transport queries are transferred to the target system with errors caused by violations of integrity of the transferred object. For example, a transferred program uses new tables (or new versions of older tables) but the target system does not “know” them, as these created/modified tables were not transferred and are absent from the query transferred with the program.
Such situations are fraught with problems: not only headaches and delays, but also more present the possibility of strategically important risks and losses.
Such risks are especially noticeable when the authors of these changes (programmers employed by the Contractor) are unable, that is to say, do not have the authority to independently transfer changes into the Customer’s target system. As a result of existing regulations, they are forced to contact the Customer’s basic consultants about these questions. Thus, a strict system of control of transferring changes is put into effect.
This situation is fraught with problems related to the loss of time and money (extension of deadlines and, as a result, terms of payment for completed work), but also can put a company’s reputation at risk. For example, unfriendly employees of the Customer have a reason to call into question the level of qualification of the Contractor’s programmers—they’re so stupid that they cannot even complete a simple transfer query! Yet the terms of the contract promised only highly qualified programmers.
As anyone familiar with the situation knows that even the most professional and experienced programmer is defenceless against such errors. There is always a risk—as a result of haste or carelessness, or because of more objective reasons e.g. the changes were made a long time ago, or due to complex interdependencies. Standard SAP tools do not offer sufficient protection.
All of this can eventually lead to real financial losses. Thus, the subject matter of this article goes beyond the scope of programmers.
However, by approaching the issue in a slightly more creative manner, it can be feasible to create tools that can help manage these risks.
In order to analyse the integrity of queries, we must perform the following steps:
The analyser is carried out like a regular executed ABAP-report.
При For the conclusion of the analysis we will not use sophisticated UI elements like ALV. For our purposes, a conventional listing conclusion is sufficient.
I will deliberately be using the old-fashioned ABAP-code style (using HEADER-LINE and so on) in the interest of brevity and clarity (and in order to remove inessential structures necessary to maintain ABAP-code in a modern style). For unassisted implementation, I recommend following SAP’s recommendations related to the outdated constructions.
PARAMETERS: p_trkorr TYPE e070-trkorr OBLIGATORY MEMORY ID trkorr " What we transfer
, p_system TYPE e070-tarsystem OBLIGATORY MEMORY ID tarsys " Where we transfer it
.
The transport query’s header and the hierarchy of its subqueries are kept in table E070. The number of the query/task is in field E070-TRKORR. The number of the higher query for the task (subquery) is in field E071-STRKORR.
Objects contained in the queries/tasks are kept in table E071.
Objects can be directly linked either to the “main” query or to the subqueries (tasks).
*We will form RANGES from the number of the query and will receive a list of all objects contained in the query, in the field E071- TRKORR.
DATA: ltr_korr TYPE RANGE OF e070-trkorr WITH HEADER LINE,
BEGIN OF ltd_objk OCCURS 0,
object TYPE e071-object,
obj_name TYPE e071-obj_name,
END OF ltd_objk.
ltr_korr-sign = 'I' .
ltr_korr-option = 'EQ' .
SELECT trkorr INTO ltr_korr-low
FROM e070
WHERE trkorr EQ p_trkorr
OR strkorr EQ p_trkorr .
APPEND ltr_korr .
ENDSELECT .
SELECT DISTINCT
object
obj_name INTO TABLE ltd_objk
FROM e071
WHERE
trkorr IN ltr_korr
AND pgmid IN ('LIMU', 'R3TR')
ORDER BY OBJECT .
In Table LTD_OBJK we now have a list of all objects included in the query and its subqueries.
In this article we are limiting ourselves to the following object types:
Field value OBJECT | Object Type |
PROG | АВАР-programs and АВАР-includes |
TABL | Definition of tables and structures of data glossaries |
TYPE | Pools (groups) of types |
FUGR | Groups of functions |
CLAS | АВАР-class |
METH | Separate method of АВАР-class |
Insofar as we are limiting ourselves in this article only to objects used as ABAP programs (and are not considering other uses, for example, of data elements in tables), we need the data sources from which we can receive information about the use of objects as ABAP programs.
SAP offers a good tool for this task: “Usage journal.”
Data on the use of objects as programs are stores in *CROSS* tables.
Table Name | Purpose |
WBCROSSI | Use of АВАР includes in programs. |
WBCROSSGT | Use of global types in programs, including use of components of tables and structures. Including the use of ABAP classes, their fields and methods. |
CROSS | Use of functional modules in programs. In this table, we will also find information about the use of pools (groups) of types. In addition, this table contains data about the use of various other objects types, e.g. messages, but we will not consider them in this article. |
WBCROSSGT is the most interesting and varied of these tables.
In SAP, the concept of “global type” is quite broad: glossary objects, tables, structures, data elements and their components. АВАР classes are also global types.
Every line of АВАР code with access to a global type or its component is given in a line of WBCROSSGT.
АВАР Code | OTYPE | WBCROSSGT- NAME |
IF sy-subrc = 0 . | SY | SY\DA:SUBRC |
DATA: BEGIN OF ltd_objk OCCURS 0, object TYPE e071-object, obj_name TYPE e071-obj_name, END OF ltd_objk. | TY | E071\TY:OBJECT |
E071\TY:OBJ_NAME | ||
CALL METHOD o_grid-> set_table_for_first_display | ME | CL_GUI_ALV_GRID\ME:SET_TABLE_FOR_FIRST_DISPLAY |
The field WBCROSSGT- INCLUDE contains the names of includes and programs, which refer to the global type or its component. Please note: it is not the name of the main program that is prescribed, but rather the name of the direct piece of the referring ABAP code.
Thus we can get a list of all global types involved directly or indirectly in the work of the ABAP programs, if we (beforehand) make a list of all includes involved in the program’s operations.
We simultaneously receive information about the usage of functional modules.
*We perform a search of all includes involved in program operations.
DATA: BEGIN OF ltb_crossi OCCURS 0,
name TYPE wbcrossi-include,
END OF ltb_crossi,
ltd_wbcrossi TYPE TABLE OF wbcrossi WITH HEADER LINE .
LOOP AT ltd_objk .
ltb_crossi-name = ltd_objk-obj_name .
COLLECT ltb_crossi .
ENDLOOP .
SELECT DISTINCT * INTO TABLE ltd_wbcrossi
FROM wbcrossi
FOR ALL ENTRIES IN ltb_crossi
WHERE
include EQ ltb_crossi-name
OR master EQ ltb_crossi-name .
* For all includes located, we perform a search of all global types used in these includes.
DATA: ltd_wbcrossgt TYPE TABLE OF wbcrossi WITH HEADER LINE .
SELECT * INTO TABLE ltd_wbcrossgt
FROM wbcrossgt
FOR ALL ENTRIES IN ltd_wbcrossi
WHERE include EQ ltd_wbcrossi-include .
* For all includes located we performa search of all functional modules involved.
DATA: ltd_cross TYPE TABLE OF cross WITH HEADER LINE .
SELECT * INTO TABLE ltd_cross
FROM cross
FOR ALL ENTRIES IN ltd_wbcrossi
WHERE include EQ ltd_wbcrossi-include .
Intermediate Results
We have received lists of the following:
Next, we must be guided by the following logic:
There is a standard way to accomplish this task in SAP: the version control system with remote inter-system version comparison.
It is possible to check for differences between versions by calling FM.
SVRS_CHECK_VERSION_REMOTE_INT
Completion of parameters:
Parameter | Description |
E071_ENTRY | The parameter with the structure of table E071, but only fiels PGMI, OBJE, OBJ_NAME have real meaning. We can get the field values by making a selection from E071 by object name (we complete these fields in any query in which it is present. |
DESTINATION | The name of the RFC connection for communication with a remote system. This RFC connection is created automatically when you configure the transport system. His name is composed according to the rule ‘TMSADM@’ + SystemName + ‘.’ + DomainTransferName . The transfer domain name can be found by the name of the target system using the FM call system TMS_CI_GET_SYSTEMLIST Or one can use use FM call SVRS_GET_RFC_DESTINATION to receive the completed RFC address. |
Result | If no differences are found, FM will work without error. If differences are found, EXCEPTION will appear NOT_EQUAL – if versions are not identical NO_VERSION – if the object has not yet transferred into the target system. |
However, this FM has a strange feature: in theory, the message EXCEPTION NO_VERSION will appear if the object is absent from the target system. Nonethless, it will work without error, as if the object was present in the target system and no differences had been found.
Therefore, before calling SVRS_CHECK_VERSION_REMOTE_INT we will first call FM FIND_OBJECT_40, which will check for the presence of the existence of the object in the target system:
CALL FUNCTION 'FIND_OBJECT_40'
EXPORTING
DESTINATION = ‘TMSADM@’ + SystemName + ‘.’ + DomainTransferName
OBJNAME = Technical name of the objext
OBJTYPE = Type of object from field E071-OBJECT (FUNC, METH, etc.)
IMPORTING
OBJECT_NOT_FOUND = Flag: object not found in target system
Afterward, if OBJECT_NOT_FOUND is in fact empty, we will call SVRS_CHECK_VERSION_REMOTE_INT.
Victor Amosoff, ABAPFactory.com
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |