Use of SY-TCODE in Delivery Processing User-Exits

According to SAP Note 209846, it is possible to switch between display mode and change mode of the delivery without leaving the screen currently edited.

However, the transaction code (SY-TCODE) set by the system does not change for switching between the display mode and the change mode. In the user exits of the delivery, if you have programmed source code depending on SY-TCODE, malfunctions can occur.

The SAP Note also specifies the possible below solution to switch the modes

In your user exits, use field T180-TRTYP instead of field SY-TCODE. This field has the following characteristics depending on the processing mode:

  • H Creation of the delivery
  • V Change of the delivery
  • A Display of the delivery

If a differentiation should be required whether the creation of the delivery is carried out online (Transaction VL01N) or is carried out in collective processing (Transaction VL10x), use the V50AGL-SAMMELGANG flag in addition:

  • T180-TRTYP = ‘H’ and V50AGL-SAMMELGANG = ‘X’: Creation of the delivery is carried out in collective processing.
  • T180-TRTYP = ‘H’ and V50AGL-SAMMELGANG = SPACE: Creation of the delivery is carried out online.

The mentioned advice works for the new and the old delivery dialog and for inbound and outbound delivery in the same way.