12-18-2006 8:51 AM
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!
12-18-2006 8:53 AM
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
12-18-2006 8:53 AM
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
12-18-2006 8:56 AM
Hi Mpm,
You cannot concatenate in a select statement , one solution is to loop on the table after select and then concatenate.
Regards
Arun
12-18-2006 8:59 AM
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
12-18-2006 9:26 AM
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.