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 can i find the maximum check's in a month

Former Member
0 Kudos

Dear Freinds

i have requirement where i have to check on week end (sunday) holiday , if the employee works i have to check how many hours he has worked. So i wanted to get from previous day what is the daily wages paid per hourly snce saturday is working day. This iam able to achive to get ther previous for today(sunday) as saturday by using the function module

CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'

EXPORTING

date = fp_v_date

days = fp_v_days "1

months = 0

signum = '-'

years = 0

IMPORTING

calc_date = fp_prev_date.

so the fp_prev_date iam checking for this date is a holiday ?

by reading from the table THOL. If the feild klass eq 1 in the tableThol then it is assume as holiday else is working day. Till here it is working perfectly

Now, i have is if iam checking for one day this logic holds good .But however if i wanted to check if the fp_prev_date is holiday then my requirement is i have to go further ( i.e friday) by one day and check the return day , if that is also holiday then i have to go still further ......so i wanted to check all the 31 or 30 or 28 days in that month till i found regular day ( i.e THOL-KLASS NE 1) So i wanted to put this logic in a common code and check every day . Can any body give me good logic.

As of now i have written as below.

IF fp_v_day IS NOT INITIAL. ( note : fp_v_day is the day iam gettin based on selection screen date)

PERFORM get_prev_day USING fp_v_day

'01'

CHANGING prev_date

v_holid.

IF v_holid IS NOT INITIAL.

fp_v_day = fp_v_day + 1. " friday

clear v_holid.

PERFORM get_prev_day USING fp_v_day

'01'

CHANGING prev_date

v_holid.

IF v_holid IS NOT INITIAL.

fp_v_day = fp_v_day + 1. "thursday

clear v_holid.

PERFORM get_prev_day USING fp_v_day

'01'

CHANGING prev_date

v_holid.

IF v_holid IS NOT INITIAL.

fp_v_day = fp_v_day + 1. "wednesday

clear v_holid.

PERFORM get_prev_day USING fp_v_day

'01'

CHANGING prev_date

v_holid.

endif.

endif.

endif.

endif.

-


PERFORM get_prev_day USING fp_v_day

'01'

CHANGING prev_date

v_holid.

this subroutine have the below code.

FORM get_prev_day USING fp_v_date

fp_v_days type DLYDY

CHANGING fp_prev_date

fp_v_holid.

CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'

EXPORTING

date = fp_v_date

days = fp_v_days "2

months = 0

signum = '-'

years = 0

IMPORTING

calc_date = fp_prev_date.

IF fp_prev_date IS NOT INITIAL.

SELECT * FROM thoc WHERE ident = 'ET'

AND datum = fp_prev_date.

SELECT SINGLE * FROM thol WHERE ftgid = thoc-ftgid.

  • AND klass = '1'.

IF sy-subrc EQ 0.

IF thol-klass EQ '1'. " Public Holiday.

MOVE 'X' TO fv_holid.

ENDIF.

ENDIF.

ENDIF.

ENDFORM.

in the above logic i have iwriten

IF v_holid IS NOT INITIAL.

fp_v_day = fp_v_day + 1. " saturday

clear v_holid.

PERFORM get_prev_day USING fp_v_day

'01'

CHANGING prev_date

v_holid.

etc i have to write 31 times and check in that month it fits or not .......if any body could please give me a better way of writting only one time subrotine( i.e calling this subrutine for all the days in the month) and checking instead me writing 31 or 30 times in that month.

regards

divya.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You can use following FM

DATE_CHECK_WORKINGDAY u2013 Determines if a single date is a working day

HOLIDAY_CHECK_AND_GET_INFO u2013 Determines if a date is a holiday

HOLIDAY_GET u2013 All holidays in a factory calendar

DATE_CHECK_WORKINGDAY u2013 Determines if a single date is a working day

DATE_CHECK_WORKINGDAY_MULIPLE u2013 Checks date across multiple factory calendars

WDKAL_DATE_ADD_FKDAYS u2013 Number of working days in a date range

Hope this helps..

2 REPLIES 2

Former Member
0 Kudos

You can use following FM

DATE_CHECK_WORKINGDAY u2013 Determines if a single date is a working day

HOLIDAY_CHECK_AND_GET_INFO u2013 Determines if a date is a holiday

HOLIDAY_GET u2013 All holidays in a factory calendar

DATE_CHECK_WORKINGDAY u2013 Determines if a single date is a working day

DATE_CHECK_WORKINGDAY_MULIPLE u2013 Checks date across multiple factory calendars

WDKAL_DATE_ADD_FKDAYS u2013 Number of working days in a date range

Hope this helps..

Former Member
0 Kudos

thanks