Instead of typing [gallery ids="122,123,124"] in the content of a page. I want to call the same functionality from the PHP code in a template file.
do_shortcode is your friend.http://codex.wordpress.org/Function_Reference/do_shortcode
easy as this one:
<?php echo do_shortcode('[gallery ids="122,123,124"]')'?>
I will worry about the id's though..