When users deal with delivery orders with lots of items lines like greater than 25, it creates processing challenges resulting in long delays as the work must be performed by a single person and can’t be divided out. Then the requirement is split delivery at VL10B for STO when the numbers of delivery line items are greater than a specific number.
This question has been asked many times in the community like this one. Jelena’s answer is absolutely working, in this article just make it more clear how to achieve this by using VOFM.
Answer from SAP Note 546668
- FORM routine DATEN_KOPIEREN_001 (include FV50C001) for the transfer of the data from the header (CVBAK) and item (CVBAP) of the sales order.
- FORM routine DATEN_KOPIEREN_002 (include FV50C002) for the transfer of the data from the business data of the sales order.
Reference Routine 301
VOFM routine -> Data Transfer -> Deliveries:
About the Key field ZUKRL
If you want to disallow combining different orders with different distribution channels and different divisions, you can fill ZUKRL as follows:
LIKP-ZUKRL(2) = CVBAK-VTWEG.
LIKP-ZUKRL+2(2) = CVBAK-SPART.
orders that have the same entries in ZUKRL will be combined, the others will get separate deliveries.
ZUKRL replacement method
As the internal table xkomdlgn keeps all the item details for all STO together and will set the LIKP-ZUKRL inside that routine. The idea of replacing ZUKRL is to collect the numbers of processed xkomdlgn item and save as global data, replace old ZUKRL with new ZUKRL if numbers of items greater than the specific number for a combination of STO number and old ZUKRL.
Copy routine 301 to a new routine like 901, insert below replacement logic after ZUKRL has been assigned.
DATA: ls_split TYPE ZSD_VL10B_DLY_SPLIT,
lv_zukrl type DZUKRL.
clear: ls_split, lv_zukrl.
ls_split-VGBEL = xkomdlgn-VGBEL.
ls_split-zukrl = likp-zukrl.
ls_split-count = 1.
" Get new ZUKRL based on accumulated item no.
CALL FUNCTION 'ZSD_VL10B_SPLIT_ITEM_GT25'
EXPORTING
input_split = ls_split
IMPORTING
ZUKRL = lv_zukrl "replaced ZUKRL
.
likp-zukrl = lv_zukrl.
Create below FM to get new ZUKRL when the number of items reaches the specific number here is 25. Define global data GT_SUM at top of the function group for this function module.
DATA: GT_SUM type ZSD_VL10B_DLY_SPLIT_T.
FUNCTION zsd_vl10b_split_item_gt25.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(INPUT_SPLIT) TYPE ZSD_VL10B_DLY_SPLIT
*" EXPORTING
*" REFERENCE(ZUKRL) TYPE DZUKRL
*"----------------------------------------------------------------------
DATA: ls_sum TYPE zsd_vl10b_dly_split, "accumulated ZUKRL
ls_split_no TYPE i,
lv_string type string.
" --------Example of Split---------
" item 0-25, ZUKRL = ZUKRL
" item 26-50, ZUKRL = ZUKRL+"SPLIT-1"
" item 51-75, ZUKRL = ZUKRL+"SPLIT-2"
" ...
"----------------------------------
" 01. get all incoming entry to Global table GT_SUM
COLLECT input_split INTO gt_sum.
* APPEND INPUT_SPLIT TO GT_SUM.
CLEAR ls_sum.
READ TABLE gt_sum INTO ls_sum
WITH KEY vgbel = input_split-vgbel
zukrl = input_split-zukrl.
" 02. check total items for current ZUKRL
IF ls_sum-count BETWEEN 1 and 25.
"keep original ZUKRL for 1-25 items
zukrl = input_split-zukrl.
ELSE.
ls_split_no = ls_sum-count DIV 25.
lv_string = ls_split_no.
"using new ZUKRL with SPLIT no. Per 25 items
CONCATENATE input_split-zukrl 'SPLIT-'
lv_string INTO zukrl.
ENDIF.
ENDFUNCTION.
Nenhum comentário:
Postar um comentário