Try investigate function SO_DOCUMENT_READ_API1 and its documentation.
It returns document_data-size and binary content among others... But there is also parameter FILTER and in it NO_CONTENT:
Default = ' '.
If this flag is set ('X'), the contents (table OBJECT_CONTENT), the
specific header data (table OBJECT_HEADER) and the processing
parameters (table OBJECT_PARA and OBJECT_PARB) of the document are
also read.
Not sure if it will return document_data-size with this FILTER NO_CONTENT set... but maybe you can find some usefull code inside this function.