Relation of Production Version with Recipe Group and Its Creation

     When a new material will be created in SAP® for the purpose of  manufacturing, certain activities must take place.Once a material and Bill of material(BOM) have been created Production versions must follow. The number of production versions to be created will depend on the type of material. To create the Production Version a master recipe and an Alternative BOM must be assigned.
              Before going through the technical methodology of creating production version and assigning material to master recipe, shall look into the purpose of production versions and recipe group involved in creation of material.
     Recipe Group: Is a task list type,which describes the different tasks to be performed in a particular manufacture,The number of times the same task list is used is given by group counter.
     When a material is created,

     A recipe group has to be created in C201, by giving the recipe group and group counter details, or the material number and plant. As shown,

      
     For example, when a vehicle(material) has to be manufactured, different materials are required.these all components are collected and methods of manufacture are listed.
     And group of all these processes is a recipe group.There can be same recipe group for different materials.When we look into C202(change master recipe) when find different materials assigned to that recipe group.
     
     Then, after recipe group is created and materials are assigned to it,production versions are to be created.
     Production version can be created functionally using C223 after the material is been assigned to the recipe group.Below is the scrren used to create a PV.
        But to automate the creation it can be done using a function module.
     A production version can be created or updated or deleted using a function module,
                                      ' CM_FV_PROD_VERS_DB_UPDATE '
     We export the tables which contain the material for which production version is created,plant it belongs to, production version number,recipe group,group counter,lot range size,valid from and to dates.
     
      'If the material for which the PV is created  is not assigned to the master recipe,it doesnot create a PV,because before a version of manufacture is designed certain tasks are to be performed which are defined by recipe group.
           Therefore, we export the tables say internal table it_insert as shown below,
                             Call Function ' CM_FV_PROD_VERS_DB_UPDATE '
                             Tables
                             It_mkal_Insert = it_insert
                             It_mkal_update = it_update
                             It_mkal_delete = it_delete
       form prodversion_update  USING    p_it_mkal_i
                                  p_it_mkal_u
                                  p_it_mkal_d
                                  p_it_mkal_aend.

  Call Function 'cm_fv_prod_vers_db_update'
    tables
      it_mkal_i    = it_mkal_i
      it_mkal_u    = it_mkal_u
      it_mkal_d    = it_mkal_d
      it_mkal_aend = it_mkal_aend.

    endform.        
            For a recipe group,there can be multiple Pv's attached,and viceversa is also true.
                Then after performing the insertion of  pv with the data in the table,
           We perform a consistency check with out which Pv will not be created for a material.
           This we can do using bdc,with material number and plant.
           Step-by-step process:
            Fetch the material for which Pv has to be created,
           Then assign the material to the master recipe (using preferably bdc)
          Using the internal table which has the fetched values. sample code material assingnment :
 loop at it_mkal_d.

* read data from it_mapl for materals which are deleted of it_mkal_d.

    read table it_mapl with key matnr = it_mkal_d-matnr
                                           transporting no fields.
    if sy-subrc eq 0.
* read data from it_mapl1 for materals which are deleted of it_mkal_d.
      read table it_mapl1 with key matnr = it_mkal_d-matnr
                                           transporting no fields.
* if deleted material is not already assgined with new recipe group.
      if sy-subrc ne 0.

       l_cnt_rec = l_cnt_rec + 1.
       refresh : it_bdctab.
* populate bdc table
       PERFORM populate_bdctab using:
             c_bdc_start c_prog_saplcpdi c_screen_4000
                              changing it_bdctab,
              c_space c_fnam_okcode c_fval_00
                              changing it_bdctab,
              c_space c_fnam_plnnr wa_update-plnnr
                              changing it_bdctab,
              c_space c_fnam_matnr c_fval_space
                              changing it_bdctab,
              c_space c_fnam_werks c_fval_space
                              changing it_bdctab,
              c_space c_fnam_plnal wa_update-plnal
                              changing it_bdctab,
              c_space c_fnam_verid c_space
                              changing it_bdctab,
              c_space c_fnam_sttag l_v_sttag
                              changing it_bdctab,

              c_bdc_start c_prog_saplcpdi c_screen_4400
                              changing it_bdctab,
              c_space c_fnam_okcode c_fval_mtue
                              changing it_bdctab,
              c_space c_fnam_entry_act c_fval_1
                              changing it_bdctab,

              c_bdc_start c_prog_saplczdi c_screen_4230
                              changing it_bdctab,
              c_space c_fnam_okcode c_fval_back
                              changing it_bdctab,
              c_space c_fnam_entry_act l_cnt_rec
                              changing it_bdctab,

              c_bdc_start c_prog_saplczdi c_screen_4230
                              changing it_bdctab,
              c_space c_fnam_okcode c_fval_back
                              changing it_bdctab,
              c_space c_fnam_entry_act l_cnt_rec
                              changing it_bdctab,
              c_space c_fnam_mapl_matnr it_mkal_d-matnr
                              changing it_bdctab,
              c_space c_fnam_mapl_werks wa_update-werks
                              changing it_bdctab,
              c_space c_fnam_mapl_plnal wa_update-plnal
                              changing it_bdctab,

              c_bdc_start c_prog_saplczdi c_screen_4230
                              changing it_bdctab,
              c_space c_fnam_okcode c_fval_back
                              changing it_bdctab,

              c_bdc_start c_prog_saplcpdi c_screen_4400
                              changing it_bdctab,
              c_space c_fnam_okcode c_fval_bu
                              changing it_bdctab,
              c_space c_fnam_entry_act c_fval_1
                              changing it_bdctab.

* call transaction c202 using bdc table it_bdctab to assign the
* material to master recipe
       call transaction c_tcode_c202
                    using  it_bdctab
                    mode   c_mode_n
                    update c_update_s.
       commit work.
      endif.
    endif.

  endloop.
          Then, call the FM given above exporting the same internal table to create a production version. then a consistency check is performed using bdc to make Pv available for further process.  This can be done using bdc by passing the data used for creating the production version.
   
    form check_consistency  USING    p_it_mkal_i.

* Refresh internal tables
  refresh : it_bdctab,
            it_msg.
* loop at it_mkal_i.
  loop at it_mkal_i into wa_mkal_i.
* Populate BDC table
    refresh it_bdctab.
    PERFORM populate_bdctab using:
             c_bdc_start c_prog_saplcmfv c_screen_1000
                             changing it_bdctab,
             c_space c_fnam_okcode c_fval_ente
                             changing it_bdctab,
             c_space c_fnam_subscr c_fval_scr1
                             changing it_bdctab,
             c_space c_fnam_mkal_werks wa_mkal_i-werks
                             changing it_bdctab,
             c_space c_fnam_mkal_matnr wa_mkal_i-matnr
                             changing it_bdctab,
             c_space c_fnam_mkal_plnnr c_fval_space
                             changing it_bdctab,
             c_space c_fnam_subscr c_fval_scr2
                             changing it_bdctab,

             c_bdc_start c_prog_saplcmfv c_screen_1000
                             changing it_bdctab,
             c_space c_fnam_okcode c_fval_maal
                             changing it_bdctab,
             c_space c_fnam_subscr c_fval_scr1
                             changing it_bdctab,
             c_space c_fnam_mkal_werks wa_mkal_i-werks
                             changing it_bdctab,
             c_space c_fnam_mkal_matnr wa_mkal_i-matnr
                             changing it_bdctab,
             c_space c_fnam_mkal_plnnr c_fval_space
                             changing it_bdctab,
             c_space c_fnam_subscr c_fval_scr2
                             changing it_bdctab,

             c_bdc_start c_prog_saplcmfv c_screen_1000
                             changing it_bdctab,
             c_space c_fnam_okcode c_fval_prfg
                             changing it_bdctab,
             c_space c_fnam_subscr c_fval_scr1
                             changing it_bdctab,
             c_space c_fnam_mkal_werks wa_mkal_i-werks
                             changing it_bdctab,
             c_space c_fnam_mkal_matnr wa_mkal_i-matnr
                             changing it_bdctab,
             c_space c_fnam_mkal_plnnr c_fval_space
                             changing it_bdctab,
             c_space c_fnam_subscr c_fval_scr2
                             changing it_bdctab,

             c_bdc_start c_prog_sapmssy0 c_screen_0120
                             changing it_bdctab,
             c_space c_fnam_okcode c_fval_back
                             changing it_bdctab,

             c_bdc_start c_prog_saplcmfv c_screen_1000
                             changing it_bdctab,
             c_space c_fnam_okcode c_fval_save
                             changing it_bdctab,
             c_space c_fnam_subscr c_fval_scr1
                             changing it_bdctab,
             c_space c_fnam_mkal_werks wa_mkal_i-werks
                             changing it_bdctab,
             c_space c_fnam_mkal_matnr wa_mkal_i-matnr
                             changing it_bdctab,
             c_space c_fnam_mkal_plnnr c_fval_space
                             changing it_bdctab,
             c_space c_fnam_subscr c_fval_scr2
                             changing it_bdctab.

* Call transaction C223 using BDC table IT_BDCTAB for consistency
* check of production versions
    call transaction c_tcode_C223
                  using it_bdctab
                  mode  c_mode_n
                  update c_update_s
               messages into it_msg.
  endloop.
endform.                    " check_consistency
     Production version delete:
     1)In case of delete just a contrary procedure is followed,
      First the Pv is deleted using the internal table which stores the particuler material,
     2)We call the same FM to delete the Pv associated to that recipe group.
     3) We delete that material assigned to the task list group using the same internal table using bdc.
      FM's to refer:
                               MRTRS300_MASTER_RECIPE_INIT
                               MRTRS300_MASTER_RECIPE_READ
                               MRTRS300_MASTER_RECIPE_SAVE
                               MRTRS300_MASTER_RECIPE_WRITE
     Combination of these may be used to assign material to the task list type.
    
Source : sdn.sap,
              Help.sap.

Labels

mdm_erp mdm_erp Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.