cancel
Showing results for 
Search instead for 
Did you mean: 

/SAPAPO/SNPLLC - does not appear to work as expected

Former Member
0 Kudos

Hi Experts,

I was wondering if anyone can shed light on how this program works. We need a successfull run of the LLC calc prior to running heuristics on the supply chain. currently the heuristics run gives unpredictable results due to the LLC calc not working.

This is the situation: -

- We have a data model where the supply source for products can change dynamically from one production plant to another. In order to faciltate the quick switching of supply, we have defined Transportation Lanes from all the possible supplying production locations to all the possible receiving locations. These are "All Products" lanes.

- Overlaid on the TLAnes, we have quota arrangements which control from day-to-day which locations do the supplying (we are running SNP with no production horizon, so it plans also the next few days as well as out to 2 years future buckets).

When we come to run the LLC program above, it always gives the Information message "Low-level codes cannot be determined due to cycles in model "000". Despite only being an Info message, it also causes the background job to fail (seemingly). In any case the LLC is not calculated correctly as all Location/Products have LLC 0 after the run. The cycles also occur in locations in other parts of the business that we have no control over (it is not possible to limit the LLC calc by location selection).

I have several questions about the way SNPLLC works: -

1. The cycles that are displayed seem to be purely based on the TLanes - does it take into account Quota Arrangements when determining cycles? The cycles displayed do not seem to be recursive - does it just give up after a certain number of iterations?

2. When I get the above info message, the detail says that I can set the "Save Low-Level Codes with Cycles" Indicator to force it to save LLC despite cycles - where is this indicator? I have looked in the SNP Global settings (profile) but can't see it. I have also implemented note 1548670 - "SNP LLC not saved for cycles" but it does not seem to have made any difference.

3. Is there anything that I can do in order to get over this issue without changing all the master data?

Any help much appreciated.

Thanks,

Chris Brookes.

Accepted Solutions (1)

Accepted Solutions (1)

former_member187488
Active Contributor
0 Kudos

Hello,

Regarding your questions:

1. The cycles that are displayed seem to be purely based on the TLanes - does it take into account Quota Arrangements when determining cycles? The cycles displayed do not seem to be recursive - does it just give up after a certain number of iterations?

SNP LLC determination will terminate when the first cycle is detected, and won't continue any more.

So only when there's not ANY cycle in the model, could SNP LLC be correctly determined.

During cycle determination, it won't take quota arrangements into account, only the transportation lanes (in case of external procurement).

2. When I get the above info message, the detail says that I can set the "Save Low-Level Codes with Cycles" Indicator to force it to save LLC despite cycles - where is this indicator? I have looked in the SNP Global settings (profile) but can't see it. I have also implemented note 1548670 - "SNP LLC not saved for cycles" but it does not seem to have made any difference.

The setting is only relevant with PPDS, but not SNP. As you can see, the note is a PPDS note.

3. Is there anything that I can do in order to get over this issue without changing all the master data?

Please check note 912108. There're 3 solutions here for your reference.

In your case, you're using quota arrangement to control the transportation, I suppose solution A) should be better for you.

You can implement the BADI, and in your customizing code, you delete those transportation lanes with 0 quota arrangement.

You can use paramter 'iv_low_level_code' to control your logic to be used only for LLC determination, like:

IF NOT iv_low_level_code EQ 'X'.

*----


The logic for other SOS determination except LLC

*----


ELSE.

*----


The logic when LLC determination:

If there's any lanes with 0 quota arrangement, delete it from SOS.

*----


ENDIF.

I hope the above helps.

Best Regards,

Ada

Former Member
0 Kudos

Hi Ada,

When I try and access the note I get the message "The requested SAP Note is either in reworking or is released internally only".

Could you include the note text as a reply?

Thanks in advance,

Chris.

former_member187488
Active Contributor
0 Kudos

Hello Chris,

Sorry that the note is in pilot release.

Please check the following text from the note:

Symptom

During the SNP low-level code calculation, a termination occurs as soon as a cycle develops:

o a location is both the delivery location and order location for a location product

o Recursion within a PPM or PDS (process industries)

This behavior is normal for the SAP standard system.

For scenarios with recursion (in the process industries, for example), this behavior may not be required or appropriate. Check the following solutions to determine which one will eliminate the problem in your scenario.

Solution

1. Solution A)

Recursion-generating sources of supply for the low-level code calculation are eliminated with a customer-specific implementation of the BAdI /SAPAPO/PWB_SOS method PWB_USEX_SOS.

Caution: The BAdI Method is also called by other functions. If the method of the low-level code calculation is called, the prameter 'iv_low_level_code' is = 'X'. (For more information, see the BAdI documentation.)

.....

Best Regards,

Ada

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Ada,

I have implemented the BADI in the way that you suggested, and it does eliminate location/products with cycles, and the LLC calculation run finishes normally.

However, I have a further concern with the subsequentl LLC calculation. This does not appear to be taking Quota Arrangements into account: In the example I am looking at, location 4442 gets the product H0265010 from location 4110. Both of these locations happen to be production plants that have the capability to make H0265010. The quota arrangement however specifies that 4442 should get the product from 4110 instead of making it (100% quota).

Given the above, I would expect that 4110 should be given a higher LLC than 4442, but this is not the case: both get LLC 1.

Are you sure that LLC calculation takes into account Quota Arrangements during the calculation?

Kind Regards,

Chris Brookes.

former_member187488
Active Contributor
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi Ada,

To my mind, this then means that the LLC calculation is not usable since you cannot guarantee that the heuristic will process the locations in the correct order: If it processes 4110 first, then it will not take into account the distribution requirements from 4442. This is a serious issue and makes me wonder why SAP allows us to use quota arrangements if it will not take them into account in the LLC/Heuristics run order.

I will enter this issue as a SAP note.

Thanks for your help.

Kind Regards,

Chris Brookes.

Former Member
0 Kudos

Hi Ada,

Just retested this and realized that although the quota was in place for 4110->4442, the product master had a Procurement type of "E". Changed this to "F" and now LLC works as expected - 4442 has LLC=1 and 4110 has LLC=2 - phew!

So Heuristics will work OK.

Thanks for your help.

Chris.

former_member187488
Active Contributor
0 Kudos

Hi Chris,

It seems that I misunderstood the above scenario before. Sorry about that.

But it's true that no quota will be considered during LLC determination.

Now after re-reading the scenario, it seems to me that 4110 should be higher than 4442 ... And even without BADI implementation, the scenario should not contain a cycle.

Could you please tell me what you did in the BADI?

Thanks and Regards,

Ada

Former Member
0 Kudos

Hi Ada,

BADI Code below: -

method /SAPAPO/IF_EX_PWB_SOS~PWB_USEX_SOS.

  • Revision History *

********************************************************************************

  • Date : 27/09/2011 Changed By : Mohammed Sajid *

  • Revision ID: AO01 Helpdesk ID: Hovis ELS ASIN-8KRJ79 *

  • Description: Filter the sources of supply so that only those with a valid *

  • Quota Arrangement are considered by the SNP LLC calculation *

********************************************************************************

*

  • AO01 Begin of Insert

TYPES : BEGIN OF ty_loc,

LOCID TYPE /SAPAPO/LOCID,

LOCNO TYPE /SAPAPO/LOCNO,

END OF ty_loc.

TYPES : BEGIN OF ty_mat,

MATID TYPE /SAPAPO/MATID,

MATNR TYPE /SAPAPO/MATNR,

END OF ty_mat.

DATA : lv_logsys TYPE BAPIGENFIELDS-LOGSYSTEM,

lv_quota_found TYPE char01,

lv_vrsioex TYPE /SAPAPO/VRSIOEX,

lv_model TYPE /SAPAPO/C_MODELID,

lv_date_from(14) TYPE c,

lv_date TYPE char08,

lv_no_quota TYPE BAPI10009GENFIELDS-NO_OF_QUOTAS,

lt_plngversion TYPE TABLE OF bapiversrange,

lt_model_sel TYPE TABLE OF BAPIMODELRANGE,

lt_loc_intsel TYPE TABLE OF BAPILOCINTRANGE,

lt_prod_intsel TYPE TABLE OF BAPIPRODUCTINTRANGE,

lt_quota_itm_lane TYPE TABLE OF BAPI10009QTAITEMLANE2O,

lt_quota_itm_erp TYPE TABLE OF BAPI10009QTAITEMEXTPROC2O,

lt_val_from TYPE TABLE OF bapi10009qtavalfrrange,

lt_val_to TYPE TABLE OF bapi10009qtavaltorange,

lt_return TYPE TABLE OF bapiret2,

lt_loc TYPE TABLE OF ty_loc,

lt_mat TYPE TABLE OF ty_mat,

ls_loc TYPE ty_loc,

ls_loc1 TYPE ty_loc,

ls_mat TYPE ty_mat,

ls_plngversion TYPE bapiversrange,

ls_model_sel TYPE BAPIMODELRANGE,

ls_loc_intsel TYPE BAPILOCINTRANGE,

ls_prod_intsel TYPE BAPIPRODUCTINTRANGE,

ls_quota_itm_lane TYPE BAPI10009QTAITEMLANE2O,

ls_quota_itm_erp TYPE BAPI10009QTAITEMEXTPROC2O,

ls_val_from TYPE bapi10009qtavalfrrange,

ls_val_to TYPE bapi10009qtavaltorange,

ls_return TYPE bapiret2.

CONSTANTS : lc_i TYPE char01 value 'I',

lc_x TYPE char01 value 'X',

lc_s TYPE char01 value 'S',

lc_eq TYPE char2 value 'EQ',

lc_le TYPE char2 value 'LE',

lc_ge TYPE char2 value 'GE',

lc_time TYPE char6 VALUE '000000'.

  • AO01 End of Insert

.

*

  • AO01 Begin of Insert

  • If Badi is called within the determinition of low-level code

  • ans Bapi is called for an SNP LLC calculation

IF iv_low_level_code = lc_x AND iv_plan_usage = lc_s.

  • Get location

IF NOT ct_sources_extend[] IS INITIAL.

SELECT LOCID LOCNO

FROM /SAPAPO/LOC

INTO TABLE lt_loc

FOR ALL ENTRIES IN ct_sources_extend

WHERE locid EQ ct_sources_extend-locfr.

IF sy-subrc IS INITIAL.

SORT lt_loc BY locid.

ENDIF.

SELECT MATID MATNR

FROM /SAPAPO/MATKEY

INTO TABLE lt_mat

FOR ALL ENTRIES IN ct_sources_extend

WHERE matid EQ ct_sources_extend-matid.

IF sy-subrc IS INITIAL.

SORT lt_loc BY locid.

ENDIF.

ENDIF.

  • Get planning version

GET PARAMETER ID '/SAPAPO/VRSIOEX' FIELD lv_vrsioex.

CALL FUNCTION '/SAPAPO/DM_MODEL_GET_BY_VERS'

EXPORTING

IV_VRSIOEX = lv_vrsioex

IMPORTING

ev_modelid = lv_model

EXCEPTIONS

version_not_found = 1

not_qualified = 2

OTHERS = 3.

  • Get Model

  • Get logical system

SELECT SINGLE logsys FROM t000

INTO lv_logsys

WHERE mandt EQ sy-mandt.

IF sy-subrc NE 0.

EXIT.

ENDIF.

  • Set Planning Version

REFRESH : lt_plngversion.

ls_plngversion-sign = lc_i.

ls_plngversion-option = lc_eq.

ls_plngversion-low = lv_vrsioex.

APPEND ls_plngversion TO lt_plngversion.

  • Set Model selection

REFRESH : lt_model_sel[].

ls_model_sel-sign = lc_i.

ls_model_sel-option = lc_eq.

ls_model_sel-low = lv_model.

APPEND ls_model_sel TO lt_model_sel.

  • Set dates

lv_date = sy-datum.

CONCATENATE lv_date lc_time INTO lv_date_from.

REFRESH : lt_val_from[].

ls_val_from-sign = lc_i.

ls_val_from-option = lc_le.

ls_val_from-low = lv_date_from.

ls_val_from-high = lv_date_from.

APPEND ls_val_from TO lt_val_from.

REFRESH : lt_val_to[].

ls_val_to-sign = lc_i.

ls_val_to-option = lc_ge.

ls_val_to-low = lv_date_from.

ls_val_to-high = lv_date_from.

APPEND ls_val_to TO lt_val_to.

LOOP AT ct_sources_extend

INTO st_sources_extend.

MOVE syst-tabix TO w_tabix.

CLEAR : lv_quota_found.

READ TABLE lt_loc INTO ls_loc WITH KEY

locid = st_sources_extend-locfr.

READ TABLE lt_loc INTO ls_loc1 WITH KEY

locid = st_sources_extend-locto.

READ TABLE lt_mat INTO ls_mat WITH KEY

matid = st_sources_extend-matid.

REFRESH : lt_loc_intsel[].

ls_loc_intsel-sign = lc_i.

ls_loc_intsel-option = lc_eq.

ls_loc_intsel-low = ls_loc1-locno. "st_sources_extend-locto.

APPEND ls_loc_intsel to lt_loc_intsel.

REFRESH : lt_prod_intsel[].

ls_prod_intsel-sign = lc_i.

ls_prod_intsel-option = lc_eq.

ls_prod_intsel-low = ls_mat-matnr. "st_sources_extend-matid.

APPEND ls_prod_intsel TO lt_prod_intsel.

  • Call BAPI to get quota arrangement

REFRESH : lt_quota_itm_lane[], lt_quota_itm_erp[].

CALL FUNCTION 'BAPI_QTASRVAPS_GETLIST2'

EXPORTING

LOGICAL_SYSTEM = lv_logsys

MAX_NUMBER_OF_QUOTA = '9999'

IMPORTING

NUMBER_OF_QUOTA = lv_no_quota

TABLES

MODEL_SELECTION = lt_model_sel

PLANNING_VERSION_SELECTION = lt_plngversion

LOCATION_INT_SELECTION = lt_loc_intsel

PRODUCT_INT_SELECTION = lt_prod_intsel

VAL_FROM_SELECTION = lt_val_from

VAL_TO_SELECTION = lt_val_to

QUOTA_ITEM_LANE = lt_quota_itm_lane

QUOTA_ITEM_EPR = lt_quota_itm_erp

RETURN = lt_return

.

  • Look for valid quota arrangements

LOOP AT lt_quota_itm_lane INTO ls_quota_itm_lane.

IF ls_quota_itm_lane-location_int_from NE ls_loc-locno

OR ls_quota_itm_lane-quota_arrangement = 0.

CONTINUE.

ELSE.

  • Quota found exit from loop

lv_quota_found = lc_x.

EXIT.

ENDIF.

ENDLOOP.

IF lv_quota_found IS INITIAL.

LOOP AT lt_quota_itm_erp INTO ls_quota_itm_erp.

IF ls_quota_itm_erp-location_int_from NE ls_loc-locno

OR ls_quota_itm_erp-quota_arrangement = 0.

CONTINUE.

ELSE.

  • Quota found exit from loop

lv_quota_found = lc_x.

EXIT.

ENDIF.

ENDLOOP.

ENDIF.

  • Exclude entry if no valid quota found

IF lv_quota_found IS INITIAL.

MOVE c_exclude TO st_sources_extend-sprkz.

MODIFY ct_sources_extend

FROM st_sources_extend

INDEX w_tabix.

ENDIF.

ENDLOOP.

  • Remove source of supply records which can be excluded

DELETE ct_sources_extend WHERE sprkz = c_exclude.

ENDIF.

  • AO01 End of Insert

endmethod.