UPS_ShipConfirm()

This subprocedure calls the UPS Ship Confirm API. It reads request data from UPSSCRQ and package information from UPSSCRQPK. For international shipments, additional request information is read from UPSSCRQFM and UPSSCRQPD. Response data is written to UPSSCRS.

Subprocedure Prototype

D UPS_shipConfirm...
D                 PR              N

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

D  pUniqueID                    15P 0

The ID of the records in UPSSCRQ and other input tables that will be used to build the request, and under which the response data will be saved in UPSSCRS.

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_shipConfirm() subprocedure to create a shipment. * * To achieve this, generate a unique ID with UPS_getUID(), and * then populate and write a record to UPSSCRQ, and one or more child * records to UPSSCRQPK. Additional records may also be needed in * UPSSCRQFM and UPSSCRQPD if international shipping is being performed. * Then, call UPS_shipConfirm() passing in your unique ID as well * as the other parameters shown. * * UPS_shipConfirm() 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 perform a CHAIN against the UPSSCRS physical * file, and retrieve the result fields. *------------------------------------------------------------------------ H DFTACTGRP(*NO) ACTGRP(*CALLER) BNDDIR('UPSBND') OPTION(*NODEBUGIO) FUPSSCRQ UF A E K DISK Qualified FUPSSCRQPK UF A E K DISK Qualified // These two files are unused in this example and by most UPSTI users. F*UPSSCRQFMUF A E K DISK Qualified F*UPSSCRQPDUF A E K DISK Qualified FUPSSCRS 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 SCRQ DS Likerec(UPSSCRQ.RUPSSCRQ:*Output) D SCRQPK DS Likerec(UPSSCRQPK.RUPSSCRQPK:*Output) D SCRS DS Likerec(UPSSCRS.RUPSSCRS:*Input) D ErrorDS DS LikeDS(UPS_ErrorDS_t) Inz(*LikeDS) D UniqueID S Like(UPS_UniqueID_t) /FREE reset ErrorDS; // Retrieve Unique ID used to identify this request UniqueID = UPS_getUID(); clear SCRQ; SCRQ.UID = UniqueID; // Populate this field with UPS user ID that is present in UPSACCT SCRQ.UserID = 'ataylorkt'; SCRQ.AcctNbr = '0704W7'; SCRQ.StCoName = 'Krengel Technology'; SCRQ.StAddr1 = '600 Shady Ridge Road NW'; SCRQ.StCity = 'Hutchinson'; SCRQ.StState = 'MN'; SCRQ.StPostCd = '55350'; SCRQ.StCntry = 'US'; SCRQ.SfCoName = 'Krengel Technology'; SCRQ.SfAddr1 = '124 E WALNUT ST'; SCRQ.SfAddr2 = 'STE 310'; SCRQ.SfCity = 'Mankato'; SCRQ.SfState = 'MN'; SCRQ.SfPostCd = '56001'; SCRQ.SfCntry = 'US'; SCRQ.SvcCd = '03'; SCRQ.LblFmtCd = 'ZPL'; SCRQ.BillType = 'PBS'; SCRQ.BAcctNbr = '0704W7'; // Other fields are available but not used in this example code write UPSSCRQ.RUPSSCRQ SCRQ; // Write individual package child record to UPSSCRQPK clear SCRQPK; SCRQPK.PID = UniqueID; SCRQPK.UID = 1; SCRQPK.PkgCd = '02'; SCRQPK.DimCd = 'IN'; SCRQPK.Length = 6.5; SCRQPK.Width = 10; SCRQPK.Height = 4; SCRQPK.WgtCd = 'LBS'; SCRQPK.PkgWgt = 5; write UPSSCRQPK.RUPSSCRQPK SCRQPK; // If UPS_shipConfirm() returns *Off, an error occurred and // UPS_ErrorDS should be reviewed to determine the cause. if not UPS_shipConfirm( 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 UPSSCRS. There is only going to be one record chain UniqueID UPSSCRS.RUPSSCRS SCRS; if not %Found(UPSSCRS); WriteToJobLog( 'ERROR: No results found in UPSSCRS' + NewLine ); exsr cleanup; return; endif; WriteToJobLog( 'Result Record: ' + NewLine ); WriteToJobLog( 'UID: ' + %Char(SCRS.UID) + NewLine ); WriteToJobLog( 'SHIPNBR: ' + %Trim(SCRS.SHIPNBR) + NewLine ); WriteToJobLog( 'WGTCD: ' + %Trim(SCRS.WGTCD) + NewLine ); WriteToJobLog( 'TOTWGT: ' + %Char(SCRS.TOTWGT) + NewLine ); WriteToJobLog( 'TRSCURCD: ' + %Trim(SCRS.TRSCURCD) + NewLine ); WriteToJobLog( 'TRSCHRG: ' + %Char(SCRS.TRSCHRG) + NewLine ); WriteToJobLog( 'SVCCURCD: ' + %Trim(SCRS.SVCCURCD) + NewLine ); WriteToJobLog( 'SVCCHRG: ' + %Char(SCRS.SVCCHRG) + NewLine ); WriteToJobLog( 'TOTCURCD: ' + %Trim(SCRS.TOTCURCD) + NewLine ); WriteToJobLog( 'TOTCHRG: ' + %Char(SCRS.TOTCHRG) + NewLine ); WriteToJobLog( 'NEGCURCD: ' + %Trim(SCRS.NEGCURCD) + NewLine ); WriteToJobLog( 'NEGCHRG: ' + %Char(SCRS.NEGCHRG) + NewLine ); // After this you'd generally move onto calling UPS_shipAccept with // the same UniqueID - refer to example T_SA. 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 RUPSSCRQFM

Record

Shipment Confirm Forms Request

A            UID           15P 0

Key

Record Unique Id

A            SOOPTION       2A

Sold To Option

A            SOCONAME      35A

Sold To Company Name

A            SOATNAME      35A

Sold to Affn. Name

A            SOTAXID       15A

Sold to Tax ID Number

A            SOPHONE       15A

Sold To Phone Number

A            SOADDR1       35A

Sold to Address Line 1

A            SOADDR2       35A

Sold to Address Line 2

A            SOADDR3       35A

Sold to Address Line 3

A            SOCITY        40A

Sold to City

A            SOSTATE        5A

Sold to State

A            SOPOSTCD      16A

Sold to Postal Code/Zip

A            SOCNTRY        2A

Sold to Country

A            FWCONAME      35A

Forward Company Name

A            FWTAXID       15A

Forward Tax ID Number

A            FWADDR1       35A

Forward Address Line 1

A            FWADDR2       35A

Forward Address Line 2

A            FWADDR3       35A

Forward Address Line 3

A            FWCITY        40A

Forward City

A            FWSTATE        5A

Forward State

A            FWPOSTCD      16A

Forward Postal Code/Zip

A            FWCNTRY        2A

Foward Country

A            UCCONAME      35A

Ultimate Consignee Company Name

A            UCADDR1       35A

Ultimate Consignee Address Line 1

A            UCADDR2       35A

Ultimate Consignee Address Line 2

A            UCADDR3       35A

Ultimate Consignee Address Line 3

A            UCCITY        40A

Ultimate Consignee City

A            UCSTATE        5A

Ultimate Consignee State

A            UCPOSTCD      16A

Ultimate Consignee Postal Code/Zip

A            UCCNTRY        2A

Ultimate Consignee Country

A            ICCONAME      35A

Intermediate Consignee Company Name

A            ICADDR1       35A

Intermediate Consignee Address Line 1

A            ICADDR2       35A

Intermediate Consignee Address Line 2

A            ICADDR3       35A

Intermediate Consignee Address Line 3

A            ICCITY        40A

Intermediate Consignee City

A            ICSTATE        5A

Intermediate Consignee State

A            ICPOSTCD      16A

Intermediate Consignee Postal Code/Zip

A            ICCNTRY        2A

Intermediate Consignee Country

A            PDOPTION       2A

Producer Option

A            PDCONAME      35A

Producer Company Name

A            PDTAXID       15A

Producer Tax ID Number

A            PDADDR1       35A

Producer Address Line 1

A            PDADDR2       35A

Producer Address Line 2

A            PDADDR3       35A

Producer Address Line 3

A            PDCITY        40A

Producer City

A            PDSTATE        5A

Producer State

A            PDPOSTCD      16A

Producer Postal Code/Zip

A            PDCNTRY        2A

Producer Country

A            INVNBR        35A

Invoice Number

A            INVDT           L

Invoice Date

A            PONBR         35A

Purchase Order Number

A            TERMSCD        3A

Terms of Shipment Code

A            EXRSNCD       20A

Reason for Export Code

A            COMMENTS     150A

Shipment Comments

A            DECSTMNT     250A

Declaration Statement

A            DISCOUNT      15P 2

Discount Amount

A            FRGTCHRG      15P 2

Freight Charges

A            INSCHRG       15P 2

Insurance Charges

A            OTHRCHRG      15P 2

Other Charges

A            OTHRDESC      10A

Other Charges Description

A            CURCD          3A

Currency Code

A            BLNKBEG         L

Blanket Period Begin Date

A            BLNKEND         L

Blanket Period End Date

A            EXPORTDT        L

Export Date

A            EXPCARR       35A

Exporting Carrier

A            CARRIER       17A

Carrier ID

A            INBONDCD       2A

In Bond Code

A            ENTRYNBR      25A

Import Entry Number

A            PNTORGN        5A

Point of Origin

A            MODTRSCD      35A

Mode of Transport Code

A            PRTEXP        35A

Port of Export

A            PRTUNLOAD     35A

Port of Unloading

A            LOADPIER      35A

Loading Pier

A            PTYTOTRS       1A

Parties to Transaction

A            RTEXPTRS       1A

Routed Export Indicator

Valid Values:

  • T
  • Y

A            CNTNRIZD       1A

Containerized Indicator

Valid Values:

  • T
  • Y

A            LICNBR        35A

License Number

A            LICDT           L

License Date

A            LICEXCCD       4A

License Exception Code

A            ECCNNBR        8A

ECCN Number

A          R RUPSSCRQPD

Record

Shipment Confirm Products Request Record

A            PID           15P 0

Key

Parent Unique ID

A            UID           15P 0

Key

Child Unique ID

A            DESC1         35A

Product Description 1

A            DESC2         35A

Product Description 2

A            DESC3         35A

Product Description 3

A            QTY            7P 0

Product Quantity

A            VALUE         12P 6

Product Value

A            UNITCD         3A

Unit Code

A            CMDTYCD       15A

Commodity Code

A            PARTNBR       10A

Part Number

A            ORGCNTRY       2A

Origin Country Code

A            JNTPROD        1A

Joint Production Indicator

Valid Values:

  • T
  • Y

A            NETCSTCD       1A

Net Cost Code

A            NETBEGDT        L

Net Cost Being Date

A            NETENDDT        L

Net Cost End Date

A            PREFCRIT       1A

Preference Criteria Code

A            PRODINFO       5A

Producer Info Code

A            MRKSNBRS      35A

Marks and Numbers

A            NBRCMDTY       3P 0

Packages Per Commodity

A            WGTCD          3A

Weight Code

A            WGT            4P 1

Product Weight

A            VEHICLID      35A

Vehicle ID

A            SCDBNBR       10A

Schedule B Number

A            SCDBQTY       10P 0

Schedule B Unit Quantity

A            SCDBCD         3A

Schedule B Unit Code

A            SCDBDESC      20A

Schedule B Unit Description

A            EXPTYPE        1A

Export Type

A            SEDVALUE      15P 2

SED Total Value

A          R RUPSSCRQPK

Record

Shipment Confirm Request Package Information Record

A            PID           15P 0

Key

Parent Unique ID

A            UID           15P 0

Key

Child Unique ID

A            PKGRTN        35A

Package Return Description

A            PKGCD          2A

Package Type Code

A            DIMCD          2A

Package Dimensions Code

A            LENGTH         6P 2

Package Length

A            WIDTH          6P 2

Package Width

A            HEIGHT         6P 2

Package Height

A            WGTCD          3A

Package Weight Code

A            PKGWGT         8P 2

Package Weight

A            LRGPKG         1A

Large Package Indicator

Valid Values:

  • T
  • Y

A            RF1BC          1A

Reference Number 1 Barcode

Valid Values:

  • T
  • Y

A            RF1CD          2A

Reference Number 1 Code

Valid Values:

  • T
  • Y

A            RF1VALUE      35A

Reference Number 1 Value

Valid Values:

  • T
  • Y

A            RF2BC          1A

Reference Number 2 Barcode

Valid Values:

  • T
  • Y

A            RF2CD          2A

Reference Number 2 Code

Valid Values:

  • T
  • Y

A            RF2VALUE      35A

Reference Number 2 Value

Valid Values:

  • T
  • Y

A            ADDLHNDL       1A

Additional Handling Req.

Valid Values:

  • T
  • Y

A            DELCNFCD       1A

Delivery Confirmation Type Code

A            DELNBR        11A

Delivery Confirmation Control Number

A            INSVALCD       3A

Insured Value Code

A            INSCURCD       3A

Insured Value Currency Code

A            INSVALUE      15P 2

Insured Value

A            CODFNDCD       1A

COD Funds Code

A            CODCURCD       3A

COD Currency Code

A            CODVALUE       8P 2

COD Value

A            VRBCNFNM      35A

Verbal Confirmation Name

A            VRBPHONE      15A

Verbal Confirmation Phone Number

A            SHIPRLS        1A

Shipper Release Indicator

Valid Values:

  • T
  • Y

Output Table Files

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