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

hi

former_member155436
Participant
0 Likes
720

Hi Experts,

I am getting one amount field between two dates.But i need for a particular year i need to calculate amount.It will use in the next steps.

For example,

Loop at itab where w_date bt two dates.

a = a + b.

endloop.

i need the amount 'a' to particular year.

Urgent!!!!!

Hi Experts,

I am getting one amount field between two dates.But i need for a particular year i need to calculate amount.It will use in the next steps.

For example,

Loop at itab where w_date bt two dates.

a = a + b.

endloop.

i need the amount 'a' to particular year.

Urgent!!!!!

7 REPLIES 7
Read only

Former Member
0 Likes
695

Extract the year according your date format and put it in the condition:

if the date format is 'DD.MM.YYYY'.

Loop at itab where w_date+6(4) bt two year.

a = a + b.

endloop.

Read only

Former Member
0 Likes
695

Hi

Get the first 4 characters of the date field which gives the year.

segregate the date into two years.or you can use Fiscal year field in most of the FI tables for this.

or take the posting date and from it take the year and seggregate the amounts.

in the loop.

if date+0(4) = year1.

amount = a.

else.

amount = b.

endif.

endloop.

rewar points if useful

regards

Anji

Read only

0 Likes
695

Actually i am calculating the amount between two dates.

for example 01.01.2003 to 03.05.2008 .here I need like

amount for 2003

and amount for 2004............till 2008.Individually i want.

have u understand.......?

Read only

Former Member
0 Likes
695

HI..

Say..ur date is '4th April,2007' and your years are 2007 and 2008.

<b>data:</b>

w_low like sy-datum,

w_high like sy-datum.

w_low = '01.01.2007'. * ur systems date format..

w_high = '01.01.2008'.

loop at itab whee <b>p_date between w_low and w_high.</b>

a = a+ b.

endloop.

write: a.

Read only

0 Likes
695

Hi Rammohan ,

Actually i am calculating the amount between two dates.

for example 01.01.2003 to 03.05.2008 .here I need like

amount for 2003

and amount for 2004............till 2008.Individually i want.

have u understand.......?

Read only

Former Member
0 Likes
695

hi,

check the snippet once

code]parameters : val(30) type c.

data : final(30) type c,

cnt type i,

v type c,

n type i.

cnt = strlen( val ).

do cnt times.

move val+n(1) to v.

if v ca '.0123456789'. "Bring in the values

move v to final+n(1).

*elseif v = ',' or v = '$'. "<---no need of this

*continue. "<----no need

endif.

n = n + 1.

enddo.

condense final no-gaps.

write:/ final .[/code]

regards

Read only

Former Member
0 Likes
695

Hi Lava ,

First u have to find out how many years are there for a given date range:

inpot = 01.01.2007 -31.12.2009.

here u have to get 3 years data

2007 = 10

2008 = 20

2009 = 30.

for this , u have to bulit year tables:make use this fm CSCP_PARA1_GET_PERIODS.

or any FM which gives no of years.

2.then u have to loop to get the sum.

loop at year.

loop at itab where date+0(4) = year-year.

a = a + itab-amount.

endloop.

modify year.

endloop.

Regards

Prabhu