Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

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

tharaka_fernando
Contributor
0 Kudos

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 :

TYPES: BEGIN OF ty_out,

           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..

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

You have 3 lines . 796 bytes in each lines

So in total 796 * 3 = 2388 Bytes which is equal to 2388/1024 ~ 2.33 KB .

Or Opposite : 2.33 KB = 2386 Bytes

Not sure how you are getting 2.33 KB = 2394 Bytes.

R

1 REPLY 1

Former Member
0 Kudos

Hi

You have 3 lines . 796 bytes in each lines

So in total 796 * 3 = 2388 Bytes which is equal to 2388/1024 ~ 2.33 KB .

Or Opposite : 2.33 KB = 2386 Bytes

Not sure how you are getting 2.33 KB = 2394 Bytes.

R