First step:
Create two number ranges for business requirement
path: Spro->Sales and Distribution->Sales->Sales Documents->Sales Document Header->Define Number Ranges For Sales Documents
TCODE: VN01
Second Step:
Configure the number ranger of sale document type.
path: Spro->Sales and Distribution->Sales->Sales Documents->Sales Document Header->Define Sales Document Types
TCODE: VOV8
Third Step:
modify the source code to control use different number range for different sale organiztion
3.1 you can use se38 to open source code MV45AFZZ and find the form userexit_number_range.
*---------------------------------------------------------------------*
* FORM USEREXIT_NUMBER_RANGE *
*---------------------------------------------------------------------*
* This userexit can be used to determine the numberranges for *
* the internal document number. *
* *
* US_RANGE_INTERN - internal number range *
* *
* This form is called from form BELEG_SICHERN *
* *
*---------------------------------------------------------------------*
form userexit_number_range using us_range_intern.
* Example: Numer range from TVAK like in standard
* US_RANGE_INTERN = TVAK-NUMKI.
endform.
3.2 change the source code as the following
*---------------------------------------------------------------------*
* FORM USEREXIT_NUMBER_RANGE *
*---------------------------------------------------------------------*
* This userexit can be used to determine the numberranges for *
* the internal document number. *
* *
* US_RANGE_INTERN - internal number range *
* *
* This form is called from form BELEG_SICHERN *
* *
*---------------------------------------------------------------------*
form userexit_number_range using us_range_intern.
* Example: Numer range from TVAK like in standard
* US_RANGE_INTERN = TVAK-NUMKI.
*{ INSERT TASK912652 1
IF us_range_intern = '13'.
CASE vbak-vkorg.
WHEN '0029'.
us_range_intern = '13'.
WHEN '0143'.
us_range_intern = '14'.
ENDCASE.
ENDIF.
*} INSERT
endform.