08-08-2006 8:15 PM
Hi friends,
I have a selection screen where I need to have two fields one for Period(month) and the other for Fiscal year. So I used
parameters : p_lfmon like mbewh-lfmon.
parameters : p_lfgja like mbewh-lfgja.
My requirement is when I execute the program I want to see the current period(08) and Year(2006) in these two fields. And also I was wondering if we can add the input help F4 for these two fields as they dont have one right now.
Finally if I want to compare the these two fields month and year with a field in normal date format (08/25/2006), what is the easiest way to do that.
Waiting for replies. Especially from Rich. Thanks
08-08-2006 8:23 PM
08-08-2006 8:26 PM
For converting to YYYYMMDD format, you will need to decide what day you want to add to it. In this example, I'm defaulting the first day of the period.
report zrich_0001.
data: datum type sy-datum.
parameters: p_spbup type spbup default '200606'.
write:/ p_spbup.
datum = p_spbup.
datum+6(2) = '01'.
write:/ datum.
Regards,
Rich Heilman
08-08-2006 8:28 PM
Hi Rich,
But in this field can we get the current month and year when we execute the program.
For me F4 is not that important.
How can we compare this field to a field like 08/24/2006.
PLease help.
08-08-2006 8:24 PM
Hi raju,
initialization.
p_lfmon = 08.
p_lfgja = 2006.
comparing with another date:
if p_lfgja = date1+4(4).
.
.
endif.
regards ,
keerthi.
08-08-2006 8:38 PM
08-08-2006 8:42 PM
I will try this. Finally Rich, can we get the current period and year into this field when I execute my program. Like sy-datum can we do something at the initialization event to put current period and year in this field. Just think about this. Waiting
08-08-2006 8:43 PM
08-08-2006 8:46 PM
If period means, just current calendar month, then you can do this.
report zrich_0001.
data: datum type sy-datum value '20060806'.
parameters: p_spbup type spbup .
initialization.
p_spbup = sy-datum+0(6).
start-of-selection.
if datum+0(6) = p_spbup.
write:/ datum, 'is in period', p_spbup.
endif.
Regards,
Rich Helman
08-08-2006 8:46 PM
No I dont mean the current(08) period. I mean when I execute my program now it should show 08/2006 and when I execute next month it should show 09/2006. It should go like that........... Sorry for not being clear... thanks
08-08-2006 8:47 PM
08-08-2006 8:49 PM
08-08-2006 8:50 PM
If you need to default the current fiscal period, then you can do this.
report zrich_0001.
data: datum type sy-datum value '20060806'.
parameters: p_spbup type spbup .
initialization.
data: xgjahr type bkpf-gjahr.
data: xpoper type t009b-poper.
call function 'FI_PERIOD_DETERMINE'
exporting
i_budat = sy-datum
i_bukrs = '0010'
importing
e_gjahr = xgjahr
e_poper = xpoper.
concatenate xgjahr xpoper+1(2) into p_spbup.
start-of-selection.
if datum+0(6) = p_spbup.
write:/ datum, 'is in period', p_spbup.
endif.
Regards,
Rich Heilman
08-08-2006 9:00 PM
Rich, whats the difference between the Current calender month and current fiscal period.
08-08-2006 8:47 PM
hey if u want to get the current year into the field then u can declare another field say v_year.
data: cur_year(8).
cur_year = sy-datum.
v_year = cur_year+0(4).
parameters : p_lfmon like mbewh-lfmon value v_year.
08-08-2006 9:45 PM
In finance you have what are called fiscal periods. This is something internal to an origanization in which they split a fiscal(read finance) year to be certain number of periods. Your fiscal year can be starting in March and ending in February. So that is when you close your books, show the earnings etc. Within the fiscal year, you will have lower level units which are your fiscal periods. Again, these fiscal periods need not be starting from the first. It can be starting on the 15th of every calendar month. Also you may have up to 16 periods in a fiscal year (a limitation of SAP).
That is why you always have to be careful about what period and year you are dealing with. You should ask your business owner to tell you if it is fiscal period or calendar month that they are looking for.
In most cases, for simplicity sake, finance decides to use calendar year and months as fiscal year and periods as well.
08-08-2006 10:28 PM
Couldn't have said it better myself, Srinivas. In my system, we have 12 fiscal periods, but they do not run the same as calendar periods, its like 4 or 5 days off, for example period 1 starts on 01/03/2006 and ends the first week in Febuary, and so on. This is why I have given both senarios.
Like Srinivas has suggested, you need to ask the user what they mean by period, fiscal or calendar.
Regards,
Rich Heilman
08-09-2006 11:25 PM