Never tried it tbh. If it doesn't work via tables, you can just do it procedural.
Check STRG_ITEM_MOVE... Or the ones for buying/selling shit to/from NPC... Don't remember the name.
Inside the selling IF statement check for RefitemID. Then just run the proc to find the first free slot. If exists... add to inventory. Else, return an ERROR integer which won't let the char sell the item to the NPC. For the error, change the clientsided (textuisys) msg to something more descriptive for your case.
Done.