UPS_shipAccept()
This subprocedure calls the UPS Ship Acceptance API. It reads request data from UPSSCRQ and UPSSCRS, and writes response data to UPSSARS, and package data to UPSSARSPK. This subprocedure relies on UPS_shipConfirm() having been called previously, and uses both the request and response data from that transaction.
Subprocedure Prototype
|
Returns *OFF if an error occurs during processing, *ON otherwise. |
|
The ID of the record in UPSSCRS that will be used to build the request, and under which the response data will be saved in UPSSARS and UPSSARSPK. |
|
The data structure in which error information will be returned. |
Example Code
*------------------------------------------------------------------------
* @Author: Kato Integrations
* @Description:
* This is a test program to illustrate how to call the
* UPS_shipAccept() subprocedure to finalize a shipment.
*
* To achieve this, pass the same UniqueID that was passed to a prior
* UPS_shipConfirm() call to UPS_shipAccept(). UPS_shipAccept() does
* not have request data tables, only response data tables.
*
* UPS_shipAccept() will return *On if no error was encountered,
* or *Off if an error occurred. If an error occurred, you should
* look at the fields in ErrorDS to retrieve information about the
* error.
*
* Otherwise, you can read the result data from UPSSARS and UPSSARSPK.
*------------------------------------------------------------------------
H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('UPSBND') OPTION(*NODEBUGIO)
FUPSSARS IF A E K DISK Qualified
FUPSSARSPK IF A E K DISK Qualified
/COPY QRPGLECPY,UPS
// This is included for demo output purposes.
D WriteToJobLog PR 10I 0 Extproc('Qp0zLprintf')
D pString * Value Options(*String)
D NewLine C x'15'
D SARS DS Likerec(UPSSARS.RUPSSARS:*Input)
D SARSPK DS Likerec(UPSSARSPK.RUPSSARSPK:*Input)
D ErrorDS DS LikeDS(UPS_ErrorDS_t) Inz(*LikeDS)
D UniqueID S Like(UPS_UniqueID_t)
/FREE
reset ErrorDS;
// Replace this with a UniqueID previously used to call
// UPS_shipConfirm()
UniqueID = 1;
// If UPS_shipAccept() returns *Off, an error occurred and
// UPS_ErrorDS should be reviewed to determine the cause.
if not UPS_shipAccept( UniqueID : ErrorDS );
WriteToJobLog( 'API Error: ' + NewLine );
WriteToJobLog( 'Error Code: ' + %Trim(ErrorDS.Code) + NewLine );
WriteToJobLog( 'Error Severity: ' +
%Char(ErrorDS.Severity) + NewLine );
WriteToJobLog( 'Error Source: ' + %Trim(ErrorDS.Pgm) + NewLine );
WriteToJobLog( 'Error Text: ' + %Trim(ErrorDS.Text) + NewLine );
exsr cleanup;
return;
else;
// Read the results from UPSSARS. There is only going to be one record
chain UniqueID UPSSARS.RUPSSARS SARS;
if not %Found(UPSSARS);
WriteToJobLog( 'ERROR: No results found in UPSSARS' + NewLine );
exsr cleanup;
return;
endif;
WriteToJobLog( 'Result Record: ' + NewLine );
WriteToJobLog( 'UID: ' + %Char(SARS.UID) + NewLine );
WriteToJobLog( 'SHIPNBR: ' + %Trim(SARS.SHIPNBR) + NewLine );
WriteToJobLog( 'WGTCD: ' + %Trim(SARS.WGTCD) + NewLine );
WriteToJobLog( 'TOTWGT: ' + %Char(SARS.TOTWGT) + NewLine );
WriteToJobLog( 'TRSCURCD: ' + %Trim(SARS.TRSCURCD) + NewLine );
WriteToJobLog( 'TRSCHRG: ' + %Char(SARS.TRSCHRG) + NewLine );
WriteToJobLog( 'SVCCURCD: ' + %Trim(SARS.SVCCURCD) + NewLine );
WriteToJobLog( 'SVCCHRG: ' + %Char(SARS.SVCCHRG) + NewLine );
WriteToJobLog( 'TOTCURCD: ' + %Trim(SARS.TOTCURCD) + NewLine );
WriteToJobLog( 'TOTCHRG: ' + %Char(SARS.TOTCHRG) + NewLine );
WriteToJobLog( 'NEGCURCD: ' + %Trim(SARS.NEGCURCD) + NewLine );
WriteToJobLog( 'NEGCHRG: ' + %Char(SARS.NEGCHRG) + NewLine );
// Next you could read through UPSSARSPK to get package-level info
// such as the tracking number, individual service charges, etc.
// Most importantly, this is where you'd find the IFS path of
// the label you have requested from UPS. If you have requested
// a ZPL label, you can then call UPS_printZPL() to print the
// label to a spooled file which can then be sent to a
// ZPL-compatible printer.
chain UniqueID UPSSARSPK.RUPSSARSPK SARSPK;
if not %Found(UPSSARSPK);
WriteToJobLog( 'ERROR: No results found in UPSSARSPK' + NewLine );
exsr cleanup;
return;
endif;
dow not %Eof(UPSSARSPK);
WriteToJobLog( 'Result Record: ' + NewLine );
WriteToJobLog( 'UID: ' + %Char(SARSPK.UID) + NewLine );
WriteToJobLog( 'TRACKNBR: ' + %Trim(SARSPK.TRACKNBR) + NewLine );
WriteToJobLog( 'LBLFMT: ' + %Trim(SARSPK.LBLFMT) + NewLine );
WriteToJobLog( 'LBLPATH: ' + %Trim(SARSPK.LBLIMG) + NewLine );
WriteToJobLog( 'SVCCURCD: ' + %Trim(SARSPK.SVCCURCD) + NewLine );
WriteToJobLog( 'SVCCHRG: ' + %Char(SARSPK.SVCCHRG) + NewLine );
WriteToJobLog( '==========' + NewLine );
reade UniqueID UPSSARSPK.RUPSSARSPK SARSPK;
enddo;
endif;
exsr cleanup;
return;
begsr cleanup;
// Always call UPS_cleanup() any time your program will terminate
UPS_cleanup();
*INLR = *ON;
endsr;
/END-FREE
Data Structures
|
|
|
Error code raised by subprocedure |
|
Severity of error - will be either UPS_SEVERE or UPS_INFO |
|
Name of subprocedure that raised the error |
|
Error message text |
Input Table Files
|
Record Shipment Confirmation Request Record |
|
Key Record Unique ID |
|
UPS User ID |
|
UPS Account Number |
|
Shipment Description |
|
Ship to Company Name |
|
Ship to Attn. Name |
|
Ship to Tax ID Number |
|
Ship to Phone Number |
|
Ship to Fax Number |
|
Ship to Email Address |
|
Ship to Address Line 1 |
|
Ship to Address Line 2 |
|
Ship to Address Line 3 |
|
Ship to City |
|
Ship to State |
|
Ship to Postal Code/Zip |
|
Ship to Country |
|
Ship to Residential Address Indicator Valid Values:
|
|
Ship From Company Name |
|
Ship From Attn. Name |
|
Ship From Tax ID Number |
|
Ship From Phone Number |
|
Ship From Fax Number |
|
Ship From Email Address |
|
Ship From Address Line 1 |
|
Ship From Address Line 2 |
|
Ship From Address Line 3 |
|
Ship From City |
|
Ship From State |
|
Ship From Postal Code/Zip |
|
Ship From Country |
|
Validate Address |
|
Billing Type |
|
Billing Account Number |
|
Billing Postal Code/Zip |
|
Billing Country |
|
Return Service Code |
|
Documents Only Indicator Valid Values:
|
|
Goods Not Free Circ. Indicator Valid Values:
|
|
Negotiated Rate Indicator Valid Values:
|
|
Movement Reference Number |
|
Reference Number 1 Barcode Valid Values:
|
|
Reference Number 1 Code |
|
Reference Number 1 Value |
|
Reference Number 2 Barcode Valid Values:
|
|
Reference Number 2 Code |
|
Reference Number 2 Value |
|
UPS Service Code |
|
Invoice Line Total Currency Code |
|
Invoice Line Total Value |
|
Request Saturday Delivery Indicator Valid Values:
|
|
Remove Invoice Indicator Valid Values:
|
|
Carbon Neutral Indicator Valid Values:
|
|
Delivery Confirmation Code |
|
Ship Label Format Code |
|
Full (I) or Partial (P) Invoice Valid Values:
|
|
SED Form Indicator Valid Values:
|
|
CO Form Indicator Valid Values:
|
|
NCO Form Indicator Valid Values:
|
|
Record Shipment Confirmation Response Record |
|
Key Record Unique ID |
|
Transportation Currency Code |
|
Transportation Charge |
|
Service Currency Code |
|
Service Charge |
|
Total Currency Code |
|
Total Charge |
|
Shipment Weight Code |
|
Shipment Weight |
|
Shipment ID NUmber |
|
Negotiated Currency Code |
|
Negotiated Total Charges |
|
IFS Path to Digest |
Output Table Files
|
Record Shipment Accept Response Record |
|
Key Record Unique ID |
|
Transportation Currency Code |
|
Transportation Charge |
|
Service Currency Code |
|
Service Charge |
|
Total Currency Code |
|
Total Charge |
|
Negotiated Currency Code |
|
Negotiated Total Charges |
|
Shipment Weight Code |
|
Shipment Weight |
|
Shipment ID Number |
|
High Value Image Path |
|
High Value Image Format |
|
International Form Image Path |
|
Internation Form Image Format |
|
COD Form Image Path |
|
COD Form Image Format |
|
Record Shipment Accept Response Record |
|
Key Parent Unique ID |
|
Key Child Unique ID |
|
Package Tracking Number |
|
Service Options Currency Code |
|
Service Charge Cost |
|
Label Image Path |
|
Label Image Format |
|
HTML Path |
|
Non-Machineable Charges Currency Code |
|
Non-Machineable Charges Monetary Value |
|
SurePost® DAS Charges Currency Code |
|
SurePost® DAS Charges Monetary Value |