This
article is for those of you who are interested in Transport Management in SAP
systems. This article tells you how to get the import history that is displayed
in T-code STMS.
Recently,
I was developing a tool to count the modification of the objects which are in
production.
Now, for finding the objects
you need a data source. There I found two options -
1. The E070 table which would contain all the
desired Transport Requests
2. The Import History found in transaction STMS
After
much thought, I decided on the Import History source. This decision was based
on primarily two reasons.
a. The import history contained a practical
and correct list of all the imports that happened in the system
b. The import history could be fetched on the
basis of start and end date of import and not just the creation date of the
transports.
That was
when I came across the FM TMS_TM_GET_HISTORY
TMS_TM_GET_HISTORY
The basic
functionality of the FM is to provide a unformatted data of the import history
based on the start date time and end date and time provided to it. In addition
it also needs the system name and domain name of the system to be provided to
it. Following section talks about the import parameters.
Importing Parameters:
iv_system:
The system name (Note: directly providing sy-sysid won't work as the types are
different)
iv_domain:
The domain name of the system. (Can be found from table tmscsys; field domnam)
iv_allcli: To be put as 'X'
iv_imports:
To be put as 'X'
Exporting Parameters:
et_tmstpalog:
This is the table of the import history. Type is tmstpalogs
table type.
Changing Parameters:
cv_start_date:
This is the date from where you want the import history from
cv_start_time:
This is the time of start for your search of the import history
cv_end_date:
This is the date till which you want the import history of the system
cv_end_time:
Similarly, this parameter defines the end time till which the import history
should be fetched
Sample Code:
*
Initialise the system
l_sysname = sy-sysid.
* Get the domain
SELECT SINGLE domnam
FROM tmscsys
INTO l_domain_p
WHERE sysnam =
l_sysname.
IF sy-subrc = 0.
* Get the import history from the sytem provided
CALL FUNCTION
'TMS_TM_GET_HISTORY'
EXPORTING
iv_system = l_sysname
iv_domain = l_domain_p
iv_allcli = k_true
* IV_TRCLI =
* IV_TRFUNCTION =
* iv_project =
iv_imports = k_true
* IV_EXPORTS =
* IV_ALL_STEPS =
* IV_ALL_ALOG_STEPS =
* IV_TPSTAT_KEY =
iv_monitor = k_true
IMPORTING
* EV_ALOG_LINENR =
et_tmstpalog = li_import_history_p
* ES_EXCEPTION =
CHANGING
cv_start_date = l_strtdt_p
cv_start_time = l_start_time_p
cv_end_date = l_enddt_p
cv_end_time = l_end_time_p
EXCEPTIONS
alert = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty
NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2
sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
No comments:
Post a Comment