How do you sum up a field in 4GL code?

I am looking for an example to TOTAL PartWhse.OnHandQty based on a PartNum. The reason is that we have multiple warehouses per part. So basically I want to know the OnHandQty per Plant. Does anyone have some examples for this?

Dan