cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Work Manager 6.2: Why when creating WO from Notification responsible partner can't be the same?

Marçal_Oliveras
Active Contributor
0 Kudos

Hi,

I was trying to set a responsible partner when creating a Work Order in SAP Work Manager 6.2 but the field was empty after creation. After investigating the code I found that there is a piece of code which is deleting the input parameter I added if the notification and the work order responsible is the same.

Actually this is what I want it to be, so why there is a specific code to avoid it to happen?

I know this question may be more for an EAM space, but the code is Work Manager specific so I'm asking here for now.

This is the code in class /SMERP/CL_PM_WORKORDER_DO class, method PREPARE_DATA_FOR_ORDER_CRT:


"Check for Order create from Notification method active
       CLEAR ls_method.
       READ TABLE me->tab_alm_order_method INTO ls_method
         WITH KEY objecttype  = lc_objtyp_head
                  method      = lc_meth_crttontf.
       IF sy-subrc = 0.
*       "Check the notification partner assignment
         READ TABLE me->tab_alm_order_method ASSIGNING <method>
           WITH KEY refnumber = ls_method-refnumber
                   objecttype = lc_objtyp_part.
         IF sy-subrc = 0 AND <method>-objectkey+0(12) = ls_method-objectkey+0(12).
           SELECT qmel~qmnum ihpa~objnr ihpa~parvw ihpa~counter ihpa~parnr
             FROM qmel INNER JOIN ihpa ON qmel~objnr = ihpa~objnr
             INTO TABLE lt_notifpart
             WHERE qmel~qmnum = ls_method-objectkey+12(12).
           LOOP AT me->tab_alm_order_partn_mul ASSIGNING <wo_partner>.
             lv_index = sy-tabix.
             READ TABLE lt_notifpart INTO ls_notifpart
               WITH KEY parvw = <wo_partner>-partn_role.
             IF sy-subrc = 0.
               CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
                 EXPORTING
                   input  = ls_notifpart-parnr
                 IMPORTING
                   output = ls_notifpart-parnr.
*
               CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
                 EXPORTING
                   input  = <wo_partner>-partner
                 IMPORTING
                   output = <wo_partner>-partner.
*
               IF ls_notifpart-parnr = <wo_partner>-partner.
                 DELETE me->tab_alm_order_partn_mul INDEX lv_index.
               ELSE.
                 <method>-method = lc_meth_change.
                 <wo_partner>-partn_role_old = ls_notifpart-parvw.
                 <wo_partner>-partner_old = ls_notifpart-parnr.
*
                 APPEND INITIAL LINE TO me->tab_alm_order_partn_mul_up ASSIGNING <wo_partner_up>.
                 <wo_partner_up>-orderid = <wo_partner>-orderid.
                 <wo_partner_up>-partn_role = abap_true.
                 <wo_partner_up>-partner = abap_true.
               ENDIF.
             ENDIF.
           ENDLOOP.
*
           READ TABLE me->tab_alm_order_partn_mul TRANSPORTING NO FIELDS
             WITH KEY orderid = <method>-objectkey+0(12).
           IF sy-subrc <> 0.
             DELETE me->tab_alm_order_method
               WHERE refnumber  = <method>-refnumber
                 AND objecttype = <method>-objecttype
                 AND objectkey  = <method>-objectkey+0(12).
           ENDIF.
         ENDIF.
       ENDIF.

Accepted Solutions (1)

Accepted Solutions (1)

i834235
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Marcal,

Usually customers have copy control or configuration in place to copy partner information  from notification  over to work order.  In such events you will have duplicate partners records populated at work order level,  if copy is done even at code level. So that's the reason why copy is not enable at code level.

So depending on your  situation either a) you can activate copy control or b) programmatically enable copy of partner from notification to work order which is going to enhancement to the base product.

I hope it clarifies.

Thanks

Manju.

Marçal_Oliveras
Active Contributor
0 Kudos

Hi Manju, thanks for the input.

I'm not sure if I'm allowed to activate the copy control (I will discuss it) but the 2nd solution is not totally clear to me. I ended up implementing the BADI to the work order create method "CREATE_END".

But doing it this way I need to call the BAPI again to update the partner and it's not the best option from the performance point of view. I guess  I don't have an alternative though.

Answers (0)