Skip to Content
author's profile photo Former Member
Former Member

change the output length of a field?

I have a table that will write a field ] with 18 characters since that’s the length in the table, but instead the content of the field should be copied into a variable which length is 30 characters and then be written in to the text file (as a result blank spaces will be added at the end of the content of the variable). do i need to declare this in a DATA statement? if so, how?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jun 05, 2014 at 05:46 PM


    I think its quite similar with a issue I had a time ago and I solved it using copying RESPECTING BLANKS using concatenate command.

    It will copy your 18 character fields adjusted to right position and respect blanks in the left side, in TXT file, so respecting 30 characters positions to this field in the file.


    If you are trying to concatenate various fields per line into TXT, use this example that worked to me:

    LOOP it_table.
    your_30_char_field = matnr.
    SHIFT your_30_char_field RIGHT DELETING TRAILING space.
    concatenate .....field1 field2 field3 your_30_char_field ... fieldN into ls_file RESPECTING BLANCS.
    append ls_file to IT_file.

    I do not know if you are using gui_download. So it's the case, use this way:

          filename                  = lc_filename
          filetype                  = 'ASC'       " important
          trunc_trailing_blanks_eol = ''     " Important
          data_tab                  = it_data_out.

    best regards.


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.