How to get Top level RefId in planned orders

Hi

I am working on Ax 2012 , Ihave planned order form as below, I need to add one more field called sales Id .

when I open planned order (Master Planning–>Common–>Planned Order) it is opening below form and it has pegging tab as shown below,in that there is field called Refid…

Please suggest how to find how many records are there pegging tab …some times it can be one and some times it is more than one…so I want find out how many records (refid’s) are there in pegging and what are they refid…

Now I want show that top level refId in the Master planning–>Common–>Planned orders -->PeggingId (custom field) through the job…

I don’t have any Idea on this module master planning…please any body suggest.