Skip to Content
0

How to write blank spaces in a file

Oct 17, 2016 at 12:21 PM

164

avatar image
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 |10000 characters needed characters left characters exceeded

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

1
* Please Login or Register to Answer, Follow or Comment.

9 Answers

avatar image
Former Member Oct 17, 2016 at 01:40 PM
-1

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.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Oct 17, 2016 at 12:57 PM
-1

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.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Oct 17, 2016 at 01:38 PM
-1

Pablo,

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

BR,

Arun.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Oct 27, 2016 at 09:33 AM
-1

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.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Oct 17, 2016 at 12:57 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Oct 17, 2016 at 01:03 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Raymond Giuseppi
Oct 17, 2016 at 02:23 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Sandra Rossi Oct 17, 2016 at 06:21 PM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Dec 12, 2016 at 11:12 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded