In a large sauce pan, saut, the onions in a little margarine until lightly browned. Add the bacon, beans, sugar, mustard and Bbq sauce and heat through. Place in a casserole dish and 350 degrees for one hour, or until bubbly around the edges. Serve immediately.