GetShipmentDocuments Method
Generates a shipping label using one of domestic UPS services.
Syntax
upsfreightship.getShipmentDocuments([callback])
Callback
The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).
The callback for this method is defined as:
function(err){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'err' has 2 properties which hold detailed information:
err.code err.message
Remarks
The following properties must be set before calling this method:
- UPSServer (required)
- UPSAccessKey (required)
- UPSPassword (required)
- UPSUserId (required)
- UPSAccountNumber (required)
- SenderContact (required)
- SenderAddress (required)
- RecipientContact (required)
- RecipientAddress (required)
- DocumentFileName
- DocumentLabelsPerPage
- DocumentPrintFormat
- DocumentPrintSize
- DocumentType (required)
- CommodityDescription (required)
- CommodityFreightClass (required for ground shipments)
- CommodityFreightIsHazardous
- CommodityFreightNMFC
- CommodityFreightNMFCSub
- CommodityNumberOfPieces (required)
- CommodityFreightPackagingType (required)
- CommodityValue (required)
- CommodityWeight (required)
- WeightUnit (required; defaults to LBS)
Upon successful response, the following properties will be populated:
The documents will be written to the filenames set in DocumentFileName.Code example:
component.UPSAccount.Server = "https://wwwcie.ups.com/webservices/FreightShip" component.UPSAccount.AccessKey = "Your Access Key" component.UPSAccount.UserId = "User Id" component.UPSAccount.Password = "Password" component.UPSAccount.AccountNumber = "000000" component.SenderCompany = "Developer Test 1" component.SenderPhone = "884530171" component.SenderAddress1 = "101 Developer Way" component.SenderCity = "Richmond" component.SenderState = "VA" component.SenderZipCode = "23224" component.SenderCountryCode = "US" component.RecipientCompany = "Consignee Test 1" component.RecipientAddress1 = "1000 Consignee Street" component.RecipientCity = "Allanton" component.RecipientState = "MO" component.RecipientZipCode = "63001" component.RecipientCountryCode = "US" component.PayorType = ptSender component.HandlingUnit = "SKD:1" component.CommodityCount = 1 component.CommodityDescription(0) = "LCD TVS" component.CommodityFreightClass(0) = "77.5" component.CommodityWeight(0) = "150" component.CommodityFreightNMFC(0) = "132680" component.CommodityFreightNMFCSub(0) = "02" component.CommodityNumberOfPieces(0) = 20 component.CommodityValue(0) = "100" component.DocumentCount = 1 component.DocumentPrintFormat = fpfLaser component.DocumentPrintSize = fpsSize8X11 component.DocumentType = ftcLabel component.DocumentFileName = "TestLabel.pdf" component.GetShipmentDocuments Debug.Print ("Total Charge: " & component.TotalCharge) Dim i As Integer For i = 0 To component.ChargeCount - 1 Debug.Print component.ChargeType(0) & ": " & component.ChargeValue(0) Next i Debug.Print ("Billable Weight: " & component.BillableWeight) Debug.Print ("BOLID: " & component.BOLID) Debug.Print ("Shipment Number: " & component.ShipmentNumber)