Hi Shaik,
You can achieve the above requirement using configuration settings itself.
You have to configuration the partner function in partner determination procedure.
SPRO->CRM->Basic functions->Partner processing->partner determination procedure->choose your partner procedure and then select partner function ship to party and add changes as shown below screen shot.
Best Regards,
Dharmakasi.