Skip to Content
Oct 30, 2015 at 10:25 AM

Text File Creation - Fixed Values - 8-bit ASCII (not Unicode)


Hi All,

I have a requirement to created a ".txt" file with fixed values (using spaces to fill the gap); below are the criteria ;

File Type - 8-bit ASCII (not Unicode)

Record Delimiter - CRLF – 0x0D0A

Record Length - 796 bytes excluding CRLF chars

I have created the ABAP program And

ex :
           field1(1035) TYPE c,
           END OF ty_out.

data :  g_space TYPE string,
            lv_reserved(255) TYPE c.    " this values should be 255 fixed length,
            it_out TYPE TABLE OF ty_out,
            wa_out TYPE ty_out,

g_space = cl_abap_conv_in_ce=>uccp( c_space ).
WRITE  g_space TO lv_reserved+254(1).

CONCATENATE  lv_rec_type l lv_reserved INTO wa_out-field1.
APPEND wa_out TO it_out.

using " cl_gui_frontend_services=>file_save_dialog" and " cl_gui_frontend_services=>gui_download" to download the file onto user's PC.

How can I check whether this is 796 bytes ? Cause when I check the properties of the file the Size is : 2.33 KB (2,394 bytes). but the total charachters are 796 as per above condition.

I use Notepad ++ to check the file and character length

But user is telling that total is 797.

How to satisfy these conditions ? Is there any other method or mechanism to do this?

one more thing,

the value of below character should be 12 (I check with Notepad ++ ) but user is telling there are 13 with spaces..


796.JPG (55.9 kB)
13.JPG (60.0 kB)