Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Allocation simulation by function module/BAPI

Weiskopf
Participant
0 Likes
576

Hello experts,

I would like to simulate an allocation (distribute quantities to plants) (SAP component LO-MDS-AL). For this Iu2019m looking for an appropriated function module which I set the article

number, plants, the allocation rule and the quantity to be distributed to the plants,

The result should only be simulated; no document should be created.

Which function module can I use for this?

Thank you for your information.

Best regards,

Kurt.

1 REPLY 1
Read only

Weiskopf
Participant
0 Likes
420

...
* Get plants for distribution:
  call function 'WAUF_READ_DISPATCHERRULE'
    exporting
      im_key                    = ls_key
      im_pincr                  = 1
      im_sbeln                  = iv_sbeln
      im_prefetch_kna1          = 'X'
      im_prefetch_wrf1          = 'X'
      im_prefetch_material_data = 'X'
      im_material               = iv_material
      im_prefetch_wlk1          = space
    importing
      ex_svko                   = ls_svko
    tables
      ex_figr                   = lt_figr
      ex_filn                   = lt_filn
    exceptions
      ar_nicht_vorhanden        = 1
      ar_pos_nicht_selektierbar = 2
      clint_convert_error       = 3
      figr_existiert_nicht      = 4
      others                    = 5.
...

The table lt_figr contains the plants assigned in the allocation; this table can be changed (remove some plants which are not necessary).


...
* Simulate allocation:
  call function 'WAUF_DETERMINE_QUANTITIES'
    exporting
      im_quantity_to_split           = lv_to_split
      im_alloc_tbl                   = lv_alloc_tbl        " Dummy
      im_alloc_tbl_item              = lv_alloc_tbl_item   " Dummy
      im_material                    = iv_material
      im_base_unit                   = 'CU'
      im_item_category               = 'ZB'
      im_quantity_simulation         = lv_quantity_simulation
      im_rounding                    = ls_svko-rundg
      im_split_remainder             = ls_svko-restv
      im_min_max_qty                 = lv_min_max_qty
    importing
      ex_quantity_splitted           = lv_quantity_splitted
    tables
      im_ex_stores                   = lt_filn
      im_ex_store_groups             = lt_figr
    exceptions
      quantity_simulation_invalid    = 1
      rounding_invalid               = 2
      split_remainder_invalid        = 3
      min_max_qty_invalid            = 4
      stores_storegroup_inconsistent = 5
      sum_quotas_initial             = 6
      call_functionmodul_round       = 7
      planned_qty_less_min_qty       = 8
      planned_qty_greater_max_qty    = 9
      arithmetic_errors              = 10
      others                         = 11.
...