Our company runs on SAP ERP 6.0, SAP_BASIS 702, SAP_ABA 702 (2005), just something to keep in mind in regards to the code syntax.
I have a table LTAP, I want to create a query based on this table, which would produce "N" as number of picks that occured in the past month from the day the report is ran.
I've defined the dynamic date with the following:
YEAR = SY-DATUM(4).
MTH = SY-DATUM+4(2).
DAY = SY-DATUM+6(2).
IF MTH EQ 1.
MTH1 = MTH + 11.
ELSE.
MTH1 = MTH - 1.
ENDIF.
IF MTH eq 1.
YEAR1 = YEAR - 1.
ELSE.
YEAR1 = YEAR.
ENDIF.
FROM_DATE(4) = YEAR1.
FROM_DATE+4(2) = MTH1.
FROM_DATE+6(2) = DAY.
Which seems to do the job.
What I can't seem to get working is to get the count of duplicate lines of field MATNR (each line entry represents a unique pick) and output it to a custom field, while removing the duplicate rows and keeping just the unique values.
Example of what I mean:
I'd like to do this while respecting the date range above and be doable within the sq01/sq02.
How to output duplicate row count into a custom field in SAP query?