This might be a bit of a historical question in nature.
Obviously given that we know the constant G, the mass of the sun, and the distance between a solar body and the sun we can calculate it's mass. Ditto if one of the other variables are missing.
What I don't understand however is how we managed to find the initial variables that we used to calculate all other variables? E.g. how did we find the distance between the Earth and sun and the sun's mass?
Sorry if the question is more historical than physical, but I couldn't find a place that describes how we arrived at our current knowledge.