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

sorting data for required days

Former Member
0 Likes
380

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.

3 REPLIES 3
Read only

yogendra_bhaskar
Contributor
0 Likes
358

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

Read only

Former Member
0 Likes
358

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

Read only

former_member196280
Active Contributor
0 Likes
358

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