System.IO.Stream    stream;
    TextStreamIo        io;
    container           conFileDataLine;
Table1          table1 = Table1::find('value');
    Table2                table2;
    Microsoft.Dynamics.AX.Framework.FileManagement.IDocumentStorageProvider storageProvider;
    DocuRef docuRef = DocuRef::findTableIdRecId(table1.DataAreaId, table1.TableId, table1.RecId);

    DocuValue   docuValue = docuRef.docuValue();

    if (docuValue)
    {
      storageProvider = Docu::GetStorageProvider(docuRef.docuType(), false);
        Microsoft.Dynamics.AX.Framework.FileManagement.DocumentLocation location = docuValue.createLocation();            
        Microsoft.Dynamics.AX.Framework.FileManagement.DocumentContents docContents = storageProvider.GetFile(location);

    io = TextStreamIo::constructForRead(docContents.Content);
    }

    if (io)
    {
        if (io.status() == IO_Status::ErrorOpen)
        {
            throw error("@SYS19358");
        } 

        io.inFieldDelimiter('\t');
        io.inRecordDelimiter('\r\n');

        ttsbegin;
        while (io.status() == IO_Status::Ok)
        {
            conFileDataLine = io.read();
            table2.Field1 = conPeek(conFileDataLine, 1);
    table2.Field2 = conPeek(conFileDataLine, 2);
    table2.Field3 = conPeek(conFileDataLine, 3);
    table2.Field4 = conPeek(conFileDataLine, 4);
    table2.Field5 = conPeek(conFileDataLine, 5);    

    table2.insert();            
        }

        ttscommit;