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

sql select

Former Member
0 Likes
550

Hi,

See the sql below... I would like to make the comparison

t1pallet_id = t2pallet_id+2(18) but it is not possible. Any help?

SELECT *

INTO CORRESPONDING FIELDS OF TABLE i_tab2

FROM t1

INNER JOIN t2

ON t1pallet_id = t2pallet_id

FOR ALL entries IN i_tab

WHERE t2~vbeln = i_tab-vbeln.

3 REPLIES 3
Read only

Former Member
0 Likes
506

You cannot use offsets or substrings in a select.

You may have to load the data in an internal table and then loop at the table to do the comparison, where offset and substrings would be allowed.

If you do, just make sure that itab2 can accomodate both pallet_id fields. You may have to do explicit mapping of fields into i_tab2 in such a case, since one of the pallet fields will have to have a different name, so CORRESPONDING FIELDS won't work.

Good luck

Brian

Read only

Former Member
0 Likes
506

Please avoid inner join

First select data from one table and then use that for other in For ALL Entries

SELECT *

FROM T1

WHERE .........conditions

Temerory table TEMP with field TMP_ID

LOOP AT T1

TEMP-TMP_ID = T1+2(18)

APPEND TEMP.

ENDLOOP

SELECT *

FROM T2

FOR ALL ENTERIS IN TEMP

WHERE ID = TEMP-TEP_ID

Rewards if useful.......................

Minal

Read only

Former Member
0 Likes
506

OK