Skip to Content

   REPORT  Z_ODS_REQUEST_DELETE.

TABLES:
  rsdodso,
  rsiccont.

PARAMETERS:
  p_jahr TYPE /BI0/OIFISCYEAR,
  p_dso TYPE RSDODSOBJECT.

TYPES:

  BEGIN OF ty_dso_req,

    REQUEST TYPE RSREQUNR,

  END OF ty_dso_req.

DATA:
  l_fiscper TYPE /BI0/OIFISCPER,
  l_jahr TYPE /BI0/OIFISCYEAR,
  l_fiscper_ab TYPE /BI0/OIFISCPER,
  l_fiscper_bis TYPE /BI0/OIFISCPER,
  l_dsoname TYPE C LENGTH 30, “Techn. Name des DSOs: /BIC/AXXXXXXX00
  lt_dso_req TYPE STANDARD TABLE OF ty_dso_req,
  wa_dso_req LIKE LINE OF lt_dso_req,
  lt_req_cube TYPE STANDARD TABLE OF rsiccont,
  l_message1 TYPE string.

* Ermittlung des Geschäftsjahres anhand TVARVC – ZFISCPER, wenn leer ist
IF p_jahr IS INITIAL.

  “Aus TVARVC-Parameter auslesen

ELSE.

  l_jahr = p_jahr.

ENDIF.

* Ermittlung des Intervalles Geschäftsjahr/-periode von bis
IF l_jahr IS NOT INITIAL.

  CONCATENATE l_jahr ‘001’ INTO l_fiscper_ab.
  CONCATENATE l_jahr ‘012’ INTO l_fiscper_bis.

ENDIF.

IF p_dso IS NOT INITIAL.

* Prüfung, ob das DSO vorhanden und aktiv ist
  SELECT SINGLE
    *
  FROM
    rsdodso
  WHERE
    odsobject EQ p_dso AND
    objvers = ‘A’.

  IF sysubrc EQ 0.

* Ermittlung des techn. Namen eines DSOs
    CONCATENATE ‘/BIC/A’ p_dso ’00’ INTO l_dsoname.

  ELSE.

    CLEAR l_dsoname.

  ENDIF.

  IF l_dsoname IS NOT INITIAL.

* Ermittle alle Requests, dessen Geschäftsjahr/-periode im Intervallbereich liegen
    SELECT
      REQUEST
    FROM
      (l_dsoname)
    INTO CORRESPONDING FIELDS OF TABLE
      lt_dso_req
    WHERE
      FISCPER GE l_fiscper_ab AND
      FISCPER LE l_fiscper_bis.

    SORT lt_dso_req ASCENDING BY REQUEST.

    DELETE ADJACENT DUPLICATES FROM lt_dso_req.

    IF lt_dso_req[] IS NOT INITIAL.

      SELECT
        *
      FROM
        rsiccont
      INTO CORRESPONDING FIELDS OF TABLE
        lt_req_cube
      WHERE
        icube EQ p_dso.

      IF lt_req_cube[] IS NOT INITIAL.

* Prüfung, ob der Request gültig und bereits beendet ist
        LOOP AT lt_dso_req INTO wa_dso_req.

          READ TABLE lt_req_cube
            WITH KEY RNR = wa_dso_reqREQUEST
            TRANSPORTING NO FIELDS.

          IF sysubrc NE 0.
* Wenn der Request ungültig ist oder noch nicht beendet ist

            DELETE lt_dso_req.

          ELSE. “Löscht den Request aus dem DSO

            CALL FUNCTION ‘RSSM_DELETE_REQUEST’
              EXPORTING
                request  = wa_dso_reqREQUEST
                infocube = p_dso.

            IF sysubrc EQ 0.

              CONCATENATE p_dso wa_dso_reqREQUEST l_message1
                INTO l_message1 SEPARATED BY SPACE.

            ELSE.

              CONCATENATE ‘Der Request ‘ wa_dso_reqREQUEST ‘im DSO’ p_dso ‘kann nicht gelöscht werden!’
                INTO l_message1 SEPARATED BY SPACE.

            ENDIF.

          ENDIF.

        ENDLOOP.

      ELSE.

        CONCATENATE ‘Zur Zeit läuft eine Datenbeladung in DSO’ p_dso
          INTO l_message1 SEPARATED BY SPACE.

      ENDIF.

    ELSE.

      CONCATENATE ‘Für das Geschäftsjahr ‘ p_jahr ‘ ist keine Requests im DSO ‘ p_dso ‘vorhanden’
        INTO l_message1 SEPARATED BY SPACE.

    ENDIF.

  ELSE.

    l_message1 = ‘DSO-Name ungültig! Bitte gültigen DSO-Namen (ohne /BIC/A und 00) eingeben!’.

  ENDIF.

ELSE.

  l_message1 = ‘Bitte gültigen DSO-Namen (ohne /BIC/A und 00) eingeben!’.

ENDIF.

IF l_message1 IS NOT INITIAL.

  MESSAGE l_message1 TYPE ‘S’.

ENDIF.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply