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

Substring in Abap Cds not working Properly

Former Member
0 Likes
3,066

Hi Team,

I am trying to calculate the number of working days remaining in a month. Suppose you are passing 2018-02-20 as a prompt. So it should give me the remaining number of working days coming from Tfacs table in that month.

capture.png

But the substring function is not considering StartDay which is an integer value.

The error is given below.

"Function SUBSTRING: at position 2, only Literals, possibly positive integers allowed"

If I use a hard coded number in place of StartDay, it works fine.

Please help me on this.

Regards,

Shawon

Hi Team,

I am trying to calculate the number of working days remaining in a month. Suppose you are passing 2018-02-20 as a prompt. So it should give me the remaining number of working days coming from Tfacs table in that month.

capture.png

But the substring function is not considering StartDay which is an integer value.

The error is given below.

"Function SUBSTRING: at position 2, only Literals, possibly positive integers allowed"

If I use a hard coded number in place of StartDay, it works fine.

Please help me on this.

Regards,

Shawon

3 REPLIES 3
Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
1,815

Did you bother to read the syntax error or the documentation?

The function properly works as documented.

Read only

0 Likes
1,815

Hey Horst,

Yes I did. I was looking for a workaround to do this.

Regards,

Shawon

Read only

gabriel_pill-kahan
Active Participant
0 Likes
1,815

I'm curious - are you able to use standard function module DATE_CONVERT_TO_FACTORYDATE? Please see documentation.

Gabriel