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: 

nested select

Former Member
0 Kudos
84

Hi friends,

SELECT objectclas objectid changenr udate utime username FROM cdhdr

INTO (cdhdr-objectclas, cdhdr-objectid, cdhdr-changenr,

cdhdr-udate, cdhdr-utime, cdhdr-username)

WHERE objectclas = 'CLASSIFY'

AND objectid = x_objectid.

  • ophalen nieuwe nieuwe waarde karakteristiek

SELECT tabkey value_new FROM cdpos

INTO (cdpos-tabkey, cdpos-value_new)

WHERE objectclas = cdhdr-objectclas

AND objectid = cdhdr-objectid

AND changenr = cdhdr-changenr

AND fname = 'ATWRT'.

  • karakteristiek ophalen

*Begin of modification TCS196699 - BV898.

  • SELECT SINGLE atnam FROM cabn INTO cabn-atnam

  • WHERE atinn = cdpos-tabkey+20(8).

SELECT atnam FROM cabn INTO cabn-atnam

UP TO 1 ROWS

WHERE atinn = cdpos-tabkey+20(8).

ENDSELECT.

*End of modification TCS196699 - BV898.

IF sy-subrc <> 0.

CLEAR cabn.

ENDIF.

zbtch_class_char-matnr = p_matnr.

zbtch_class_char-werks = p_werks.

zbtch_class_char-charg = p_charg.

zbtch_class_char-atnam = cabn-atnam.

zbtch_class_char-changenr = cdhdr-changenr.

zbtch_class_char-udate = cdhdr-udate.

zbtch_class_char-utime = cdhdr-utime.

zbtch_class_char-username = cdhdr-username.

zbtch_class_char-value_new = cdpos-value_new.

MODIFY zbtch_class_char.

ENDSELECT.

ENDSELECT.

i want to improve the performane to the above code . How i can change the inside select query for better performance.Please help me.

Thanks for all.

5 REPLIES 5

Former Member
0 Kudos
43

Hi,

use inner join like the example shown below.for that the tables being joined should cotain some relation.

SELECT BBUTTON ABUTTON_TEXT INTO (BUTT,BUTT_TEXT) FROM ZTMW_BUTTONS_TYP AS A

INNER JOIN ZTMW_BUTTON_GRP AS B ON BBUTTON = ABUTTON AND BTMW_IMPL = ATMW_IMPL

INNER JOIN ZTMW_WRKBNCH_TAB AS C ON CBUTTON_DIS_GRP = BBUTTON_DIS_GRP AND CTMW_IMPL = BTMW_IMPL

WHERE CWORK_BENCH_TAB = TAB_NUM AND CTMW_IMPL = IMPL.

rgds,

bharat.

Former Member
0 Kudos
43

hi bharat,

plz go through your code again....

as <b>cabn </b> cant be used join condition and there is no relation between cabn and cdhdr you need to use <b>for all entries</b> while firing the query.

Try to avoid the nested select statemnts in ur programs as it will make some performance issue and also for large data the query gives the dumps.

regards,

sachin

plz reward if useful

Former Member
0 Kudos
43

hi

good

1-Use Move Corresponding with all the select statement.

thanks

mrutyun^

Former Member
0 Kudos
43

Hi,

Use internal tables to populate the data. remove select endselect statements. Instead, use

select -


from cdhdr into corresponding fields of table itab where ---.

then in second select statement, write,

select -


from cdpos into coreesponding fields of table itab1 for all entries in itab where objectclas = itab-objectclas.

Use this method for other select statements as well. Use F1 help to find exact syntax of the statement if you dont get the syntax,

Pls reward points if helpful.

Karan

Former Member
0 Kudos
43

Hey bharath,

You are using horrible nested selectstatement. it will take lot of time for execution. Try with the above solution by using innerjoin.

Reply for queries. Shall post the updates.

Regards,

Kumar.