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: 

how to display monthly calendar in smartform

Former Member
0 Kudos
679

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
472

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)

12 REPLIES 12

Former Member
0 Kudos
472

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

0 Kudos
472

hi,

I am not looking for current date .

am looking for all the dates for the given month and year .

Former Member
0 Kudos
473

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)

0 Kudos
472

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

0 Kudos
472

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

0 Kudos
472

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 .

0 Kudos
472

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

0 Kudos
472

Hi

its working .

thanks for your help.

gaurav_tripathi3
Explorer
0 Kudos
472

Hi Indira,

           I tested given logic by Mr. Sailesh its working as per your requirment.

         

Thanks

Gaurav

0 Kudos
472

hi,

May look at calender table(e.g. TFACD).

You can use select statments and take  your want .

regards.

0 Kudos
472

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.

0 Kudos
472

Hi,

Try This FM : DAY_ATTRIBUTES_GET.

It will give entire month details which day the month begins and other details etc...