Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to reverse a meter reading in a program

Former Member
0 Kudos

I am trying to reverse a meter reading in a similar way as:

T-code EL37

--> Writing installation --> Executing

--> Selecting reading --> Reversing

but instead of using the transaction, doing it directly in a program.

I made some research and found these FMs:

ISU_METERREAD_CANCEL, ISU_O_METERREAD_OPEN

but I haven't been successful in reversing the meter reading using these FMs.

Does anybody knows what to pass to these FMs or any other FM to reverse a meter reading, or how to reverse a meter reading (in code)?

Thanks.

1 REPLY 1

Former Member
0 Kudos

Hi,

Check this code:

CALL FUNCTION 'ISU_O_METERREAD_OPEN'
    EXPORTING
      x_anlage              = l_anlage
      x_adatsoll            = l_adatsoll
      x_ablbelnr            = l_ablbelnr
      x_ablesgr             = l_ablesgr
      x_select2             = '2'
     x_wmode               = '6'
      x_upd_online          = space
      x_no_dialog           = 'X'
      x_aufruf              = '01'
      x_karenzprfg          = 'X'
    IMPORTIN
      y_obj                 = ls_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
      OTHERS                = 17.

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
         WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    l_error = 'X'.
  ELSE.
    ls_obj-contr-no_change = space.
    ls_obj-contr-no_other = space.
    ls_obj-contr-enq_done = 'X'.


    CALL FUNCTION 'ISU_O_METERREAD_ACTION'
         EXPORTING
              x_okcode             = 'PSAV'
         CHANGING
              xy_obj               = ls_obj
         EXCEPTIONS
              cancelled            = 1
              failed               = 2
              action_not_supported = 3
              system_error         = 4
              input_error          = 5
              not_allowed          = 6
              not_customized       = 7
              reestimation_failed  = 8
              path_invalid         = 9
              date_invalid         = 10
              internal_error       = 11
              general_fault        = 12
              OTHERS               = 13.

    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      l_error = 'X'.
    ELSE.

      CLEAR tb_eabl.
      REFRESH tb_eabl.

      CALL FUNCTION 'ISU_O_METERREAD_ACTION'
        EXPORTING
          x_okcode             = 'SAVE'
        TABLES
          yt_eabl_delete       = tb_eabl
        CHANGING
          xy_obj               = ls_obj
        EXCEPTIONS
          cancelled            = 1
          failed               = 2
          action_not_supported = 3
          system_error         = 4
          input_error          = 5
          not_allowed          = 6
          not_customized       = 7
          reestimation_failed  = 8
          path_invalid         = 9
          date_invalid         = 10
          internal_error       = 11
          general_fault        = 12
          OTHERS               = 13.

      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        l_error = 'X'.
      ENDIF.
    ENDIF.
  ENDIF.

  IF l_error IS INITIAL.
    COMMIT WORK AND WAIT.
  ENDIF.

Edited by: xavier kerouanton on Mar 31, 2010 3:28 PM

Edited by: xavier kerouanton on Mar 31, 2010 3:31 PM