CTLSBSITM: Substitution product control

This entry point concerns the automatic substitution of a product when entering a sales document line.

It is used to take over right before the substitution to carry out controls in order to execute or not this substitution.

This entry point is located in the TRTVENCTL process in the CTLSBSITM sub-program.

The substitution corresponds to the automatic replacement of the entered product reference by the reference of the substitution product mentioned in the sales tab of the product record, and this, if the document date is later than or equal to the substitution date.

Context and operating method

Transaction

There is no transaction in process.

Log file

There is no open log file.

Call context

This entry point is called in quote, order, delivery and invoice management.

It is called each time a new line is entered, from the standard control action of the product field (C_ITMREF de SUBSOH for instance). It is the 1st control performed on the field.

The substitution product has just been read in the [F :ITS] class.

Available variables and masks

The screen classes for the object are on line and loaded.

In the CTLSBSITM sub-program, the following variables are available:

·               WITMREF  (value char)  : Reference of the product of origin

·               DAT (value date)             :  Document date (for ctrl with the substitution date)

·               RET (value integer)         :  Feedback variable

                                                                    0=No substitution product

                                                                    1=Substitution product but problem when reading the product ([F :ITS]

                                                                    2=Substitution ok

When the EP is called, the [F :ITS] class is loaded with the substitution product.

RET is loaded. RET=2. The original product will be replaced by the substitution product.

To avoid substitution, RET should be set to 0 or 1.

If it is set to 0, everything is transparent. Nothing happens. The original product is kept.

If it is set to 1, the following error message appears: "Problem on the substitution product". mkstat is set to 2. An error remains on the Product field.

To change the substitution product, RET should be kept to 2 and [F :ITS] should be loaded with the new product.

Open tables

The open tables are the tables of the object (quote, order, delivery, invoice).

 

Table

Significant content

Table Title

ITMMASTER

No

Products

ITMSALES 

Yes

Sales product