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: 

BAPI Function for EG70 change rate data

Former Member
0 Kudos

I am searching a BAPI function which can perform the function of EG70 (change rate data), ie, update the RateType and Fact Group is each register under an installation and device.

Can anybody helps? Thanks very much and point must be rewarded.

1 ACCEPTED SOLUTION

oliviawalsh
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello,

I dont know of such a BAPI to change rate data but I can tell you that the function module used in the standard system is called ISU_S_DEVICERATE_CHANGE.

Perhaps this can help you.

Regards

Olivia

View solution in original post

8 REPLIES 8

Former Member
0 Kudos

Hi,

ISU_DB_EASTL_RATETYPE_SELECT - Use this for selecting rate type & fact group.

ISU_DB_EASTL_UPDATE -Use this to update rate type & fact grp at device level

ISU_DB_EASTS_RATETYPE_SELECT - Use this for selecting rate type & fact group at register level.

ISU_DB_EASTS_UPDATE-use this to update rate type & fact grp at register level.

Two tables are updated by EG70 EASTS & EASTS,you can search any FM from SE37 by ISUEAST

Hope this helps.

oliviawalsh
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello,

I dont know of such a BAPI to change rate data but I can tell you that the function module used in the standard system is called ISU_S_DEVICERATE_CHANGE.

Perhaps this can help you.

Regards

Olivia

Former Member
0 Kudos

I tried ISU_DB_EASTS_RATETYPE_SELECT to update the entry in the table EASTS and it is successfully done. BUT I worried that the operation in EG70 may not only update the table EASTSj, any side effect of just using this function to update?

For function ISU_S_DEVICERATE_CHANGE, it only call up the online screen program for me to update. Since the program need to be run in background, ie., I think it is not useful if it cannot update related issue in background mode....

0 Kudos

I did make it work by using ISU_O_DEVICERATE_OPEN then modifying the right parameters in tables OBJ and AUTO then calling ISU_S_DEVICERATE_CHANGE with the modified tables and using the NO_DIALOG = 'X' option. I ran it in Background and it updates the data desired. At this moment I am looking to update the METERREAD table in order to put my last meter reading ... but I have hit a snag. We are looking at emulating EC30 instead but the function doesnt seem to be able to work in a NO_DIALOG mode. I hope this helps and maybe if you are trying to update the meter reading you can help me

0 Kudos

This message was moderated.

0 Kudos

Hi

I am facing the same problem.

Could you pls tell me what parameters that i need to modified in OBJ and AUTO in order to update the Rate Type?

0 Kudos

   In our case we modified the gas procedure and VCF index. lwa_obj and lwa_auto were obtained by calling FM  ISU_O_DEVICERATE_OPEN

     lwa_obj-contr-general-wmode = '2'.

     lwa_obj-auto-contr-okcode   = 'SAVE'.

     lwa_auto-contr-okcode       = 'SAVE'.

*   Update REG_ALL with new value

*   Copy the data from one table to another.

     lwa_obj1-obj-reg_all[] = lwa_obj-obj-reg_all[].

     SORT lwa_auto-reg  BY bis ab.

     SORT lwa_obj1-obj-reg_all BY bis ab.


*   Delete all the old entries and future entries i.e.

*   Select only that time slice which is current time period

     DELETE lwa_obj1-obj-reg_all WHERE bis < sy-datum OR ab GT sy-datum.

     READ TABLE lwa_obj1-obj-reg_all INTO lwa_ob INDEX 1.

     IF sy-subrc = 0.

       lwa_ob-thgver       x_thgver.             " Gas procedure

       lwa_ob-zuszahlzw  x_zuszahl.            " VCF Index

       lwa_ob-zwnabr = ' '.

       MODIFY lwa_obj-obj-reg_all FROM lwa_ob

         TRANSPORTING thgver zuszahlzw zwnabr WHERE bis = lwa_ob-bis AND ab = lwa_ob-ab .

       MODIFY lwa_obj-obj-reg FROM lwa_ob INDEX 1

         TRANSPORTING thgver zuszahlzw.

       MODIFY lwa_auto-reg FROM lwa_ob                       "INDEX 1.

       TRANSPORTING thgver zuszahlzw WHERE bis = lwa_ob-bis AND ab = lwa_ob-ab.

Once this is done call  ISU_S_DEVICERATE_CHANGE passing the auto and obj fields with flags for no dialog, prorate and update online.

0 Kudos

Hi Sophanith, it got complicated a little and it was a lot of trial and error so here are some of the highlights.

Here is basically part of the code as I dont really remember what every field does, it was 5 years ago:) , Enjoy!

LOOP AT p_it_eg70 INTO l_st_eg70.

     
CHECK l_st_eg70-rec_del IS INITIAL.

     
CLEAR: z_time, z_wmode, z_select_date, z_auto, z_obj.



     
CALL FUNCTION 'ISU_O_RATE_MAINTENANCE_OPEN'

       
EXPORTING

          x_anlage              
= l_st_eg70-anlage

          x_keydate             
= l_st_eg70-date_ref

          x_wmode               
= '2'

          x_prorate             
= ' '

          x_upd_online          
= 'X'

          x_no_dialog           
= 'X'

       
IMPORTING

          y_obj_rm              
= z_objrm

          y_dev_rate            
= z_obj

       
EXCEPTIONS

          input_error           
= 1

         
OTHERS                 = 6.



     
IF sy-subrc <> 0.

       
ADD 1 TO g_err_count.

       
EXIT.

     
ELSE.

        z_auto
-reg[] = z_obj-obj-reg[].

        z_auto
-dev[] = z_obj-obj-dev[].

     
ENDIF.




      z_auto
-contr-okcode = 'SAVE'.

*   Boucle pour modifier le data dans Z_AUTO-REG

     
LOOP AT z_auto-reg ASSIGNING <reg70>.

       
IF <reg70>-geraet = l_st_eg70-geraet AND

           <reg70>
-anlage = l_st_eg70-anlage AND

           <reg70>
-ab     = l_st_eg70-date_ref AND

           <reg70>
-zwnabr = space.



          <reg70>
-profest   = l_st_eg70-vollinea.

         
IF NOT <reg70>-profest IS INITIAL.

            <reg70>
-zeitraum  = 'JAN-DÉC'.

         
ELSE.

           
CLEAR <reg70>-zeitraum.

         
ENDIF.

*       Prepare key to modify ITAB

          l_st_itab
-equnr    = <reg70>-equnr.

          l_st_itab
-ab       = <reg70>-ab.

          l_st_itab
-logikzw  = <reg70>-logikzw.

          l_st_itab
-zwnummer = <reg70>-zwnummer.

       
ENDIF.

     
ENDLOOP.




     
LOOP AT z_obj-obj-reg ASSIGNING <obj70>.

       
IF <obj70>-geraet = l_st_eg70-geraet AND

           <obj70>
-anlage = l_st_eg70-anlage AND

           <obj70>
-ab     = l_st_eg70-date_ref AND

           <obj70>
-zwnabr = space.

          <obj70>
-profest   = l_st_eg70-vollinea.

         
IF NOT <obj70>-profest IS INITIAL.

            <obj70>
-zeitraum  = 'JAN-DÉC'.

         
ELSE.

           
CLEAR <obj70>-zeitraum.

         
ENDIF.

       
ENDIF.

     
ENDLOOP.

*   Boucle pour modifier le data

*          dans Z_OBJ-OBJ-INTEGRATION-CONSUMPT-ITAB

     
LOOP AT z_obj-obj-integration-consumpt-itab ASSIGNING <itab1>.

       
IF <itab1>-equnr    = l_st_itab-equnr AND

           <itab1>
-ab       = l_st_itab-ab AND

           <itab1>
-zwnummer = l_st_itab-zwnummer AND

           <itab1>
-logikzw  = l_st_itab-logikzw.

          <itab1>
-profest   = l_st_eg70-vollinea.

         
IF NOT <itab1>-profest IS INITIAL.

            <itab1>
-zeitraum  = 'JAN-DÉC'.

         
ELSE.

           
CLEAR <itab1>-zeitraum.

         
ENDIF.

       
ENDIF.

     
ENDLOOP.

*   Boucle pour modifier le data

*          dans Z_OBJ-OBJ-INTEGRATION-CONSUMPT-ZW_EASTE

     
LOOP AT z_obj-obj-integration-consumpt-zw_easte ASSIGNING <easte>.

       
IF <easte>-zwnummer = l_st_itab-zwnummer AND

           <easte>
-equnr    = l_st_itab-equnr AND

           <easte>
-ab       = l_st_itab-ab AND

           <easte>
-logikzw  = l_st_itab-logikzw.

          <easte>
-profest   = l_st_eg70-vollinea.

         
IF NOT <easte>-profest IS INITIAL.

            <easte>
-zeitraum  = 'JAN-DÉC'.

         
ELSE.

           
CLEAR <easte>-zeitraum.

         
ENDIF.

       
ENDIF.

     
ENDLOOP.



     
CALL FUNCTION 'ISU_S_DEVICERATE_CHANGE'

       
EXPORTING

          x_geraet                
= l_st_eg70-geraet

          x_stichtag              
= l_st_eg70-date_ref

          x_no_dialog             
= 'X'

          x_auto                  
= z_auto

          x_obj                   
= z_obj

   
IMPORTING

          y_db_update             
= z_update

       
EXCEPTIONS

          not_found               
= 1

          foreign_lock            
= 2

          cancelled               
= 3

          input_error             
= 4

          general_fault           
= 5

         
OTHERS                   = 6

               
.

     
IF sy-subrc <> 0.

       
ADD 1 TO g_err_count.

     
ELSE.

       
ADD 1 TO g_maj_count.

     
ENDIF.



     
CALL FUNCTION 'ISU_O_RATE_MAINTENANCE_CLOSE'

       
IMPORTING

          y_db_update
= z_db_update

          y_exit_type
= z_exit_type

       
CHANGING

          xy_obj_rm  
= z_objrm

          xy_dev_rate
= z_obj.



   
ENDLOOP.