Hello,
AI generation with ammendments:
The error means BC is trying to read Location Code = '' (blank) during invoicing.
It’s not the SKU itself – it’s a posting step where Location is empty, so Location.GET('') fails.
Because Receive+Invoice works but Invoice-only fails, the usual suspects are:
---
1. A blank Location somewhere in the chain
Check all of these on the problem order:
1. Purchase Header
Fields: Location Code / Shortcut Location Code
If Inventory Setup → Location Mandatory = TRUE, header or line must have a non-blank Location.
2. Purchase Lines
Make sure every item line still has Location Code filled when you try “Post → Invoice”.
Sometimes users:
Receive the order
Then later clear/change the Location on the line or header
Invoice → error appears because some logic now sees Location = ''.
3. Posted Purchase Receipt
Open the related Posted Purchase Receipt from the order (Line → Navigate / Receipts).
Check that the Location Code on the receipt lines is populated and matches the current Location on the PO lines.
If any line/receipt has Location = '', that’s exactly what triggers “Location does not exist. Code=''”.
---
2. SKU vs Location mismatch
Since it’s a SKU item:
Make sure you actually use the Location Code of the SKU on the Purchase Line.
BC doesn’t magically pull Location from the SKU if the line Location is empty.
If Location Mandatory is on and a SKU exists for that item, but your line Location is blank:
Receive+Invoice might still work (because it uses the line state at that moment)
Separate invoice later hits code that checks Location and fails if it’s blank.
---
3. Item Charges / Extra lines
Check if the PO has:
Item Charge lines or
Non-Inventory / G/L lines
Sometimes those lines inherit a blank Location Code. When invoicing only, BC still runs Location-related code (depending on your setup / extensions), and the blank Location on one of these lines can trigger the error even though the main item line looks fine.
---
What I would do step-by-step
On the same PO where you see the error:
1. Make sure all lines (including Item Charges) have Location Code filled.
2. Make sure the Purchase Header Location Code is not blank if you rely on header → line defaults.
3. Open the linked Posted Purchase Receipt and confirm Location Code is populated.
4. Try posting Invoice again.
If it still fails after verifying all of that, it’s likely custom code or an extension around SKUs/locations. In that case, I’d next:
Temporarily turn off extensions that touch locations/SKUs (if possible in a sandbox) and test.
Or use the debugger on the purchase posting to see exactly which table/field is passing Code=''.
Regards,
AI generated