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 remove whitespace in .dat file in Al11?

walkerist
Participant
0 Kudos
574

I'm debugging a custom program which creates a document in AL11. Is it possible to remove the whitespace?

Whitespace is highlighted in blue. Additionally, I want to put "#" or " | " at the end of the line.

Edit: assuming that the pipes in the image are borders between null values.

Sometimes the output is:

|50|123|444|122222| *whitespace*

8 REPLIES 8

Sandra_Rossi
Active Contributor
0 Kudos
453

Yes. This won't create any trailing space:

TRANSFER '50||||...........001|||||||||' TO textfile.

Tomas_Buryanek
Active Contributor
453

How can we help without you sharing relevant piece of code?

-- Tomas --

thkolz
Contributor
0 Kudos
453
l_concat = l_concat && '|'.
CONDESE l_concat NO-GAPS.

Actually that looks like code from hell!

0 Kudos
453

should I insert it here? the value of c_del is ' | '

*    DO.
*      ASSIGN COMPONENT sy-index
*        OF STRUCTURE <fs_final>
*        TO <fs_field>.
*        IF sy-subrc EQ 0.
*          IF sy-index EQ 1.
*            DATA(l_concat) =
*              CONV string( <fs_field> ).
*              l_concat = c_del && l_concat.
*          ELSE.
*            IF <fs_field> IS NOT INITIAL.
*              l_concat = l_concat &&
*                         c_del &&
*                         <fs_field>.
*            ENDIF.
*            IF <fs_field> IS INITIAL.
*              l_concat = l_concat &&
*                         c_del.
*            ENDIF.
*          ENDIF.
*          l_count = l_count + 1.
*        ELSE.
*          EXIT.
*        ENDIF.
*    ENDDO.
*      outlines = outlines + 1.
*      move-corresponding

0 Kudos
453
DO.
ASSIGN COMPONENT sy-index
OF STRUCTURE <fs_final>
TO <fs_field>.
IF sy-subrc = 0.
lv_concat = lv_concat && CONV string( <fs_field> ) && c_del.
ELSE.
* Last field => add last delimiter and exit
lv_concat = lv_concat && c_del.
EXIT.
ENDIF.
ENDDO.

* Remove leading/trailing blanks and all substrings that contain nothing but blanks
CONDENSE lv_concat NO-GAPS.

WRITE:/ lv_concat.

0 Kudos
453

c12b61ded10b4e18beae75c3b6218d2c Hi, I've tried replicating your code but still encountering a whitespace. This is a subroutine pool. Is it possible to debug it?

Sandra_Rossi
Active Contributor
0 Kudos
453

walkerist Why don't you use debugger F9 at the ABAP statement TRANSFER? I'm pretty sure it will work even for generated subroutine pools.

walkerist
Participant
0 Kudos
453

@tomas.buryanek modified