Application Development and Automation 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: 
Read only

AL11 Alignment Issues

Former Member
0 Likes
2,023

Hi All,

I am writing data to a file in AL11 from an internal table and I'm facing alignment issue when I open the file in the AL11 folder.

Here is the scenario.

1. The internal table has 10 records.

2. Below is the how the 10 records are coming out in the text file.

000050001141

000050004054

000050004062

000050004068

000050004072

Each line gets displaced for a certain number of tabs. Any ideas ?

Thanks.

14 REPLIES 14
Read only

Former Member
0 Likes
1,735

Can you explain ur problem more clearly.

bi

Read only

former_member156446
Active Contributor
0 Likes
1,735

the output in al11 is not the final or exact output.. the server tries to compress the file and display.. so you better download the file to presentation server and then view the exact file format... Tr. CG3Y / CG3Z

Read only

0 Likes
1,735

Hi,

I am not seeing the text file from AL11. I am directly acessing the file from the application server folder which is the real text file.

Thanks,

Nandha.

Read only

0 Likes
1,735
000050001141
    000050004054
        000050004062
            000050004068
                000050004072

This is how the output in the file gets displaced in each line

Read only

0 Likes
1,735

when you get the data into internal table using Open dataset... you can use Condense No gaps which will remove the gaps..

you can even use the same before writing the file UNIX server..

Read only

0 Likes
1,735

Condense won't work because it will condense all the fields which is not the required functionality

Read only

0 Likes
1,735

Hi,

Do u want to write file with field length as it is in Internal table?

or do u want to write fixed length file.?

Read only

0 Likes
1,735

I want to write it as it is in the internal table. If the internal table has 10 rows with 10 columns, just transfer them as it is

Read only

0 Likes
1,735

Lets see your code.. how you are transfering data... ASC mode Binary mode? what delimitor are u using..

Read only

0 Likes
1,735
IF p_appsrv <> space.
*Write the data to the application server file
*Open the file
    OPEN DATASET p_file FOR OUTPUT IN BINARY MODE .
    IF sy-subrc <> 0.
      WRITE :/1 'Server File Not Found'(002).
    ELSE.
*Transfer data
      LOOP AT it_data INTO wa_output.
        v_count = v_count + 1.
        TRANSFER wa_output TO p_file.
        CLEAR wa_output.
      ENDLOOP.
*Close the file
      CLOSE DATASET p_file.
    ENDIF.
  ENDIF.
Read only

0 Likes
1,735

try this way..

*Transfer data
      LOOP AT it_data INTO wa_output.
        TRANSFER wa_output TO p_file.
        CLEAR wa_output.
        v_count = v_count + 1.
      ENDLOOP.

check this sample code.. it works perfect..

IF NOT p_ufile IS INITIAL.

OPEN DATASET p_ufile FOR OUTPUT IN TEXT MODE.
IF sy-subrc <> 0.
EXIT.
ENDIF.
LOOP AT p_output INTO wa_file.
TRANSFER wa_file TO p_ufile.
CLEAR wa_file.
ENDLOOP.
CLOSE DATASET p_ufile.

Read only

0 Likes
1,735

then u have to write the code like this.

data : <fs> type any.

data : begin of ty_struc1,

f1 type c value space.

f2 tyep c value '[',

end of ty_struc1.

data : begin of ty_struc2,

f1 type c value '[',

f2 type c value space,

end of ty_struc.

loop at itab.

assing commponent of itab to <fs>.

translate <fs> using ty_struc1.

concatenate v_temp <fs> to v_temp.

translate v_temp using ty_struc2.

transfer th v_temp to file

endloop.

hope this works

Read only

0 Likes
1,735

Nope , Mr. A the result is still the same.

Read only

0 Likes
1,735

Figured out the issue. Should be using Text mode Default encoding with smart linefeed