You select a field flight_date with type DATS in the field list of a CDS view.
Which of the following expressions returns the 2-digit month from the field?
(Select 2 correct answers)
Suggested Answer: A, B
Get Premium C_ABAPD_2507 Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
A DATS field is stored as YYYYMMDD.
Option A: substring( flight_date, 5, 2 ) Extracts characters 5--6 correct month.
Option B: right( left( flight_date, 6 ), 2 ) Takes first 6 chars YYYYMM, then last 2 correct month.
Option C: Wrong, extracts last 2 chars of MMDD, results in day not month.
Option D: Wrong, starts at 4 gives YM instead of MM.
Study Guide Reference: ABAP CDS Development Guide -- String Functions in CDS.
16 comments · newest first
CH
Christoper
10 months ago
Wait, how does D return the month? Seems off.
EU
Eura
11 months ago
Definitely A and D, no doubt about it!
DO
Doug
11 months ago
I think B might work too, but not sure.
RO
Rolf
11 months ago
A and D are correct!
MI
Ming
11 months ago
I agree, A and D are the way to go!
YV
Yvonne
12 months ago
I’m confused about the positions in these functions. I thought the month was always at the same place, but I can't recall if it’s 4 or 5 for the substring.
BE
Becky
12 months ago
I practiced a similar question last week, and I feel like B could be a valid way to extract the month too.
LA
Latrice
1 year ago
I'm not entirely sure, but I remember something about using substring for date fields. Maybe D is also a good choice?
MA
Marilynn
1 year ago
I think option A might be correct since it looks like it starts at the right position for the month.
PR
Precious
1 year ago
I'm not too sure about this. I think I'll try options B and C just to see if they work as well. Better to cover all the bases in the exam.
VA
Vannessa
1 year ago
I'm pretty confident about this one. The 2-digit month is the 5th and 6th characters of the date string, so option A and D should work.
KI
Kindra
1 year ago
Okay, I've got this. The DATS field type means it's a date field, so I can use the substring() function to extract the month part. I'll go with option A and D.
GE
Gearldine
1 year ago
Hmm, I'm a bit confused. I'm not sure if I should be using substring(), left(), or right() functions here. I'll have to think this through carefully.
GL
Glory
1 year ago
I think I'll try option A and D. The question is asking for the 2-digit month, so I'm guessing I need to extract the middle part of the date string.
JE
Jess
1 year ago
A and D are the correct answers. The month is always in the 5th and 6th positions of a DATS field.
TU
Tuyet
1 year ago
I think A and D might be correct.