Hello Chetan,
This is clearly related to setup change in vendor posting profile form.
I have checked the scenario you explained and found no challenge in system. So after posting the PO invoice; if I apply the prepayment in the same invoiced PO from the "All vendors" form; I am getting the impact in the same main account set for vendor control as well as in prepayment account.
Below highlighted entry I have got after applying the prepayment from "All vendors" form after this PO was fully invoiced.

Now I have below queries to you.
--- Have you got this mismatch in the same vendor ?
For example; every time transactions are posted in the correct vendor controlling account (say; 1001) for the vendor (say; vendor account is V001) but then one or two times, the entry is posted in a different vendor controlling account (say; 1002) while using the same vendor account V001.
If the answer is 'Yes', then you can be sure that somebody is playing with the vendor posting profile setup.
--- You mentioned that, "some of these prepayment transaction not getting posted to AP control account ". Then in which account it is posted ? Is it posted in another vendor controlling account ? For example; instead of posting in account 1001, it is posted in account 1002.
--- Have you set the purchase order prepayment account in the inventory posting profile setup form ?
--- When you book the prepayment in PO, what is the journal entry you are getting ?
Appreciate if you kindly elaborate these points which could be helpful to understand the entire scenario in more specific.
Best regards,
Sourav Dam
Kindly mark this thread 'Yes' if this is answered your query which may help other community members in this forum.