This blog has been discontinued (See latest posts)
Wednesday, April 7, 2010 BAdI for Flexible SXS Explosion Date
VN:F [1.9.22_1171]
Rating: 3.0/5 (1 vote cast)

Once you create an order the explosion date for all master data is set to the start date of that order. Since this might happen well before the actual execution date you might want to change something on short notice in the XSteps section before you actually create a control recipe.If you have release the old version of your SXS and you have the business function active which prevents the change of released SXS’s you can only create a new version from the current date with the changes. However the old orders still have the explosion date in the past and will not be able to use the new version.

Today the note 1452604 has been released which adds a BAdI to implement custom code which is called whenever the explosion date is accessed in the context of XSteps.

Here is the detailed procedure and some sample coding to change the explosion date:

  • Create a new implementation (SE19) for enhancement spot ES_CMX_XS_BADI.
  • Chose a name for the implementation, e.g. Z_SXS_EXPLOSION
  • Chose a name for the implementing class, e.g. Z_SXS_EXPLOSION
  • You now can choose to copy the example class CL_IM_CMX_XS_EXPLDATE_EXAMPLE which does some checking on the order type and simply sets a fixed date for a fixed order number (it’s just an example code…)

Here is some sample coding if you want to use a user status in the order:

METHOD if_badi_cmx_xs_expldate~get_explosion_date.
  DATA: lr_context      TYPE REF TO cocr_cmx_s_cr_data,
          lv_statkey    TYPE j_objnr,
          lv_fullfill   LIKE sy-datar,
          ls_jest       TYPE jest.

  IF ir_context_key IS BOUND. "check just to be safe

    TRY .
        lr_context ?= ir_context_key.

        CONCATENATE 'OR' lr_context->aufnr INTO lv_statkey.

        CALL FUNCTION 'STATUS_CHECK_BY_SELSCHEM'
          EXPORTING
            objnr          = lv_statkey
            selid          = 'Z_SXS'
          IMPORTING
            fullfill       = lv_fullfill
          EXCEPTIONS
            no_stat_tab    = 1
            no_stat_scheme = 2
            OTHERS         = 3.

        IF sy-subrc = '0' AND lv_fullfill = 'X'.
          rv_explosion_date = sy-datum.
        ENDIF.

      CATCH cx_sy_move_cast_error.
*      The type cast above should never fail.
    ENDTRY.

  ENDIF.
ENDMETHOD.

I am using a status selection schema here to decide whether an order should use the current date. If the order does not fullfill the selection schema the normal explosion date is used. Here are the steps to make this work:

  • Create a status profile with your user status (transaction BS02) or assign a new user status to your existing status profile you use for the order.
  • Create a status selection schema (transaction BS42) where you specify your new user status as set. In my example I used ‘Z_SXS’
  • Use this schema in your coding as the value for exporting parameter ‘SELID’ (see above)

Now you can decide in any given order by setting this user status whether the normal explosion date is used or the current date. Of course you can also implement a popup that asks the user for a date or that gives several possibilities.

BAdI for Flexible SXS Explosion Date, 3.0 out of 5 based on 1 rating
Please rate the article:
VN:F [1.9.22_1171]
Rating: 3.0/5 (1 vote cast)

News

This blog has been discontinued!

Archives

Calendar

April 2010
M T W T F S S
 1234
567891011
12131415161718
19202122232425
2627282930