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

select statement issue

Former Member
0 Likes
873

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

7 REPLIES 7
Read only

Former Member
0 Likes
835

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

Read only

Former Member
0 Likes
835

hi,

After selecting field1 and field2, concatenate both into Field3.

THanks,

Deepti

Read only

0 Likes
835

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

Read only

0 Likes
835

Hi,

Can u be more clear.

What is the problem if u select first and then concatenate.

Thanks,

Deepti

Read only

0 Likes
835

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

Read only

former_member772790
Participant
0 Likes
835

its not possible in the select statement it self.

u can achieve it after retrieving the data into the local fields only.

-Pesi.

Read only

Former Member
0 Likes
835

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....