Hi Manish,
my client also creating the POs automatically for sales orders, we have a custom program for this.
could you Please explain your requirement a bit clear?
Please check the below points:
suppose in your PO you have a vendor, material, plant,delivery date
-->for automatic creating STO you should have supp plant and receiving plant and the custom program needs these information to create STOs