Hi Gopinathan,
How are you creating the Clearing document? Are your creating it manually??
Try putting value * in the field while creating the document. SAP will internally populate the Ref document # in the field if you pass "*" in the field.
- Harshad