Skip to Content
author's profile photo Former Member
Former Member

PPDS heuristic development

Hi Experts,

We have to split weekly orders to shift quantities and one of the proposed solution is to develop our own PPDS heuristic.

Just wanted to find out on the complexity of the task, and will appreciate if any of you could share there experience.

Are there are any user exits (Badi) that we can use in standard ones?

Your help will be highly appreciated.

Regards,

Zeeshan.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 01, 2008 at 11:35 AM

    Hi,

    writing your own heuristic is not that difficult, just go for it!

    As an example you can use this piece of coding which is doing something very similar to what you want to have: It makes one order out of several.

    Best regards

    Thomas

    FUNCTION Z_MY_FIRST_HEUR.

    *"----


    ""Local Interface:

    *" IMPORTING

    *" REFERENCE(I_HEUR_SETTINGS) TYPE /SAPAPO/HEUR_SETTINGS

    *" VALUE(I_SIMVERID) TYPE /SAPAPO/VRSIOID

    *" VALUE(I_SIMSESSID) TYPE /SAPAPO/OM_SIMSESSION

    *" REFERENCE(I_DIALOG_FLG) TYPE C DEFAULT SPACE

    *" REFERENCE(I_OBJECT_KEYS) TYPE /SAPAPO/HEUR_OBJECT_KEYS

    *" EXPORTING

    *" REFERENCE(E_CHANGED_OBJECTS) TYPE /SAPAPO/HEUR_CHANGED_OBJECTS

    *" REFERENCE(E_OBJECT_KEYS) TYPE /SAPAPO/HEUR_OBJECT_KEYS

    *" EXCEPTIONS

    *" NOT_QUALIFIED

    *" NO_INPUT_OBJECTS

    *" FAILED

    *"----


    data:

    lv_PegId type /sapapo/pegid,

    lt_PegId type /SAPAPO/PEGID_TAB,

    lv_OrdId type /sapapo/ORDERID,

    lv_OrdNo TYPE /SAPAPO/ORDNO,

    lt_DelOrdId type /SAPAPO/ORDERID_TAB,

    ls_DelOrdId type /SAPAPO/ORDERID_str,

    lt_OrdId type /sapapo/guid_tab,

    lt_OrdData type /sapapo/om_order_ext_tab,

    ls_OrdData type /sapapo/om_order_ext_str,

    lt_OutData type /SAPAPO/OM_IO_TAB,

    ls_OutData type /SAPAPO/OM_IO,

    lt_OrderId type /SAPAPO/OM_ORDERID_TAB,

    lt_OrderIdToDel type /SAPAPO/OM_ORDERID_TAB,

    lt_SubOrderId type /SAPAPO/OM_ORDERID_TAB,

    lt_DelOrder type /SAPAPO/OM_ORDER_TAB,

    ls_DelOrder type /SAPAPO/OM_ORDER,

    lv_Quantity type /sapapo/menge,

    lo_Conf type ref to /sapapo/CL_CONFR,

    lv_MinTime type /SAPAPO/ENDTI,

    lv_NumPegIds type i.

    break-point.

    • Set min time to some huge value.

    lv_MinTime = '99991231000000'.

    • Announce planning version to rrp.

    CALL FUNCTION '/SAPAPO/TSIM_SIMULATION_SET'

    EXPORTING

    I_SIMVERID = i_simverid.

    • Prepare a copy of input pegging ids.

    lt_PegId[] = i_object_keys-pegid_tab[].

    • In this example we pick only one pegid and ignore the rest!

    describe table lt_PegId lines lv_NumPegIds.

    if lv_NumPegIds <> 1.

    return.

    endif.

    read table lt_PegId into lv_PegId index 1.

    • Read all orders for the picked pegid which output!! (=6) this product.

    CALL FUNCTION '/SAPAPO/EFPL_PEG_GET_ORD'

    EXPORTING

    I_SIMSESSID = i_simsessid

    I_SIMVERID = i_simverid

    I_PEGIDS_TAB = lt_PegId

    I_IONODE_PEG_SEL = 6

    IMPORTING

    E_ORDERS_TAB = lt_OrdId

    EXCEPTIONS

    NOT_QUALIFIED = 1

    NO_PEGIDS_FOUND = 2

    NO_ORDERS_FOUND = 3

    NO_IONODES_FOUND = 4

    OTHERS = 5.

    IF SY-SUBRC <> 0.

    break-point.

    ENDIF.

    • Prepare a copy of the order ids.

    lt_OrderID[] = lt_OrdId[].

    • Read data for the orders

    CALL FUNCTION '/SAPAPO/RRP_LC_ORDER_GET_DATA'

    EXPORTING

    IT_ORDERTAB = lt_orderid

    IMPORTING

    ET_ORDER = lt_OrdData.

    • Collect all suborderids which are not parent orders and prepare for deletion.

    loop at lt_OrdData into ls_OrdData.

    if not ls_OrdData-Parent_OrderId is initial.

    append ls_OrdData-OrderId to lt_SubOrderId.

    append ls_OrdData-Parent_OrderId to lt_OrderIdToDel.

    endif.

    endloop.

    • No suborders found ==> no pr ==> exit.

    if lt_SubOrderId[] is initial.

    return.

    endif.

    • Read now the output nodes for all suborders.

    CALL FUNCTION '/SAPAPO/RRP_LC_ORDER_GET_DATA'

    EXPORTING

    IT_ORDERTAB = lt_suborderid

    IMPORTING

    ET_OUTPUTS = lt_OutData.

    • Sum up the output quantities and min time.

    loop at lt_OutData into ls_OutData.

    lv_Quantity = lv_Quantity + ls_OutData-Real_Quantity.

    if ls_OutData-Io_Time < lv_MinTime.

    lv_MinTime = ls_OutData-Io_Time.

    endif.

    endloop.

    • Create a new order with total quantity (here some hard coded date only!).

    CALL FUNCTION '/SAPAPO/RRP_ORDER_CREATE_FINDS'

    EXPORTING

    IV_PEGID = lv_PegId

    IV_QUANTITY = lv_Quantity

    IV_RQMTTI = lv_MinTime

    IV_CONFIGURATION = lo_Conf

    IV_APPLICATION = space

    IMPORTING

    EV_ORDID = lv_OrdId

    EV_ORDNO = lv_OrdNo.

    • Delete the old orders.

    CALL FUNCTION '/SAPAPO/RRP_ORDER_DELETE'

    EXPORTING

    IT_ORDID = lt_OrderIdToDel

    IV_APPLICATION = space

    IMPORTING

    ET_CHANGED_ORDERS = lt_DelOrder.

    • Prepare changed object info...

    loop at lt_DelOrder into ls_DelOrder.

    ls_DelOrdID-Orderid = ls_DelOrder-OrderId.

    append ls_DelOrdId to lt_DelOrdId.

    endloop.

    • ... and export it.

    append lines of lt_DelOrdId to e_changed_Objects-OrderId_Del_Tab.

    append lv_OrdId to E_CHANGED_OBJECTS-orderid_tab.

    ENDFUNCTION.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 31, 2008 at 10:34 AM

    Hello,

    Writing and heuristic is not an easy task.

    Could you please provide detailed problem definition?

    Are u planning to create multiple orders (order qty = shift prodution)? In this case you may try fixed or periodic lot sizing procedure.

    There are some BADIs in heuristic which can influence the planning result. We can think on it after knowing exact problem definition?

    Regards

    Mangesh A. Kulkarni

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks for your answer Mangesh,

      Yes the requirement is the same as you have mentioned. Multiple orders, with each order = shift quantity.

      As an example, we may have a weekly (5 day) order of 1000. The resulting shift quantity (3 shifts /day) would be 1000/5/3 = 67.

      We would expect 15 orders of 67 quantity each.

      Regards,

      Zeeshan.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.