Does the error message give you the table?
Does the CardCode / ItemCode / posting period you are using exist in the database?
Under Administration>General Settings>Inventory Tab are you managing serial numbers on every transaction, or On Release Only?