Skip to Content

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

month to date sales

Hi,

I did a report to get last month sales. Now how to get sales of current month till date. Is there any function module to get current month till date. For getting last month sales the code i ve written is this.

FORM GET_LSTMON_SALE .

DATA: MFDATE LIKE SY-DATUM,

MLDATE LIKE SY-DATUM,

MMON(2) TYPE C,

MYEAR(4) TYPE C.

MMON = P_AUDAT+4(2) - 1.

MYEAR = P_AUDAT(4).

IF MMON < 0.

MMON = 12.

MYEAR = MYEAR - 1.

ENDIF.

IF MMON < 10.

CONCATENATE '0' MMON INTO MMON.

ENDIF.

CONCATENATE MYEAR MMON '01' INTO MFDATE.

CALL FUNCTION 'SG_PS_GET_LAST_DAY_OF_MONTH'

EXPORTING

DAY_IN = MFDATE

IMPORTING

LAST_DAY_OF_MONTH = MLDATE

EXCEPTIONS

DAY_IN_NOT_VALID = 1

OTHERS = 2.

SELECT VBRKVBELN VBRKFKDAT VBRKFKSTO VBRKFKART VBRPPOSNR VBRPFKIMG

VBRPAUBEL VBRPAUPOS VBRPMATNR VBRPWERKS vbrp~vrkme

INTO CORRESPONDING FIELDS OF TABLE I_INVDET

FROM VBRK

JOIN VBRP ON VBRPVBELN = VBRKVBELN

WHERE VBRP~MATNR IN S_MATNR

AND VBRP~WERKS IN S_WERKS

AND VBRK~FKDAT <= MLDATE

AND VBRK~FKDAT >= MFDATE

AND VBRK~SFAKN = ''

AND VBRK~FKSTO = ''.

can u suggest how to write code for current month sales. Thanks in advance.

Regards,

Ram

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