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 query

Former Member
0 Likes
791

Hi,

Can this select statement be changed with removing endselect.

SELECT partner INTO t_db_pos_match-partner

FROM ekun

WHERE dr_license = t_bp_obj-act-ekun-dr_license

AND partner NE t_bp_obj-act-ekun-partner.

SORT t_db_pos_match BY partner.

READ TABLE t_db_pos_match WITH KEY

partner = t_db_pos_match-partner BINARY SEARCH.

IF sy-subrc NE 0.

t_db_pos_match-match_type = '2'.

APPEND t_db_pos_match.

ELSE.

CLEAR: t_db_pos_match.

ENDIF.

ENDSELECT.

Please reply me.

Thanks,

Binay.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
760

You should be able to read all the entries you are currently getting from the SELECT directly into an internal table and then loop through it and do the further processing then.

Rob

5 REPLIES 5
Read only

Former Member
0 Likes
761

You should be able to read all the entries you are currently getting from the SELECT directly into an internal table and then loop through it and do the further processing then.

Rob

Read only

Former Member
0 Likes
760

Hi,

try using the following code.

**********************************************************************

data t_temp like t_db_pos_match.

SELECT partner INTO corresponding fields of table t_temp

FROM ekun

WHERE dr_license = t_bp_obj-act-ekun-dr_license

AND partner NE t_bp_obj-act-ekun-partner.

loop at t_temp.

SORT t_db_pos_match BY partner.

READ TABLE t_db_pos_match WITH KEY

partner = t_temp-partner BINARY SEARCH.

IF sy-subrc NE 0.

t_temp-match_type = '2'.

APPEND t_temp to t_db_pos_match.

ELSE.

CLEAR: t_temp.

ENDIF.

endloop.

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
760

Hi,


SELECT partner INTO CORRESPONDING FIELDS OF TABLE t_db_pos_match-partner
FROM ekun
WHERE dr_license = t_bp_obj-act-ekun-dr_license
AND partner NE t_bp_obj-act-ekun-partner ORDER BY partner. "sort done by ORDER BY addition

*SORT t_db_pos_match BY partner. " TSort can also be done out side SELECT for that remove ORDER BY in above query
loop at t_db_pos_match where match_type <> '2'. " Delete where match_type not equal to 2.
delete t_db_pos_match.
endloop.

Regards,

Sesh

Read only

Former Member
0 Likes
760

Hi Binay,

first get all the data into internal table,

if t_bp_obj [] is not initial.

select partner from ekun into table it_part for all entries in t_bp_obj where dr_license = t_bp_obj-act-ekun-dr_license

AND partner NE t_bp_obj-act-ekun-partner.

now u have data in it_part.

sort it_part by partner.

loop at it_part.

READ TABLE t_db_pos_match WITH KEY

partner = it_part-partner BINARY SEARCH.

IF sy-subrc NE 0.

it_part-match_type = '2'.

APPEND it_part.

ELSE.

CLEAR: it_part.

ENDIF.

please reward points to all helpful answers

kiran.M

Read only

Former Member
0 Likes
760

Hi

yes

SELECT partner

INTO <u><b>table</b></u> t_db_pos_match-partner

FROM ekun

WHERE dr_license = t_bp_obj-act-ekun-dr_license

AND partner NE t_bp_obj-act-ekun-partner.

SORT t_db_pos_match BY partner.

READ TABLE t_db_pos_match WITH KEY

partner = t_db_pos_match-partner BINARY SEARCH.

IF sy-subrc NE 0.

t_db_pos_match-match_type = '2'.

APPEND t_db_pos_match.

ELSE.

CLEAR: t_db_pos_match.

ENDIF.

reward if usefull