Application Development 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: 

Type conversion from chac to number

Former Member
0 Kudos
177

Hi experts,

I want to select the maximum and minimum excise number from the the excise header table J_1IEXCHDR. But the field j_1iexchdr-exnum field is of chac type . If i am writing select qurey such as

select MIN ( exnum ) as exnum MAX( exnum ) as exnum1 from j_1iexchdr into corresponding fields of table it_J_1iexchdr where werks = '1010' and

exgrp = '11' and

exdat in s_budat and

srgrp = '60'.

i am getting one record in internal table it_j_1iexchdr with only max number but min number is getting blank. what is the problem acutally? i am thinking becasue of the exnum is chac type field it is not taking min number . if so wht to do? how to convert that and write the qurey to select max and min excise number?

any suggestions.... will be helpful.

please help its urget.

<b>points will be rewarded for useful answers </b>

Regars,

priyanka reddy.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
71

Hi,

I think for ur selection criteria the table contains the record with the EXNUM as space , so u r getting space as minimum value

For this scenario add one more condition in the select query like

EXNUM NE SPACE in the where clause

Now u will get the required value at the select query output.

Regards,

Manikumar

5 REPLIES 5

amit_khare
Active Contributor
0 Kudos
71

How about SELECT all the data in an internal table and then SORT the table on required field in Descending Order. Then, first row will contain MAX value and last row MIN value.

Regards,

Amit

Former Member
0 Kudos
71

try to add a search condition

exnum NE SPACE.

Former Member
0 Kudos
71

I think the minimum value in the exnum would be a space

in the table ..

and it is getting a space .. get all the entries sort by ascending

and take the min value(other than space)

0 Kudos
71

Hi,

I think for ur selection criteria the table contains the record with the EXNUM as space , so u r getting space as minimum value

For this scenario add one more condition in the select query like

EXNUM NE SPACE in the where clause

Now u will get the required value at the select query output.

Regards,

Manikumar

Former Member
0 Kudos
72

Hi,

I think for ur selection criteria the table contains the record with the EXNUM as space , so u r getting space as minimum value

For this scenario add one more condition in the select query like

EXNUM NE SPACE in the where clause

Now u will get the required value at the select query output.

Regards,

Manikumar