EDUCAÇÃO E TECNOLOGIA

Split STO delivery with fixed number of line items

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.

Q: How can the split be affected via the copy control?

A: Via the copy control, the data is copied from the preceding document to the

header of the delivery and therefore acts as a splitting criterion. Two routines are relevant for the data transfer for outbound deliveries with order reference in the standard: 

  • 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.

With all other outbound delivery types as well as with inbound deliveries,

the data transfer is carried out via FORM routine DATEN_KOPIEREN_301

(include FV50C301) or DATEN_KOPIEREN_201 (include FV50C201).

In the table with delivery header data LIKP, there is field ZUKRL which can be filled with any values via the copying control. The contents of this field act as splitting criteria for the delivery creation so

that you can use it in order to force a delivery split according to your own specifications. Apart from that, the field does not have any business or technical importance and can be delivered via both of the routines mentioned above.

You can find more detailed information in note 166397.

Reference Routine 301

VOFM routine -> Data Transfer -> Deliveries:

About the Key field ZUKRL

The criterion is not about splitting one order into several deliveries, but about combining or not several orders into one delivery (Zusammenführungskriterium = Combination criterion).

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.

Define a structure to save the accumulated items per VGBEL and 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.

DATAGT_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.