EDUCAÇÃO E TECNOLOGIA

PM/CS: Configurable Task List without using the Equipment Configuration Tab



In a traditional configurable general task list process you need to create many objects in SAP such as material configuration profile, task list configuration profile, equipment configuration etc.

This process can be simplified, but it does require some ABAP programming which can allow for more complicated selection scenarios.

In this scenario we are going to extract a characteristic value from the equipment which will then be used to select specific operation(s) from the task list onto the PM/CS order. The scenario is loosely based on functionality defined in OSS Note 111394.

We need to ensure that our equipment already has a class assigned and in this example the characteristic value we are interested in is held in the pump capacity (C201) as shown below:

The following steps detail how to set up the data:


2.1 Define Class/Characteristic Data (CL02/CT04):

We first need to create a new DUMMY class (type 300) which we will use to carry the pump capacity data from the equipment into the variant configuration engine:

The DUMMY characteristic is mandatory when we come to set up the configuration profile which we will define in the following steps. Other than that, it plays no other part in the process.

Note that the C201 characteristics is the same characteristic used in the equipment.


3.1 Create a Function (CU65):

We now need to create a variant configuration function that can contain our ABAP code:

3.2 Create a Function (CU65): Add Characteristics

You now need to add the characteristics via the Characteristics button above. Remember that the DUMMY characteristic is mandatory even though we don’t need it.

3.3 Create a Function (CU65): Create Function Module

You now need to create the function module via the Function Module button above.

The function module has the following parameters:

3.4 Create a Function (CU65): ABAP Code

The following ABAP code is used:

The following ABAP code is used: PM_GET_EQUIP_DATA: function pm_get_equip_data.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(GLOBALS) TYPE CUOV_00 OPTIONAL
*" TABLES
*" QUERY STRUCTURE CUOV_01
*" MATCH STRUCTURE CUOV_01
*" EXCEPTIONS
*" FAIL
*" INTERNAL_ERROR
*"---------------------------------------------------------------------- * Based on code in OSS Note 111394 data: lv_c201 type cuov_01-atflv, lv_equnr type equnr. field-symbols <fs_equnr> like equi-equnr. * Initialize return values match[] = query[]. * Delete any import characteristics delete match where atcio eq 'I'. * Mark entry as to 'work on' match-atcio = space. modify match transporting atcio where atcio eq 'O'. assign ('(SAPLCOIH)CAUFVD-EQUNR') to <fs_equnr>. if <fs_equnr> is assigned. gv_equnr = <fs_equnr>. * Read classification data perform read_classification. * Set values from classification perform set_characteristics tables match. else. lv_c201 = 0. call function 'CUOV_SET_FUNCTION_ARGUMENT' exporting argument = 'C201' vtype = 'NUM' num_val = lv_c201 tables match = match. endif. endfunction. LZPM_GET_EQUIP_DATATOP: function-pool zpm_get_equip_data. "MESSAGE-ID .. * INCLUDE LZPM_GET_EQUIP_DATAD... " Local class definition * key of functional location
data: gv_equnr like equi-equnr. * characteristics (and values) from classification
data: begin of class_values occurs 0, atinn like ausp-atinn, atwrt like ausp-atwrt, atflv like ausp-atflv, atbez like cabnt-atbez, atfor like cabn-atfor, end of class_values. LZPM_GET_EQUIP_DATAF01: *&--------------------------------------------------------------------&*
*& INCLUDE LZPM_GET_EQUIP_DATAF01.
*&--------------------------------------------------------------------&* *&--------------------------------------------------------------------&*
*& Form READ_CLASSIFICATION
*&--------------------------------------------------------------------&*
*& Read classification data from functional location
*&--------------------------------------------------------------------&*
form read_classification. data: iausp like ausp occurs 0 with header line, klart like ausp-klart value '002', objek like ausp-objek. data: t_cabn like cabn occurs 0 with header line. ranges: r_cabn for cabn-atinn. refresh class_values. * read characteristics
* Only classes of classtype '002' are taken into account! objek = gv_equnr. call function 'CLSE_SELECT_AUSP' exporting klart = '002' objek = objek tables t_ausp = iausp exceptions no_entry_found = 1 parameters_not_sufficient = 2 others = 3. if sy-subrc eq 0. loop at iausp.
* fill internal table for classification values move-corresponding iausp to class_values. append class_values. endloop. * get name and datatype of characteristics loop at iausp. r_cabn-sign = 'I'. r_cabn-option = 'EQ'. r_cabn-low = r_cabn-high = iausp-atinn. append r_cabn. endloop. call function 'CLSE_SELECT_CABN' tables in_cabn = r_cabn t_cabn = t_cabn exceptions no_entry_found = 1 others = 2. if sy-subrc ne 0. raise internal_error. endif. * complete classification data with name and datatype of
* the characteristics loop at t_cabn. class_values-atbez = t_cabn-atnam. class_values-atfor = t_cabn-atfor. modify class_values transporting atbez atfor where atinn eq t_cabn-atinn. endloop. endif. endform. " READ_CLASSIFICATION *&---------------------------------------------------------------------*
*& Form SET_CHARACTERISTICS
*&---------------------------------------------------------------------*
* Set configuration values from classification
*----------------------------------------------------------------------*
* <-> MATCH export values for configuration
*----------------------------------------------------------------------*
form set_characteristics tables match structure cuov_01. data: num_value like cuov_01-atflv, chr_value like cuov_01-atwrt. loop at match. loop at class_values where atbez eq match-varnam. exit. endloop. if sy-subrc eq 0.
* characteristic belongs to classification
* assign data type match-atfor = class_values-atfor. case match-atfor. when 'NUM'. clear chr_value. num_value = class_values-atflv. when 'CHAR'. clear num_value. chr_value = class_values-atwrt. endcase.
* set configuration value perform set_function_argument tables match using match-varnam match-atfor chr_value num_value. else.
* determine data type only perform get_data_type using match-varnam match-atfor. modify match. endif. endloop. endform. " SET_CHARACTERISTICS *&---------------------------------------------------------------------*
*& Form CALCULATE_CHARACTERISTICS
*&---------------------------------------------------------------------*
* Evaluate additional values for configuration
*----------------------------------------------------------------------*
* <-> MATCH export values for configuration
*----------------------------------------------------------------------*
form calculate_characteristics tables match structure cuov_01. data: loc_match like cuov_01 occurs 0 with header line. data: length like match-atflv, width like match-atflv, area like match-atflv. * loc_match[] = match[].
* loop at match
* where atcio is initial.
** all unassigned values
* clear: match-atwrt, match-atflv.
* case match-varnam.
* when 'FUNCTIONAL_LOCATION'.
** key of functional location
* match-atwrt = gv_equnr.
* when 'AREA'.
** calculate area
* loop at loc_match.
* case loc_match-varnam.
* when 'LENGTH'.
* length = loc_match-atflv.
* when 'WIDTH'.
* width = loc_match-atflv.
* endcase.
* endloop.
* area = length * width.
* match-atflv = area.
* when others.
** no assignments
** ...
* endcase. * set configuration value perform set_function_argument tables match using match-varnam match-atfor match-atwrt match-atflv.
* endloop. endform. " CALCULATE_CHARACTERISTICS *&---------------------------------------------------------------------*
*& Form GET_DATA_TYPE
*&---------------------------------------------------------------------*
* Determine data type of a characteristic
*----------------------------------------------------------------------*
* --> VARNAM name of characteristic
* <-- ATFOR datatype
*----------------------------------------------------------------------*
form get_data_type using value(varnam) like cuov_01-varnam atfor like cuov_01-atfor. data: all_attributes like chardata, t1 like cha_descr occurs 0, t2 like chvals occurs 0, t3 like cha_vdescr occurs 0, t4 like cha_cl_typ occurs 0, t5 like cha_reftab occurs 0. clear atfor. call function 'CARD_CHARACTERISTIC_READ' exporting characteristic = varnam with_values = space with_value_descriptions = space importing all_attributes = all_attributes tables descriptions = t1 allowed_values = t2 value_descriptions = t3 restrict_usage_in_class_type = t4 reference_to_table = t5 exceptions others = 1. if sy-subrc eq 0. atfor = all_attributes-datatype. endif. endform. " GET_DATA_TYPE *&---------------------------------------------------------------------*
*& Form SET_FUNCTION_ARGUMENT
*&---------------------------------------------------------------------*
* Set value for configuration (internal table MATCH)
*----------------------------------------------------------------------*
* <-> MATCH internal table for configuration values
* --> VARNAM name of characterisitc
* --> ATFOR datatype ('NUM' or 'CHAR')
* --> ATWRT character value
* --> ATFLV floatingpoint value
*----------------------------------------------------------------------*
form set_function_argument tables match structure cuov_01 using value(varnam) like cuov_01-varnam value(atfor) like cuov_01-atfor value(atwrt) like cuov_01-atwrt value(atflv) like cuov_01-atflv. * set configuration value dependent on datatype case atfor. when 'CHAR'. call function 'CUOV_SET_FUNCTION_ARGUMENT' exporting argument = varnam vtype = 'CHAR' sym_val = atwrt tables match = match exceptions existing_value_replaced = 0 others = 1. when 'NUM'. call function 'CUOV_SET_FUNCTION_ARGUMENT' exporting argument = varnam vtype = 'NUM' num_val = atflv tables match = match exceptions existing_value_replaced = 0 others = 1. endcase. endform. " SET_FUNCTION_ARGUMENT 

 


4.1 Create an Action Dependency (CU01):

We are going to create an action dependency which we will use un the configuration profile in a subsequent step. We need this dependency as it allows us to link into a function module where the required ABAP code is stored:

FUNCTION PM_GET_EQUIP_DATA
(DUMMY = $ROOT.DUMMY,
C201 = $SELF.C201)


5.1 Create General Task List: (IA05):

Create your general task list and add the operations as required. Add the operations for the various variations of pump capacity (C201). We will add the dependencies at a later stage.

This is required now as we need the task list name before we can create the configuration profile in the following steps.


6.1 Create a Configuration Profile (CU41):

We now create a configuration profile and link all the objects together:

6.2 Create a Configuration Profile (CU41): Classification Assignment:

We assign the class we created at the beginning of this process. Make sure you enter a value in the DUMMY characteristic – remember that the system needs this data, but it is of no use to us.

6.3 Create a Configuration Profile (CU41): Dependency Assignment:

We now assign the action dependency we created in step section 4.1 above:

Save the dependency.


7.1 Create a Selection Condition Dependencies (CU01):

We will now create two selection condition dependencies that will be used in the task list to select the relevant operations:

Save the dependencies.


8.1 Assign Selection Condition Dependencies to Task List Operations:

The two operations below have been assigned to the selection condition dependencies created in the previous step.


9.1 Testing with Manually Assigned Task Lists (IW31/2):

Create or change an existing order and ensure that the relevant equipment is entered in the order header.

Select the configurable general task list via menu path: Extras->Task List Selection->General Task List:

A classification screen should now be displayed and the characteristic values copied from the equipment. You can change these if required.

Green-arrow back out of this screen and the order should now be updated with the relevant operations i.e. those operations that satisfy the object dependency parameters, or those operations with no object dependency assignments.

9.2 Testing with Maintenance Plans (IP10):

Create a maintenance plan for the equipment you identified above.

Schedule the plan via IP10 and release one of the calls.

The order should now be created with the relevant operations i.e. those operations that satisfy the object dependency parameters, or those operations with no object dependency assignments. Notice that the classification popup does not appear in this case.