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

where condition

Former Member
0 Likes
663

Hi all,

How to check the below condition in abap,

here i have date field in table a and table b, i want to compare these 2 dates like :

sql statement is like,

WHERE a.BIL_DAT < min( b.GDATU ).

so how check this con in abap.

Thanks in advance,

sudharsan.

1 ACCEPTED SOLUTION
Read only

gopi_narendra
Active Contributor
0 Likes
643
select <fields> from B into table it_b.
sort it_b by GDATU descending.
read table it_b index 1.
if sy-subrc = 0.
l_date = it_b-gdatu.
endif.

Now you can use l_date in place of min(b.gdatu)

Regards

Gopi

5 REPLIES 5
Read only

gopi_narendra
Active Contributor
0 Likes
644
select <fields> from B into table it_b.
sort it_b by GDATU descending.
read table it_b index 1.
if sy-subrc = 0.
l_date = it_b-gdatu.
endif.

Now you can use l_date in place of min(b.gdatu)

Regards

Gopi

Read only

0 Likes
643

Hi friends ,

Thank u very much for quickl replay.

i ve given good rewards.

regards,

sudharsan

Read only

Former Member
0 Likes
643

Hi,

Try this..

SELECT SINGLE bil_date

INTO (v_date)

FROM tableA

WHERE bil_date < ( select min( BIL_DAT )

FROM table A

WHERE key = 'ab' ).

Thanks

Naren

Read only

Former Member
0 Likes
643

check

sort b by GDATU.

Read b index 1.

if sy-subrec =0.

LV_DATE = b-GDATU

endif.

Select *

From a

WHERE BIL_DAT LE LT LV_DATE.

Read only

Former Member
0 Likes
643

Hello Sudarshan,

If you want to compare date fields in two tables there might be somr other common fields also .

You can Loop internal Table A

and use Read statment based on other common fields to get record of B in work area..

Then compare the work area data of table A against the work area of B..

Hope this Helps.

Thanks

Praveen