Yes, you can do that provided that your 401(k) plan allows such a rollover - not all do. Also note that if the IRA contains any after-tax money, that cannot be rolled into a 401(k) - only before-tax money can. That should be done as a trustee-to-trustee transfer between the IRA trustee and the 401(k) trustee. Be sure to keep all records because the IRS often questions IRA to 401(k) rollovers because the 401(k) plan does not report receipt of the rollover to the IRS and they often ask you for proof that the rollover actually took place.
As far as prorating any after-tax basis, the years beginning balance makes no difference, it is only prorated over any taxable distribution and the years ending total IRA value - if that value is zero then there is nothing to prorate.