Skip to Content
author's profile photo Former Member
Former Member

Period totals

Hi Gurus,

I have the following requirement where I'm stuck.

I have an internal table with the following fields and sample data.

it_temp:

bukrs hkont kostl kosar gjhar monat actual plan

1100 71100 120325 F 2007 01 100.00 100.00

1100 71100 120326 F 2007 02 0.00 100.00

1100 71100 120327 F 2007 03 100.00 100.00

1100 71100 120328 F 2007 04 100.00 100.00

1100 71100 120329 F 2007 05 10.00 100.00

1100 71100 130325 V 2007 01 100.00 100.00

1100 71100 130326 V 2007 02 100.00 100.00

1100 71100 130327 V 2007 03 100.00 100.00

I have a select option S_MONAT to enter the monat range from 01 to 12 which is basically the months.

S_MONAT is an obligatory field. Report is run only for ONE year.

Two possible ways of entry:

1. If user enters only say S_MONAT-LOW = 03, I set S_MONAT-LOW = 01 and S_MONAT-HIGH = 03.

2. If user enters a range say S_MONAT- LOW = 02 and S_MONAT-HIGH = 05, it stays the same.

Now what I need is to get the period actual amounts and year-to-date amounts in another table it_alv.

it_alv:

bukrs kosar mactual mplan year-to-date-actual year-to-date-plan

Case1: User enters only S_MONAT-LOW = 03

In this case mactual, mplan would correspond to the record with monat = '03'

year-to-date would be sum of mactual01 mactual02mactual03 and mplan01mplan02mplan03

Case2: User enters S_MONAT-LOW = 04 and S_MONAT-HIGH = 06 i.e second quarter of 2007.

In this case mactual = mactual04mactual05mactual06 and likewise for mplan.

year-to-date-actual would be from MONAT = 01 to S_MONAT-HIGH, which here is S_MONAT-HIGH = 06

year-to-date-actual = mactual01 mactual02.....+mactual06.

Can anyone help me out with coding this? Points for sure!

Thanks,

MJ.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 17, 2008 at 02:16 PM

    Hi Mjay,

    Just define a RANGE for MONAT as well. Use the logic you have described to fill the RANGE instead of the select-option. Herewith you can decide what to do when calculating the totals.

    Regards,

    John.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.