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

Concatenate two fields

Former Member
0 Likes
711

Hi,

Can anyone let me know how to concatenate the following two fields and use it in the select statement::

BKPF-AWKEY = MKPF-BELNR + MKPF-MJAHR.

Please reply at your earliest convenience.

Thanks,

Amit.

5 REPLIES 5
Read only

Former Member
0 Likes
605

Can you specify the field correctly.

for your query,

declare l_awkey type BKPF-AWKEY.

concatenate MKPF-BELNR MKPF-MJAHR to l_awkey.

BKPF-AWKEY = l_bwkey.

Read only

Former Member
0 Likes
605

Hi,

concatenate mkpf-belnr mkpf-mjahr into v_awkey.

select * from bkpf where awkey = v_awkey.

keerthi

Read only

Former Member
0 Likes
605

i_awkey like bkpf-awkey.

concatenate mkpf-belnr mkpf-mjahr into i_awkey.

select * from <table> where awkey = i_awkey.

regds

sarath

Read only

Former Member
0 Likes
605
DATA: v_awkey LIEK bkpf-awkey.
CONCATENATE mkpf-belnr mkpf-mjahr INTO v_awkey.

SELECT * FROM BKPF
               INTO TABLE i_bkpf
               WHERE awkwy = v_awkey.

In case if u want to concatenate inside a loop.

LOOP AT i_mkpf.
CONCATENATE i_mkpf-belnr i_mkpf-mjahr INTO i_mkpf-awkey.
MODIFY i_mkpf.
CLEAR i_mkpf.
ENDLOOP.

SELECT * FROM BKPF
                FOR ALL ENTRIES IN i_mkpf             
               INTO TABLE i_bkpf
               WHERE awkey = i_mkpf-awkey.

Read only

Former Member
0 Likes
605

hi

good

check this example and use accordingly

DATA: c1(10) TYPE c VALUE 'Sum',

c2(3) TYPE c VALUE 'mer',

c3(5) TYPE c VALUE 'holi ',

c4(10) TYPE c VALUE 'day',

c1 (30) TYPE c,

sep(3) TYPE c VALUE ' - '.

CONCATENATE c1 c2 c3 c4 INTO c5.

WRITE c5.

CONCATENATE c1 c2 c3 c4 INTO c5 SEPARATED BY sep.

WRITE / c5.

The output looks like this:

Summerholiday

Sum - mer - holi - day

In c1 to c5, the trailing blanks are ignored. The separator sep retains them.

thanks

mrutyun^