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 get NEXT free NUMBER for EXTERNALLY assigned RANGEs - SNUM, MD91 ?

Former Member
0 Kudos

Hi Experts,

I know that, with the FM - NUMBER_GET_NEXT_V1, I can get the next # for most document #s.

But, this FM is ONLY applicable to INTERNAL NUMBER RANGE.

1 - But., am working with EXTERNAL NUMBER RANGE, so looking forward for a FM/BAPI, which gives me next free # for use.

2 - If nothing is there, How to get it done? Is directly grabbing the latest # from the table/data base?

3 - Any other ideas?

thanq

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You can try writing a wrapper to RFC enable the FM NUMBER_GET_NEXT_V1,. Note though, whether you use this approach or the ggrab-last-rec-# approach, there is no protection that the number selected will not get used while you are still processing in the external function, since SAP does not 'know' that an instance of get-nest_number is in use. Of course, if you hare doing this to populate your custome Y or Z table, and you have complete knowledge of what all occassions the number range is called, you are in the clear.

4 REPLIES 4

Former Member
0 Kudos

You can use:

select max( fldname ) into ws_next from tablename .......

ws_next = ws_next + 1

will give you the next number.

Regards,

Subramanian

Former Member
0 Kudos

You can try writing a wrapper to RFC enable the FM NUMBER_GET_NEXT_V1,. Note though, whether you use this approach or the ggrab-last-rec-# approach, there is no protection that the number selected will not get used while you are still processing in the external function, since SAP does not 'know' that an instance of get-nest_number is in use. Of course, if you hare doing this to populate your custome Y or Z table, and you have complete knowledge of what all occassions the number range is called, you are in the clear.

0 Kudos

thanq

good analysis.

can i hv some breif idea/logic that, How to write a wrapper for RFC for get_next_number FM?

thanq

0 Kudos

For an example

Look at Attributes for SAP function ' L_TO_CONFIRM_SU' . Observe the radio button 'REmote-enabled function module - 2nd one.

Then you can see under source code it calls other SAP FMs. This is where you call the SAP FM you found.

A remote enabled fm requires a Logical destination when called from a program- you might already know that.