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: 

How do I concatenate 2 fields in an Open SQL Select

Former Member
0 Kudos
854

Hi,

I have an internal table (simplified) that looks like this:

BEGIN OF t_konv,

kwert_vprs TYPE kwert,

knumv_kposn type char16,

END OF t_konv.

From an Open SQL Select statement I need to put kwert into kwert and I need to combine knumv and kposn into knumv_kposn.

Here is my select, but I do not know how to specify the last 2 fields as being concatenated into kmunv_kposn in my internal table.

SELECT hkwert hknumv h~kposn

INTO TABLE it_konv

FROM konv AS h

FOR ALL ENTRIES IN it_bil_sal

WHERE h~knumv = it_bil_sal-knumv

AND h~kposn = it_bil_sal-posnr.

Any help is much appreciated!

Thx,

Andy

1 ACCEPTED SOLUTION

Former Member
0 Kudos
45

What happens if you execute the queery as written?

Rob

4 REPLIES 4

Former Member
0 Kudos
46

What happens if you execute the queery as written?

Rob

0 Kudos
45

I get a short dump:

Error analysis

In a SELECT or FETCH command, the field string or internal table

specified in the INTO clause has 9 fields. It must have

at least as many fields as in the SELECT clause,

10 fields in this case.

0 Kudos
45

Do you have to combine both fields into one?

I guess you could select the data into a table with the correct attributes and then copy the table into another table wit the attributes you want. (ITAB1[] = itab2[].)

Rob

0 Kudos
45

Right now, concatenating them is my solution to some other issue, so yea, I'd like to make it work this way, if possible.

That's a thought...I could do as you try. It just sucks that I can't do it in the select...it's so simple in ANSI SQL:

Select fielda || fieldb from...

Thanks alot for your help, Rob.

Andy