You can check the RecreatePurchLines function in the Purchase Header table. This should give an idea about how the lines are updated when something changes in the header.
Sir i have one custamization where i need this thing because type field editable false for user and what ever they select on header only that will look in line