Doubt in sap automation. set the field in sap according to the current month

In sap automation, if the date should be taken as per the current month how to set the field in sap.

@anjani_priya

Can you please elaborate

If you need current date then use Now.ToString("FormatYouNeed")

If you want to add days use Now.AddDays(numberofdaysplusOrminus)

Cheers

Capture224
every month if we run the sap then it should take the year and period of current month how to do that?

@anjani_priya

Year will be Now.Year.ToString

What do you mean the period?

The start and end of current week?

Cheers

according to the financial year
apr2023 - mar 2023 is the current year
how to declare that in sap
if we declare as now.year.tostring then the current year 2024 is getting but I want the year according to the financial year

@anjani_priya

if the financial year is constant like april to march every year use the below expressions

"apr"+now.addyears(-1).tostring("yyyy")
"mar"+now.tostring("yyyy")

how to declare this in SAP
Capture224

@anjani_priya

let me know, what you want to type in the Fiscal year.

just 2024 or 2023-2024 ?

2023 because according to the financial year feb is 2023(apr-march is 2023)

@anjani_priya

I might be apr 2023 - mar2024 and fy would be 2023 yes

so you can use something like this…if the month is in jan,feb or mar it would be previous year else it would be current year

so If(Now.Month>3,Now,Now.AddYears(-1)).Year.ToString - this will give the required financial year

Hope this helps

cheers

1 Like

how to set period
period means month number
like apr means 1 may means 2 so the current month is jan so it should be 10 how to set period

@anjani_priya

Try this

If(Now.Month>3,Now.Month-3,Now.Month+9).ToString

cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.