‎2013 Mar 06 5:53 AM
hi,
i need to get data of required field(say, STPO-MENGE) for first 30days from posting date.
i have got the posting date from MKPF-budat.i have joined both the tables with a common table field.
what my requirement is to get first 30days data of MENGE in output.
could any one plz provide me a sample coding.
‎2013 Mar 06 6:44 AM
Hi Srikanth ,
see the sample code for your help ,
PARAMETERS : p_date TYPE mkpf-budat.
DATA : it_mkpf TYPE STANDARD TABLE OF mkpf.
data : l_date TYPE mkpf-budat.
l_date = p_date + 30.
select * FROM mkpf INTO TABLE it_mkpf WHERE budat BETWEEN p_date and l_date.
Regards ,
Yogendra Bhaskar
‎2013 Mar 06 8:01 AM
Hi,
Use Ranges to fetch data from one date to another date. You can also use select options.
Eg.
ranges : r_date for mkpf-budat.
Posting date = todays date.
r_date-low = Posting date - 30
r_date-high = Posting date.
r_date-sign = 'I'
r_date-option = 'BT'
select * from STPO into table itab where ANDAT in R_DATE.
Hope this helps.
Thanks,
Tooshar Bendale
‎2013 Mar 06 8:54 AM
Use function module RP_CALC_DATE_IN_INTERVAL to get the interval and then use between along with your select statement.
Example:
Call FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
Exporting
date = mkpf-budat
days = '30'
months = '0'
signnum = '-' "+
years = '0'.
IMPORTING
calc_date = lv_30days
***Where budat between mkpf-budat and lv_30days.
I guess, this can help you to resolve your issue.
Regards,
SaiRam