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: 

selection based on date

Former Member
0 Kudos

i have to select data from covp table based on posting date instead of fiscal year as per my requirement . How do i give that in the where clause ?

select kokrs belnr buzei perio

wogbtr lednr objnr gjahr

wrttp versn kstar owaer budat

from covp into table i_covp

where kokrs = i_prps-pkokr and lednr = '00' and

objnr = i_prps-objnr and

gjahr ge yprevyear and

wrttp = '04' and versn = '000'

and kstar not in s_kstar.

I have to remove gjahr ge yprevyear and give posting date .

Say if the year is 2007 then i have to use dates from sep 1st 2006 to aug 31st 2007 and so on.

I appreciate your responses.

1 ACCEPTED SOLUTION

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this and build selection screen for GJAHR.


tables: covp.

parameters: p_gjahr like covp-gjahr.

ranges: r_budat for covp-budat.

r_budat-sign = 'I'.
r_budat-option = 'BT'.
r_budat-low(4) = p_gjahr - 1.
r_budat-low+4(4) = '0901'.
r_budat-high(4) = p_gjahr.
r_budat-high+4(4) = '0831'. 
append r_budat.

select kokrs belnr buzei perio
wogbtr lednr objnr gjahr
wrttp versn kstar owaer budat
from covp into table i_covp
where kokrs = i_prps-pkokr and lednr = '00' and
objnr = i_prps-objnr and
budat in r_budat and                        "Change here
wrttp = '04' and versn = '000'
and kstar not in s_kstar.

Regards,

Ferry Lianto

5 REPLIES 5

Former Member
0 Kudos

I answered this in an earlier post. You get the relationship in table T009B.

Rob

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this and build selection screen for GJAHR.


tables: covp.

parameters: p_gjahr like covp-gjahr.

ranges: r_budat for covp-budat.

r_budat-sign = 'I'.
r_budat-option = 'BT'.
r_budat-low(4) = p_gjahr - 1.
r_budat-low+4(4) = '0901'.
r_budat-high(4) = p_gjahr.
r_budat-high+4(4) = '0831'. 
append r_budat.

select kokrs belnr buzei perio
wogbtr lednr objnr gjahr
wrttp versn kstar owaer budat
from covp into table i_covp
where kokrs = i_prps-pkokr and lednr = '00' and
objnr = i_prps-objnr and
budat in r_budat and                        "Change here
wrttp = '04' and versn = '000'
and kstar not in s_kstar.

Regards,

Ferry Lianto

0 Kudos

thanks for the reply ... I will even try with t009 and one more thing i have to get period based on posting date . If it is september i have to give period in i_covp as 1 and for oct i have to give 2 and so on .

loop at i_covp.

  • i have to get month in budat and calculate new period

i_covp-perio = new period.

append i_covp.

endloop.

how do i do that ? i appreciate very much for your valuable time

0 Kudos

just hard coding it with the case statement or any other easy way .

ferry_lianto
Active Contributor
0 Kudos

Hi,

You can use case statement to assign period based on posting date.

Regards,

Ferry Lianto