11-18-2009 5:25 PM
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.
11-20-2009 2:29 AM
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.
11-18-2009 6:58 PM
11-18-2009 7:08 PM
How can you write a BDC for this transaction (EG76) if there are multiple registers on the meter ?
11-18-2009 11:26 PM
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.
11-18-2009 11:27 PM
" 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.
11-18-2009 11:27 PM
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.
11-18-2009 11:30 PM
The BDC in your system maybe differennt than mine so please adjust accordingly.
Cheers,
Chaiphon
11-19-2009 4:21 PM
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
11-19-2009 6:16 PM
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.
11-20-2009 2:29 AM
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.
12-02-2009 10:26 PM
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.
12-02-2009 10:39 PM
12-22-2009 8:56 AM
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.