在现实的业务中,一个公司有多个销售组织,它们使用同一个出库类型,业务往往希望它们创建的出库单的号码采用不同号码范围。但在sap里出库单号码范围是在出库单类型里设置,也就是使用相同的出库单类型,也就使用相同的号码范围。如果要达到上需业务需求,我们可以使用增强实现。具体实现参见下面的步骤:
步骤1:创建多个号码段:
path: Spro->Sales and Distribution->Sales->Sales Documents->Sales Document Header->Define Number Ranges For Sales Documents
or
path: Spro->Logistics Execution->Shipping->Deliveries->Define Number Ranges for Deliveries
TCODE: VN01
步骤二:设置出库单类型的号码范围
path: Spro->Logistics Execution->Shipping->Deliveries->Define Delivery Types
TCODE: 0VLK
步骤三:修改SAP增强代码
modify the source code to control use different number range for different sale organiztion
3.1 you can use se38 to open source code MV50AFZ1 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 TVLK like in standard
* US_RANGE_INTERN = TVLK-NUMKI.
*{ INSERT DEVK943692 1
DATA: z_werks TYPE lips-werks,
z_vkorg TYPE likp-vkorg,
z_nrnr TYPE nrnr,
z_vbtyp TYPE likp-vbtyp.
DATA: wa_xlikp LIKE likpvb,
wa_xlips LIKE lipsvb.
US_RANGE_INTERN = TVLK-NUMKI.
data t(1).
t = TVLK-LFART(1).
if t = ‘Z‘.
LOOP AT xlikp INTO wa_xlikp.
LOOP AT xlips INTO wa_xlips.
CASE wa_xlikp-vbtyp.
WHEN OTHERS.
MOVE: wa_xlikp-vbtyp TO z_vbtyp.
ENDCASE.
IF z_vbtyp EQ ‘J‘ or "outbound del.
z_vbtyp eq ‘T‘. "return del. "V003
MOVE: wa_xlips-werks TO z_werks, "V002 "SBr16072007
wa_xlikp-vkorg TO z_vkorg.
ELSEIF z_vbtyp EQ ‘7‘. "shipp.notification
MOVE: space TO z_vkorg,
wa_xlips-werks TO z_werks.
ENDIF.
if z_vkorg = ‘6001‘.
if z_vbtyp eq ‘J‘.
Case z_werks.
WHEN ‘6255‘.
US_RANGE_INTERN = ‘D1‘.
WHEN ‘6245‘.
US_RANGE_INTERN = ‘D2‘.
WHEN ‘6254‘.
US_RANGE_INTERN = ‘D3‘.
WHEN ‘6234‘.
US_RANGE_INTERN = ‘D4‘.
WHEN ‘6101‘.
US_RANGE_INTERN = ‘D5‘.
endcase.
elseif z_vbtyp EQ ‘T‘ .
Case z_werks.
WHEN ‘6255‘.
US_RANGE_INTERN = ‘R1‘.
WHEN ‘6245‘.
US_RANGE_INTERN = ‘R2‘.
WHEN ‘6254‘.
US_RANGE_INTERN = ‘R3‘.
WHEN ‘6234‘.
US_RANGE_INTERN = ‘R4‘.
WHEN ‘6101‘.
US_RANGE_INTERN = ‘R5‘.
endcase.
endif.
endif.
EXIT.
ENDLOOP.
EXIT.
ENDLOOP.
endif.
*} INSERT
ENDFORM.
相关链接:
版权声明:本文为博主原创文章,未经博主允许不得转载。