2013 May 17 1:17 PM
Dear experts,
I am using a MAX statement in one of my query but it fails to work and there is data present in the database table.
SELECT MAX( aznum ) INTO l_aznum FROM febko
WHERE bukrs = wa_ff67_hdr-bukrs
AND hbkid = wa_ff67_hdr-hbkid
AND hktid = wa_ff67_hdr-hktid.
though it is very easy but still not working.
2013 May 17 2:00 PM
It is unlikely in the extreme that the max statement has suddenly stopped working. Far more likely is that you've made a mistake.
Have you checked that wa_ff67_hdr-bukrs -hbkid and -hktid contain any data?
Have you checked whether there are conversion exits on the domains these fields are built upon?
2013 May 17 2:35 PM
Please ensure l_aznum is of the same type as aznum. Query seems to be fine.
Check if have data issues.
The other way is to fetch the data and sort it in descending order on aznum.
Regards,
Manu
2013 May 17 4:11 PM
Hi,
Please check whether database is containing any record with given selection.
Type of l_aznum should be matched with AZNUM_EB.
Otherwise query is OK.
Regards,
Neha
2013 May 17 6:57 PM
Hi,
Check whether the condition you specified has any record or not. There is no problem with the query.
2013 May 18 4:05 AM
Hi,
May be you have multiple statement number lines try this:
SELECT MAX( DISTINCT aznum ) INTO l_aznum FROM febko
WHERE bukrs = wa_ff67_hdr-bukrs
AND hbkid = wa_ff67_hdr-hbkid
AND hktid = wa_ff67_hdr-hktid.
Hope it helps.
Cheers,
Arindam
2013 May 18 4:58 AM
Hi Mahesh
Pls try the below code:
SELECT single MAX( aznum ) INTO l_aznum
FROM febko
WHERE bukrs = wa_ff67_hdr-bukrs
AND hbkid = wa_ff67_hdr-hbkid
AND hktid = wa_ff67_hdr-hktid.
Regards,
Suganya
2013 May 18 5:44 AM
Hi Mahesh,
Is there any error message you got...?
If not the where condition not match with you data available in your database table.
Regards,
R.S.K
2013 May 18 5:45 AM
Dear all,
wa_ff67_hdr-hbkid was passed in small case and it needs to be passed in upper case. So solved the issue by observing it.
Thanks for reply.
2013 May 18 9:47 AM