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 duplicates

Former Member
0 Likes
936

Hi experts,

I want to select those function names from table fupararef where all the given parameters are existing.

I use this selection:

SELECT * FROM fupararef

INTO TABLE i_list

WHERE parameter = 'I_RLTYP' OR

parameter = 'I_AKTYP'.

I need only those function names where all two parameters existing, so if it is only 1 of the two is existing I don't need that anymore.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
892

SELECT * FROM fupararef
INTO TABLE i_list
WHERE parameter = 'I_RLTYP'.

SELECT * FROM fupararef
INTO TABLE i_list2
WHERE parameter = 'I_AKTYP'.

loop at i_list.
  read table i_list2 with key funcname = i_list-funcname.
  if sysubrc = 0.
    append i_list to i_list_final.
  endif.
endloop.

Edited by: Florian Kemmer on May 28, 2009 12:28 PM

9 REPLIES 9
Read only

Former Member
0 Likes
893

SELECT * FROM fupararef
INTO TABLE i_list
WHERE parameter = 'I_RLTYP'.

SELECT * FROM fupararef
INTO TABLE i_list2
WHERE parameter = 'I_AKTYP'.

loop at i_list.
  read table i_list2 with key funcname = i_list-funcname.
  if sysubrc = 0.
    append i_list to i_list_final.
  endif.
endloop.

Edited by: Florian Kemmer on May 28, 2009 12:28 PM

Read only

0 Likes
892

just replace the OR with AND...

wont that solve ur case??

Read only

Former Member
0 Likes
892

SELECT * FROM fupararef

INTO TABLE i_list

WHERE (parameter = 'I_RLTYP' AND parameter = 'I_AKTYP').

Read only

Former Member
0 Likes
892

Hi,

Use like this

SELECT DISTINCT * FROM fupararef INTO TABLE i_list

WHERE ( parameter = 'I_RLTYP' OR parameter = 'I_AKTYP' ).

Regards,

Vijay

Read only

Former Member
0 Likes
892

Hi

Try This:

SELECT *

FROM FUPARAREF

WHERE parameter EQ 'I_RLTYP'

AND parameter EQ 'I_AKTYP'.

Sometimes = sign acts as an assignment operator and hence leads to retrival of records which are not expected, so it is always prefrable to make use of EQ, NE, GT, LT, etc in where as well as in IF conditions.

Regards

Gaurav.

Read only

0 Likes
892

Hi ,

you can use the following code



select fieldname 
from table name
into internal_table
where field in ('value1','value2').

or you can use a ranges table



ranges: r_range for table-fieldname.

r_range-sign = 'I'.
r_range-option = 'EQ'.
r_range-low = 'value1'.
append r_range. clear r_range.


r_range-sign = 'I'.
r_range-option = 'EQ'.
r_range-low = 'value2'.
append r_range. clear r_range.

select fieldname 
from table name
into internal_table
where field in range.

Regards,

Abdullah

Read only

Former Member
0 Likes
892

you could try something like this

SELECT funcname FROM fupararef
INTO TABLE i_list WHERE parameter = 'I_RLTYP'
AND funcname IN ( SELECT funcname FROM fupararef WHERE parameter =
'I_AKTYP' ).

Read only

Former Member
0 Likes
892

hi ,

try this

DATA : i_list TYPE TABLE OF fupararef WITH HEADER LINE,

i_list_tmp TYPE TABLE OF fupararef,

w_list LIKE LINE OF i_list_tmp.

SELECT DISTINCT * FROM fupararef INTO TABLE i_list

WHERE ( parameter = 'INTERNAL_ERROR' OR parameter = 'SEND_ERROR' ).

IF sy-subrc = 0.

APPEND LINES OF i_list TO i_list_tmp .

SORT i_list_tmp BY funcname r3state parameter paramtype.

DELETE ADJACENT DUPLICATES FROM i_list_tmp COMPARING funcname.

LOOP AT i_list_tmp INTO w_list .

READ TABLE i_list INTO w_list WITH KEY funcname = w_list-funcname

parameter = 'I_RLTYP' .

IF sy-subrc = 0.

READ TABLE i_list INTO w_list WITH KEY funcname = w_list-funcname

parameter = 'I_AKTYP'.

IF sy-subrc NE 0.

DELETE i_list WHERE funcname = w_list-funcname.

ENDIF.

ELSE.

DELETE i_list WHERE funcname = w_list-funcname.

ENDIF.

ENDLOOP.

REFRESH i_list_tmp.

clear : w_list,i_list.

ENDIF.

kindly give points if u find it useful.

Read only

Former Member
0 Likes
892

Thanks