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:
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.
<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.
* get simsession and parameters for LiveCache call
CALL FUNCTION ‘/SAPAPO/RRP_SIMSESSION_GET’
ev_simsession = lv_simsession
es_gen_params = ls_gen_params.
* no need to calculate pegging
ls_exclude_fields–slacktime = gc_true.
ls_exclude_fields–devquantity = gc_true.
CALL FUNCTION ‘/SAPAPO/OM_ORDER_GET_DATA’
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
et_rc = lt_rc
et_activities = lt_activities
lc_connect_failed = 1
lc_com_error = 2
lc_appl_error = 3
OTHERS = 4.
IF sy–subrc <> 0 AND lt_activities IS INITIAL.
* 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
LOOP AT lt_activities ASSIGNING <act>.
LOOP AT ct_io ASSIGNING <io> WHERE orderid = <act>–orderid.
<io>–main_resource = <act>–resid.
” delete remaining activities of the order to keep
” the new main resource.
DELETE lt_activities WHERE orderid = <act>–orderid.