Application Development 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: 

Get Date value from text and display in a table

0 Kudos

Hello,

Please I need help:

Exemple: I have the text below:

" Accident Date=12/04/2021 15:56 , please record it "

I am looking for a SAP script to only get date and time value and display in a table.

Thanks for ur support

3 REPLIES 3

former_member751591
Participant
0 Kudos

Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend you to read this overview Community Q&A, and to take our Q&A tutorial . With these tips you'll be able to prepare questions that draw responses from our members.

The more details you provide, the more likely it is that members will be able to answer your question.

Should you wish, you can revise your question by selecting Actions, then Edit.

By adding a Picture to your profile you encourage readers to respond.

Sandra_Rossi
Active Contributor
0 Kudos

One solution is to use a regular expression (see ABAP documentation) to extract the values. Example:

ASSERT |12/04/2021 15:56 | = match( val = 'Date=12/04/2021 15:56 , please' regex = '([0-9/: ]+)' ).

Another solution is to extract them into two ABAP date and time type variables. But first you need to answer this question: how do you interpret 12/04? December 4th or April 12th?

0 Kudos

I think the OP wants a full working program, Sandra. I'm not even sure he's a programmer (he's asking for a script?).
Sadly, his specs are too wide and too short.
I mean, if all texts will have exactly the same format, he can just capture the positions with a classical text+pos(len) substring, or whatever.

BUT I must admit this question will not be downvoted because it leaded to me to the "regex" thing, I'm totally ignorant of (up to now).