Former Member

### Count weeks in a payroll period

HI all,

How can I count weeks in a payroll period.

I want to know how many weeks are in

01.01.02015 - 31.01.2015

what operation or function do I use?

Regards

Paul

10|10000 characters needed characters exceeded

• Nov 04, 2015 at 05:54 PM

You could create a Constant in table view V_511K that would hold the number of weeks in a month, and query that constant in a pcr.

Example:

ZWKIMWeeks in month01.01.201531.01.20154,43ZWKIMWeeks in month01.02.201528.02.20154,00ZWKIMWeeks in month01.03.201531.03.20154,43ZWKIMWeeks in month01.04.201530.04.20154,28ZWKIMWeeks in month01.05.201531.05.20154,43ZWKIMWeeks in month01.06.201530.06.20154,28ZWKIMWeeks in month01.07.201531.07.20154,43ZWKIMWeeks in monthand so on until 2020 or more

Note that if you require more decimals, you could use 428571.43 (instead of 4.43) and divide the value of Constant ZWKIM by the value of Constant GENAU (100000.00) in your PCR.

10|10000 characters needed characters exceeded
• Former Member

You also write a rule. If you look at the documentation of the operation NUM, using t code PE04, you can verify the information for 6 place operand. From here you can go into 2nd Variant(highlighted). That will tell what to use to determine number of calendar days in a month using specification G. Using this you can store the number of days for the month in a variable and then divide that by 7 to determine number full weeks in a month. If you want to find out how many calendar weeks are in a month, that can be tricky but you can figure that out from here.

Using this you can also count how many Sunday's are in the month or Monday's in the month. Based on the counted days of each week day you can determine the number of calendar weeks.

• Nov 03, 2015 at 09:43 PM

Hi Paul:

Not sure you can achieve this using standard operation. I know you can use SETIN X=WW when processing ZL table but that would only fetch week number into your variable split.

Cheers,

Antoine