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: 

Increment of + 1 not working properly for KUNNR

Former Member
0 Kudos

Hi Guys,

I might be asking a very basic question,but tried several ways not found a solution.

Lets say I have a Customer No KUNNR with value '0000000111'.

I am doing a increment for this KUNNR like + 1.

When I am adding +1 to KUNNR with value '0000000111' , the result is becoming '112'.

But I want the result as '0000000112'.

How to achieve this.

I used counter type as kunnr.

Assigned this Counter to '0000000001'.

But still not working.Could any one plz suggest.

Waiting for your reply.

3 REPLIES 3

Former Member
0 Kudos

Haven't heard or came across any requirement where you add something to KUNNR.

If you are populating a new KUNNR, use number ranges.

But just for your info, if you want to increment, you need to apply conversion exit 'CONVEXITALPHAINPUT/OUTPUT routines and store in KUNNR variable.

BTW appreciate if you can highlight your requirement of adding 1 to KUNNR.

Regards,

Santosh

former_member191735
Active Contributor
0 Kudos

Try the following

data: l_kunnr type kunnr value '0000000010'.

l_kunnr = l_kunnr + 1.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = l_kunnr

IMPORTING

OUTPUT = l_kunnr.

.

Edited by: Sampath Kumar on May 18, 2011 1:27 PM

brad_bohn
Active Contributor
0 Kudos

Yes, very basic. You can refer to the ABAP documentation on field conversion and mathematical operations on unlike data types, especially character results. However, as Santosh hinted at, why aren't you using NUMBER_GET_NEXT to get the next un-assigned number in the interval if you in fact need to assign a number? What are you using the number for? How do you know that '112' isn't assigned or that '111' isn't the end of the range?