2007 Sep 24 9:34 AM
Hi Guys,
I need to pick the maximum number from the database table and increment by 1. I am using select max ..... but it is not picking the maximum number from the database table.
<u><b>s.no</b></u>
0001
0002
0003
0004
5
6
7
Data in the field is like this, we changed the field data type and again we assigned the same data type as before even though we are getting the number like 5,6,7, instead of 0005,0006,0007,....
Please tell me how to solve this problem, as the object has been send to production.
All answers are rewarded.
Regards,
Line
2007 Sep 24 9:44 AM
hi Line,
I guess this is a Z... table and the field is C type. In this case change the field to N type (and adjust the table, no concern, it won't be deleted). Now all values will look like (because the initial value of an N type variabnle is '0')
0001
0002
...
0006
0007
and it will give back the value you need.
hope this helps
ec
hi Line,
I guess this is a Z... table and the field is C type. In this case change the field to N type (and adjust the table, no concern, it won't be deleted). Now all values will look like (because the initial value of an N type variabnle is '0')
0001
0002
...
0006
0007
and it will give back the value you need.
hope this helps
ec
2007 Sep 24 9:44 AM
hi Line,
I guess this is a Z... table and the field is C type. In this case change the field to N type (and adjust the table, no concern, it won't be deleted). Now all values will look like (because the initial value of an N type variabnle is '0')
0001
0002
...
0006
0007
and it will give back the value you need.
hope this helps
ec
2007 Sep 24 12:27 PM
No the datatype of the field is NUMC, But I get the values like this, Can any one help me.
Regards,
Line
2007 Sep 24 1:14 PM
can you check the values in SE16? what do you see? Did you click on adjust the table after you changed it (in SE11 database utility)?
2007 Sep 24 10:29 AM
Suppose a database table TEST, consisting of two columns and 10 lines:
COL_1 COL_2
1 3
2 1
3 5
4 7
5 2
6 3
7 1
8 9
9 4
10 3
The following coding demonstrates the aggregate functions:
DATA RESULT TYPE P DECIMALS 2.
SELECT <agg>( [DISTINCT] COL_2 )
INTO RESULT
FROM TEST.
WRITE RESULT.
The following table shows the results of this program extract according to different combinations of aggregate expressions <agg> and the DISTINCT option.
Aggregate expression
DISTINCT
Result
MAX
no
9.00
MAX
yes
9.00
MIN
no
1.00
MIN
yes
1.00
AVG
no
3.80
AVG
yes
4.43
SUM
no
38.00
SUM
yes
31.00
COUNT
yes
7.00
COUNT( * )
---
10.00
reward points if helpful.........
2007 Sep 26 8:25 AM
Hi Line,
Please use the FM NUMBER_GET_NEXT. You have to pass the Number range number and the Object which you can find in SNRO.
Regards,
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |