Preview:
public class NW_ContractRenewalServiceEntity extends common
{
    /// <summary>
    ///
    /// </summary>
    public void postLoad()
    {
        DocuRef     DocuRef;
        DocuValue   DocuValue;
        NW_ContractRequest NW_ContractRequest;
        super();
        changecompany('SHC')
        {
            select DocuRef
                where DocuRef.RefRecId == this.ContractRecId
                && DocuRef.RefTableId == tableNum(NW_ContractRenewalRequest);

            //select DocuValue where DocuValue.RecId == DocuRef.ValueRecId;
            if(DocuRef)
            {
                //DocuRef docuref;
                //ITSGetFileFromDocMgmtInVariousFormats runnable = ITSGetFileFromDocMgmtInVariousFormats::construct();
                //runnable.readfromDocuRefAttachments(docuref);
                //BitMap fileContents =  DocumentManagement::getAttachmentAsContainer(DocuRef);
                //str fileBase64Str = con2base64str(fileContents);
                BinData BinData;
                using(System.IO.Stream fileStream = DocumentManagement::getAttachmentStream(DocuRef))
                {
                    using(System.IO.MemoryStream memoryStream = new System.IO.MemoryStream())
                    {
                        fileStream.CopyTo(memoryStream);
                        this.Attach = System.Convert::ToBase64String(memoryStream.ToArray());
                    }
                }
              // or use this.Attach = DocuRef.getFileContentAsBase64String() insted of the above code from "ElectronicReporting" model
                this.FileName = DocuRef.filename();
                this.FileType = DocuRef.fileType();
            }
        }
    }

}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter