Skip to end of metadata
Go to start of metadata

List of all pages

Pages at first level

Applies to:

SAP ECC, SAP IS Utility

Summary

There are many of forums and wikis to show how to use BAPI to change an installation facts but none of them give a code on how to delete installation facts from an installation. Therefore this wiki will show how to delete installation facts from installation.

Author(s):  Chaiphon Pulnitiporn

Company:     Independent Company
Created on:    28 Feb 2010

How to Delete Installation Facts on Installation Using Function Modules.

Normally an abaper can program to change an installation facts by using BAPI 'BAPI_UTILINSTALLATION_CHANFACT' but there is a limitation to this BAPI. the BAPI cannot delete installation facts without adding a new installation time slice. Therefore, in order to delete installation facts time slices, function module 'ISU_S_INSTLN_CHANGE' needed to be used. This function module requires basic data of an installation first so the easiest way to retrieve installation is to use function module 'ISU_S_INSTLN_PROVIDE'.

Here is the sample code.

Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
DATA: ls_auto   TYPE isu01_instln_auto.
FIELD-SYMBOLS:  TYPE isu20_flag_auto.

* First, Get all the installation data and facts from function 'ISU_S_INSTLN_PROVIDE'
CALL FUNCTION 'ISU_S_INSTLN_PROVIDE'
  EXPORTING
    x_anlage        = i_anlage
    x_keydate       = sy-datum
    x_wmode         = '2'
    x_prorate       = 'X'
    x_no_dialog     = 'X'
  IMPORTING
    y_auto          = ls_auto
  EXCEPTIONS
    not_found       = 1
    invalid_keydate = 2
    foreign_lock    = 3
    not_authorized  = 4
    invalid_wmode   = 5
    general_fault   = 6
    OTHERS          = 7.
IF sy-subrc = 0.
* Select the operand that need to be deleted. In case that whole operand need to be deleted, use command delete
  READ TABLE ls_auto-facts-facts_auto-iflag
  ASSIGNING
  with key operand = i_operand.
  IF sy-subrc = 0.
* Delete selected time slice in this case if the time slice start after the key date, it will get deleted.
    delete-ivalue where ab >= i_keydate.
    IF sy-subrc = 0.
      ls_auto-contr-use-facts  = 'X'.
      ls_auto-contr-use-okcode = 'X'.
      ls_auto-contr-okcode     = 'SAVE'.
      CALL FUNCTION 'ISU_S_INSTLN_CHANGE'
        EXPORTING
          x_anlage       = i_anlage
          x_keydate      = sy-datum
          x_prorate      = 'X'
          x_upd_online   = 'X'
          x_no_dialog    = 'X'
          x_auto         = ls_auto
        EXCEPTIONS
          not_found      = 1
          foreign_lock   = 2
          not_authorized = 3
          cancelled      = 4
          input_error    = 5
          general_fault  = 6
          OTHERS         = 7.
    ENDIF.

  ENDIF.

Related Content

Please include at least three references to SDN documents or web pages.
http://wiki.sdn.sap.com/wiki/display/Utilities/2009/01/16/REPORT++Z117_LOAD_SAMPLE_F

Useful Information

Delete installation facts, SAP ISU

**Data declaration

DATA: gt_auto TYPE isu01_instln_auto,
      wa_iquant type isu20_quant_auto,
      wa_value type LINE OF isu20_quant_auto-ivalue.

*Selection scree
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS : p_anlage TYPE anlage OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK b1.

START-OF-SELECTION.

*FM to read Existing Facts
  CALL FUNCTION 'ISU_S_INSTLN_PROVIDE'
    EXPORTING       x_anlage        = p_anlage
      x_keydate       = sy-datum
      x_wmode         = '2'
      x_prorate       = 'X'
      x_no_dialog     = 'X'
*     X_CALLED_BY     =
    IMPORTING
*     Y_OBJ           =
      y_auto          = gt_auto
    EXCEPTIONS
      not_found       = 1
      invalid_keydate = 2
      foreign_lock    = 3
      not_authorized  = 4
      invalid_wmode   = 5
      general_fault   = 6
      OTHERS          = 7.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

*Adding one Operand in Installation facts
  wa_iquant-OPERAND = 'KWH_BILLED'.
  wa_iquant-AUTO_USE = 'X'.

  wa_value-AB = SY-DATUM.
  wa_value-BIS = '99991231'.
  WA_VALUE-MENGE = '20.00'.

  APPEND WA_VALUE TO WA_IQUANT-IVALUE.
  append wa_iquant to GT_AUTO-FACTS-FACTS_AUTO-IQUANT.

*Set the Parameters
  gt_auto-contr-use-facts  = 'X'.
  gt_auto-contr-use-okcode = 'X'.
  gt_auto-contr-okcode     = 'SAVE'.

*Change Installation Fact  

CALL FUNCTION 'ISU_S_INSTLN_CHANGE'
    EXPORTING
      x_anlage       = p_anlage
      x_keydate      = sy-datum
      x_upd_online   = 'X'
      x_no_dialog    = 'X'
      x_auto         = gt_auto
    EXCEPTIONS
      not_found      = 1
      foreign_lock   = 2
      not_authorized = 3
      cancelled      = 4
      input_error    = 5
      general_fault  = 6
      OTHERS         = 7.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

  • No labels