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: 

How to trigger the warning % of number range

Former Member
0 Kudos

Hi experts,

I've created a Z number range z_text,and setted 50% to Warning %.

And then called function NUMBER_GET_NEXT in program,but sy-subrc always equal to 0.

DATA num TYPE n LENGTH 3.
CALL FUNCTION 'NUMBER_GET_NEXT'
  EXPORTING
    nr_range_nr                   = '01'
    object                        = 'Z_TEST'
*   QUANTITY                      = '1'
*   SUBOBJECT                     = ' '
*   TOYEAR                        = '0000'
*   IGNORE_BUFFER                 = ' '
IMPORTING
   number                        = num
*   QUANTITY                      =
*   RETURNCODE                    =
EXCEPTIONS
   interval_not_found            = 1
   number_range_not_intern       = 2
   object_not_found              = 3
   quantity_is_0                 = 4
   quantity_is_not_1             = 5
   interval_overflow             = 6
   buffer_overflow               = 7
   OTHERS                        = 8.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
         WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

So how to trigger the warning % of number range,and in what form we received the warning % .

Best Regards.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

Uncomment the RETURNCODE parameter (and read its documentation, or online help : Number Ranges, Assigning and Checking Numbers)

Regards,

Raymond

9 REPLIES 9

raymond_giuseppi
Active Contributor
0 Kudos

Uncomment the RETURNCODE parameter (and read its documentation, or online help : Number Ranges, Assigning and Checking Numbers)

Regards,

Raymond

0 Kudos

Thanks for your reply,raymond.

when i call number_check,code always eq space,sy-subrc always eq 2.

CALL FUNCTION 'NUMBER_CHECK'

  EXPORTING

   nr_range_nr                   = '01'

    number                        = num

    object                          = 'Z_TEST'

*   SUBOBJECT               = ' '

*   TOYEAR                     = '0000'

*   NUMERIC_CHECK       = ' '

IMPORTING

   returncode                     = code

EXCEPTIONS

   interval_not_found             = 1

   number_range_not_extern = 2

   object_not_found              = 3

   OTHERS                          = 4

          .

IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

I wonder is there configuration needed be set if i want to get the warning.

Best regards.

0 Kudos

Hi Li

If you F1 on the Warning field you get this documentation:

Percentage for warning message

Percentage of numbers remaining in a number range, upon reaching which in
number assignment a warning is given.

Examples

You have defined an interval from 1 to 1000. If you want to issue a warning
at the number 900, enter 10 (%) here.

Regards

Arden

0 Kudos

Hi arden,

I've got F1 documentation and defined an interval from 1 to 10,set 50 to warning %. but no warning message is reported until the number eq 10.

If it's a standard number range,how to throw out the warning message.now wo just wait for number range overflow ,and then to step in processing.

Best Regards.
Tom

0 Kudos

Hi Li

Based on the following

http://scn.sap.com/people/sivaprasad.r/blog/2008/03/17/how-sap-creates-alerts-before-expiry-of-numbe...

I'm wondering if because your usage is custom, you may need to build in a custom notification.

Regards

Arden

0 Kudos

Hi arden,

I got it with your suggestion,thanks very much.

Regards.

0 Kudos

And what is the value of returncode  ?

0 Kudos

Yes,after call number_check,returncode EQ space until num got maximum value.

"-----code as follow>>>

DATA num TYPE n LENGTH 3.
DATA code TYPE inri-returncode.
CALL FUNCTION 'NUMBER_GET_NEXT'
  EXPORTING
    nr_range_nr                   = '01'
    object                        = 'Z_TEST'
*   QUANTITY                      = '1'
*   SUBOBJECT                     = ' '
*   TOYEAR                        = '0000'
*   IGNORE_BUFFER                 = ' '
IMPORTING
   number                        = num
*   QUANTITY                      =
*   RETURNCODE                    =
EXCEPTIONS
   interval_not_found            = 1
   number_range_not_intern       = 2
   object_not_found              = 3
   quantity_is_0                 = 4
   quantity_is_not_1             = 5
   interval_overflow             = 6
   buffer_overflow               = 7
   OTHERS                        = 8.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
         WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

CALL FUNCTION 'NUMBER_CHECK'
  EXPORTING
    nr_range_nr                   = '01'
    number                        = num
    object                        = 'Z_TEST'
*   SUBOBJECT                     = ' '
*   TOYEAR                        = '0000'
*   NUMERIC_CHECK                 = ' '
IMPORTING
   returncode                    = code
EXCEPTIONS
   interval_not_found            = 1
   number_range_not_extern = 2
   object_not_found              = 3
   OTHERS                        = 4
          .
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

"-----<<<

Where is a mistake,please help to correct it.thanks.

Regards.

0 Kudos

Sorry,I found returncode = 1.Thanks.