2012 Oct 11 5:08 AM
hi all,
I am new to Smartform .
I need to display monthly calendar in smartform .
I had created the template but i dont know how to populate the dates in that corressponding to the day for a given month and year .
Please help me.
thanks in advance.
regards,
Indira.
2012 Oct 11 5:57 AM
Hi Abapers,
Clearly i would like to explain my requirement .
I want to design a layout with smartform. layout should be like calender( mon-sunday. and 1-30) so many cells(rows and columns) are needed .one month may be start from monday and nother one start from with another week.how to put the data in appropriate box(mon-sun)
2012 Oct 11 5:22 AM
Hi indira,
If u wont current date ,month and year .
just drag sy-datum (All system variables store syst table)
if wont any information just send aravind.myname@gmail.com i'll replay
Thanks
Nagaraju.T
2012 Oct 11 5:35 AM
hi,
I am not looking for current date .
am looking for all the dates for the given month and year .
2012 Oct 11 5:57 AM
Hi Abapers,
Clearly i would like to explain my requirement .
I want to design a layout with smartform. layout should be like calender( mon-sunday. and 1-30) so many cells(rows and columns) are needed .one month may be start from monday and nother one start from with another week.how to put the data in appropriate box(mon-sun)
2012 Oct 11 1:25 PM
Hi Indira,
You can use the variable of type sy-datum then u can assing the requird month and year to it.
initialize it to first day of that month.
then u can module it by 7.
depending on the remainder value , u can assig it to respective day.
example.
DATA: offst TYPE i,
date TYPE d.
date+6(2) = '01'. "First day of the month
date+0(4) = p_year. "Given Year
date+4(2) = p_month. "Given Month
WHILE date+4(2) = p_month.
offst = ( date ) MOD 7.
CASE offst.
WHEN 1.
* Assing it to sunday column.
WHEN 2.
* Assing it to monday column.
WHEN 3.
* Assing it to Tuesday column.
WHEN 4.
* Assing it to Wednesday column.
WHEN 5.
* Assing it to Thursday column.
WHEN 6.
* Assing it to Friday column.
WHEN 0.
* Assing it to Satday column.
ENDCASE.
date = date + 1.
ENDWHILE.
the above code can be wriiten in the program lines for that window or folder.
Hoping you will get what u required.
Regards
sailesh
2012 Oct 12 7:45 AM
Hi Indira ,
Just follow the sailesh abap code its perfectly work .
or
go through this link for exactly code what do u want.
http://scn.sap.com/thread/3249922
If u have any q's let me know
Regards
Mahesh
2012 Oct 12 8:42 AM
Hi,
i tried with your code.
but i dont know how to differ the positioning of each date on corressponding days dynamically.
sample
if 1 comes on sunday and 8 also comes on sunday .
i dont know how to give it in smartform .
2012 Oct 12 8:55 AM
Hi Indira,
Let me get explain abt ur requirement.
As per u
You have a table which is has a line type of seven coloumns and each column represents each day of week. and it is assumed that week starts with sunday.
If the Above assumption is true.
then
the code will be rewritten as:
WHILE date+4(2) = p_month.
offst = ( date ) MOD 7.
CASE offst.
WHEN 1.
* Assing it to sunday colomn/field of work area.
* Append the work area to table .
*Clear the work area.
WHEN 2.
* Assing it to monday colomn/field of work area.
WHEN 3.
* Assing it to Tuesday colomn/field of work area.
WHEN 4.
* Assing it to Wednesday colomn/field of work area.
WHEN 5.
* Assing it to Thursday colomn/field of work area.
WHEN 6.
* Assing it to Friday colomn/field of work area.
WHEN 0.
* Assing it to Satday colomn/field workarea.
ENDCASE.
date = date + 1.
ENDWHILE.
Hoping this will work this time....
If not please revert back.
Regards
sailesh
2012 Oct 15 5:39 AM
2012 Oct 12 7:09 AM
Hi Indira,
I tested given logic by Mr. Sailesh its working as per your requirment.
Thanks
Gaurav
2012 Oct 12 8:32 AM
hi,
May look at calender table(e.g. TFACD).
You can use select statments and take your want .
regards.
2012 Oct 12 8:43 AM
Use this FM , AC_BUILD_CALENDAR . You will get the calendar values and week days in the format and print it in your template for calendar.
2012 Oct 12 12:02 PM
Hi,
Try This FM : DAY_ATTRIBUTES_GET.
It will give entire month details which day the month begins and other details etc...