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

D UPS_shipAccept  PR              N

Returns *OFF if an error occurs during processing, *ON otherwise.

D  pUniqueID                    15P 0

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.

D  pErrorDS                           LikeDS(UPS_Error)

The data structure in which error information will be returned.

Example Code


*------------------------------------------------------------------------ * @Author: Krengel Technology * @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(*CALLER) 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 = 444; // 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

D UPS_Error       DS                  Qualified Inz
 
D  Code                         10A

Error code raised by subprocedure

D  Severity                     10I 0

Severity of error - will be either UPS_SEVERE or UPS_INFO

D  Pgm                          30A   Varying

Name of subprocedure that raised the error

D  Text                      32000A   Varying

Error message text

Input Table Files

A          R RUPSSCRQ

Record

Shipment Confirmation Request Record

A            UID           15P 0

Key

Record Unique ID

A            USERID        30A

UPS User ID

A            ACCTNBR       10A

UPS Account Number

A            SHIPDESC      35A

Shipment Description

A            STCONAME      35A

Ship to Company Name

A            STATNAME      35A

Ship to Attn. Name

A            STTAXID       15A

Ship to Tax ID Number

A            STPHONE       15A

Ship to Phone Number

A            STFAX         15A

Ship to Fax Number

A            STEMAIL       50A

Ship to Email Address

A            STADDR1       35A

Ship to Address Line 1

A            STADDR2       35A

Ship to Address Line 2

A            STADDR3       35A

Ship to Address Line 3

A            STCITY        40A

Ship to City

A            STSTATE        5A

Ship to State

A            STPOSTCD      16A

Ship to Postal Code/Zip

A            STCNTRY        2A

Ship to Country

A            STRESDNT       1A

Ship to Residential Address Indicator

Valid Values:

  • T
  • Y

A            SFCONAME      35A

Ship From Company Name

A            SFATNAME      35A

Ship From Attn. Name

A            SFTAXID       15A

Ship From Tax ID Number

A            SFPHONE       15A

Ship From Phone Number

A            SFFAX         15A

Ship From Fax Number

A            SFEMAIL       50A

Ship From Email Address

A            SFADDR1       35A

Ship From Address Line 1

A            SFADDR2       35A

Ship From Address Line 2

A            SFADDR3       35A

Ship From Address Line 3

A            SFCITY        40A

Ship From City

A            SFSTATE        5A

Ship From State

A            SFPOSTCD      16A

Ship From Postal Code/Zip

A            SFCNTRY        2A

Ship From Country

A            VALIDATE       1A

Validate Address

A            BILLTYPE       3A

Billing Type

A            BACCTNBR      10A

Billing Account Number

A            BPOSTCD       16A

Billing Postal Code/Zip

A            BCNTRY         2A

Billing Country

A            RETURNCD       1A

Return Service Code

A            DOCONLY        1A

Documents Only Indicator

Valid Values:

  • T
  • Y

A            GNIFC          1A

Goods Not Free Circ. Indicator

Valid Values:

  • T
  • Y

A            NEGRATE        1A

Negotiated Rate Indicator

Valid Values:

  • T
  • Y

A            MVREFNBR      18A

Movement Reference Number

A            RF1BC          1A

Reference Number 1 Barcode

Valid Values:

  • T
  • Y

A            RF1CD          2A

Reference Number 1 Code

A            RF1VALUE      35A

Reference Number 1 Value

A            RF2BC          1A

Reference Number 2 Barcode

Valid Values:

  • T
  • Y

A            RF2CD          2A

Reference Number 2 Code

A            RF2VALUE      35A

Reference Number 2 Value

A            SVCCD          4A

UPS Service Code

A            LINCURCD       3A

Invoice Line Total Currency Code

A            LINVALUE       8P 0

Invoice Line Total Value

A            SATDLVR        1A

Request Saturday Delivery Indicator

Valid Values:

  • T
  • Y

A            INVRMV         1A

Remove Invoice Indicator

Valid Values:

  • T
  • Y

A            CNEUTRAL       1A

Carbon Neutral Indicator

Valid Values:

  • T
  • Y

A            DELCNFCD       1A

Delivery Confirmation Code

A            LBLFMTCD       6A

Ship Label Format Code

A            INVFORM        1A

Full (I) or Partial (P) Invoice

Valid Values:

  • I
  • P

A            SEDFORM        1A

SED Form Indicator

Valid Values:

  • T
  • Y

A            COFORM         1A

CO Form Indicator

Valid Values:

  • T
  • Y

A            NCOFORM        1A

NCO Form Indicator

Valid Values:

  • T
  • Y

A          R RUPSSCRS

Record

Shipment Confirmation Response Record

A            UID           15P 0

Key

Record Unique ID

A            TRSCURCD       3A

Transportation Currency Code

A            TRSCHRG       15P 2

Transportation Charge

A            SVCCURCD       3A

Service Currency Code

A            SVCCHRG       15P 2

Service Charge

A            TOTCURCD       3A

Total Currency Code

A            TOTCHRG       15P 2

Total Charge

A            WGTCD          3A

Shipment Weight Code

A            TOTWGT         8P 2

Shipment Weight

A            SHIPNBR       21A

Shipment ID NUmber

A            NEGCURCD       3A

Negotiated Currency Code

A            NEGCHRG       15P 2

Negotiated Total Charges

A            DIGEST       256A

IFS Path to Digest

Output Table Files

A          R RUPSSARS

Record

Shipment Accept Response Record

A            UID           15P 0

Key

Record Unique ID

A            TRSCURCD       3A

Transportation Currency Code

A            TRSCHRG       15P 2

Transportation Charge

A            SVCCURCD       3A

Service Currency Code

A            SVCCHRG       15P 2

Service Charge

A            TOTCURCD       3A

Total Currency Code

A            TOTCHRG       15P 2

Total Charge

A            NEGCURCD       3A

Negotiated Currency Code

A            NEGCHRG       15P 2

Negotiated Total Charges

A            WGTCD          3A

Shipment Weight Code

A            TOTWGT         8P 2

Shipment Weight

A            SHIPNBR       21A

Shipment ID Number

A            HVALIMG      256A

High Value Image Path

A            HVALFMT        6A

High Value Image Format

A            FORMIMG      256A

International Form Image Path

A            FORMFMT        6A

Internation Form Image Format

A            CODIMG       256A

COD Form Image Path

A            CODFMT         6A

COD Form Image Format

A          R RUPSSARSPK

Record

Shipment Accept Response Record

A            PID           15P 0

Key

Parent Unique ID

A            UID           15P 0

Key

Child Unique ID

A            TRACKNBR      21A

Package Tracking Number

A            SVCCURCD       3A

Service Options Currency Code

A            SVCCHRG       15P 2

Service Charge Cost

A            LBLIMG       256A

Label Image Path

A            LBLFMT         6A

Label Image Format

A            HTML         256A

HTML Path