Usina BRAdvPL Guide
Sign in
← All topics
ENTRY POINTPublished

M410STTS

M410STTS( <nOper> ) --> Nil

Runs additional handling after sales order changes in routine MATA410.

Entry pointsBillingSales orderMATA410Protheus 11Protheus 12
01 · OVERVIEW

Overview

M410STTS is an entry point of the sales order routine MATA410(). It runs after changes to the order file have been made, allowing complementary handling for inclusion, change, deletion, copy and purchase return operations.

02 · SYNTAX

Syntax

M410STTS( <nOper> ) --> Nil

Parameters

PARAMIXB[1] / nOper
NumericRequired

Code of the operation being executed in the sales order routine.

Default:

Return value

No expected return. The reference indicates Nil.

03 · PRACTICAL EXAMPLE

Minimum structure by operation

#Include "TOTVS.ch"

User Function M410STTS()
    Local nOper := PARAMIXB[1]

    Do Case
    Case nOper == 3 // Inclusion
        ConOut("Order included")

    Case nOper == 4 // Change
        ConOut("Order changed")

    Case nOper == 5 // Deletion
        ConOut("Order deleted")

    Case nOper == 6 // Copy
        ConOut("Order copied")

    Case nOper == 7 // Purchase return
        ConOut("Purchase return")
    EndCase

Return Nil
Expected result

The example shows how to identify the operation received in PARAMIXB[1] and separate handling according to the sales order change type.

04 · PRACTICAL EXAMPLE

Specific handling for copy

#Include "TOTVS.ch"

User Function M410STTS()
    Local nOper := PARAMIXB[1]

    If nOper == 6 // Copy
        // Additional handling after copying the order.
        ConOut("Post-copy sales order handling")
    EndIf

Return Nil
Expected result

When the operation is copy, identified by value 6, the routine runs only the desired complementary handling.

BEST PRACTICES
  • Read PARAMIXB[1] into a clearly named local variable, such as nOper.
  • Use DO CASE or well-separated IF statements to handle each operation.
  • Document in the source which operations are handled by the customization.
  • Keep the entry point small and delegate larger rules to helper functions.
  • Record controlled logs when the customization performs relevant actions after the order change.
COMMON PITFALLS
  • Because it runs after order changes, do not assume this point replaces validations before recording.
  • Do not confuse the operation code with a menu option; explicitly handle each expected value.
  • Avoid long processing or blocking integrations at this point without assessing user impact.
  • Test inclusion, change, deletion, copy and return separately, as each operation may have a different context.

Related content

REFERENCES
  1. TOTVS. M410STTS - Sales Order Changes. TDN. Created by Nuria Fauró Campos, last modified by Marcio Rogerio Menon on Jan. 17, 2019. Accessed on Aug. 28, 2026.
  2. Entry Points — AP 7 7.10. Historical base used by AdvPL Guide for cross-reference with routine MATA410.
Status
Published
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha