Application Development 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: 

Displaying Header for a selected period in report

Former Member
0 Kudos

hi,

I have this query with regard to reports. I am working on a report(Cash Flow Forecast) which requires the output to be dsiplayed in the format of table only for the periods that have been selected in the selection screen. For eg. if June`2005 to Feb`2006 is selected, then in that case only that period report should be displayed. The entire thing is getting displayed in my report.

The only issue is, now I want to have headers for every month. Like, for June`2005, it should display June`2005 on top of it...then July`2005 and so on so forth till Feb`2005.

Can someone please suggest me ways to do incorporate it in my report?

an earliest reply wud be highly appreicated in this case.

Regards,

Ravi

1 ACCEPTED SOLUTION

hymavathi_oruganti
Active Contributor
0 Kudos

select-options: s_date for ........

select ......... from ......

where date in s_date.

for top of page

write: 'From ', s_date-low, 'to', s_date-high.

10 REPLIES 10

Former Member
0 Kudos

Hi

You should use an internal table to display your data and this table should have the period as key (main) field where period is year and month.

DATA: BEGIN OF ITAB OCCURS 0,

PERIOD(6) TYPE N,

.......

END OF ITAB.

While filling the table:

CONCATENATE <YEAR> <MONTH> INTO ITAB-PERIOD.

....

APPEND ITAB.

SORT ITAB BY PERIOD.

Now when the period is changing you print a new page.

Max

Former Member
0 Kudos

Hi Ravi,

Firstly, if the period of selection is say 'June 2005 to Feb 2006', why is that you are getting all data? Shows, your select statement is not considering the period entered in selection-screen.

Secondly, if you want the Header to display the Month as 'June 2006', you first sort your output internal table, and while looping check if month has changed(you can use FM (CACS_DATE_GET_YEAR_MONTH, to get month number and year) for this, and on new month, display the Header.

Regards,

Raj

0 Kudos

Hi Raj,

No, I am not getting the entire data. What I meant to say was, I am getting the data for the entire selected period. Sorry, if my statement mislead you.

However, my query remains still unresolved.

The issue is that, I want for every column the respective Month'Year format should be displayed.

Like June`2005...July`2005..AUgust'2005 and so on so forth till the time period selected in the selection screen.

I guess, now you are able to figure out what actually I want. Sorry, if my previous query was not clear to you.

Regards,

Ravi

0 Kudos

Hi Raj,

My query remains still unresolved.

The issue is that, I want for every column the respective Month'Year format should be displayed.

Like June`2005...July`2005..AUgust'2005 and so on so forth till the time period selected in the selection screen.

I guess, now you are able to figure out what actually I want. Sorry, if my previous query was not clear to you.

Waiting for a solution ...!

Regards,

Ravi

0 Kudos

Hi,

try s.th. like that:

PARAMETERS  start LIKE sy-datum DEFAULT '20050601'.
PARAMETERS  end   LIKE sy-datum DEFAULT '20060201'.
DATA month(15).
DATA z(5) type n.
DATA hdate TYPE sy-datum.

CALL FUNCTION 'HR_PT_GET_MONTHS'
     EXPORTING
          first_date        = start
          second_date       = end
          modify_interval   = 'P'
     IMPORTING
          duration          = z
     EXCEPTIONS
          invalid_seq_dates = 1
          OTHERS            = 2.

hdate = start.

DO z TIMES.
  IF hdate+4(2) > 12.
    hdate+4(2) = 1.
    ADD 1 TO hdate(4).
  ENDIF.

  SELECT SINGLE ltx  FROM  t247 INTO month
         WHERE  mnr  = hdate+4(2)
          AND  spras = sy-langu.

  CONCATENATE month hdate(4) INTO month SEPARATED BY space.
  WRITE: month.

  ADD 1 TO hdate+4(2).
ENDDO.

Andreas

Former Member
0 Kudos

What do you mean by by "The entire thing is getting displayed in my report" ??

if you mean total records irrespective of selection screen dates ,then in the SELECT statement you have add these SELECT-OPTION value also in WHERE condition. then you will get only records for that particular period.

check this & if this hasnt resolve your issue,pl clearly write your problem

regards

srikanth

0 Kudos

Thanks for your valuable input. However, my query remains still unresolved.

The issue is that, I want for every column the respective Month'Year format should be displayed.

Like June`2005...July`2005..AUgust'2005 and so on so forth till the time period selected in the selection screen.

I guess, now you are able to figure out what actually I want. Sorry, if my previous query was not clear to you.

Regards,

Ravi

hymavathi_oruganti
Active Contributor
0 Kudos

select-options: s_date for ........

select ......... from ......

where date in s_date.

for top of page

write: 'From ', s_date-low, 'to', s_date-high.

0 Kudos

Hi Hymavathi,

Thanks for your valuable input. However, my query remains still unresolved.

The issue is that, I want for every column the respective Month'Year format should be displayed.

Like June`2005...July`2005..AUgust'2005 and so on so forth till the time period selected in the selection screen.

I guess, now you are able to figure out what actually I want. Sorry, if my previous query was not clear to you.

Regards,

Ravi

0 Kudos

hi,

i donno whether there is any direct fn module or else

u can use case

ex date is 01/01/2005

concatenate date(3) date(4) somedate

case somedate.

when 01.

jan

......

endcase.

and if u want in each column, u add it in itab which u r displaying