Skip to Content
avatar image
Former Member

Month wise splitting

Hi,

I did a report to get details of customers based on invoice date. Now I have to modify the report to get month wise splitting of columns based on invoice dates. In the selection screen if the user selects a range of dates for 3 months based on the invoice date i have to get data by month wise like eg...

customer no. may(price) june july

19 100 200 20

20 0 10 300. in this the output should come. how should i write the code to get month wise splitting based on invoice date. Kindly suggest.

regards,

Rakesh

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Oct 21, 2008 at 06:29 AM

    Hi,

    For getting your desired you have to use dynamic internal table.

    where your fields will be based on the date range given.

    Check out saptechnical.com for help in creating dynamic internal table.

    As coding will be huge.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      For example user given date range like 01.01.2007 to 20.05.2008

      we can get month and year by using the fuction module like

      CACS_DATE_GET_YEAR_MONTH.

      if pass 01.01.2007 we will get month like 01.

      if pass 20.05.2008 we will get month like 05.

      define internal table with 12 months

      if you are using ALV bulid the fieldcatalog dynamically .

      lv_var = 05 - 01.

      add 1 to lv_var.

      do lv_var times.

      bulid the fieldcatalog .

      enddo.

      Regards,

      Suresh.

  • avatar image
    Former Member
    Oct 21, 2008 at 07:13 AM

    Hi,

    Then capture the value of month by using offset and use fm 'IDWT_READ_MONTH_TEXT' to get the months name. Then in the field of invoice date...replace the dates by the name of months.

    then sort the table by month and use at end of month to add up the pricing values.....you will have like this...

    customer no date price

    <some value> jan 10.00

    <some value> feb 20.00

    and so on....then create another table the way you want and use case to fill up the values...

    Hope this will help you.

    Regards

    Debarshi

    Add comment
    10|10000 characters needed characters exceeded