>Thanks Hilmar
>
>I was sucessful to write to lines, but I think I have a problem in arrange SCAN command
>and variable because only the last record is written to the .txt.
>
>
>
>SELECT nota
>
> SCAN
>
> nfe = "E" +"|" + ALLTRIM(cl ) + "|IE|ISUF|" + CHR(13) + CHR(10)
>nfe = nfe + "E02|CNPJ" + CHR(13) + CHR(10)
>
>
>nfe = nfe + "E05|XLgr|Nro|XCpl|XBairro|CMun|XMun|UF|CEP|CPais|XPai" + CHR(13) + CHR(10)
>
>
> ENDSCAN
>
> STRTOFILE(nfe, "nfe001.txt")
In your first SCAN you're not incrementing nfe, so you overwrite it every time. BTW, it will be much faster if you write each line directly to the file rather than construct one long string first. Just use 1 as last parameter in StrToFile function to append to the existing file.
If it's not broken, fix it until it is.
My Blog