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

Query about SELECT...WHERE...

Former Member
0 Likes
637

Hi Guys,

Having my sample code below, is it just possible to use as a parameter of the where clause the value taken from internal table i_tc21?? If this is the a wrong logic, please tell how am i going to do it? Thanks a lot always...

IF sy-subrc eq 0 AND i_crhd[] is NOT INITIAL.

SELECT vgwts

par01

par02

par03

par04

par05

par06

FROM tc21 INTO CORRESPONDING FIELDS OF TABLE i_tc21

FOR ALL ENTRIES IN i_crhd

WHERE vgwts = i_crhd-vgwts.

IF sy-subrc eq 0 AND i_tc21[] is NOT INITIAL.

SELECT SINGLE txt

FROM tc20t INTO v_txt1

FOR ALL ENTRIES IN i_tc21

WHERE parid = i_tc21-par01

AND spras = c_en.

ENDIF.

ENDIF.

4 REPLIES 4
Read only

Former Member
0 Likes
600

There is nothing wrong in your code.It will work.

Read only

0 Likes
600

Thanks Rengith...

If there are multiple entries in table i_tc21, will it read everything in that internal internal table before ending the Select statement??

Thanks a lot!

Read only

0 Likes
600

Hi,

FOR ALL ENTRIES doesn't work with select single.

Regards,

Sipra

Read only

0 Likes
600

Thanks...

Is there any way to shorten the code below??

What if the i_tc21 has multiple values,,, how am i going to pass every entry of the internal table to the select statement??

Thanks a lot!

Thanks a lot!

IF sy-subrc eq 0 AND i_tc21[] is NOT INITIAL.

SELECT txt

FROM tc20t INTO v_txt1

FOR ALL ENTRIES IN i_tc21

WHERE parid = i_tc21-par01

AND spras = c_en.

IF sy-subrc eq 0.

  • do nothing

ENDIF.

SELECT txt

FROM tc20t INTO v_txt2

FOR ALL ENTRIES IN i_tc21

WHERE parid = i_tc21-par02

AND spras = c_en.

IF sy-subrc eq 0.

  • do nothing

ENDIF.

SELECT txt

FROM tc20t INTO v_txt3

FOR ALL ENTRIES IN i_tc21

WHERE parid = i_tc21-par03

AND spras = c_en.

IF sy-subrc eq 0.

  • do nothing

ENDIF.

SELECT txt

FROM tc20t INTO v_txt4

FOR ALL ENTRIES IN i_tc21

WHERE parid = i_tc21-par04

AND spras = c_en.

IF sy-subrc eq 0.

  • do nothing

ENDIF.

SELECT txt

FROM tc20t INTO v_txt5

FOR ALL ENTRIES IN i_tc21

WHERE parid = i_tc21-par05

AND spras = c_en.

IF sy-subrc eq 0.

  • do nothing

ENDIF.

SELECT txt

FROM tc20t INTO v_txt6

FOR ALL ENTRIES IN i_tc21

WHERE parid = i_tc21-par06

AND spras = c_en.

IF sy-subrc eq 0.

  • do nothing

ENDIF.

ENDIF.