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: 

LSMW for MRO rev using Installation and schedule MR date

former_member230926
Active Participant
0 Kudos

Hi Experts,

I have list of installations and corresponding Schedule MR date which I want to reverse , I tried using LSMW and recorded EL37 TCODE but in the recording it is not capturing 2nd screen fields because of which it is not working.

Any solution for this or alternate solution for reverse MRO for 1000+ Installations (I can not use MRU because I do not want reverse all MRO for a MRU)

Regards

Manoj

4 REPLIES 4

srinivasankh
Contributor
0 Kudos

Hi Manoj,

There are two options to achieve this,

1) As you did first record 'all' the screens in EL37 - here in the second screen there is an option to 'Select All' and then click reverse - this will make sure you recording will always select all the open MR. Now there could be additional screen depending on the nature of the Installation in that case please identify those and have them recorded separately so that now you will have two sets of Installations.

2) If possible write new ABAP program to use similar to that of what EL37 uses:

submit releabl8

       with ableinh  in ableinh

       with vertrag  vertrag

       with anlage   anlage

       with geraet   geraet

       with ablesgr  ablesgr

       with equnr    equnr

       with adatsoll in adatsoll

       with ams      in ams

       with trstat   in trstat

       with trstat_i in trstat_i                         " note 1928424

       with trdate   in trdate

       with trtime   in trtime

       with process  f_process

       with etrg_all etrg_all

       with timevar  ' '

   and return.



Hope this helps.


Thanks,

Srini

daniel_mccollum
Active Contributor
0 Kudos

Could also record a gui script & embed it in something that can loop over the data set. I've used excel a number of times for bulk ad hoc updates that are supported by transactional processes. IE its easy to do if you have to do it a handful of times, but tedious & time consuming for 1000.

sample might be

session.findById("wnd[0]/tbar[0]/okcd").text = "/nel37" 'Call TX

session.findById("wnd[0]").sendVKey 0  'Hit Enter

session.findById("wnd[0]/usr/ctxtANLAGE").text = anlage 'Set Installation to Var

session.findById("wnd[0]/tbar[1]/btn[8]").press ' Hit Execute

session.findById("wnd[0]/usr/cntlCONTAINER_EABLD_EL37_EL35/shellcont/shell").pressToolbarButton "MARK" 'Mark all for deletion

session.findById("wnd[0]/usr/cntlCONTAINER_EABLD_EL37_EL35/shellcont/shell").pressToolbarButton "CANC" 'Reverse all marked results

session.findById("wnd[0]/tbar[0]/btn[3]").press 'hit back

loop over the inputs with some wrapper scripting. Load balance with multiple script sessions.

0 Kudos

Hi Manoj,

Create a custom report calling EL37 in a loop for your process. it shouldn't take an ABAPer more than 10 mins to write you one or you can use gui scripts as Daniel mentioned.

@Daniel : nice to see you use GUI scripting. I have been using it for some years now. Its a powerful tool.

Cheers,

Rakesh..

mohammedmuzammil
Participant
0 Kudos

Hello Manoj,

Hope the below code helps. Please do let me know.

****************************************************************************************************************

*---Begin Of Code

****************************************************************************************************************

  TYPES : BEGIN OF ty_meter_orders_data,
           anlage   TYPE eablg-anlage,
           adatsoll TYPE eablg-adatsoll,
           ablesgr  TYPE eablg-ablesgr,
          END OF ty_meter_orders_data.

  DATA : lt_meter_orders_data TYPE STANDARD TABLE OF ty_meter_orders_data,
              xy_ieabl_delete   TYPE  eabl_tab,
              xy_ieablg_delete  TYPE  eablg_tab,
              xy_ietrg_delete   TYPE  etrg_tab,

              x_anlage type anlage,

              x_retro_upd_date type adatsoll,

              y_return type char1.

  DATA : y_obj TYPE  isu17_meterread.

*--Get the needed data for reversal
  SELECT a~anlage
         a~adatsoll
         a~ablesgr
    FROM eablg AS a
    INNER JOIN eabl AS b ON a~ablbelnr = b~ablbelnr
    INTO TABLE lt_meter_orders_data
    WHERE a~anlage IN x_anlage                "list of installations from selection screen.

          AND a~adatsoll >= x_date                   "Specify a date if needed.

          AND b~ablstat = '0'.                               "MR Order


  IF sy-subrc = 0.

    SORT lt_meter_orders_data BY anlage ablesgr adatsoll.
    DELETE ADJACENT DUPLICATES FROM lt_meter_orders_data COMPARING anlage ablesgr adatsoll.
    SORT lt_meter_orders_data BY adatsoll DESCENDING.

    LOOP AT lt_meter_orders_data ASSIGNING FIELD-SYMBOL(<fs_meter_orders_data>).

      CALL FUNCTION 'ISU_O_METERREAD_OPEN'
        EXPORTING
          x_anlage              = <fs_meter_orders_data>-anlage
          x_adatsoll            = <fs_meter_orders_data>-adatsoll
          x_ablesgr             = <fs_meter_orders_data>-ablesgr
          x_select2             = '5'
          x_wmode               = '6'
        IMPORTING
          y_obj                 = y_obj
        EXCEPTIONS
          not_found             = 1
          foreign_lock          = 2
          internal_error        = 3
          input_error           = 4
          existing              = 5
          number_error          = 6
          general_fault         = 7
          system_error          = 8
          manual_abort          = 9
          gasdat_not_found      = 10
          no_mrrel_registers    = 11
          internal_warning      = 12
          not_authorized        = 13
          not_qualified         = 14
          anpstorno_not_allowed = 15
          already_billed        = 16
          dev_already_prep      = 17
          OTHERS                = 18.

      IF sy-subrc = 0.

        CALL FUNCTION 'ISU_O_METERREAD_ACTION'
          EXPORTING
            x_okcode             = 'PSAV'
          CHANGING
            xy_obj               = y_obj
          EXCEPTIONS
            cancelled            = 1
            failed               = 2
            action_not_supported = 3
            system_error         = 4
            input_error          = 5
            not_customized       = 6
            OTHERS               = 7.

        IF sy-subrc = 0.

          CALL FUNCTION 'ISU_O_METERREAD_ACTION'
            EXPORTING
              x_okcode             = 'SAVE'
            TABLES
              yt_eabl_delete       = xy_ieabl_delete[]
              yt_eablg_delete      = xy_ieablg_delete[]
              yt_etrg_delete       = xy_ietrg_delete[]
            CHANGING
              xy_obj               = y_obj
            EXCEPTIONS
              cancelled            = 1
               failed               = 2
              action_not_supported = 3
              system_error         = 4
              input_error          = 5
              not_customized       = 6
              OTHERS               = 7.
          IF sy-subrc = 0.
            COMMIT WORK.
          ENDIF.
        ENDIF.

        CALL FUNCTION 'ISU_O_METERREAD_CLOSE'
          CHANGING
            xy_obj = y_obj.
* Implement suitable error handling here
      ELSE.
        y_return = 'E'.
      ENDIF.
    ENDLOOP.
    IF y_return <> 'E'.
      y_return = 'S'.
    ENDIF.
  ELSE
*    RAISE no_mtr_read_ordrs_found.
  ENDIF.

***************************************************************************************************************

*---End of Code

****************************************************************************************************************