SAP for Utilities Discussions
Connect with fellow SAP users to share best practices, troubleshoot challenges, and collaborate on building a sustainable energy future. Join the discussion.
cancel
Showing results for 
Search instead for 
Did you mean: 

FM for Meter and CT-PT Replacement

former_member199650
Participant
0 Kudos

Hi,

Could you please help me in knowing the FM for CT-PT (which are in a Device Group) and Meter Replacement in SAP IS U.

Thanks and Regards

1 ACCEPTED SOLUTION

daniel_mccollum
Active Contributor
0 Kudos

ISU_S_WORKLIST_INSTALL

View solution in original post

4 REPLIES 4

daniel_mccollum
Active Contributor
0 Kudos

ISU_S_WORKLIST_INSTALL

0 Kudos

Hi,

Thanks for the FM please but could you elaborate what parameters we need to pass-in.

As well as if i need to do the Meter Replacement along with CT and PT (which are in a Device Group) then can this FM work for all.

I was already working with this FM for Meter Installation, Removal and Replacement.

Kindly suggest.

Following is code being used:

x_devloc           = gwa_v_equi_old-tplnr. "gwa_v_equi-tplnr.
      x_anlage          
= gwa_easts-anlage.
      x_geraetalt       
= wa_data-meter_old.
      x_equnralt        
= wa_data-meter_old.
      x_matnralt        
= gwa_v_equi_old-matnr. "wa_data-matnr_old.
      x_geraetneu       
= wa_data-meter_new.
      x_equnrneu        
= wa_data-meter_new.
      x_matnr           
= gwa_v_equi_new-matnr. "wa_data-matnr_new.

      x_eadat           = lv_mcodate.
      x_action          
= '03'.—replacement

CALL FUNCTION 'ISU_S_WORKLIST_INSTALL_PROVIDE'
       
EXPORTING
          x_devloc      
= x_devloc
          x_anlage      
= x_anlage
          x_eadat       
= x_eadat
          x_geraetneu   
= x_geraetneu
          x_equnrneu    
= x_equnrneu
          x_geraetalt   
= x_geraetalt
          x_equnralt    
= x_equnralt
          x_matnr       
= x_matnr
          x_matnralt    
= x_matnralt
          x_action      
= x_action
          x_upd_online  
= 'X'
       
IMPORTING
          y_obj         
= wa_obj
          y_auto        
= wa_auto
       
EXCEPTIONS
          not_found     
= 1
          foreign_lock  
= 2
          invalid       
= 3
          internal_error
= 4
          not_qualified 
= 5
          input_error   
= 6
          system_error  
= 7
          not_customized
= 8
         
OTHERS         = 9.

IF sy-subrc EQ 0 .
       
REFRESH lt_auto_zw,
                   lt_auto_ger
.
        lt_auto_zw       
= wa_auto-auto_zw.
        lt_auto_ger      
= wa_auto-auto_ger.
       
LOOP AT lt_auto_zw ASSIGNING <fs_auto_zw>                       .
         
IF     <fs_auto_zw>-zwnummera EQ '001'.
            <fs_auto_zw>
-zwstandca        wa_data-kwh_old." Meter Reading (Removal)
         
ELSEIF <fs_auto_zw>-zwnummera EQ '002'.
            <fs_auto_zw>
-zwstandca        wa_data-kvah_old." Meter Reading (Removal)
         
ELSEIF <fs_auto_zw>-zwnummera EQ '003'.
            <fs_auto_zw>
-zwstandca        wa_data-mdi_old." Meter Reading (Removal)

         IF      <fs_auto_zw>-zwnummere EQ '001'.
            <fs_auto_zw>
-zwstandce        = wa_data-kwh_new. "Meter Reading (Install)
            <fs_auto_zw>
-tarifart         = ‘Kwh’           " Rate Type of New Meter
            <fs_auto_zw>
-perverbr         = '60'.
            <fs_auto_zw>
-kondigre         =             “fact group”
            <fs_auto_zw>
-anzdaysofperiod  = '60'.

         
ELSEIF  <fs_auto_zw>-zwnummere EQ '002'.
            <fs_auto_zw>
-zwstandce        = wa_data-kvah_new. "Meter Reading (Install)
            <fs_auto_zw>
-tarifart         = 'KVAH'.           " Rate Type of New Meter
            <fs_auto_zw>
-perverbr         = '60'.
            <fs_auto_zw>
-kondigre         = .           “fact group”
            <fs_auto_zw>
-anzdaysofperiod  = '60'.
         
ELSEIF  <fs_auto_zw>-zwnummere EQ '003'.
            <fs_auto_zw>
-zwstandce        = wa_data-mdi_new. "Meter Reading (Install)
            <fs_auto_zw>
-tarifart         = 'KVA'.           " Rate Type of New Meter
            <fs_auto_zw>
-perverbr         = '60'.
            <fs_auto_zw>
-kondigre         =              “fact group”
            <fs_auto_zw>
-anzdaysofperiod  = '60'.
         
ENDIF.
       
ENDLOOP.

LOOP AT lt_auto_ger ASSIGNING <fs_auto_ger>.
          <fs_auto_ger>
-gerwechs = '02'.            " Activity Reason
       
ENDLOOP.
        UNASSIGN <fs_auto_ger>
.

        wa_auto
-okcode    = 'SAVE'.
        wa_auto
-auto_zw   = lt_auto_zw.
        wa_auto
-auto_ger  = lt_auto_ger.
        wa_auto
-zwstand   = 'X'.
*---Call FM to Replacement
       
CLEAR : db_update_temp,
                exit_type_temp
,
                result_tab
.


       
CALL FUNCTION 'ISU_S_WORKLIST_INSTALL'
         
EXPORTING
            x_devloc      
= x_devloc
            x_anlage      
= x_anlage
            x_eadat       
= x_eadat
            x_geraetneu   
= x_geraetneu
            x_equnrneu    
= x_equnrneu
            x_geraetalt   
= x_geraetalt
            x_equnralt    
= x_equnralt
            x_matnr       
= x_matnr
            x_matnralt    
= x_matnralt
            x_action      
= x_action
            x_upd_online  
= 'X'
            x_no_dialog   
= 'X'
         
IMPORTING
            y_db_update   
= db_update_temp
            y_exit_type   
= exit_type_temp
            y_result_tab  
= result_tab
         
CHANGING
            xy_auto       
= wa_auto
         
EXCEPTIONS
            not_found     
= 1
            foreign_lock  
= 2
            invalid       
= 3
            internal_error
= 4
            not_qualified 
= 5
            input_error   
= 6
            system_error  
= 7
            not_customized
= 8
           
OTHERS         = 9.

       
IF  sy-subrc EQ 0. "exit_type_temp = 'SAVE'.
         
COMMIT WORK.

Thanks and Regards

0 Kudos

once in a device group, they need to be managed as a group.

you will need to populate structures:

isu07_install_auto

isu07_install

for all the devices in the group at once.

I suggest review the data constellation that would be collected if performing the update functionally in EG30 for your specific use case.

The sample code you provided appears fine as a baseline, but I'd suggest it needs extending to collect everything at once in the case you describe.