Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A


Good Afternoon,

I am trying to populate a UDF on a SAP service call automatically with a return despatch date.

Basically when an instrument is received in the creation date of the document I want to add 10 working days to this and put this in the UDF.

At the moment I can add 10 days but this also includes weekends and bank holidays.

Here is what I am using as my linked query at the moment:

SELECT min (T0.[U_Date]) FROM [dbo].[@VALIDDELDATES] T0 WHERE T0.[U_Date] >= dateadd(dd, 10, $[$])

The above query is setup to add from the OSCL.createDate but does not work correctly returning an error:

Incorrect syntax near $

Whereby VALIDDELDATES is a UDT with the following fields, Code, Name and U_Date.

I have added a number of dates eg that do not include bank holidays/weekends below is the format for the table

Code Name U_Date

10     10          13.08.15

11     11          14.08.15

12     12          17.08.15

SAP did seem to modify the code at one point to the following:

SELECT min (T0.[U_Date]) FROM [dbo].[@VALIDDELDATES] T0 WHERE T0.[U_Date] = dateadd(dd, 10, CONVERT(DATETIME, '20150817', 112))

Not sure why?

Regardless I was wondering where I had gone wrong.

Alternatively I though it might be easier to look up todays date against the relating code and then add 10 to the code and return the correspond U_Date but I am unsure on if this is possible/can be achieved.

Any help would be greatly appreciated.

Former Member
Not what you were looking for? View more on this topic or Ask a question