Application Development and Automation 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: 
Read only

Reg Funcion module

Former Member
0 Likes
842

Is there any function module to display the date but if the date falls on the weekend then it should display the next available weekday.?

Reply me ASAP.

Regards,

Shobana.

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
807

Look function module DATE_CONVERT_TO_FACTORYDATE, by default it convert a date to factory date.

First parameter CORRECT_OPTION

'+' if the specified date is not a working day,

the first working day after the date is returned.

(default)

Regards

7 REPLIES 7
Read only

Former Member
0 Likes
807

hi,

Try this FM

WEEK_GET_NR_OF_WORKDAYS.

Read only

0 Likes
807

Can u plz explain wat r the parameters need to import n export?

Rgds,

Shobana.

Read only

Former Member
0 Likes
807

Hi,

Use the Function module <b>HOLIDAY_CHECK_AND_GET_INFO</b> Useful for determining whether or not a date is a holiday. Give the function a date, and a holiday calendar, and you can determine if the date is a holiday by checking the parameter HOLIDAY_FOUND.


data: ld_date                 like scal-datum  default sy-datum,
      lc_holiday_cal_id       like scal-hcalid default 'CA',
      ltab_holiday_attributes like thol occurs 0 with header line,
      lc_holiday_found        like scal-indicator.

CALL FUNCTION 'HOLIDAY_CHECK_AND_GET_INFO'
  EXPORTING
    date                               = ld_date
    holiday_calendar_id                = lc_holiday_cal_id
    WITH_HOLIDAY_ATTRIBUTES            = 'X'
  IMPORTING
    HOLIDAY_FOUND                      = lc_holiday_found
  tables
    holiday_attributes                 = ltab_holiday_attributes
  EXCEPTIONS
    CALENDAR_BUFFER_NOT_LOADABLE       = 1
    DATE_AFTER_RANGE                   = 2
    DATE_BEFORE_RANGE                  = 3
    DATE_INVALID                       = 4
    HOLIDAY_CALENDAR_ID_MISSING        = 5
    HOLIDAY_CALENDAR_NOT_FOUND         = 6
    OTHERS                             = 7.

if sy-subrc = 0 and
   lc_holiday_found = 'X'.
  write: / ld_date, 'is a holiday'.
else.
  write: / ld_date, 'is not a holiday, or there was an error calling the function'.
endif.

Regards

Sudheer

Read only

RaymondGiuseppi
Active Contributor
0 Likes
808

Look function module DATE_CONVERT_TO_FACTORYDATE, by default it convert a date to factory date.

First parameter CORRECT_OPTION

'+' if the specified date is not a working day,

the first working day after the date is returned.

(default)

Regards

Read only

Former Member
0 Likes
807

Hi,

USE FM 'DATE_COMPUTE_DAY '

This FM will give week day.

Then if it returns 6 or 7 then add 1 or two.

that will be the next week day.

If it saturaday it will give six then add 2 that will be the next monday.

If it sunday it will give seven then add 1 that will be the next monday.

Thanks,

CSR.

******Reward if helpful

Read only

0 Likes
807

But i need to print the date.If 30 th June is Saturday+2 it will give monday.

Wil it print the date correctly as 2nd July.?

Rgds,

Shobana

Read only

Former Member
0 Likes
807

There are various Function Modules available under the following function groups

like <b>acal; scal; ncal.</b> You can use any of them as per your requirement.

Please reward the helpful entries.

Regards,

Raman.