Skip to Content

Hi all.

At the Product View, Elements tab, there is field Resource. This column displays, in general, the resource assigned to the last operation of the order (or the output resource).

Overtime, I’ve seen a couple of customers who wanted to display in this field the resource assigned to the first operation of the order instead.

This can be done by creating an implementation of BAdI /SAPAPO/RRP_IO_COL, Method RRP_USEX_COLS_FILL_01.


When the BAdI is reached, there is table CT_IO which contains field MAIN_RESOURCE, which is the resource id of the resource displayed in Elements tab. When we want to show a different resource, we have to assign a different main_resource.


An example of how this could be done is shown below:


method /SAPAPO/IF_EX_RRP_IO_COL~RRP_USEX_COLS_FILL_01.


INCLUDE /sapapo/constants_om.

   DATA:

   lt_rc              TYPE /sapapo/om_lc_rc_tab,

   lt_order           TYPE /sapapo/om_ordid_tab,

   lt_activities      TYPE /sapapo/om_tab_act,

   ls_gen_params      TYPE /sapapo/om_gen_params,

   lv_simsession      TYPE /sapapo/om_simsession,

   ls_exclude_fields  TYPE /sapapo/om_exclude_fields,

   ls_exclude         TYPE /sapapo/om_getdata_options.

   FIELD-SYMBOLS:

     <io> LIKE LINE OF ct_io,

     <act> LIKE LINE OF lt_activities.

* get orders

   LOOP AT ct_io ASSIGNING <io> WHERE orderid IS NOT INITIAL.

     APPEND <io>orderid TO lt_order.

   ENDLOOP.

   CLEAR <io>.

* get simsession and parameters for LiveCache call

   CALL FUNCTION ‘/SAPAPO/RRP_SIMSESSION_GET’

     IMPORTING

       ev_simsession = lv_simsession

       es_gen_params = ls_gen_params.

* no need to calculate pegging

   ls_exclude_fieldsslacktime   = gc_true.

   ls_exclude_fieldsdevquantity = gc_true.

   CALL FUNCTION ‘/SAPAPO/OM_ORDER_GET_DATA’

     EXPORTING

       is_gen_params      = ls_gen_params

       iv_simsession      = lv_simsession

       it_order           = lt_order

       is_exclude_exports = ls_exclude

       is_exclude_fields  = ls_exclude_fields

     IMPORTING

       et_rc              = lt_rc

       et_activities      = lt_activities

     EXCEPTIONS

       lc_connect_failed  = 1

       lc_com_error       = 2

       lc_appl_error      = 3

       OTHERS             = 4.

   IF sysubrc <> 0 AND lt_activities IS INITIAL.

     EXIT.

   ENDIF.

* only activities with assigned resources

   DELETE lt_activities WHERE resid IS INITIAL.

* so resource of GR activities will not be shown first

* unless it is the only activity of the order.

   SORT lt_activities DESCENDING BY opr_level.

* first activity of first operation with assigned resource

   SORT lt_activities BY orderid

                         oprcounter

                         group_oprcounter.

   LOOP AT lt_activities ASSIGNING <act>.

     LOOP AT ct_io ASSIGNING <io> WHERE orderid = <act>orderid.

       <io>main_resource = <act>resid.

     ENDLOOP.

     ” delete remaining activities of the order to keep

     ” the new main resource.

     DELETE lt_activities WHERE orderid = <act>orderid.

   ENDLOOP.

endmethod.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply