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

Inserting Tab delimiter(#) in internal table

Former Member
0 Likes
5,798

Hi Gurus ,

i have records in my internal table , now i want to insert '#' tab delimiter into each records. i mean that

my internal table should contains records coloumn instead of '|' it should be replaced by '#'.PLease

help me on this .

Thanks and regards,

Rajeshwar

Hi Gurus ,

i have records in my internal table , now i want to insert '#' tab delimiter into each records. i mean that

my internal table should contains records coloumn instead of '|' it should be replaced by '#'.PLease

help me on this .

Thanks and regards,

Rajeshwar

12 REPLIES 12
Read only

Former Member
0 Likes
2,687

Hi,

Assuming that the internal table is of type string :

loop at itab into watab.

concatenate wa_tab-field1 wa_tab-field2 wa_tab-field3 into wa_output-field1 
separated by cl_abap_char_utilities=>horizontal_tab.

append wa_output to gt_output.

endloop.

Best regards,

Prashant

Read only

0 Likes
2,687

Hi,

Using this method we can include Horizontal tab as '#'.

but can we include the TAB as we are getting when we are using FM 'GUI_DOWNLOAD'.

Thanks....

Read only

0 Likes
2,687

Use cl_abap_char_utilities=>HORIZONTAL_TAB

Regards

Read only

Former Member
0 Likes
2,687

Hi rajeshwar,

Please go through Th link In which You have the sample code for this:

http://www.sap-img.com/abap/insert-a-special-tab-delimited-character.htm.

I think it should solve ur problem.

Regards,

Rahul

Read only

Former Member
0 Likes
2,687

Hi Rajeshwar,

Try the following snippet for delimiter.

DATA: w_deli(1) TYPE c,           "delimiter
      w_text(50) TYPE c,
      w_hex TYPE x.
FIELD-SYMBOLS: <fs> .

ASSIGN w_deli TO <fs> TYPE 'X'.
w_hex = 09.
<fs> = w_hex.

CONCATENATE 'Testing' 'Tab' 'Delimiter' INTO w_text SEPARATED BY w_deli.
WRITE: w_text.

Use w_deli as delimiter.

Hope this will help you.

Regards,

Manoj Kumar P

Read only

0 Likes
2,687

Hi,

as you have mentioned. we are able to include a special character while writing, do you know how to include proper TAB as we can see in text file.

Thanks....

Read only

Former Member
0 Likes
2,687

Hi,

Tab wud b displayed as # if you open the file in application server ( AL11).

Download the file to presentation server using transaction CG3Y / CG3Z & then check.

  1. wud b replaced by TAB.

Best regards,

Prashant

Read only

Former Member
0 Likes
2,687

Hi Rajeshwar,

Actually hash is nothing but tab delemeted file on application server.

So you have to loop at each record and concatenate all the fields with '#' as seperator.

data : wa_output(200) type c.

loop at itab into watab.

concatenate wa_tab-field1 wa_tab-field2 wa_tab-field3 into wa_output-field1

separated by cl_abap_char_utilities=>horizontal_tab.

append wa_output to gt_output.

endloop.

Then probably you can download the file at application server if you have such requirement.

Regards,

Anil Salekar

Read only

Former Member
0 Likes
2,687

thanks its solved

Read only

0 Likes
2,687

Hi Raj,

Ca you tell me how you solved this case, I have a same requirment to add Delimiter "|"  to each records in the internal table.

Thanks

Rufus

Read only

0 Likes
2,687

concatenate wa_tab-field1 wa_tab-field2 wa_tab-field3 into wa_output-field1

separated by  '|'.

append wa_output to gt_output.

Read only

0 Likes
2,687

Hi Peter,

Thanks for the info, But inorder to achieve this we need to loop the internal table, in my scenario my internal table has 50 lakh records, so its not possible to do with a loop.

Is there any other alternative way of FM to achieve this.

Thanks

Rufus