Delivery split in VL10C according to material and quantity

In the data transfer routine when creating deliveries for sales orders, the delivery split can be executed according to various criteria. However, it is not possible to realize a split by quantity, i. that a material may only be put into a delivery with a certain or maximum quantity.

In order to realize this requirement, one must intervene at an earlier point in time of delivery.

Scenario

Several items are recorded in a sales order. However, a certain material always has to be supplied separately. A shipment of this material may continue to contain only a maximum amount of 2 pieces.

This requirement is not uncommon when e.g. certain materials declared as dangerous goods are shipped by air freight.

Example: The dangerous goods are recorded with quantity = 9 PC. It must be split into 4 deliveries a 2 PC and one delivery a 1 PC.

Full fill the requirement

In the VL10C, sales orders due for delivery are grouped into so-called packages. Each package is a group of order items that can theoretically be combined into a single delivery. Each package then passes through the data transfer routine Order -> Delivery, where the actual delivery split is then executed out for the package. A package can therefore be 1 … n deliveries.

On the tab “User role” of the selection screen of the VL10C there is the parameter “PackageType”. This parameter determines the logic by which the packages are assembled. If the value “9 = Userexit” is entered here, you can put together the packages according to your own logic and perform your own split criteria for the delivery split according to material and quantity.

The preset of the selection screen with PackageType = 9 is done in transaction VL10CUC.

By setting the parameter “PackageType = 9”, we jump to the user exit USEREXIT_PREPARE_PACKAGES_CR in program LV50R_VIEWG09.

There, the table ct_key_try is filled and the table it_postab is manipulated if necessary.

The ct_key-PANUM field controls which items flow into a delivery.

The delivery quantity can be entered in the field it_postab-kumng.

Coding 

*----------------------------------------------------------------------*
***INCLUDE LV50R_VIEWF62 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form USEREXIT_PACKAGES_CHANGE
*&---------------------------------------------------------------------*
FORM userexit_prepare_packages_chan
 USING ix_list_profil TYPE shp_vl10_list_profil
 it_postab TYPE shp_vl10_postab_t
 CHANGING ct_packages TYPE shp_vl10_package_t
 ct_vorgabe_daten TYPE shp_vorgabe_daten_t
 ct_komdlgn TYPE shp_komdlgn_t.

* Deklarationen
 DATA: ls_postab LIKE LINE OF it_postab,
 ls_vorgabe LIKE LINE OF ct_vorgabe_daten,
 ls_pack LIKE LINE OF ct_packages.

 "PACKAGES
 LOOP AT ct_packages INTO ls_pack.
 IF sy-tabix = 4.
 ls_pack-panum = '2'.
 MODIFY ct_packages FROM ls_pack.
 ENDIF.
 ENDLOOP.
 ls_pack-panum = '3'.
 ls_pack-tabix = 5.
 ls_pack-id = '5'.
 APPEND ls_pack TO ct_packages.

 "POSTAB
 LOOP AT it_postab INTO ls_postab.
 READ TABLE ct_packages INTO ls_pack WITH KEY tabix = ls_postab-master_tabix.

 IF ls_pack-tabix = 4.
 ls_postab-kumng = 4.
 ENDIF.

 MODIFY it_postab FROM ls_postab.
 ENDLOOP.

 ls_postab-kumng = 6.
 APPEND ls_postab TO it_postab.

 "VORGABE
 LOOP AT ct_vorgabe_daten INTO ls_vorgabe.
 READ TABLE ct_packages INTO ls_pack WITH KEY tabix = ls_vorgabe-postab_tabix.

 IF ls_pack-tabix = 4.
 ls_vorgabe-lfimg = 4.
 ls_vorgabe-lgmng = 4.
 ls_vorgabe-lfimg_flo = 4.
 ls_vorgabe-lgmng_flo = 4.
 ls_vorgabe-panum = 2.
 ENDIF.

 MODIFY ct_vorgabe_daten FROM ls_vorgabe.
 ENDLOOP.

 ls_vorgabe-lfimg = 6.
 ls_vorgabe-lfimg_flo = 6.
 ls_vorgabe-lgmng_flo = 6.
 ls_vorgabe-panum = '3'.
 ls_vorgabe-id = '5'.
 APPEND ls_vorgabe TO ct_vorgabe_daten.

ENDFORM. " USEREXIT_PACKAGES_CREATE
.

Result

The sales order has been split into 6 deliveries.

  • Delivery 1: the 3 normal items (not dangerous goods)
  • Delivery 2-5: one item dangerous goods a 2 PC
  • Delivery 6: one item dangerous goods a 1 PC

Further informations

Special topics on SAP forms

Fixed price SAP forms

SAP form development