# OutStream.Write(Record [, Integer]) Method
> Version: _Available or changed with runtime version 1.0._
Writes a specified number of bytes to the stream. Data is written in binary format.
## Syntax
```al
[Written := ]  OutStream.Write(Value: Record [, Length: Integer])
```
## Parameters
OutStream
Type: outstream-data-type
An instance of the outstream-data-type data type.
Value
Type: ../record/record-data-type
Contains the data to be written.
*[Optional] Length*
Type: ../integer/integer-data-type
The number of bytes to be written. In the case of data types other than string, code, and binary, if you specify a length that differs from the size of the variable, an error message is displayed.
## Return Value
*[Optional] Written*
Type: ../integer/integer-data-type
The number of bytes that were written. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.
## Remarks
If the optional return value, Written, is not specified and it was not possible to write all the data, an error message is displayed.
If the return value is present, you must verify that all the data was streamed.
## Example
```al
 var
    recBinaries: Record "Company Information";
    OStream: OutStream;
    Rec: Record Customer;
begin
    recBinaries.Find('-');
    recBinaries.Picture.CreateOutstream(OStream);
    OStream.Write(recCust);
    recBinaries.Modify();
end;
```
## Related information
outstream-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/outstream/outstream-write-table-integer-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/outstream/outstream-write-table-integer-method/
