NES Module Setup
What is NES?
The NES is a computer-based system which allows export declarations to be made electronically, it replaces the manual process. NES operates within the nationwide electronic Customs Handling of Import and Export Freight (CHIEF) system which controls the movement of international cargo.
Please consult our NES User Guide for more information on how to use this module after it has been set up.
NES Module Setup
Follow the instructions below to set up the NES module in Moveware.
System Parameter
Code Value: DisableNES
Description: Disable NES
Value: N
Tooltip: N = No, Y = Yes
Help: Disable NES
In Tandem with Hardcoding:
if not (sysparam.sysparam-country = ‘GB’ or sysparam.sysparam-country = ‘NZ’ or sysparam.sysparam-comp begins ‘kent’ or sysparam.sysparam-comp begins ‘qcon’ or sysparam.sysparam-comp begins ‘Wridgways’) then hide button-customs in frame {&frame-name}.
System Setting Branch Management
Each company must have their Own Role, Location and Turn Numbers these are assigned by HMRC.
The below are example from the Excess setup and should NEVER be used on a new Client, they MUST have their OWN unique credentials.
Test System
Customs Email Address: stest@smtptest.hmce.gov.uk
Role: THS1ZDW
Location: LOCEDC1ZDW
TURN: 123456789123 (Example Dummy Turn)
Live System
Customs Email Address: edcs@edcsdata.hmce.gov.uk
Role: THSAGAG
Location: LOCEDCAGAG
TURN: 123456789123 (Example Dummy Turn)
The Role, Location & TURN are set up in Branch Management, by branch: The Customs Link in live should be set to NES Live.
Diary Actions
Dairy Action | Description | Message Type |
Customs Lodged | Customs Docs Lodged | Outbound |
Customs Cleared | Customs Cleared | Inbound |
CustomsAmended | Customs Declaration Amended | Outbound |
CustomsAmendAccept | Customs Declaration Amendment Accepted | Inbound |
CustomsInitAmended | Customs Initial Declaration Amended | Outbound |
CustomsCancelled | Customs Declaration Cancelled | Outbound |
CustomsCancelAccept | Customs Declaration Canceln Accepted | Inbound |
CustomsClosed | Customs Declaration Closed | TBC |
CustomsRejected | Customs Declaration Rejected | Inbound |
CustomsResponse | Customs Response Message | Inbound |
Note: The following should be set for each of these actions:
‘Automated’ Set to ‘Y’
‘Type’ Set to ‘Email’
‘Key Action’ Set accordingly these are set as Inactive in Codes Management “Dairy Key Actions”
‘Customs Cleared’ and ‘Customs Lodged’ were pre-existing diary actions, the rest are new.
The following screen shows the Customs Actions:
Live Email Setup
In XML Type – Email – Comments to the Email TO and From MUST be set accordingly if the Client is using a different email account for the NES then the main email address need to have permission to send as the NES dedicated Email.
Waybill Configuration – Spare Field 5 must be activated and described as “Flag” and set to Lookup from the Country Code Table.
Technical Information:
The interactive Customs UK user interface program is d-customsUKex.w. It calls routine, p-cusresmsg.p, to translate & diarise inbound Customs response messages that are read from a text file, apart from generating the outbound messages to text file and creating the associated diary entries in the Waybill diary screen. This routine should also be used in the automation software (see later).
The d-customsUKex.w program is called using an icon selection on the Waybill Details screen.
Outbound messages to Customs are sent by email attachment (No body text, just a single file attachment) with suggested subject lines:
Test system: Test EDIFACT message for HMUT
Live System: Live EDIFACT message for CHIEF
An outbound message looks like:
The outbound message is just a single line containing the EDIFACT message to be sent to Customs – The file name is the waybill number followed by the message type
(One of CUSDEC, AMEND, CANCEL). This is generated by d-customsUKex.w as noted above.
For each inbound Customs response, two emails are received, the first is a receipt acknowledgement with the subject: X.400 Inter-Personal Notification.
And the actual response message is contained in the body of the second email:
Inbound
messages (Customs responses) are received back to the originating outbound
email address. Excess sends messages
from a dedicated email address to customs and receives the responses back to
the same address.
Currently, the outbound message is placed in the user’s directory (v-dir) as follows (Code from d-customsUKex.w):
find first sysparam no-lock no-error.
v-usrname = BB_GetValue (“security”, “userid”).
v-rep = bb_getvalue(‘User’,’Salesrep’).
find first payemp where payemp.pay-username = v-usrname no-lock no-error.
if available payemp then do.
assign v-dir = payemp.pay-pdfpath
v-brch = payemp.pay-brch.
end.
else v-dir = ‘C:\Temp’.
/* System parameters */
find first branch where br-code = v-brch no-lock.
if available branch then
assign v-turn = branch.br-permission /* Excess ‘835241638000’ */
v-role = branch.br-clientID /* Role ‘THSAGAG’ */
v-location = branch.br-principalID. /* Location ‘LOCEDCAGAG’ */
assign v-cr = ”
v-tl = yes. /* Set to YES to produce LIVE messages */
/* Settings for Testing */
if v-location = ‘LOCEDC1ZDW’ then
assign v-dir = ‘C:\Temp’
v-tl = no.
The user’s branch (v-brch) is used to extract the Location, Role & TURN information.
Perhaps this code needs to change to specify a global directory for outbound EDIFACT messages. The current setup certainly provides a level of security I guess.
For testing, the program uses the location information to set for test messages and to send the outbound messages to C:\Temp.
When the outbound message is ‘sent’ by the user using d-customsUKex.w, the body of the message is placed in the ‘Additional Notes’ section of the diary entry created, and the full path specification of the file attachment for the outbound message is placed in the ‘Attachments’ section.
Note: in the screen above date/time is showing local time for outbound messages and UK time for inbound messages. This sequencing will resolve itself when the program is run in the UK.
For inbound messages the p-cusresmsg.p routine should be called. This routine takes a textual message (body of the email response), ‘translates’ it and creates the diary entry. An example of a customs response in the diary is:
This diary entry was created by reading in the customs response from a text file in d-customsUKex.w.
p-cusresmsg.p call parameters for automation are:
def input parameter v-msg as char no-undo. /* EDIFACT message */
def input parameter v-raw as char no-undo. /* Raw message – passed or set */
def input parameter v-long as log no-undo. /* If Yes, Long Translation */
def input parameter v-skip as log no-undo. /* If Yes Skip some setup */
def input parameter v-diary as log no-undo. /* If Yes, create diary entry */
def output parameter v-trmsg as char no-undo. /* Translation */
def output parameter v-msgtype as int no-undo. /* Message Type */
def output parameter v-error as char no-undo. /* Error Return */
v-msg Inbound message text file (from the email body)
v-raw Set to ‘’ always
v-long Set to ‘No’
v-skip Set to ‘No’ always
v-diary Set to ‘Yes’ so the diary entry is created
v-trmsg Returns the translation of the inbound message
v-msgtype Ignore this return
v-error Return non-blank if a an error has been found.
The translation of the message gives some useful information – best done on the fly on user demand & not stored. Perhaps this could be done using a ‘hotkey’ translation to a message screen) – See the Notes below about short translation of outbound messages.
A ‘short’ translation of an inbound (CUSRES acceptance) message looks like:
CUSRES-Accept
Our ICR: 35995002
Customs ICR: 0008325860
ASG Code: 730 – CUSDEC (Initial Entry)
CHIEF Common Access Ref: DTM-REF558460-080618-16-01
Message Code: EFD – CUSDEC Declaration
Message Function: 29 – Accepted without amendment
Entry DTM: 20080618:1604
Goods Location Code: GBLHR
Office of Export: 120
Master UCR: A:93224161583
Declaration UCR: 8GB835241638000-558460
CHIEF Entry Reference Number: A63506L/1
Entry Status at Customs: 1 – Consignment subject to associated Route
Entry Status(Qualifier): A1 – Export entry accepted on CHIEF based on intention to export (Goods not “on hand”)
Examination Route Code: H
A ‘short’ translation of an inbound (CUSRES rejection) message looks like:
CUSRES-Reject
Our ICR: 35995001
Customs ICR: 0008450947
ASG Code: 730 – CUSDEC (Initial Entry)
CHIEF Common Access Ref: MWADMIN-REF900012-080723-10-56
Message Code: EFD – CUSDEC Declaration
Message Function: 27 – Not accepted
Declaration UCR: 8GB835241638-35995
Errors: (Line-Segment:Element:Component ErrorMessage)
13-NAD E10436FIELDCNSGE-STREETISMANDATORY
18-MEA:4:2 E345ITEMGROSSMASSLESSTHANITEMNETMASS
22-DOC:3:6 E3209PREVIOUSDOCUMENTCLASSANDTYPEISNOTAVALIDPREVIOUSDOCUMEN
A ‘short’ translation of an inbound (CONTRL rejection) message looks like:
CONTRL-Reject
Our ICR: 35995001
Customs ICR: 0008458810
Segment: UNB
Action: 4 – This level and all lower levels rejected
Error: 26 – Duplicate interchange (ICR) for role
Note:
‘Our ICR’ is stored in the dd-from field & ‘Customs ICR’ is stored in the dd-to field of the diary for inbound messages. The p-cusresmsg.p routine will not create additional diary entries if a customs response is reloaded.
For outbound messages a short translation is stored in the dd-to field of the diary, for example the initial outbound customs declaration translation is:
‘Our ICR’ is composed of a waybill number with a 3-digit suffix.