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: 

Variable

Former Member
0 Kudos

Hi

Req :

A varible which should be a unique no for one execution of the program .

if the variable is i_doc = '1000000000' for one execution (f8), then for the next execution(f8) of the prog 'i_doc = '1000000001'. and so on . It should be

a number of length 10. Not time and date varible fields.

Thanks,

Vind.

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You could create a number range in transaction SNRO and then use the function module NUMBER_GET_NEXT to increment it everytime the program runs.

Regards,

RIch Heilman

5 REPLIES 5

former_member195698
Active Contributor
0 Kudos

Hi,

You can create a Number range object and then you can get the next number every time the report is run,.

The number range object can be created through the transaction SNRO. You can use the Function Module

NUMBER_GET_NEXT to get the next number.

Regards,

Aj

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You could create a number range in transaction SNRO and then use the function module NUMBER_GET_NEXT to increment it everytime the program runs.

Regards,

RIch Heilman

0 Kudos

Hi

i created a object z_doc through SNRO tc., Can you pls let me know how to use this varible in the fm NUMBER_GET_NEXT.

Thanks,

Vind.

0 Kudos

Simply pass the name Z_DOC and the interval number, if you have not yet created an interval, you can do so in the SNRO transaction, this is simply telling the number range object what the number range is, like 1000000000 to 1999999999



  DATA: new_number(10) TYPE c.

  CALL FUNCTION 'NUMBER_GET_NEXT'
    EXPORTING
      nr_range_nr = '0001'
      object      = 'Z_DOC'
    IMPORTING
      number      = new_number
    EXCEPTIONS
      OTHERS      = 8.

Regards,

RIch Heilman

Former Member
0 Kudos

Hi Vind,

You could place an entry on table TVARV and update it or create a number range.

Regards,

Chester