Dear All,
Thank you for your all valuable reply.
The above requirement has been completed.
I have considered, the respective material document number has been given in the sales order and the other calculation as per requirement has been done by routine.
Used the material id as primary key to compare the material document number to compare the
sales order (Material ID).