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: 

Register relationships for meters

Former Member
0 Kudos

I am trying to find out a way to delete register relationships for meters in background mode. The transaction EG76 can do it in foreground mode but I need something in background.

1 ACCEPTED SOLUTION

chaiphon
Contributor
0 Kudos

Hi,

for exporting

x_installation = your installation number

x_keydate = your key date

x_wmode = '1'

x_no_dialog = 'X'

for import and changing , you do not need to put data in there. you just get data back from the function. these is how to define the variables

lw_obj TYPE ISU75_REGRELSHIP

lw_auto TYPE ISU75_REGRELSHIP_AUTO

lw_integration TYPE ISU07_INTEGRATION_DATA.

Most of the time sy-subrc will be 0.

If it is not 0, it means that something wrong with your parameter.

Chaiphon.

View solution in original post

12 REPLIES 12

chaiphon
Contributor
0 Kudos

You can write BDC program for this

Cheers,

Chaiphon

Former Member
0 Kudos

How can you write a BDC for this transaction (EG76) if there are multiple registers on the meter ?

chaiphon
Contributor
0 Kudos

Try this. This is the code to delete all the register.


" Clear old relationship.
      call function 'ISU_S_REGRELSHIP_PROVIDE'
        exporting
          x_installation  = import-anlage
          x_keydate       = import-zopdate
          x_wmode         = '1'
          x_no_dialog     = i_batch
        importing
          y_obj           = lw_obj
          y_auto          = lw_auto
        changing
          xy_integration  = lw_integration
        exceptions
          not_found       = 1
          invalid_keydate = 2
          foreign_lock    = 3
          invalid_wmode   = 4
          general_fault   = 5
          others          = 6.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
              into export-message
              with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        export-zminsc         = 'F'.
        export-zdmflag_regrel = 'E'.
        return.
      endif.

" Remove register relation and change
      clear_bdc_data.      "Clear all BDC data (macro)

" EG76 First screen
      write import-zopdate to lv_date.
      bdc_dynpro 'SAPLEG75'       '0100'.
      bdc_field  'BDC_OKCODE'     '/00'.
      bdc_field  'REG75-ANLAGE'   import-anlage.
      bdc_field  'REG75-PRORATE'  'X'.
      bdc_field  'REG75-DEVLOC'   ''.
      bdc_field  'REG75-GERAET'   ''.
      bdc_field  'REG75-MATNR'    ''.
      bdc_field  'REG75-SPARTE'   ''.
      bdc_field  'REG75-HISTORY'  'Y'.
      bdc_field  'REG75-STICHTAG' lv_date.

chaiphon
Contributor
0 Kudos

" Delete all relationship
      loop at lw_auto-regrelh into lw_regrelh.
" Select regiser relationship
        bdc_dynpro 'SAPMSSY0'       '0120'.
        bdc_field  'BDC_OKCODE'     '=TRSL'.
        bdc_field  'BDC_CURSOR'     '06/18'.
" Click delete button
        bdc_dynpro 'SAPLEG75'       '0200'.
        bdc_field  'BDC_OKCODE'     '=DLT'.
      endloop.
" Save
      bdc_dynpro 'SAPMSSY0'       '0120'.
      break sumate.

      if i_batch = 'X'.   "In case batch input this meter information otherwise let user key-in
        lv_ctu_params-dismode = 'N'.  "BATCH

        bdc_field  'BDC_OKCODE' '=SAVE'.
      else.
        lv_ctu_params-dismode = 'E'.

        bdc_field  'BDC_OKCODE' '=ABL'.
" Enter meter reading screen
        bdc_dynpro 'SAPLEL01'   '0240'.
" Input Z1 to every line
        lt_regrel[] = lw_auto-regrel[].
        delete lt_regrel where not bis = '99991231'.
        sort lt_regrel by equnr zwnummer.
        delete adjacent duplicates from lt_regrel comparing equnr zwnummer.
        sort lt_regrel by indexnr.

chaiphon
Contributor
0 Kudos


        clear lv_count.
        loop at lt_regrel into lw_regrel.
          add 1 to lv_count.
          if lv_count = 15.
            lv_count = 1.
            bdc_field  'BDC_OKCODE'    '=P+'.  "Next Page
            bdc_dynpro 'SAPLEL01'      '0240'.
          endif.

          concatenate 'REABLD-ABLHINW(' lv_count ')' into lv_field.
          bdc_field  lv_field 'Z1'.
          concatenate 'REABLD-ZWSTAND(' lv_count ')' into lv_field.
          bdc_field  lv_field space.
        endloop.
      endif.
      lv_ctu_params-defsize = 'X'.
      lv_ctu_params-updmode = 'S'.

" Call transaction to Change or create register relationship
      call transaction 'EG76' using it_bdcdata
                       options from lv_ctu_params
                      messages into it_messtab.

      read table it_messtab into wa_messtab with key msgid = 'EN'
                                                     msgnr = '402'. "Register relationship was changed/created
      if sy-subrc = 0.
        clear export-message.
        export-zminsc         = 'C'.
        export-zdmflag_regrel = 'X'.
      else.
        loop at it_messtab into wa_messtab
                          where   msgtyp = 'E'       " Normal error
                             or ( msgid  = '00'
                            and   msgnr  = '344' ).  " No Screen error message
        endloop.
        if sy-subrc <> 0.
          describe table it_messtab lines lv_lines.
          read table it_messtab into wa_messtab index lv_lines.
        endif.
        if not wa_messtab is initial.
          message id wa_messtab-msgid type wa_messtab-msgtyp number wa_messtab-msgnr
                into export-message
                with wa_messtab-msgv1 wa_messtab-msgv2 wa_messtab-msgv3 wa_messtab-msgv4.
        endif.
        export-zminsc         = 'F'.
        export-zdmflag_regrel = 'E'.
      endif.

chaiphon
Contributor
0 Kudos

The BDC in your system maybe differennt than mine so please adjust accordingly.

Cheers,

Chaiphon

Former Member
0 Kudos

Hello Chaiphon,

How did you define in the ISU_S_REGRELSHIP_PROVIDE functionm module the following variables:

i_batch

lw_obj

lw_auto

lw_integration

Thanks for your help.

Bill

Former Member
0 Kudos

Hello Again,

Also how is the variable EXPORT defined ? It is used if the ISU_S_REGRELSHIP_PROVIDE dose not return a 0 return code.

chaiphon
Contributor
0 Kudos

Hi,

for exporting

x_installation = your installation number

x_keydate = your key date

x_wmode = '1'

x_no_dialog = 'X'

for import and changing , you do not need to put data in there. you just get data back from the function. these is how to define the variables

lw_obj TYPE ISU75_REGRELSHIP

lw_auto TYPE ISU75_REGRELSHIP_AUTO

lw_integration TYPE ISU07_INTEGRATION_DATA.

Most of the time sy-subrc will be 0.

If it is not 0, it means that something wrong with your parameter.

Chaiphon.

Former Member
0 Kudos

Hello Chaiphon,

The code you sent me worked just fine. I did have to make one change.

The statement - bdc_field 'REG75-HISTORY' 'Y'. was not working because the REG75-HISTORY field was not on the screen.

So I just commented it out and it worked fine.

Another thing, if you don't know this, if you enter a keydate of one day more than the last bill date on function 'ISU_S_REGRELSHIP_PROVIDE' you don't have to enter meter reads to delete the register relationship.

chaiphon
Contributor
0 Kudos

Thanks Bill for an update

Former Member
0 Kudos

Hi DM Team ,

I have an Requirement to Dismantle the Register relationship , Pls find below the steps and guide me if I need to perform /Include any other process ,

1. Extract all the Installations having Meter Networks ( EASTI /EASTS)

2.Pass all the Installations to the std function module 'ISU_S_REGRELSHIP_PROVIDE'

in order to extract all the Sub meters ( Based on operation codes 03 & 04 )

3.Then Delete Register Relationship through EG76 (BDC)

4.Then perform Billing Related Removal EG35 (Pls suggest any std function module or go with BDC)

My Quries :

1. Devices Installed in the same Installation ( one Main meter & 3 Submeters) so all the four Devices installed in same Installation ,where I need to perform Technical removal here .

2. In one Installation there are 3 Meters one is main & 2 is Sub and two sub meters having their own Sub Installation with the register relationship .

Pls guide me how to handle the above mentioned two scenarios in terms of Register relationshop removal.

3.Only Billing relevant removal is enough for the submeter in Main Installation or we need to remove technical as well .

4.If we remove the relationship wef the day before the change is made in SAP this will be part way through a billing cycle for any of the meters - will this cause issues when the next cycle bill is raised i.e. when the next bill is raised for the main meter will it raise a bill showing the sub meters consumption deducted up to the date the relationship has been removed and then all consumption from that date forward? Please clarify?

Kindly suggest any furhter steps I need to take or guide me any other way to perform efficiently.

Thanks & Regards ,

Hariharan.