How to write code that covers all companies

hi guys,

what is the code to effect all companies?

requirement:

set allowed posting from, allowed posting date to to beginning of the month when i run a particular company.

i have 10 companies, but i would like to run the codeunit once to update date of allowed posting from/to.

http://mohana-dynamicsnav.blogspot.in/2013/02/how-to-updatemodify-data-in-all.html