CALECHE: Modification of the open items generated upon creation of a sales invoi

This entry point is called upon creation of a sales invoice following the generation of payment open items.

It is used to intervene on the open items created in order to modify the dates, amounts, payment methods, etc.

This entry point is located in the TRTVENFACDUD processing.

Context and operating mode

Transaction

There is no transaction in progress when the entry point is called from invoice management, invoice import and the automatic invoicing functions for contracts, service requests, and transfers, and from the invoices/proforma buttons in the management of quotes, orders and deliveries.

There is a transaction in progress when the entry point is called from the automatic invoicing functions for orders and deliveries and from the management of quotes, orders, deliveries upon valuation.

Log file

There is no open log file when the entry point is called from the management of invoices, quotes, orders, deliveries (invoice/proforma button and document valuation).

There is an open log file when the entry point is called from invoice import and the automatic invoicing functions.

Different call cases

This entry point is activated in the following processings:

.        Invoice and invoice import functions

.        Automatic invoicing of orders and deliveries functions

.        Automatic invoicing of contracts, service requests and transfer functions

.        Invoice/proforma button from the quote, order and delivery functions

.        Quote, order and delivery functions upon valuation.

If this entry point is only active in a specific context (for example only for credit memos), it is necessary to test only the data in the screen classes.  

Available variables and masks

Never use the values of the [F:SIH] [F:SIV] [F:SID] file classes; the invoice calculation is only carried out with the values in the [M] classes.

The [M :SIH0], [M :SIH1] and [M :SIH2] masks are loaded with the header data. The [M :SIH4] mask is loaded with the detail lines and is indexed from 0 to [M :SIH4]NBLIG-1 ([M :SIH4]NBLIG corresponds to the number of lines in the invoice).

This entry point is used to intervene:

. Before the loading and the standard calculation of the regional taxes:

The PE_COD variable must be loaded to START. If the GPE global variable is set to 1, the loading and the standard calculation will not be performed and must be done in the EP. The taxes must be loaded in the SIHV screen:

[M:SIHV]XVTAX(I): Tax code

[M:SIHV]XVTYP(I): Tax type. (Type=4=Regional taxes)

[M:SIHV]XVBAS(I): Amount no (if tax with formula)

[M:SIHV]XVCHA(I): Subject to VAT

[M:SIHV]XVSHO(I): Short title

[M:SIHV]XVRAT(I): Tax rate

[M:SIHV]XVSMI(I): Subjected amount

[M:SIHV]XVAMT(I): Tax amount

l must be loaded with the index of the tax first line available in the tax grid. For each new line added, [M:SIHV]NBVAT must be incremented of 1.

. After the loading and the standard calculation of the regional taxes:

The PE_COD variable must be loaded to END. The variables previously described can be modified in the tax grid.

Warning:

The EP is activated only if the PTX activity code (Regional taxes) is activated.

Open tables

For the tables that are not used in all the processings, the names of the processings using them are given, knowing that:

.        FUNAUTINVO:           Automatic invoicing of orders

.        FUNAUTINVD:           Automatic invoicing of deliveries

.        SUBSOH:           Invoice button from the orders

.        SUBSDH:           Invoice button from the deliveries

.        SUBSIH:           Invoice function

 

Table

Processing

Significant content

Table Title

TABSIVTYP

 

 

Invoice type table

TABMODELIV

FUNAUTINVO

FUNAUTINVC

FUNAUTINVS

 

Delivery methods table

TABCUR

SUBSIH

 

Currency table

BPCUSTOMER

 

 

Customers

BPARTNER

 

 

BP

BPCUSTMVT

 

 

Customer transactions

LASTCUSMVT

 

 

Last customer transactions

BPDLVCUST

 

Ship-to customers

BPADDRESS

FUNAUTINVD

FUNAUTINVO

FUNAUTINVS

 

Addresses

ITMMASTER

 

 

Products

ITMFACILIT

 

Product-site

ITMSALES

 

Product-sales

ITMBPC

SUBSIH

FUNAUTINVO

FUNAUTINVD

 

Customer product

ITMMVT

SUBSIH

 

Product movements

FACILITY

SUBSIH

 

Sites

SALESREP

SUBSIH

 

Sales reps

PRICSTRUCT

SUBSIH

 

Price list structure

SPRICLINK

SUBSIH

 

Price list search

SORDER

SUBSIH

FUNAUTINVD

FUNAUTINVO

FUNAUTINVC

 

Order headers

SORDERC

SUBSDH

 

Order early/late total

SORDERP

SUBSIH

FUNAUTINVO

FUNAUTINVC

 

Order price lines

SORDERQ

SUBSIH

FUNAUTINVO

FUNAUTINVD

FUNAUTINVC

 

Order quantity lines

SDELIVERY

FUNAUTINVD

SUBSIH

 

Delivery headers

SDELIVERYD

FUNAUTINVD

SUBSIH

 

Delivery detail lines

SINVOICE

 

Yes

Invoice headers

SINVOICEV

 

Yes

Invoice headers

SINVOICED

 

 

Invoice detail lines

SWRKINV

FUNAUTINVO

FUNAUTINVD

FUNAUTINVC

FUNAUTINVS

FUNAUTINVT

 

Auto invoicing work file

GTYPACCENT

 

Entry type

GACCCODE

 

Accounting codes

GACCCOUNT

 

General ledger accounts

GAUTACE 

 

 

Automatic journals

GAUTACEF 

 

 

Automatic journals (lines)

STOALL

SUBSDH

 

Allocations

SVCRVAT

 

 

Sales documents - taxes

SVCRFOOT

 

 

Sales documents - invoicing elements

ITMCATEG

 

 

Product category

CONTSERV

FUNAUTINVC

SUBSIH

 

Service contracts

CONTSERVX

FUNAUTINVC

 

Service contracts 

CONTREW 

FUNAUTINVC 

 

Renewal of contracts 

CONTREWX 

FUNAUTINVC

 

Renewal of contracts

CONTAMT 

FUNAUTINVC

 

Annual databases 

CONTAMTX 

FUNAUTINVC 

 

Annual databases 

SERREQUEST

SUBSIH

 

Service requests 

HDKTASKINV

SUBSIH

 

Consumptions to be invoiced 

SCHGH

FUNAUTINVT

 

Stock change header

SCHGD 

FUNAUTINVT

 

Stock change detail 

STOJOU

SUBSIH 

 

 Stock journal

STOCK

SUBSIH

 

 Stock

STOLOT

SUBSIH 

 

Lot no.

TABPRTMOD

SUBSIH

 

 Print template table

WAREHOUSE

SUBSIH

FUNAUTINVO

 

 Warehouses

ITMWRH

SUBSIH

FUNAUTINVO

 

 Products warehouse

CPTANALIN

 

 Analytical accounting lines

TABUNIT

SUBSIH

 

Unit table

TABCOUAFF

 

 

ACODNUM

 

 

Document sequence numbers

GJOURNAL

FUNAUTINVD

FUNAUTINVO

FUNAUTINVC

FUNAUTINVS

FUNAUTINVT

 

Journals

GACM

 

FUNAUTINVD

FUNAUTINVO

FUNAUTINVC

FUNAUTINVS

FUNAUTINVT

 

Account Core Models

PERIOD

FUNAUTINVC

FUNAUTINVS

 

Periods 

AREPORT

FUNAUTINVC

FUNAUTINVS 

 

Report dictionary 

AREPORTM

FUNAUTINVC

FUNAUTINVS  

 

Temporary print key tables

TEXCLOB

FUNAUTINVS

 

Text clob

ACTIV

SUBSIH

 

Activity codes

TABSTORUL

SUBSIH

 

Stock management rules

TABALLRUL

SUBSIH

 

Allocation management rules

STOWIPW

SUBSIH

 

 Stock being processed

 

DATEECHE: Load open item start date before invoice creation

This entry point concerns the creation of a sales invoice.

It is used to load the open item start date before the invoice creation so that it is taken into account in the open item creation.

This entry point is located in the TRTVENFACDUD processing.

It is called from each processing used to generate an invoice.

Context and operating mode

Transaction

There is a transaction in progress (invoice creation transaction). The GOK variable is used and tested. It is equal to 1. It can be set to 0 if the transaction is to be abandoned. 

Log file

There is no open log file.

Different call cases

This entry point is called from each processing used to generate an invoice:

.        Invoice Function

.        Automatic invoicing of orders function

.        Automatic invoicing of deliveries function

.        Invoice button from the order function

.        Invoice button from the delivery function

 

In the invoice function, the create button has been initiated. This is at the level of the INICRE action just before the write of the [F:SIH] and [F:SIV] records and the creation of the open items. The detail lines have not yet been created.

In all other cases, all the detail lines are created with the associated updates. This is just before the write of the [F:SIH] and [F:SIV] records and the creation of the open items. 

Available variables and masks

The [F:SIH] and [F:SIV] buffers are loaded when the entry point is called.

The screen class linked to the invoice object is loaded. [M :SIH0], [M :SIH1] and [M :SIH2] are loaded with the header data. [M :SIH4] is loaded with the detail lines.

In addition, the following variables are available concerning the invoice currently being created:

.        WINVTYP:           Invoice type (1=Invoice, 2=Credit memo, 3=Debit note,

4=Credit note, 5=Proforma)

.        WSIHORI:           Invoice origin ( 1=Direct, 2=Order,

3=Delivery, 4=Invoice, 5=Quote, 6=Return)

.        WSOHNUM:           Original order no. for an order invoice.

In the case of an invoice for several orders, it corresponds to the 1st order.

.        WSDHNUM:           Original delivery no. for an delivery invoice.

In the case of an invoice with several deliveries, it corresponds to the 1st order.

.        WSTRDUDDAT:           Open item start date. This variable is the one

that must be loaded to give a new start date.

All of these variables should be sufficient to allow the processing of the entry point.

The screen masks can be used. [M :SIH4] contains the detail lines grid. It is indexed from 0 to [M :SIH4]NBLIG-1 ([M :SIH4]NBLIG corresponds to the number of lines in the invoice).

The invoice screen classes and files are not modified. It is only required that WSTRDUDDAT be specified.

Open tables

For the tables that are not used in all the processings, the names of the processings using them are given, knowing that:

.        FUNAUTINVO:           Automatic invoicing of orders

.        FUNAUTINVD:           Automatic invoicing of deliveries

.        SUBSOH:           Invoice button from the orders

.        SUBSDH:           Invoice button from the deliveries

.        SUBSIH:           Invoice function

 

Table

Processing

Significant content

Table Title

TABSIVTYP

 

 

Invoice type table

TABMODELIV

 

 

Delivery methods table

TABCUR

SUBSIH

SUBSOH

SUBSDH

 

Currency table

TABSOHTYP

SUBSOH

 

Order type tables

ACTIV

FUNAUTINVO

FUNAUTINVD

 

Activity code table

BPCUSTOMER

 

 

Customers

BPARTNER

 

 

BP

BPCUSTMVT

 

 

Customer transactions

BPDLVCUST

FUNAUTINVD

SUBSIH

SUBSOH

SUBSDH

 

Ship-to customers

CONTACT

SUBSOH

 

Contacts

ITMMASTER

 

 

Products

ITMFACILIT

FUNAUTINVO

SUBSIH

SUBSOH

SUBSDH

 

Product-site

ITMSALES

SUBSIH

SUBSOH

SUBSDH

 

Product-sales

ITMBPC

SUBSIH

SUBSOH

SUBSDH

 

Customer product

ITMMVT

SUBSIH

SUBSOH

SUBSDH

 

Product movements

FACILITY

SUBSIH

SUBSOH

SUBSDH

 

Sites

SALESREP

SUBSIH

SUBSOH

SUBSDH

 

Sales reps

PRICSTRUCT

SUBSIH

SUBSOH

SUBSDH

 

Price list structure

SPRICLINK

SUBSIH

SUBSOH

SUBSDH

 

Price list search

SORDER

 

 

Order headers

SORDERC

SUBSDH

 

Order early/late total

SORDERP

FUNAUTINVO

SUBSIH

SUBSOH

SUBSDH

 

Order price lines

SORDERQ

 

 

Order quantity lines

SDELIVERY

FUNAUTINVD

SUBSIH

SUBSDH

 

Delivery headers

SDELIVERYD

FUNAUTINVD

SUBSIH

SUBSDH

 

Delivery detail lines

SINVOICE

 

Yes

Invoice headers

SINVOICEV

 

Yes

Invoice headers

SINVOICED

 

 

Invoice detail lines

SWRKINV

FUNAUTINVO

FUNAUTINVD

 

Auto invoicing work file

GTYPACCENT

FUNAUTINVO

FUNAUTINVD

SUBSIH

 

Entry type

GACCCODE

FUNAUTINVO

FUNAUTINVD

SUBSIH

 

Accounting codes

GACCCOUNT

FUNAUTINVO

FUNAUTINVD

SUBSIH

 

General ledger accounts

STOALL

SUBSDH

 

Allocations

 

AFFACOMPTE: Prepayment assignment to the invoice

This entry point concerns the creation of a sales invoice.

It is used to act on the prepayment amount assigned to the invoice.

It is located in the TRTVENFACC processing and it is called from each processing used to generate an invoice.

Context and operating mode

Transaction

There is a transaction in progress (invoice creation transaction). The GOK variable is used and tested. It is equal to 1. It can be set to 0 if the transaction is to be abandoned. 

Log file

There is no open log file.

Different call cases

This entry point is called from each processing used to generate an invoice:

.        Invoice Function

.        Automatic invoicing of orders function

.        Automatic invoicing of deliveries function

.        Invoice button from the order function

.        Invoice button from the delivery function

In the invoice function, after the activation of the creation or save button, in the INICRE or INIMOD action just before the write of the [F :SIH] and [F :SIV] records. The detail lines have not yet been created.

In all other cases, all the detail lines are created with the associated updates. This is just before the write of the [F:SIH] and [F:SIV] recordings.

For each invoice, it is possible to assign a maximum of 4 prepayments. A loop on invoice lines is used to find the original order for each line as well as any potential prepayment associated with this order.

The entry point is located in this loop after the prepayment selection. It makes it possible in this way to modify the prepayment value to be deducted from the invoice.        

Available variables and masks

The [F:SIH] and [F:SIV] buffers are loaded when the entry point is called.

The screen class linked to the invoice object is loaded. [M :SIH0], [M :SIH1] and [M :SIH2] are loaded with the header data. [M :SIH4] is loaded with the detail lines.

The screen masks can be used. [M :SIH4] contains the detail lines grid. It is indexed from 0 to [M :SIH4]NBLIG-1 ([M :SIH4]NBLIG corresponds to the number of lines in the invoice).

In addition the following variables are available:

Grid containing 4 lines corresponding to the storage of the 4 prepayments to assign to the invoice.

.        ZNOCDE ( ) :           Order no (GACCDUDATE document no)

.        ZDUDLIG ( ) :           GACCDUDATE open item no 

.        ZAPRENDRE( ) :           Maximum prepayment value that can be assigned to the invoice 

.        ZPRIS ( ) :           Value assigned to the invoice 

Other variables

.        JLL:           Invoice line index containing the order number with the prepayment 

.        JLZ:           Line number in the grids above (from 1 to 4) 

On the call to the entry point, the fields 

- JLL             contains the index of the mask line [M:SIH4]

- JLZ             line number ( the index in the grids is JLZ-1 )

- Do not modify the ZPRIS() values

The ZAPRENDRE(ZJL-1) value must never be greater than the value to be deducted [F:DUD]IBDAMT

After use of the entry point, the grids are used to update the SINVOICEV [F:SIV] invoice table, as well as the open item table GACCDUDATE [F:DUD].

 Open tables

Table

Significant content

Table Title

SINVOICE

Yes

Invoice headers

SINVOICEV

Yes

Invoice headers

SINVOICED

No

Invoice detail lines

BPCUSTOMER

Yes

Customers

BPARTNER

No

BP

BPDLVCUST

No

Ship-to customers

BPCUSTMVT

No

Customer transactions

TABSIVTYP

No

Invoice type table

ITMMASTER

No

Products

GACCDUDATE

Yes

Open items