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: 

Table Control

former_member585865
Contributor
0 Kudos

Hi all,

Give me an Idea that I want to populate the day(like for 23 nov as Friday 24 of nov as Saturday) dynamically for every month in table control for time sheet program.Could you suggest me what is the best way to achieve this?

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos

Use this FM to get the day from date

DATE_TO_DAY

Regards,

Naimesh Patel

3 REPLIES 3

naimesh_patel
Active Contributor
0 Kudos

Use this FM to get the day from date

DATE_TO_DAY

Regards,

Naimesh Patel

0 Kudos

Hi Naimesh,

The function module you given is ok .but am using table control with 31 columns for 31 days.tell me how to populate the days(such as mon or tue) like that for 31 days.is there any way to acheive in table control because we can't add pushbutton or label i table control correct me if am wrong.

0 Kudos

There's a couple of questions in there... firstly, it's pretty easy to loop around 31 times to build up an array of dates and day names - see example code below. Secondly, yes you can have buttons in a TC, and also set individual cells to be output so that you can use them as labels. Thirdly, you might find function modules DATE_COMPUTE_DAY & DAY_NAMES_GET give you better results.

Jonathan


report zlocal_jc_sdn_date_loop.

parameters:
  p_start               type sy-datum obligatory default sy-datum,
  p_loop                type sy-loopc obligatory default 31.

start-of-selection.
  perform build_date_list.


*&---------------------------------------------------------------------*
*&      Form  build_date_list
*&---------------------------------------------------------------------*
form build_date_list.

  data:
    begin of ls_date_day,
      date            type sy-datum,
      day             type dtresr-weekday,
    end of ls_date_day,
    lt_date_day       like ls_date_day occurs 0.

  ls_date_day-date = p_start.

  do p_loop times.

    call function 'DATE_TO_DAY'
      exporting
        date    = ls_date_day-date
      importing
        weekday = ls_date_day-day.

    append ls_date_day to lt_date_day.

    add 1 to ls_date_day-date.  "increment date

  enddo.

  format reset.
  format color col_normal.
  loop at lt_date_day into ls_date_day.
    write: / ls_date_day-date, ls_date_day-day, at sy-linsz space.
  endloop.

endform.                    "build_date_list