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

please validate my select query with offset

Former Member
0 Likes
1,057

Could you please validate my select query below :

AND kadky+0(4) IN s_gjahr is correct ?

=====================================

SELECT-options:

s_gjahr FOR ckhs-gjahr NO-EXTENSION NO INTERVALS OBLIGATORY DEFAULT sy-datum+0(4).

SELECT bzobj

kalnr

kalka

kadky

tvers

bwvar

kkzma

matnr

werks

feh_sta

FROM keko

INTO TABLE i_keko

FOR ALL ENTRIES IN i_mackw

WHERE matnr = i_mackw-matnr

AND werks = i_mackw-werks

AND kadky+0(4) IN s_gjahr <==

AND ( feh_sta = 'FR'

OR feh_sta = 'VO' )

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
975

the requirement is not date range .

Functional requirement is year range in selection options

like this

s_gjahr FOR ckhs-gjahr NO-EXTENSION NO INTERVALS OBLIGATORY

8 REPLIES 8
Read only

Former Member
0 Likes
975

Does it pass a syntax check?

Rob

Read only

Former Member
0 Likes
975

Not passed syntax check.

My intention is to select records from keko table based on the year entered and also previous to the year entered on the selection screen.

Like

s_gjahr_1 = s_jahr -1.

*-KEKO

SELECT bzobj

kalnr

kalka

kadky

tvers

bwvar

kkzma

matnr

werks

feh_sta

FROM keko

INTO TABLE i_keko

FOR ALL ENTRIES IN i_mackw

WHERE matnr = i_mackw-matnr

AND werks = i_mackw-werks

AND ( kadky+0(4) IN s_gjahr

OR kadky+0(4) IN s_gjahr_1 )

AND ( feh_sta = 'FR'

OR feh_sta = 'VO' )

Read only

0 Likes
975

Replace the values in s_gjahr_1 with wildcard characters (single character wildcard) and take the offset off of kadky.

Rob

Read only

Former Member
0 Likes
975

i am sorry - I did not get you.

kadky is of 'DATS' type.

and I am using year to select records from KEKO-kadky.

Read only

0 Likes
975

Well then, make your SELECT OPTION a date range rather than a year range.

Rob

Read only

Former Member
0 Likes
976

the requirement is not date range .

Functional requirement is year range in selection options

like this

s_gjahr FOR ckhs-gjahr NO-EXTENSION NO INTERVALS OBLIGATORY

Read only

0 Likes
975

You can easily build a date range table from the year SELECT OPTION.

Rob

Read only

Former Member
0 Likes
975

Hi,

Use the below code.

ranges: r_gjahr for ckhs-gjahr.

r_gjahr-low = s_gjahr-low.

r_gjahr-sign = 'I'.

r_gjahr-option = 'EQ'.

append r_gjahr.

r_gjahr-low = s_gjahr-low - 1.

r_gjahr-sign = 'I'.

r_gjahr-option = 'EQ'.

append r_gjahr.

SELECT bzobj

kalnr

kalka

kadky

tvers

bwvar

kkzma

matnr

werks

feh_sta

FROM keko

INTO TABLE i_keko

FOR ALL ENTRIES IN i_mackw

WHERE matnr = i_mackw-matnr

AND werks = i_mackw-werks

AND ( feh_sta = 'FR'

OR feh_sta = 'VO' ).

if sy-subrc = 0.

delete i_keko where not kadky+0(4) IN r_gjahr.

endif.

Regards,

Kumar Bandanadham

Edited by: Velangini Showry Maria Kumar Bandanadham on May 28, 2009 7:37 AM