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

concatenation

Former Member
0 Likes
927

I have an internal table having a single entry and around 60 fields. each of the fields have varying lengths. Some of the fields have values and others are blank.

for example: my first field has length 4 char and has a value "ABCD". my second field is 10 char and 3rd is 35 char but both are blank. 4th field again has some value say "xyz".

i want "ABCD...(45 spaces)...XYZ.." and so on to be transferred to the file having single line.

I want to pass all the data to a file on application server appending the spaces for the fields having no values.

Please suggest how to achieve this?

Regards

Nishant

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
873

If you are downloading to a text file on the application server, this behavior should be happening automatically for you.

Are you using OPEN DATSET and TRANSFER?

Regards,

Rich Heilman

8 REPLIES 8
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
874

If you are downloading to a text file on the application server, this behavior should be happening automatically for you.

Are you using OPEN DATSET and TRANSFER?

Regards,

Rich Heilman

Read only

0 Likes
873

ya, open dataset and transfer.....

Read only

Former Member
0 Likes
873

Simply use concatenate F1 f2 f3 f4 into f5. u will get the spaces.

Read only

0 Likes
873

hi Nishant,

Just use <b>concatente f1 f2 f3 f4</b> into f5 as Madhu said ...

Regards,

Santosh

Read only

Former Member
0 Likes
873

Hi Nishanth,

do this way:

concatenate 'ABCD'

` `

'XYZ'

INTO

V_FINAL.

WRITE:/ V_FINAL.

Regards,

ravi

Note that the quotes for the 45 spaces is the quote key near the 1 key(over the tab button on the key board)

Regards,

ravi

Read only

0 Likes
873

If you structure in your internal table is as you have defined previously, it will write the spaces if you transfer the entire line. You should not need to concatenation at all.

data: begin of itab occurs 0,
      fld1(4) type c,
      fld2(35) type c,
      fld3(10) type c,
      fld4(4) type c,
      end of itab.

loop at itab.
 transfer itab to d1.
endloop.

Regards,

Rich Heilman

Read only

former_member184495
Active Contributor
0 Likes
873

hi,

i feel you must be having problems with the space field, as it does not get concatenated ... try using offset instead of concatenating,

hope this would work...

cheers,

Aditya.

Read only

0 Likes
873

data : m(50) type c.

data : myspace(50) type c.

data : howmany type i.

howmany = 45.

concatenate 'abcd' 'xyz' into m separated by myspace(howmany).

write m.