Period selection in SAP

Hi everyone,

I am working on a project where some transactions in SAP should be filled and run. I have difficulties to code a variable which will return a correct period. In company where I work for, business year starts on 1st of October which means we are “three periods ahead”. I have tried few variables “Default” filled like this but it do not work (+2 is there because transactions should be run during first week of month for previous month).

If(system.DateTime.Now.Month+2)<=12 Then
Period_1
Else
Period_2
EndIf

Thanks in advance for any help.