*---------------------------------------------------------------------*
*    view related FORM routines
*   generation date: 09.01.2021 at 16:42:55
*   view maintenance generator version: #001407#
*---------------------------------------------------------------------*
*...processing: ZAMPV_CONFIG_PRO................................*
FORM GET_DATA_ZAMPV_CONFIG_PRO.
  PERFORM VIM_FILL_WHERETAB.
*.read data from database.............................................*
  REFRESH TOTAL.
  CLEAR   TOTAL.
  SELECT * FROM ZAMP_CONFIG_PROV WHERE
(VIM_WHERETAB) .
    CLEAR ZAMPV_CONFIG_PRO .
ZAMPV_CONFIG_PRO-METRIC_SCENARIO =
ZAMP_CONFIG_PROV-METRIC_SCENARIO .
ZAMPV_CONFIG_PRO-METRIC_GROUP =
ZAMP_CONFIG_PROV-METRIC_GROUP .
ZAMPV_CONFIG_PRO-METRIC_CLASS =
ZAMP_CONFIG_PROV-METRIC_CLASS .
<VIM_TOTAL_STRUC> = ZAMPV_CONFIG_PRO.
    APPEND TOTAL.
  ENDSELECT.
  SORT TOTAL BY <VIM_XTOTAL_KEY>.
  <STATUS>-ALR_SORTED = 'R'.
*.check dynamic selectoptions (not in DDIC)...........................*
  IF X_HEADER-SELECTION NE SPACE.
    PERFORM CHECK_DYNAMIC_SELECT_OPTIONS.
  ELSEIF X_HEADER-DELMDTFLAG NE SPACE.
    PERFORM BUILD_MAINKEY_TAB.
  ENDIF.
  REFRESH EXTRACT.
ENDFORM.
*---------------------------------------------------------------------*
FORM DB_UPD_ZAMPV_CONFIG_PRO .
*.process data base updates/inserts/deletes.........................*
LOOP AT TOTAL.
  CHECK <ACTION> NE ORIGINAL.
MOVE <VIM_TOTAL_STRUC> TO ZAMPV_CONFIG_PRO.
  IF <ACTION> = UPDATE_GELOESCHT.
    <ACTION> = GELOESCHT.
  ENDIF.
  CASE <ACTION>.
   WHEN NEUER_GELOESCHT.
IF STATUS_ZAMPV_CONFIG_PRO-ST_DELETE EQ GELOESCHT.
     READ TABLE EXTRACT WITH KEY <VIM_XTOTAL_KEY>.
     IF SY-SUBRC EQ 0.
       DELETE EXTRACT INDEX SY-TABIX.
     ENDIF.
    ENDIF.
    DELETE TOTAL.
    IF X_HEADER-DELMDTFLAG NE SPACE.
      PERFORM DELETE_FROM_MAINKEY_TAB.
    ENDIF.
   WHEN GELOESCHT.
  SELECT SINGLE FOR UPDATE * FROM ZAMP_CONFIG_PROV WHERE
  METRIC_SCENARIO = ZAMPV_CONFIG_PRO-METRIC_SCENARIO AND
  METRIC_GROUP = ZAMPV_CONFIG_PRO-METRIC_GROUP .
    IF SY-SUBRC = 0.
    DELETE ZAMP_CONFIG_PROV .
    ENDIF.
    IF STATUS-DELETE EQ GELOESCHT.
      READ TABLE EXTRACT WITH KEY <VIM_XTOTAL_KEY> BINARY SEARCH.
      DELETE EXTRACT INDEX SY-TABIX.
    ENDIF.
    DELETE TOTAL.
    IF X_HEADER-DELMDTFLAG NE SPACE.
      PERFORM DELETE_FROM_MAINKEY_TAB.
    ENDIF.
   WHEN OTHERS.
  SELECT SINGLE FOR UPDATE * FROM ZAMP_CONFIG_PROV WHERE
  METRIC_SCENARIO = ZAMPV_CONFIG_PRO-METRIC_SCENARIO AND
  METRIC_GROUP = ZAMPV_CONFIG_PRO-METRIC_GROUP .
    IF SY-SUBRC <> 0.   "insert preprocessing: init WA
      CLEAR ZAMP_CONFIG_PROV.
    ENDIF.
ZAMP_CONFIG_PROV-METRIC_SCENARIO =
ZAMPV_CONFIG_PRO-METRIC_SCENARIO .
ZAMP_CONFIG_PROV-METRIC_GROUP =
ZAMPV_CONFIG_PRO-METRIC_GROUP .
ZAMP_CONFIG_PROV-METRIC_CLASS =
ZAMPV_CONFIG_PRO-METRIC_CLASS .
    IF SY-SUBRC = 0.
    UPDATE ZAMP_CONFIG_PROV ##WARN_OK.
    ELSE.
    INSERT ZAMP_CONFIG_PROV .
    ENDIF.
    READ TABLE EXTRACT WITH KEY <VIM_XTOTAL_KEY>.
    IF SY-SUBRC EQ 0.
      <XACT> = ORIGINAL.
      MODIFY EXTRACT INDEX SY-TABIX.
    ENDIF.
    <ACTION> = ORIGINAL.
    MODIFY TOTAL.
  ENDCASE.
ENDLOOP.
CLEAR: STATUS_ZAMPV_CONFIG_PRO-UPD_FLAG,
STATUS_ZAMPV_CONFIG_PRO-UPD_CHECKD.
MESSAGE S018(SV).
ENDFORM.
*---------------------------------------------------------------------*
FORM READ_SINGLE_ZAMPV_CONFIG_PRO.
  SELECT SINGLE * FROM ZAMP_CONFIG_PROV WHERE
METRIC_SCENARIO = ZAMPV_CONFIG_PRO-METRIC_SCENARIO AND
METRIC_GROUP = ZAMPV_CONFIG_PRO-METRIC_GROUP .
ZAMPV_CONFIG_PRO-METRIC_SCENARIO =
ZAMP_CONFIG_PROV-METRIC_SCENARIO .
ZAMPV_CONFIG_PRO-METRIC_GROUP =
ZAMP_CONFIG_PROV-METRIC_GROUP .
ZAMPV_CONFIG_PRO-METRIC_CLASS =
ZAMP_CONFIG_PROV-METRIC_CLASS .
ENDFORM.
*---------------------------------------------------------------------*
FORM CORR_MAINT_ZAMPV_CONFIG_PRO USING VALUE(CM_ACTION) RC.
  DATA: RETCODE LIKE SY-SUBRC, COUNT TYPE I, TRSP_KEYLEN TYPE SYFLENG.
  FIELD-SYMBOLS: <TAB_KEY_X> TYPE X.
  CLEAR RC.
MOVE ZAMPV_CONFIG_PRO-METRIC_SCENARIO TO
ZAMP_CONFIG_PROV-METRIC_SCENARIO .
MOVE ZAMPV_CONFIG_PRO-METRIC_GROUP TO
ZAMP_CONFIG_PROV-METRIC_GROUP .
  CORR_KEYTAB             =  E071K.
  CORR_KEYTAB-OBJNAME     = 'ZAMP_CONFIG_PROV'.
  IF NOT <vim_corr_keyx> IS ASSIGNED.
    ASSIGN CORR_KEYTAB-TABKEY TO <vim_corr_keyx> CASTING.
  ENDIF.
  ASSIGN ZAMP_CONFIG_PROV TO <TAB_KEY_X> CASTING.
  PERFORM VIM_GET_TRSPKEYLEN
    USING 'ZAMP_CONFIG_PROV'
    CHANGING TRSP_KEYLEN.
  <VIM_CORR_KEYX>(TRSP_KEYLEN) = <TAB_KEY_X>(TRSP_KEYLEN).
  PERFORM UPDATE_CORR_KEYTAB USING CM_ACTION RETCODE.
  ADD: RETCODE TO RC, 1 TO COUNT.
  IF RC LT COUNT AND CM_ACTION NE PRUEFEN.
    CLEAR RC.
  ENDIF.

ENDFORM.
*---------------------------------------------------------------------*
*...processing: ZAMPV_CONFIG_SCE................................*
FORM GET_DATA_ZAMPV_CONFIG_SCE.
  PERFORM VIM_FILL_WHERETAB.
*.read data from database.............................................*
  REFRESH TOTAL.
  CLEAR   TOTAL.
  SELECT * FROM ZAMP_CONFIG_SCEN WHERE
(VIM_WHERETAB) .
    CLEAR ZAMPV_CONFIG_SCE .
ZAMPV_CONFIG_SCE-METRIC_SCENARIO =
ZAMP_CONFIG_SCEN-METRIC_SCENARIO .
ZAMPV_CONFIG_SCE-CONVERTER_CLASS =
ZAMP_CONFIG_SCEN-CONVERTER_CLASS .
<VIM_TOTAL_STRUC> = ZAMPV_CONFIG_SCE.
    APPEND TOTAL.
  ENDSELECT.
  SORT TOTAL BY <VIM_XTOTAL_KEY>.
  <STATUS>-ALR_SORTED = 'R'.
*.check dynamic selectoptions (not in DDIC)...........................*
  IF X_HEADER-SELECTION NE SPACE.
    PERFORM CHECK_DYNAMIC_SELECT_OPTIONS.
  ELSEIF X_HEADER-DELMDTFLAG NE SPACE.
    PERFORM BUILD_MAINKEY_TAB.
  ENDIF.
  REFRESH EXTRACT.
ENDFORM.
*---------------------------------------------------------------------*
FORM DB_UPD_ZAMPV_CONFIG_SCE .
*.process data base updates/inserts/deletes.........................*
LOOP AT TOTAL.
  CHECK <ACTION> NE ORIGINAL.
MOVE <VIM_TOTAL_STRUC> TO ZAMPV_CONFIG_SCE.
  IF <ACTION> = UPDATE_GELOESCHT.
    <ACTION> = GELOESCHT.
  ENDIF.
  CASE <ACTION>.
   WHEN NEUER_GELOESCHT.
IF STATUS_ZAMPV_CONFIG_SCE-ST_DELETE EQ GELOESCHT.
     READ TABLE EXTRACT WITH KEY <VIM_XTOTAL_KEY>.
     IF SY-SUBRC EQ 0.
       DELETE EXTRACT INDEX SY-TABIX.
     ENDIF.
    ENDIF.
    DELETE TOTAL.
    IF X_HEADER-DELMDTFLAG NE SPACE.
      PERFORM DELETE_FROM_MAINKEY_TAB.
    ENDIF.
   WHEN GELOESCHT.
  SELECT SINGLE FOR UPDATE * FROM ZAMP_CONFIG_SCEN WHERE
  METRIC_SCENARIO = ZAMPV_CONFIG_SCE-METRIC_SCENARIO .
    IF SY-SUBRC = 0.
    DELETE ZAMP_CONFIG_SCEN .
    ENDIF.
    IF STATUS-DELETE EQ GELOESCHT.
      READ TABLE EXTRACT WITH KEY <VIM_XTOTAL_KEY> BINARY SEARCH.
      DELETE EXTRACT INDEX SY-TABIX.
    ENDIF.
    DELETE TOTAL.
    IF X_HEADER-DELMDTFLAG NE SPACE.
      PERFORM DELETE_FROM_MAINKEY_TAB.
    ENDIF.
   WHEN OTHERS.
  SELECT SINGLE FOR UPDATE * FROM ZAMP_CONFIG_SCEN WHERE
  METRIC_SCENARIO = ZAMPV_CONFIG_SCE-METRIC_SCENARIO .
    IF SY-SUBRC <> 0.   "insert preprocessing: init WA
      CLEAR ZAMP_CONFIG_SCEN.
    ENDIF.
ZAMP_CONFIG_SCEN-METRIC_SCENARIO =
ZAMPV_CONFIG_SCE-METRIC_SCENARIO .
ZAMP_CONFIG_SCEN-CONVERTER_CLASS =
ZAMPV_CONFIG_SCE-CONVERTER_CLASS .
    IF SY-SUBRC = 0.
    UPDATE ZAMP_CONFIG_SCEN ##WARN_OK.
    ELSE.
    INSERT ZAMP_CONFIG_SCEN .
    ENDIF.
    READ TABLE EXTRACT WITH KEY <VIM_XTOTAL_KEY>.
    IF SY-SUBRC EQ 0.
      <XACT> = ORIGINAL.
      MODIFY EXTRACT INDEX SY-TABIX.
    ENDIF.
    <ACTION> = ORIGINAL.
    MODIFY TOTAL.
  ENDCASE.
ENDLOOP.
CLEAR: STATUS_ZAMPV_CONFIG_SCE-UPD_FLAG,
STATUS_ZAMPV_CONFIG_SCE-UPD_CHECKD.
MESSAGE S018(SV).
ENDFORM.
*---------------------------------------------------------------------*
FORM READ_SINGLE_ZAMPV_CONFIG_SCE.
  SELECT SINGLE * FROM ZAMP_CONFIG_SCEN WHERE
METRIC_SCENARIO = ZAMPV_CONFIG_SCE-METRIC_SCENARIO .
ZAMPV_CONFIG_SCE-METRIC_SCENARIO =
ZAMP_CONFIG_SCEN-METRIC_SCENARIO .
ZAMPV_CONFIG_SCE-CONVERTER_CLASS =
ZAMP_CONFIG_SCEN-CONVERTER_CLASS .
ENDFORM.
*---------------------------------------------------------------------*
FORM CORR_MAINT_ZAMPV_CONFIG_SCE USING VALUE(CM_ACTION) RC.
  DATA: RETCODE LIKE SY-SUBRC, COUNT TYPE I, TRSP_KEYLEN TYPE SYFLENG.
  FIELD-SYMBOLS: <TAB_KEY_X> TYPE X.
  CLEAR RC.
MOVE ZAMPV_CONFIG_SCE-METRIC_SCENARIO TO
ZAMP_CONFIG_SCEN-METRIC_SCENARIO .
  CORR_KEYTAB             =  E071K.
  CORR_KEYTAB-OBJNAME     = 'ZAMP_CONFIG_SCEN'.
  IF NOT <vim_corr_keyx> IS ASSIGNED.
    ASSIGN CORR_KEYTAB-TABKEY TO <vim_corr_keyx> CASTING.
  ENDIF.
  ASSIGN ZAMP_CONFIG_SCEN TO <TAB_KEY_X> CASTING.
  PERFORM VIM_GET_TRSPKEYLEN
    USING 'ZAMP_CONFIG_SCEN'
    CHANGING TRSP_KEYLEN.
  <VIM_CORR_KEYX>(TRSP_KEYLEN) = <TAB_KEY_X>(TRSP_KEYLEN).
  PERFORM UPDATE_CORR_KEYTAB USING CM_ACTION RETCODE.
  ADD: RETCODE TO RC, 1 TO COUNT.
  IF RC LT COUNT AND CM_ACTION NE PRUEFEN.
    CLEAR RC.
  ENDIF.

ENDFORM.
*---------------------------------------------------------------------*
