Skip to Content

How to write blank spaces in a file

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

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.

    Add comment
    10|10000 characters needed 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.

    Add comment
    10|10000 characters needed 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.

    Add comment
    10|10000 characters needed 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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 17, 2016 at 12:57 PM

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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 17, 2016 at 01:03 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 17, 2016 at 02:23 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 17, 2016 at 06:21 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 12, 2016 at 11:12 AM

    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

    Add comment
    10|10000 characters needed characters exceeded