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: 

How to write blank spaces in a file

Former Member

Hi experts,

I want that a file has exactly the same lenght in every line so that, I have to insert blank spaces when a line doesn't have the right lenght. I've already use:

g_space = cl_abap_conv_in_ce=>uccp( '00A0' ).

But when I open it in AL11 it has got "#" symbol in those positions. The point is that this document will be processed by other entity and there must be blank spaces not "#" or other symbol.

Do you know any solution?

Thank you in advance,

Pablo

10 REPLIES 10

Former Member
0 Kudos

Dear Pablo,

In the method call cl_abap_conv_in_ce=>uccp importing parameter needs to be 00A0 instead of OOAO. OOAO returns '#'. Check if this change works in your case.

BR,

Arun.

Former Member
0 Kudos

You could have the valid character on the fle. It is just that the SAP Gui is showing a '#'.

matt
Active Contributor

You know that # is just what is displayed when SAPGui finds an undisplayable character. It's not # in the file (if you were, for example, to check the file in a text editor).

Former Member
0 Kudos

Hi

I don't know which system has to read your file, but you need to consider it's impossible to place blank spaces at the right of a record, but it usually needs to use a end pf record character: this is a special not printable chararter and the system shows it as #

So for me it's ok you see #, 00A0 is line feed

Max

Former Member
0 Kudos

Pablo,

Please save your file in ASCII mode in AL11, Bin mode always do have # at the end of each line.

BR,

Arun.

Former Member
0 Kudos

Pablo,

In the method call cl_abap_conv_in_ce=>uccp importing parameter needs to be 00A0 instead of OOAO. OOAO returns #. Check if the change work in your case.

BR,

Arun.

raymond_giuseppi
Active Contributor
0 Kudos

In your 'TRANSFER dobj TO dset.' statement use a STRING type, so trailing blanks won't be deleted.

Hint: find the difference between space, ' ' and ` ` (or read Character Literals)

Regards,
Raymond

Sandra_Rossi
Active Contributor
0 Kudos

If the "transferred" data object is of type C (or a flat-character-like structure), then you may use TRANSFER dobj TO dset LENGTH the_right_length.

Former Member
0 Kudos

Hi Pablo,

SAP trunks blanks from the end of record.

If you want to still add, cl_abap_conv_in_ce=>uccp( '00A0' ) will add. it as that is space equivalent character. It will not show in text editor.
If you want it in-between you can use SPACE keyword.

I was also having similar requirement, As 3rd party will read details from generated file for internal purpose. After a long waste of time we ended up with mutual decision i.e. 3rd party will treat cl_abap_conv_in_ce=>uccp( '00A0' ) (Hexa - 00A0, decimal - 160, char - á) as space.

Please update if any alternative available.

with regards,

Pramod Kumar Mandal.

Former Member
0 Kudos

Finally, I used:

blank = CL_ABAP_CHAR_UTILITIES=>CR_LF, and I declared blank as type C of 1 lenght so I just get the CR.

Thank you very much