Attach custom .p program to menu

I am creating a program that prompts for a start and end date. It then retrieves all orders that are within the user entered range and dumps the results to a .csv file.

Question is if I compile this into a .r file. How can I attach it to a menu and have it still prompt the user for the required criteria. What would I need to revise on this program in order to do this and how to attach to menu? We are running Vantage 6.1 THANKS.

**************************
define variable varstartdate as date label "Start Order Date" no-undo.
define variable varenddate as date label "End Due Date" no-undo.

repeat:
update varstartdate
varenddate.
leave.

end.
output to v:\a\out.csv.
export delimiter "," "OrderNum" "CustNum" "PONum" "OrderDate".
for each orderhed where orderhed.company = "DD-1" and
orderhed.orderdate >= varstartdate and
orderhed.orderdate <= varenddate no-lock:
export delimiter ","
orderhed.ordernum
orderhed.custnum
orderhed.ponum
orderhed.orderdate.
end.
output close.