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

Concatenate a Tab to a String between two fields

Former Member
0 Likes
4,098

I want a concatenate two fields (Matnr, Kebtr) into a string of 100 characters.

But my requirement is to concatenate 1 Matnr, 1 Tab, and 1 Kebtr.

Is there any ways to add a tab while concatenating.

I have done for a comma like

Concatenate matnr ‘,’ kbetr into output.

Instead of comma how to add a tab there….

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,522

Report ztest.

constants: c_a type x value '09'.

data: g_file like rlgrap-filename.

g_file = 'Test.txt'.

OPEN DATASET g_file FOR APPENDING IN BINARY MODE.

if sy-subrc = 0.

transfer 'AA' to g_file.

TRANSFER c_a TO g_file.

transfer 'ZZ' to g_file.

endif.

CLOSE DATASET g_file.

I want a concatenate two fields (Matnr, Kebtr) into a string of 100 characters.

But my requirement is to concatenate 1 Matnr, 1 Tab, and 1 Kebtr.

Is there any ways to add a tab while concatenating.

I have done for a comma like

Concatenate matnr ‘,’ kbetr into output.

Instead of comma how to add a tab there….

5 REPLIES 5
Read only

Former Member
0 Likes
1,523

Report ztest.

constants: c_a type x value '09'.

data: g_file like rlgrap-filename.

g_file = 'Test.txt'.

OPEN DATASET g_file FOR APPENDING IN BINARY MODE.

if sy-subrc = 0.

transfer 'AA' to g_file.

TRANSFER c_a TO g_file.

transfer 'ZZ' to g_file.

endif.

CLOSE DATASET g_file.

Read only

varma_narayana
Active Contributor
0 Likes
1,522

hI..

Concatenate field1 field2 Field3

into TargetField

separated by CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.

<b></b>

<b>Reward if Helpful</b>

Read only

Former Member
0 Likes
1,522

hi,

Check out the following link:

http://www.sapdevelopment.co.uk/file/file_ascii.htm

Or

You can try defining the following and use it as the tab delimiter.

data: tab(1) type x value '09'.

Read only

Former Member
0 Likes
1,522

Hi,

You can do it by first declaring a constant:

<b>CONSTANTS: c_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.</b>

and then concatenate:

<b>concatenate matnr c_tab Kebtr into string.</b>

<b>Reward with points for helpful answers.</b>

Regards,

Amit

Read only

Former Member
0 Likes
1,522

Concatenate matnr ' ' kbetr into output SEPERATED BY SPACE.

This will insert a TAB.

Reward points if useful, get back in case of query...

Cheers!!!