‎2006 Dec 25 9:03 AM
Hi,
I have a select option (DTE) for date on selection screen. Now i want extract data from DB table to internal table where all dates shlod be LE from givin date in select option
my select statment is :
SELECT VBELN FKDAT KUNRG BSTNK_VF FROM VBRK INTO CORRESPONDING FIELDS OF TABLE ITAB_VBRK
WHERE KUNRG IN CUST_NO AND FKDAT IN DTE.
i m getiing data only EQ givin date. but i need all dates wich r LE from givin date.
From Jitendra
‎2006 Dec 25 9:16 AM
hi ,
Welcome to SDN,,
SELECT VBELN FKDAT KUNRG BSTNK_VF FROM VBRK INTO CORRESPONDING FIELDS OF
TABLE ITAB_VBRK
WHERE KUNRG IN CUST_NO AND FKDAT LE DTE-Low ."chk this
pass the select-option value of dte into a variable and substitute this variable in the where clause .
will fetch u the records from Db for Date LE from date of ur selection screen.
LE -->
or LT--> for the date
hope this helps ,
regards,
vijay
‎2006 Dec 25 9:15 AM
Actually you should be rather using a parameter instead of a selec option.
Anyway with a SELECT OPTION you code should be:
SELECT VBELN FKDAT KUNRG BSTNK_VF FROM VBRK INTO CORRESPONDING FIELDS OF TABLE ITAB_VBRK
WHERE KUNRG IN CUST_NO
<b>AND FKDAT LT DTE-LOW</b>.
‎2006 Dec 25 9:16 AM
hi ,
Welcome to SDN,,
SELECT VBELN FKDAT KUNRG BSTNK_VF FROM VBRK INTO CORRESPONDING FIELDS OF
TABLE ITAB_VBRK
WHERE KUNRG IN CUST_NO AND FKDAT LE DTE-Low ."chk this
pass the select-option value of dte into a variable and substitute this variable in the where clause .
will fetch u the records from Db for Date LE from date of ur selection screen.
LE -->
or LT--> for the date
hope this helps ,
regards,
vijay
‎2006 Dec 25 9:18 AM
Hi jitendra,
SELECT VBELN FKDAT KUNRG BSTNK_VF FROM VBRK INTO CORRESPONDING FIELDS OF TABLE ITAB_VBRK
WHERE KUNRG IN CUST_NO AND FKDAT IN DTE-LOW.
check with this code it will work.
‎2006 Dec 25 9:27 AM
tables: vbrk.
select-options : dte for vbrk-fkdat.
* cust_no for vbrk-kunrg.
data : begin of itab_vbrk occurs 0,
vbeln like vbrk-vbeln,
fkdat like vbrk-fkdat,
kunrg like vbrk-kunrg,
bstnk_vf like vbrk-bstnk_vf,
end of itab_vbrk.
SELECT VBELN FKDAT KUNRG BSTNK_VF FROM VBRK INTO CORRESPONDING FIELDS OF
TABLE ITAB_VBRK
WHERE FKDAT LE DTE-low .
sort itab_vbrk by fkdat descending.
loop at itab_vbrk.
write:/ itab_vbrk-vbeln,
itab_vbrk-fkdat.
endloop.check this code ...
regards,
vijay
‎2006 Dec 26 2:22 AM
HI Jitendra
As highlighted by Sharath, do declare the date as PARAMETER instead of select options and use as below:
<b>PARAMETERS: DTE TYPE FKDAT.</b>
SELECT VBELN FKDAT KUNRG BSTNK_VF FROM VBRK INTO CORRESPONDING FIELDS OF TABLE ITAB_VBRK
WHERE KUNRG IN CUST_NO AND <b>FKDAT LE DTE</b>.
If the requirement is to use SELECT-OPTION, then ask the users to input the date in HIGH instead of LOW. In that case, your select statement will work.
Kind Regards
Eswar
‎2006 Dec 26 4:21 AM
Hi ,
An example of how this will work is as given below
Data : it_1 type table of mara.
select-options : s_matnr for mara-ersda.
data : r_matnr like line of s_matnr.
start-of-selection.
loop at s_matnr into r_matnr.
r_matnr-option = 'LE'.
modify s_matnr from r_matnr.
endloop.
select * into table it_1
from mara
where ersda in s_matnr.
data : wa like line of it_1.
loop at it_1 into wa .
write:/ wa-matnr.
endloop.What this code will do is select all the materials from MARA where ERSDA is less than or equal to s_matnr-low.
Try this and if you have any queries please do revert back.
Regards
Arun