Script PORLEGLIB1 : X3 connection properties

SET_FARMER_DOC entry point

SET_FARMER_DOC: Set farmers transport document.

This entry point allows you to define a transport document that has the farmer's transport document when the document is about to be communicated to the fiscal authorities via a web service.

Context and operating method

Transaction

There is no transaction in progress.

Log file

There is an open log file.

Different call cases

This entry point is called after gathering all relevant data from the document and before it is communicated via the web service.

Available variables

DTNUM variable: indicates the document number.

DOCTYP variable: indicates the document type. Depending on the document type, we know the origin of the document:

2 - document from SDELIVERY table

3, 4 or 5 - document from SRETURN table

6, 7 or 8 - document from SCHGH table

9 - document from PRETURN table

10 - document from TRANNOTEH table

If the document is to be set as a farmer’s transport document, the variable FARMERDOC value should be set to 1. In this case, the following variable values should also be provided (mandatory):

FPPD_ORIGINATING_ON: Global document number that this document should refer to (OrderReference\OriginatingON tag)

FPPD_MOVEMENT_TYPE: Global document type that this document should refer to (OrderReference\MovementType tag)

FARMER_TAX_ID: The farmer tax VAT number (FarmerTaxID tag, just the numbers, without the country code)

Open tables

Depending on the document type (DOCTYP variable), the following tables are open and with significant content:

SDELIVERY, with PTSDH abbreviation

SRETURN, with PTSRH abbreviation

SCHGH, with PTSGH abbreviation

PRETURN, with PTPNH abbreviation

TRANNOTEH, with PTTNH abbreviation

BPARTNER, with PTBPR abbreviation, for every type

TRDCOMTRACE: Prevents initialization of a new trace file during communication with Portuguese Authorities.

Context and operating method

Transaction

A transaction is in progress.

Log file

There is a log file open.

Code context

This entry point is located in the PORLEGLIB1 process. It is used to prevent the initialization of a new trace file when a transport document is being communicated to the Portuguese Authorities.

It is only activated if the communication is triggered via web services ([V]GWEBSERV ≠ 0).

The local variable [L]PRIVTRACE is available for use. It is initialized to 0.

To prevent the trace file from being opened, set PRIVTRACE to any value other than 0.

If PRIVTRACE = 0 and no other trace is open, a new trace file will be created.

This entry point is placed after variable declarations and table openings, but before any values are assigned or records are read.

Available variables and masks

VariableDescription
PRIVTRACELocal variable (ShortInt). Set to a non-zero value to prevent trace file creation.

Open tables

All necessary tables for the process are already open at the time this entry point is called.