Application Development and Automation 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: 
Read only

Syntax needed for particular month in Select Statement

Former Member
0 Likes
740

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.

4 REPLIES 4
Read only

Former Member
0 Likes
701

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

Read only

0 Likes
701

Hi sabyasachi kar ,

Thanks for the response.

But I am not using any selection screen for my report.

Thanks...Prasad.

Read only

Former Member
0 Likes
701

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.

Read only

0 Likes
701

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.