Skip to Content
Technical Articles
Author's profile photo Jigang Zhang 张吉刚

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.

Answer from SAP Note 546668

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:


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.

       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.
      input_split       = ls_split
      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.


FUNCTION zsd_vl10b_split_item_gt25.
*"*"Local Interface:
  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.

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


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Raghavendra Raghavendra
      Raghavendra Raghavendra

      Hi Zhang,

      Thanks for the clear explanation .

      I am facing issue will copying 301 to 910 routine .In  301 routine we have multiple ENHANCEMENT-POINTs ,in ENHANCEMENT  OID_EXTD_FV50C301  we have code like

        likp-oic_lifnr     xkomdlgn-oichlifnr.                   "soDK003593
      likp-oic_dcityc    xkomdlgn-oichdcityc.                  "soDK003593

      when i try to copy giving the error message like

      Component oichlifer doesn't exists in  komdlgn structure.

      But same code working in 301 routine .


      Author's profile photo Jigang Zhang 张吉刚
      Jigang Zhang 张吉刚
      Blog Post Author

      Hi Raghavendra Raghavendra, why do you need those fields like likp-oic_lifnr? Those fields are obsolete in the current version. Please compare with your LIKP table and comment on them accordingly.

      Anyway, you can activate your code by force without syntax check at this include program for routine.

      Author's profile photo Raghavendra Raghavendra
      Raghavendra Raghavendra

      Hi Zhang,

      Okay , Understand .

      Force activation is done.

      Thanks for the inputs.


      Author's profile photo Amarnath Deshpande
      Amarnath Deshpande

      Hi Zhang,

      I have a requirement to consider total weight of delivery to not exceed 16,000 LBS.
      Can you please suggest any way to achieve it, as the upcoming weight of the item and previous item weight needs to be stored and ZUKRL value needs to be tweaked.
      Please help me.

      Author's profile photo Jigang Zhang 张吉刚
      Jigang Zhang 张吉刚
      Blog Post Author

      Looks like it's similar to my case just with a different condition.Please try this:

      1. Create one new routine by VOFM routine -> Data Transfer -> Deliveries;
      2. Define a structure to save the accumulated quantity with KOMDLGN-LFIMG per VGBEL and ZUKRL.
      3. Create one new FM to get the new ZUKRL and replace the old ZUKRL when the Qty reaches your defined up-limit.