Application Development and Automation 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: 
Read only

Number Range dependent upon date

Former Member
0 Likes
872

Hi SAP Guru's,

Can we provide new number range to be genrated daily,

for eg.NR should be like this DDMMYY+(NEW-SERIAL NO)

posting date 11.12.2009: NR genrated is 111209001 to 111209050

posting date 12.12.2009: NR genrated is 121209001 to 121209060

and if somebody post document for 11.12.2009: NR genrated Should be genrated 111209051.

I am on implementation project , this is client's requirement.

It looks to me that this is not poosible but Please do suggest, how we can provide a solution for this problem.

Thanks & kind regards,

Rahul

4 REPLIES 4
Read only

former_member206377
Active Contributor
0 Likes
656

Hi Rahul,

Use the FM 'QF05_RANDOM_INTEGER' to generate a random number and concatenate the obtained value with sy-datum field.


data : l_rnd_numb type i.

CALL FUNCTION 'QF05_RANDOM_INTEGER'
 EXPORTING
   RAN_INT_MAX         = '999'
   RAN_INT_MIN         = '000'
 IMPORTING
   RAN_INT             = d_result
 EXCEPTIONS
  INVALID_INPUT       = 1
   OTHERS              = 2
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

concatenate sy-datum d_result into l_rnd_numb.

Read only

0 Likes
656

Dear Vasuki S Patki ,

Thanks for reply.

But my problem is to post the document in back date, in that case the sy-date will be the current date and i want to pick the document date or posting date mention in the order or invoice.

Kind regards,

Rahul

Read only

0 Likes
656

Hi Rahul,

As you said want to pick the document date or posting date mention in the order or invoice. Exactly thats what you have to do.

You will get that posting date field by debugging program. You have to just some efforts for that.

Read only

Former Member
0 Likes
656

It is recommended from sap not to change the auto generated number range as there could be a chance of missing the number range .. We have refused this scenario to client by explaining the complication which can be faced on implementing it.. Closing the old thread........