Skip to Content
-1

ABAP table ($filter odata) filtering timestamp in a specific Period

May 04, 2017 at 10:11 AM

141

avatar image

Hey guys,

Im pretty new to ABAP and i just wanted to ask if someone maybe got an idea how to solve the problem im actually facing right now.

Im coding the Backend in ABAP for an SAP Ui5 application which should be able to present for instance PICKS in a specific period.

So i have the fields " Chart ", "Aggregation", "Timestamp" and "Value".

charts and aggr. are const. values atm
charts = Picks
aggr. = M

the timestamp is filled with the actual timestamp (just for testing right now)
and - 1000 secs for every line so i have more test data's
(arround 10 lines)

The table is all arround the Picks like mentioned above. Right now im selecting the date of the Picks from a DIFFERENT table, (i also use the filter select options to read the odata filter parameters) so im able right now to filter the Picks i'm selecting from a different table in a specific time period.

my problem is => the TIMESTAMP in the actual table should show something like 01.01. for january and 01.02. for february and so on...
the VALUE should show the numbers of picks done in 1 month
so the first entry might look like this

chart
picks

aggr
M

timestamp
01.01.

value
20 (picks in january)

so my question now is how can i seperate or group the picks per month ?
when im selecting i might have like 1 pick at 01.01., another pick at 03.01., 4 picks at 06.01 and so on... so i need to take all picks inbetween 01.01. to 31.01. and set their TIMESTAMP to 01.01., same goes for febuary and so on... but i dont really know how to do this ?
and then i need to take these for example 20 picks in january and put the value into the field value, because value is the field for the number of picks done in this month.

i hope someone understands me a bit,
even with my bad english :D

thank you already for helping.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Jelena Perfiljeva
May 05, 2017 at 08:33 PM
0

TL. I lost the trail somewhere in the middle but based on the question at the end it seems obvious that you need to read the data and summarize the records by month. The specific coding depends on where/how exactly you are doing all this and where the data is coming from.

E.g. you could try SELECT... SUM... or do LOOP AT .... COLLECT... (read ABAP Help for these commands). Or in ABAP 7.4 and higher there is more advanced stuff available (Google "ABAP 7.4 keyword documentation"). You could do summarization in a CDS view, for example. Lots of possibilities.

But in general this is a very simple algorithm IMHO, not sure why you're having trouble. Maybe I missed something.

Share
10 |10000 characters needed characters left characters exceeded