*---------------------------------------------------------------------*
*    view related FORM routines
*   generation date: 2021.07.15 at 23:39:11
*   view maintenance generator version: #001407#
*---------------------------------------------------------------------*
*...processing: ZFLIFMV_LAYOUT..................................*
FORM GET_DATA_ZFLIFMV_LAYOUT.
  PERFORM VIM_FILL_WHERETAB.
*.read data from database.............................................*
  REFRESH TOTAL.
  CLEAR   TOTAL.
  SELECT * FROM ZFLIFMT_LAYOUT WHERE
(VIM_WHERETAB) .
    CLEAR ZFLIFMV_LAYOUT .
ZFLIFMV_LAYOUT-MANDT =
ZFLIFMT_LAYOUT-MANDT .
ZFLIFMV_LAYOUT-VERSN =
ZFLIFMT_LAYOUT-VERSN .
ZFLIFMV_LAYOUT-ASSETS =
ZFLIFMT_LAYOUT-ASSETS .
ZFLIFMV_LAYOUT-LIAB_EQUITY =
ZFLIFMT_LAYOUT-LIAB_EQUITY .
ZFLIFMV_LAYOUT-PL =
ZFLIFMT_LAYOUT-PL .
ZFLIFMV_LAYOUT-ETC =
ZFLIFMT_LAYOUT-ETC .
ZFLIFMV_LAYOUT-ERNAM =
ZFLIFMT_LAYOUT-ERNAM .
ZFLIFMV_LAYOUT-ERDAT =
ZFLIFMT_LAYOUT-ERDAT .
ZFLIFMV_LAYOUT-ERZET =
ZFLIFMT_LAYOUT-ERZET .
<VIM_TOTAL_STRUC> = ZFLIFMV_LAYOUT.
    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_ZFLIFMV_LAYOUT .
*.process data base updates/inserts/deletes.........................*
LOOP AT TOTAL.
  CHECK <ACTION> NE ORIGINAL.
MOVE <VIM_TOTAL_STRUC> TO ZFLIFMV_LAYOUT.
  IF <ACTION> = UPDATE_GELOESCHT.
    <ACTION> = GELOESCHT.
  ENDIF.
  CASE <ACTION>.
   WHEN NEUER_GELOESCHT.
IF STATUS_ZFLIFMV_LAYOUT-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 ZFLIFMT_LAYOUT WHERE
  VERSN = ZFLIFMV_LAYOUT-VERSN .
    IF SY-SUBRC = 0.
    DELETE ZFLIFMT_LAYOUT .
    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 ZFLIFMT_LAYOUT WHERE
  VERSN = ZFLIFMV_LAYOUT-VERSN .
    IF SY-SUBRC <> 0.   "insert preprocessing: init WA
      CLEAR ZFLIFMT_LAYOUT.
    ENDIF.
ZFLIFMT_LAYOUT-MANDT =
ZFLIFMV_LAYOUT-MANDT .
ZFLIFMT_LAYOUT-VERSN =
ZFLIFMV_LAYOUT-VERSN .
ZFLIFMT_LAYOUT-ASSETS =
ZFLIFMV_LAYOUT-ASSETS .
ZFLIFMT_LAYOUT-LIAB_EQUITY =
ZFLIFMV_LAYOUT-LIAB_EQUITY .
ZFLIFMT_LAYOUT-PL =
ZFLIFMV_LAYOUT-PL .
ZFLIFMT_LAYOUT-ETC =
ZFLIFMV_LAYOUT-ETC .
ZFLIFMT_LAYOUT-ERNAM =
ZFLIFMV_LAYOUT-ERNAM .
ZFLIFMT_LAYOUT-ERDAT =
ZFLIFMV_LAYOUT-ERDAT .
ZFLIFMT_LAYOUT-ERZET =
ZFLIFMV_LAYOUT-ERZET .
    IF SY-SUBRC = 0.
    UPDATE ZFLIFMT_LAYOUT ##WARN_OK.
    ELSE.
    INSERT ZFLIFMT_LAYOUT .
    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_ZFLIFMV_LAYOUT-UPD_FLAG,
STATUS_ZFLIFMV_LAYOUT-UPD_CHECKD.
MESSAGE S018(SV).
ENDFORM.
*---------------------------------------------------------------------*
FORM READ_SINGLE_ZFLIFMV_LAYOUT.
  SELECT SINGLE * FROM ZFLIFMT_LAYOUT WHERE
VERSN = ZFLIFMV_LAYOUT-VERSN .
ZFLIFMV_LAYOUT-MANDT =
ZFLIFMT_LAYOUT-MANDT .
ZFLIFMV_LAYOUT-VERSN =
ZFLIFMT_LAYOUT-VERSN .
ZFLIFMV_LAYOUT-ASSETS =
ZFLIFMT_LAYOUT-ASSETS .
ZFLIFMV_LAYOUT-LIAB_EQUITY =
ZFLIFMT_LAYOUT-LIAB_EQUITY .
ZFLIFMV_LAYOUT-PL =
ZFLIFMT_LAYOUT-PL .
ZFLIFMV_LAYOUT-ETC =
ZFLIFMT_LAYOUT-ETC .
ZFLIFMV_LAYOUT-ERNAM =
ZFLIFMT_LAYOUT-ERNAM .
ZFLIFMV_LAYOUT-ERDAT =
ZFLIFMT_LAYOUT-ERDAT .
ZFLIFMV_LAYOUT-ERZET =
ZFLIFMT_LAYOUT-ERZET .
ENDFORM.
*---------------------------------------------------------------------*
FORM CORR_MAINT_ZFLIFMV_LAYOUT 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 ZFLIFMV_LAYOUT-VERSN TO
ZFLIFMT_LAYOUT-VERSN .
MOVE ZFLIFMV_LAYOUT-MANDT TO
ZFLIFMT_LAYOUT-MANDT .
  CORR_KEYTAB             =  E071K.
  CORR_KEYTAB-OBJNAME     = 'ZFLIFMT_LAYOUT'.
  IF NOT <vim_corr_keyx> IS ASSIGNED.
    ASSIGN CORR_KEYTAB-TABKEY TO <vim_corr_keyx> CASTING.
  ENDIF.
  ASSIGN ZFLIFMT_LAYOUT TO <TAB_KEY_X> CASTING.
  PERFORM VIM_GET_TRSPKEYLEN
    USING 'ZFLIFMT_LAYOUT'
    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: ZFLIFMV_TCURR...................................*
FORM GET_DATA_ZFLIFMV_TCURR.
  PERFORM VIM_FILL_WHERETAB.
*.read data from database.............................................*
  REFRESH TOTAL.
  CLEAR   TOTAL.
  SELECT * FROM ZFLIFMT_TCURR WHERE
(VIM_WHERETAB) .
    CLEAR ZFLIFMV_TCURR .
ZFLIFMV_TCURR-MANDT =
ZFLIFMT_TCURR-MANDT .
ZFLIFMV_TCURR-GJAHR =
ZFLIFMT_TCURR-GJAHR .
ZFLIFMV_TCURR-MONAT =
ZFLIFMT_TCURR-MONAT .
ZFLIFMV_TCURR-FCURR =
ZFLIFMT_TCURR-FCURR .
ZFLIFMV_TCURR-TCURR =
ZFLIFMT_TCURR-TCURR .
ZFLIFMV_TCURR-FRATE =
ZFLIFMT_TCURR-FRATE .
ZFLIFMV_TCURR-TRATE =
ZFLIFMT_TCURR-TRATE .
ZFLIFMV_TCURR-ERNAM =
ZFLIFMT_TCURR-ERNAM .
ZFLIFMV_TCURR-ERDAT =
ZFLIFMT_TCURR-ERDAT .
ZFLIFMV_TCURR-ERZET =
ZFLIFMT_TCURR-ERZET .
<VIM_TOTAL_STRUC> = ZFLIFMV_TCURR.
    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_ZFLIFMV_TCURR .
*.process data base updates/inserts/deletes.........................*
LOOP AT TOTAL.
  CHECK <ACTION> NE ORIGINAL.
MOVE <VIM_TOTAL_STRUC> TO ZFLIFMV_TCURR.
  IF <ACTION> = UPDATE_GELOESCHT.
    <ACTION> = GELOESCHT.
  ENDIF.
  CASE <ACTION>.
   WHEN NEUER_GELOESCHT.
IF STATUS_ZFLIFMV_TCURR-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 ZFLIFMT_TCURR WHERE
  GJAHR = ZFLIFMV_TCURR-GJAHR AND
  MONAT = ZFLIFMV_TCURR-MONAT AND
  FCURR = ZFLIFMV_TCURR-FCURR AND
  TCURR = ZFLIFMV_TCURR-TCURR .
    IF SY-SUBRC = 0.
    DELETE ZFLIFMT_TCURR .
    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 ZFLIFMT_TCURR WHERE
  GJAHR = ZFLIFMV_TCURR-GJAHR AND
  MONAT = ZFLIFMV_TCURR-MONAT AND
  FCURR = ZFLIFMV_TCURR-FCURR AND
  TCURR = ZFLIFMV_TCURR-TCURR .
    IF SY-SUBRC <> 0.   "insert preprocessing: init WA
      CLEAR ZFLIFMT_TCURR.
    ENDIF.
ZFLIFMT_TCURR-MANDT =
ZFLIFMV_TCURR-MANDT .
ZFLIFMT_TCURR-GJAHR =
ZFLIFMV_TCURR-GJAHR .
ZFLIFMT_TCURR-MONAT =
ZFLIFMV_TCURR-MONAT .
ZFLIFMT_TCURR-FCURR =
ZFLIFMV_TCURR-FCURR .
ZFLIFMT_TCURR-TCURR =
ZFLIFMV_TCURR-TCURR .
ZFLIFMT_TCURR-FRATE =
ZFLIFMV_TCURR-FRATE .
ZFLIFMT_TCURR-TRATE =
ZFLIFMV_TCURR-TRATE .
ZFLIFMT_TCURR-ERNAM =
ZFLIFMV_TCURR-ERNAM .
ZFLIFMT_TCURR-ERDAT =
ZFLIFMV_TCURR-ERDAT .
ZFLIFMT_TCURR-ERZET =
ZFLIFMV_TCURR-ERZET .
    IF SY-SUBRC = 0.
    UPDATE ZFLIFMT_TCURR ##WARN_OK.
    ELSE.
    INSERT ZFLIFMT_TCURR .
    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_ZFLIFMV_TCURR-UPD_FLAG,
STATUS_ZFLIFMV_TCURR-UPD_CHECKD.
MESSAGE S018(SV).
ENDFORM.
*---------------------------------------------------------------------*
FORM READ_SINGLE_ZFLIFMV_TCURR.
  SELECT SINGLE * FROM ZFLIFMT_TCURR WHERE
GJAHR = ZFLIFMV_TCURR-GJAHR AND
MONAT = ZFLIFMV_TCURR-MONAT AND
FCURR = ZFLIFMV_TCURR-FCURR AND
TCURR = ZFLIFMV_TCURR-TCURR .
ZFLIFMV_TCURR-MANDT =
ZFLIFMT_TCURR-MANDT .
ZFLIFMV_TCURR-GJAHR =
ZFLIFMT_TCURR-GJAHR .
ZFLIFMV_TCURR-MONAT =
ZFLIFMT_TCURR-MONAT .
ZFLIFMV_TCURR-FCURR =
ZFLIFMT_TCURR-FCURR .
ZFLIFMV_TCURR-TCURR =
ZFLIFMT_TCURR-TCURR .
ZFLIFMV_TCURR-FRATE =
ZFLIFMT_TCURR-FRATE .
ZFLIFMV_TCURR-TRATE =
ZFLIFMT_TCURR-TRATE .
ZFLIFMV_TCURR-ERNAM =
ZFLIFMT_TCURR-ERNAM .
ZFLIFMV_TCURR-ERDAT =
ZFLIFMT_TCURR-ERDAT .
ZFLIFMV_TCURR-ERZET =
ZFLIFMT_TCURR-ERZET .
ENDFORM.
*---------------------------------------------------------------------*
FORM CORR_MAINT_ZFLIFMV_TCURR 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 ZFLIFMV_TCURR-GJAHR TO
ZFLIFMT_TCURR-GJAHR .
MOVE ZFLIFMV_TCURR-MONAT TO
ZFLIFMT_TCURR-MONAT .
MOVE ZFLIFMV_TCURR-FCURR TO
ZFLIFMT_TCURR-FCURR .
MOVE ZFLIFMV_TCURR-TCURR TO
ZFLIFMT_TCURR-TCURR .
MOVE ZFLIFMV_TCURR-MANDT TO
ZFLIFMT_TCURR-MANDT .
  CORR_KEYTAB             =  E071K.
  CORR_KEYTAB-OBJNAME     = 'ZFLIFMT_TCURR'.
  IF NOT <vim_corr_keyx> IS ASSIGNED.
    ASSIGN CORR_KEYTAB-TABKEY TO <vim_corr_keyx> CASTING.
  ENDIF.
  ASSIGN ZFLIFMT_TCURR TO <TAB_KEY_X> CASTING.
  PERFORM VIM_GET_TRSPKEYLEN
    USING 'ZFLIFMT_TCURR'
    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.
*---------------------------------------------------------------------*
