Opening a Sales Order and shipping less than the original quantity such as below will leave an Outstanding Quantity value on the warehouse document (this includes Shipments and Picks where used). 

Leaving this document as it is, go back to the "Sales Order" and Post the Invoice. In this example, my Quantity field remains as 5 but my Quantity Invoiced would be 3. 

From the menu ribbon on the "Sales Order" screen, select Actions and then 'Cancel Back order' which will bring up a confirmation message. 

Clicking 'No' here will close the message and keep the current values as is. Selecting 'Yes' will close down any Warehouse document that has a Quantity Outstanding for this "Sales Order" and will replace the value in the Quantity field on the Sales Lines to the value that was invoiced. The example below now shows the updated value on the line.