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

select statement ?

Former Member
0 Likes
627

hi

i want to select a field from table.

In where condition between the 2 dates and another field is equal to some value.

how to write select statament.

please help..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
606

SELECT FIELD
INTO W_FIELD
FROM TABLE
WHERE DATA BETWEEN W_DATE_1 AND W_DATE_2
AND FIELD2 EQ W_FIELD2.

Greetings,

Blag.

5 REPLIES 5
Read only

Former Member
0 Likes
607

SELECT FIELD
INTO W_FIELD
FROM TABLE
WHERE DATA BETWEEN W_DATE_1 AND W_DATE_2
AND FIELD2 EQ W_FIELD2.

Greetings,

Blag.

Read only

0 Likes
606

can u please check below program for performance..

tables : mkpf.

data : it_mkpf type table of mkpf,

wa_mkpf type mkpf,

date type d.

date = '01/01/2005'.

select MBLNR from MKPF INTO CORRESPONDING FIELDS OF TABLE it_mkpf

where BLDAT between date and sy-datum and FRBNR = 'prfdy001'.

if sy-subrc = 0.

loop at it_mkpf into WA_MKPF.

write 😕 wa_mkpf-mblnr.

ENDLOOP.

endif.

Read only

0 Likes
606

Hi,

The code is not correct,

change it to

tables : mkpf.

data : it_mkpf type table of mkpf,

wa_mkpf type mkpf,

date type d.

<b>date = '20050101'.</b>

select MBLNR from MKPF INTO CORRESPONDING FIELDS OF TABLE it_mkpf

where BLDAT between date and sy-datum and FRBNR = <b>'PRFDY001'</b>.

if sy-subrc = 0.

loop at it_mkpf into WA_MKPF.

write 😕 wa_mkpf-mblnr.

ENDLOOP.

endif.

and if you just want mblnr from the table then no need to select all other fields. Just select fields required + key fields. It will improve performance.

Reward points if useful.

Regards,

Atish

Read only

Former Member
0 Likes
606

select * into itab

from <table>

where date_field ge low_date

and date_field le high_date

and field1 = some_value.

Read only

Former Member
0 Likes
606

Hi,

Just refer to standard SAP help

SELECT carrid connid fldate

FROM sflight

INTO CORRESPONDING FIELDS OF TABLE sflight_tab

WHERE fldate BETWEEN sy-datum AND date

AND field2 = <Some value>.

Reward points if useful.

Regards,

Atish