‎2008 Dec 09 2:23 PM
Hi Guys,
My Issue is I am selection some fields from IMRG table into some internal table.
In this I need to select some records based on month condition.
Means I need to get the records info into the internal table regarding this month.
If i execute this report next month it should fetch the data from that month only.
How to make the syntax in select statement.
Thanks & Regards ...
Prasad.
‎2008 Dec 09 2:26 PM
Then what are your selection criteria if its date then
you have to use a begin date and end date and where you need to mention high and low and use the same in your select statement
SELECT VBRK~VBELN AS VBELN
VBRK~VKORG AS VKORG
VBRK~VTWEG AS VTWEG
VBRP~PRODH AS PRODH
VBRK~FKDAT AS FKDAT
SUM( VBRP~FKLMG ) AS FKLMG
SUM( VBRP~NETWR ) AS NETWR
INTO CORRESPONDING FIELDS OF WA_TAB FROM VBRK AS VBRK JOIN VBRP AS VBRP
ON VBRKVBELN = VBRPVBELN
WHERE VBRP~MATNR = WA_TAB-MATNR
AND VBRP~WERKS = WA_TAB-WERKS
AND VBRK~FKDAT BETWEEN S_DATE-LOW AND S_DATE-HIGH
AND VBRK~VKORG IN S_VKORG
AND VBRK~VTWEG IN S_VTWEG
AND VBRK~FKSTO NE 'X'
AND VBRK~FKART EQ 'ZBI1'
AND ( VBRKVBTYP EQ'M' OR VBRKVBTYP EQ 'P' OR VBRKVBTYP EQ 'O' OR VBRKVBTYP EQ '6'
OR VBRK~VBTYP EQ '5' )
GROUP BY VBRKVBELN VBRKVKORG VBRKVTWEG VBRPPRODH VBRKFKDAT VBRPFKLMG.
WA_TAB-VAR0 = ( ( WA_TAB-VAR0 + WA_TAB-FKLMG ) ).
WA_TAB-VAR34 = ( WA_TAB-VAR34 + WA_TAB-NETWR ).
Edited by: sabyasachi kar on Dec 9, 2008 3:26 PM
‎2008 Dec 09 2:28 PM
Hi sabyasachi kar ,
Thanks for the response.
But I am not using any selection screen for my report.
Thanks...Prasad.
‎2008 Dec 09 2:28 PM
Hi,
In different variable, get the current month from the sy-datum variable. You can then use this variable in the select statement.
Best Regards.
‎2008 Dec 09 2:31 PM
Hi Abaper,
I can understand what u r saying. I used my syntax like this
select point vlcod erdat from IMRG into table ITAB
where vlcod NE space and erdat eq sy-datum+4(2).
but i am not getting the records.
Thanks...Prasad.