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

Tab deliminated file on application server

former_member925838
Participant
0 Likes
1,588

Hello Experts,

I am trying to upload tab deliminated file on application server, i have successfully done it. but it display # in place of tab, after searching on SDN i found that # is a internal representation of tab. but i want to upload it with tab only. is it possible? how can i achieve this?

Thanks,

Amar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,227

Hi,

I guess its not possible as i haven't seen any file on AL11 without #.

Btw it is just internal representation, if you download the data into file, you'll not see #.

So there is no problem as such.

Hello Experts,

I am trying to upload tab deliminated file on application server, i have successfully done it. but it display # in place of tab, after searching on SDN i found that # is a internal representation of tab. but i want to upload it with tab only. is it possible? how can i achieve this?

Thanks,

Amar

7 REPLIES 7
Read only

Former Member
0 Likes
1,228

Hi,

I guess its not possible as i haven't seen any file on AL11 without #.

Btw it is just internal representation, if you download the data into file, you'll not see #.

So there is no problem as such.

Read only

Former Member
0 Likes
1,227

Hi Amar,

     The tab is not stored as '#' internally. Its just that system is not able to do the code page conversion when the file is being displayed so it is representing this unconvertible character as '#'. The processing of the file would happen like any other tab delimeted files when used in the programs.

Hope this helps,

~Athreya

Read only

tolga_polat
Active Participant
0 Likes
1,227

Hi,

How you upload your file?

If you using DATASET you can try structure as work area. here is example

DATA : ls_tab type <your file structure>.

OPEN DATASET <path> FOR INPUT IN TEXT MODE ENCODING DEFAULT MESSAGE <msg>.

DO.

       READ DATASET <path> INTO ls_tab.

       IF sy-subrc NE 0.

          EXIT.

       ENDIF.

ENDDO.

If you dont know file structure you can create dynamic structure like this:

DATA : lv_data TYPE string,

            lv_data_for_structure TYPE string.

DATA : moff TYPE i,

           lv_count TYPE i,

           lv_dummy TYPE string.

OPEN DATASET <path> FOR INPUT IN TEXT MODE ENCODING DEFAULT MESSAGE <msg>.

DO.

IF sy-index EQ 1.

       READ DATASET <path> INTO ls_data.

       IF sy-subrc NE 0.

          EXIT.

       ENDIF.

ls_data_for_structure = ls_data.


DO.

     FIND FIRST OCCURRENCE OF cl_abap_char_utilities=>horizontal_tab

                           IN ls_data_for_structure

                 MATCH OFFSET moff.

     IF sy-subrc NE 0.

       moff = strlen( ls_data_for_structure ).

       IF moff EQ 0.

         EXIT.

       ENDIF.

     ENDIF.

     IF moff EQ 0.

       IF ls_data_for_structure+0(1) = cl_abap_char_utilities=>horizontal_tab.

         SHIFT ls_data_for_structure BY 1 PLACES.

       ELSE.

         moff = strlen( ls_data_for_structure ).

         lv_dummy = ls_data_for_structure+0(moff).

       ENDIF.

     ELSE.

       lv_dummy = ls_data_for_structure+0(moff).

       moff = moff + 1.

       SHIFT ls_data_for_structure BY moff PLACES.

     ENDIF.

     ADD 1 TO lv_count.

* in here instead of write you can create your own fieldcat

     WRITE : / lv_count,

                    lv_dummy.

* As you can see this code gives you the colomn count and write its value.


     CLEAR : moff,

                   lv_dummy.

   ENDDO.

after fieldcat is filled you can create your table just using CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE at here

ENDIF.

* After creating your own table you can assign value to work area. you can declare your workarea like CREATE DATA lf_wa LIKE LINE OF <your_table>. then just move your ls_dats to lf_wa->*

ENDDO.

I hope this will help.

Read only

arindam_m
Active Contributor
0 Likes
1,227

Hi,

Check the ENCODING OPTION used during your upload. Tab does not get represented has # it means the symbol is begin misinterpreted. Try encoding UTF.  Also is your hash coming at end of line then it can be due to the fact the newline character (CRLF) coming from windows OS is being misread in UNIX

Cheers,

Arindam

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,227

Hello Amar,

AL11 doesn't give you the actual contents of the file it is just a representation of how the file looks like!

So when the ABAP list tries to write the horizontal tab it doesn't find any suitable character mapped to it & hence displays it with an '#'.

BR,

Suhas

Read only

mayur_priyan
Active Participant
0 Likes
1,227

Hi,

If you want to maintain spaces in your file maintained on the Application Layer, then use Normal space instead of Tab space. Coz if you try to use Tab then you will surely get '#' in your file.

Read only

former_member925838
Participant
0 Likes
1,227

Hi All thanks for all reply.

i have changed file format as its not possible to get tab on application server.

thanks everyone for suggestions.

Regards,

Amar