Yes, just make sure they are thoroughly dried. Last time I did this I left them on the plants until the pods started to go crispy, then picked the pods and moved them to the greenhouse in trays. Some people hang them up and put something underneath to collect the beans.
Don't shell them - the pods will open naturally as they dry, and eventually shed their beans.
Once they are thoroughly dried store in a jar or other airtight container. Soak for 12 hours and boil for 10 minutes before cooking with them. You can also sow them again next year provided you're not using an F1 variety.
HTH.