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: 

how to write the where clause base on the user entered input on dynamic ss

Former Member
0 Kudos

Hi experts,

The report is using dynamic selection screen, here the user is asked to enter the parameters and they are collected in one intenal table say i_to_cond,in the program.

now my problem is, this report retrives the data from the BW cube,the select stmt is already there (now i have to get the data from this BW cube based on the user entered parameters) which the present select stmt id not doing.

can any one please help me in writing the "where clause" for the select stmt

regards,

vara

2 REPLIES 2

Former Member
0 Kudos

Hi

Please check the below code and write your own logic as per your requirment.

DATA: where_clause TYPE string.

  • Get whear clause

CLEAR where_clause.

CONCATENATE 'KAPPL = P_KAPPL AND'

'KSCHL = P_KSCHL'

INTO where_clause

SEPARATED BY space.

LOOP AT it_vakey_fields.

*Get whear clause

CONCATENATE where_clause 'AND'

INTO where_clause

SEPARATED BY space.

  • Getting the table and field name.

text1+0(it_vakey_fields-fieldlen) =

it_data-vakey+it_vakey_fields-offset(it_vakey_fields-fieldlen).

  • Getting the table and field name.

CONCATENATE single_quote

text1+0(it_vakey_fields-fieldlen)

single_quote

INTO text2.

  • Get where clause

CONCATENATE where_clause

it_vakey_fields-fieldname

'='

text2

INTO where_clause

SEPARATED BY space.

ENDLOOP.

  • Dynamic select with dynamic where clause

CLEAR cond_rec_exists.

SELECT SINGLE kappl

INTO kappl_temp

FROM (v_cond_table)

WHERE (where_clause).

Regards

Lakshmikanth.T.V

0 Kudos

hi this my select stmt, now tell me how to write a where clause base on the user entered parameters on the dynamic selection screen. please

SELECT s5~/bic/zobjct

s7~/bic/zfield

s8~/bic/zvon

s6~/bic/zbis

s2~/bic/zsecasgnd

s1~/bic/zrpdesc

s4~/bic/zsingpro

s3~/bic/zsimdesc

s9~/bic/zability

s10~/bic/zsecuname

s11~/BIC/ZSYSIDNT "

**FROM

FROM /bic/fzability4 AS f

JOIN /bic/dzability42 AS d2

ON fkey_zability42 EQ d2dimid

JOIN /bic/szrpdesc AS s1

ON d2sid_zrpdesc EQ s1sid

JOIN /bic/szsecasgnd AS s2

ON d2sid_zsecasgnd EQ s2sid

JOIN /bic/dzability43 AS d3

ON fkey_zability43 EQ d3dimid

JOIN /bic/szsimdesc AS s3

ON d3sid_zsimdesc EQ s3sid

JOIN /bic/szsingpro AS s4

ON d3sid_zsingpro EQ s4sid

JOIN /bic/dzability44 AS d4

ON fkey_zability44 EQ d4dimid

JOIN /bic/szobjct AS s5

ON d4sid_zobjct EQ s5sid

JOIN /bic/dzability45 AS d5

ON fkey_zability45 EQ d5dimid

JOIN /bic/szbis AS s6

ON d5sid_zbis EQ s6sid

JOIN /bic/szfield AS s7

ON d5sid_zfield EQ s7sid

JOIN /bic/szvon AS s8

ON d5sid_zvon EQ s8sid

JOIN /bic/dzability4p AS dp

ON fkey_zability4p EQ dpdimid

JOIN /bic/dzability47 AS d7

ON fkey_zability47 EQ d7dimid

JOIN /bic/szability AS s9

ON d7sid_zability EQ s9sid

JOIN /bic/dzability41 AS d1

ON fkey_zability41 EQ d1dimid

JOIN /bic/szsecuname AS s10

ON d1sid_zsecuname EQ s10sid

JOIN /bic/dzability46 AS d6

ON fkey_zability46 EQ d6dimid

JOIN /bic/szsysidnt AS s11

ON d6sid_zsysidnt EQ s11sid

APPENDING TABLE i_profile

**WHERE

WHERE dp~sid_0recordtp EQ 0

  • AND s9~/bic/zability IN w_ability------- Commented by vara24052007.

***************start of Addition .

AND s9~/bic/zability IN w_ability2

AND ( ( s8~/bic/zvon like i_to_cond-low )

OR ( s6~/bic/zbis like i_to_cond-low )

OR ( s8~/bic/zvon EQ c_asteriks )

OR ( s6~/bic/zbis EQ c_asteriks )

OR ( s8~/bic/zvon LE i_to_cond-low

AND s6~/bic/zbis GE i_to_cond-low ) )

******************End of Addition .

AND s10~/bic/zsecuname IN w_tnumber

AND s11~/bic/zsysidnt EQ w_sosy

**GROUP BY

GROUP BY

s1~/bic/zrpdesc

s2~/bic/zsecasgnd

s3~/bic/zsimdesc

s4~/bic/zsingpro

s5~/bic/zobjct

s6~/bic/zbis

s7~/bic/zfield

s8~/bic/zvon

s9~/bic/zability

s10~/bic/zsecuname

s11~/BIC/ZSYSIDNT.