Application Development 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: 

Concatenate in Select

Former Member
0 Kudos

Hi,

How can I concatenate 3 fields in a select?

I have ..

select

cretim credat updtim upddat docnum status idoctp maxsegnum from

edidc into table it_control

where cretim in timeidoc

and credat in dateidoc

and updtim in timereg

and upddat in datereg

and docnum in numdoc

and status in stat. "latest status for this idoc

I want to concatenate EDIDC-SNDPRT/EDIDC-SNDPFC/EDIDC-SNDPRN in field it_control- aplicacion.

thanks!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

You can do this within Select & endselect. But the better way is to select seperately first & then pass the concatenated value to other field within a loop.

1.

select

cretim credat updtim upddat docnum status idoctp maxsegnum from

edidc into table it_control

where cretim in timeidoc

and credat in dateidoc

and updtim in timereg

and upddat in datereg

and docnum in numdoc

and status in stat. "latest status for this idoc

concatenate it_control-SNDPRT it_control-SNDPFC it_control-SNDPRN into it_control-aplicacion.

append it_control.

endselect.

2.

select

cretim credat updtim upddat docnum status idoctp maxsegnum from

edidc into table it_control

where cretim in timeidoc

and credat in dateidoc

and updtim in timereg

and upddat in datereg

and docnum in numdoc

and status in stat. "latest status for this idoc

loop at it_control.

concatenate it_control-SNDPRT it_control-SNDPFC it_control-SNDPRN into it_control-aplicacion.

modify it_control.

endloop.

null

4 REPLIES 4

Former Member
0 Kudos

Hi,

You can do this within Select & endselect. But the better way is to select seperately first & then pass the concatenated value to other field within a loop.

1.

select

cretim credat updtim upddat docnum status idoctp maxsegnum from

edidc into table it_control

where cretim in timeidoc

and credat in dateidoc

and updtim in timereg

and upddat in datereg

and docnum in numdoc

and status in stat. "latest status for this idoc

concatenate it_control-SNDPRT it_control-SNDPFC it_control-SNDPRN into it_control-aplicacion.

append it_control.

endselect.

2.

select

cretim credat updtim upddat docnum status idoctp maxsegnum from

edidc into table it_control

where cretim in timeidoc

and credat in dateidoc

and updtim in timereg

and upddat in datereg

and docnum in numdoc

and status in stat. "latest status for this idoc

loop at it_control.

concatenate it_control-SNDPRT it_control-SNDPFC it_control-SNDPRN into it_control-aplicacion.

modify it_control.

endloop.

null

Former Member
0 Kudos

Hi Mpm,

You cannot concatenate in a select statement , one solution is to loop on the table after select and then concatenate.

Regards

Arun

Former Member
0 Kudos

select

cretim credat updtim upddat docnum status idoctp maxsegnum from

edidc into corresponding fields of it_control

where cretim in timeidoc

and credat in dateidoc

and updtim in timereg

and upddat in datereg

and docnum in numdoc

and status in stat. "latest status for this idoc

concatenate it_control-SNDPRT it_control-SNDPFC it_control-SNDPRN into it_control- aplicacion separated by '/'.

append it_control.

endselect.

regards

shiba dutta

Former Member
0 Kudos

DEFINE AN ITAB LIKE:

DATA: BEGIN OF ITAB OCCURS 1,

STR(255),

END OF ITAB.

select

cretim credat updtim upddat docnum status idoctp maxsegnum from

edidc into table it_control

where cretim in timeidoc

and credat in dateidoc

and updtim in timereg

and upddat in datereg

and docnum in numdoc

and status in stat. "latest status for this idoc

LOOP AT IT_CONTROL.

CONCATENATE CRETIM CREDAT UPDTM DOCNUM INTO ITB-STR SEPERATED BY ','.

APPEND ITAB.

ENDLOOP.

Finally u will get data in itab.

Cheers.