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: 

Keep spaces in al11 file without end of line

anjalikushwah
Explorer
0 Kudos
794

Hi Gurus,

I have a requirement .

I am generating File in AL11 through one program , now first line contains 5 characters in al11 file.

After 5 characters ,I need 1700 spaces in my file and then end of characters should come.\

But when I concatenate space ,it is not coming in file,That is when I download file in text mode and open in notepad ,

end of line (CRLF)comes after 5th character.

4 REPLIES 4

raymond_giuseppi
Active Contributor
731

How did you define and transfer the 1700 blank characters.

(Post relevant part of your current code)

anjalikushwah
Explorer
0 Kudos
731
Local variable declarations
data : Z_LV_FILE type LOCALFILE,
Z_LV_FILENAME type LOCALFILE,
* Z_LV_STRING(1800) type C,
Z_LV_STRING type string,
WA_TXT_OUTPUT_01 type TY_TXT_OUTPUT,
OV_SUBRC type SY-SUBRC.
data :lv_length type N LENGTH 4,
lv_length1 type N LENGTH 4,
lv_space type string.

types : begin of TY_ZFI_USERCODE,
ZLOGINID type ZFI_USERCODE-ZLOGINID,
end of TY_ZFI_USERCODE.

data : LV_CODE(10) type C value 'XXXXXX',
LV_CODE1 type C value 'N'.
if OT_TXT_OUTPUT is initial.
message text-017 type 'W'. " WITH text-017.
leave to list-processing.
else.

if not P_PATH is initial.
replace first occurrence of 'DRB' in P_PATH with SY-SYSID.

concatenate 'EFT_' P_ZBUKR '_' P_LAUFD '_' P_LAUFI
into Z_LV_FILE.

Z_LV_FILENAME = Z_LV_FILE. "chr 9955
concatenate Z_LV_FILE '.TXT' into Z_LV_FILE.
condense Z_LV_FILE.
concatenate P_PATH Z_LV_FILE into Z_LV_FILE.
open dataset Z_LV_FILE for output in text mode encoding default with WINDOWS LINEFEED
constants: LV_CRLF(1) value CL_ABAP_CHAR_UTILITIES=>CR_LF.
lv_space = cl_abap_conv_in_ce=>uccp( '00a0' ).
if SY-SUBRC = 0.
loop at OT_TXT_OUTPUT into WA_TXT_OUTPUT_01.

move WA_TXT_OUTPUT_01-DATA to Z_LV_STRING.

if ( SY-TABIX le 5 ) or ( Z_LV_STRING+0(1) = 'P' and SY-TABIX > 5 ).
lv_length = strlen( Z_LV_STRING ).
lv_length1 = 1701 - lv_length.
do lv_length1 times.
CONCATENATE Z_LV_STRING lv_space INTO Z_LV_STRING .
enddo.
endif.

if not Z_LV_STRING is initial.
transfer Z_LV_STRING to Z_LV_FILE.

endif."ENDIF check for z_lv_string IS INITIAL
clear Z_LV_STRING.

endloop.
close dataset Z_LV_FILE.
if SY-SUBRC = 0.
message text-018 type 'I'.
OV_SUBRC = 0.
wait up to 5 seconds.
perform ENCRYPT_FILE using Z_LV_FILE Z_LV_FILENAME.
else.
OV_SUBRC = SY-SUBRC.
message text-019 type 'E'.
endif.
endif.
endif.
endif.

endform. "z_f_send

Sandra_Rossi
Active Contributor
0 Kudos
731

Did you debug your code? Do you have 1700 characters in Z_LV_STRING?

How do you download? Maybe only the download part is the problem, not your ABAP program?

Note that this line is a problem:

lv_space = cl_abap_conv_in_ce=>uccp( '00a0' ).

First of all, you want to write a NON-BREAKING SPACE, I guess it's not what is expected in the requirement.

Second, I think it should be 00A0, probably 00a0 is interpreted as 0000 as you can see via debug.

Concerning your requirement, did you look at TRANSFER documentation? LENGTH is probably what you need...

anjalikushwah
Explorer
0 Kudos
731

Hi Sandra ,

I have checked in debugging lv_space contains #. Instead of 1700 character ,If I give 512 character ,then it works fine

lv_space = cl_abap_conv_in_ce=>uccp( '00a0' ).