‎2007 Jun 14 7:52 AM
Hi
Is it possible to write select st like
select field1 field2 from tab
i want to combine <b><b>field1 and field2</b> into single field</b> in result
Thanks
Venkat
‎2007 Jun 14 7:54 AM
Hi,
Yes..some how it can be achieved..
DATA: BEGIN OF WA,
FIELD1,
FIELD2,
END OF WA.
SELECT FIELD1 FIELD2 INTO WA
FROM TABLE.
Now if you use WA ...the values are combined..
WRITE: / WA.
Please make sure to reward points for helpful answers..
Thanks
Naren
‎2007 Jun 14 7:55 AM
hi,
After selecting field1 and field2, concatenate both into Field3.
THanks,
Deepti
‎2007 Jun 14 7:57 AM
Hi Deepti,
Thanks for your reply.
My requirement is the select statement itself combine 2 fields and assign to single variable.
Is it possible.
Thanks
Venkat
‎2007 Jun 14 8:15 AM
Hi,
Can u be more clear.
What is the problem if u select first and then concatenate.
Thanks,
Deepti
‎2007 Jun 14 8:24 AM
In the below code i am using 2 loop . first concatenate the fields , then using select for all entries and againg one loop.
I want to fine tune this .
create a new internal table with the two fields..
data: begin of wa_obj,
loobj1 TYPE dfkklocks-loobj1,
gpart TYPE dfkklocks-gpart,
PROID TYPE dfkklocks-PROID,
LOCKR TYPE dfkklocks-LOCKR,
end of wa_obj.
data: t_obj like table of WA_OBJ.
data: t_obj_1 like table of WA_OBJ.
process the internal table to prepare the internal table T_OBJ.
loop at idfkkop into waDfkkop.
concatenate waDfkkop-opbel
waDfkkop-opupw
waDfkkop-opupk
waDfkkop-opupz
into w_loobj1.
wa_obj-loobj1 = w_loobj1.
wa_obj-gpart = waDfkkop-gpart.
append wa_obj to t_obj.
ENDLOOP.
if NOT T_OBJ[] Is initial.
Select the data from the database table.
SELECT PROID LOCKR LOOBJ1 GPART
INTO TABLE T_OBJ_1
FROM dfkklocks
FOR ALL ENTRIES IN T_OBJ
WHERE LOOBJ1 = T_OBJ-LOOBJ1
AND GPART = T_OBJ-GPART.
ENDIF.
loop at idfkkop into waDfkkop.
concatenate waDfkkop-opbel
waDfkkop-opupw
waDfkkop-opupk
waDfkkop-opupz
into w_loobj1.
READ TABLE LT_OBJ_1 INTO WA_OBJ
WITH KEY loobj1 = w_loobj1
gpart = waDfkkop-gpart.
if sy-subrc = 0.* modify idfkkop from waDfkkop.
endif.
clear w_loobj1.
endloop.
Thanks
Venkat
‎2007 Jun 14 7:57 AM
its not possible in the select statement it self.
u can achieve it after retrieving the data into the local fields only.
-Pesi.
‎2007 Jun 14 8:08 AM
hi
it is possible to represent the both fields in single field by just writing the complete WA rather than individual field as told by someone but provided the DATA TYPE shud permit. Bcos sometimes u will get a messij that the data type is not convertable....