Deleting TPSTAT

TPSTAT is a standard SAP-table containing information on TMS, on transport requests that are currently being imported to be exact. Once in a while – most likely when a TP-process hangs and must be abported – you need to clear it so you can restart your transport requests. To prevent opening up the client you can use this report to delete its entries:

*&--- Technical description -------------------------------------------*
*& Report  Y12S_22_TP_DELTPSTAT                            Version 1.1 *
*& 09.11.2004 by Kai Boenke                         *
*&                                                                     *
*&--- Function overview -----------------------------------------------*
*& Delete an entry within table TPSTAT.                                *
*&                                                                     *
*&--- Changelog -------------------------------------------------------*
*&  09.11.2004  Kai Boenke         First edition                       *
*&  09.12.2004  Kai Boenke         Added support for *                 *
*&---------------------------------------------------------------------*
REPORT Y12S_22_TP_DELTPSTAT.

*&----- Declare variables
Tables:      TPSTAT.
Parameters:  trname   Like TPSTAT-TRKORR     Obligatory.
Data:        retcode  Like SY-SUBRC.


*&----- Validate given data
If trname <> '*'.
  Select * From TPSTAT  Where TRKORR = trname.
  EndSelect.

  If SY-SUBRC <> 0.
    Message a000(fb) With 'No such transport in TPSTAT.'.
  EndIf.
EndIf.


*&----- Delete table-entry
If trname <> '*'.
  Delete from TPSTAT    Where TRKORR = trname.
  retcode = SY-SUBRC.
Else.
  Delete from TPSTAT    Where TRKORR like '%'.
  retcode = SY-SUBRC.
EndIf.


*&----- Show result
If retcode <> 0.
  Message e000(fb) With 'Could not delete entry. '
                        '(' retcode ')'.
Else.
  Message s000(fb) With 'Entry deleted'.
EndIf.