Entering content frame

Procedure documentation Inserting Period Management into Customizing Tables/Views Locate the document in its SAP Library structure

Prerequisites

The following instructions are only for system administrators with ABAP experience.

If you want to create a table with version management, the last key field in the table must be the "VERSION" field (category CACSVERSION). At the end of the table, insert the CACS_S_VERS1 structure next to the master data CACS_S_VERS2, in the same way, for example, as in the CACS_CTRTST table.

The table is now versioned.

Procedure

  1. Call up the SE54 transaction to create the view.
  2. Choose the selection button Dictionary and choose Create/Change.

In the dictionary part of the view, set the heading of column "P" (maintenance status) to "R" (read only) in the following fields:

  1. Choose Utilities ® Table Maintenance Generator.
  2. Choose the selection button Generated Objects.
  3. Choose Environment à Modification à Events.
  4. Use the following events to call up version programs.

Event

FORM Name/Program Name

03

VIEW_AVOID_DELETE

05

VIEW_INIT

21

VIEW_VERSION

Note

The programs behind the events must be as follows:

Event 05 (always use the view name for VIEW )

FORM VIEW_INIT.

DATA:

TS TYPE TIMESTAMP.

IF STATUS-ACTION = 'C'.

GET TIME STAMP FIELD TS.

VIEW-TECH_BEGIN = TS.

VIEW-TECH_END = '99991231000000'.

VIEW-FLG_CANCEL_VERS = ' '.

VIEW-CHG_USR = SY-UNAME.

VIEW-VERSION = 1.

VIEW-STATUS_WORK = 9.

VIEW-STATUS_VERSION = 1.

ELSE.

STATUS-MODE = 'D'.

ENDIF.

ENDFORM.

 

 

Event 03 (always use the view name for VIEW )

FORM VIEW_AVOID_DELETE.

DATA: ACTION,

BEGIN OF I_TABLE_DEF.

INCLUDE STRUCTURE VIEW.

INCLUDE STRUCTURE VIMTBFLAGS.

DATA: END OF I_TABLE_DEF.

DATA: I_TABLE LIKE I_TABLE_DEF OCCURS 0 WITH HEADER LINE,

I_TABLE_UEG LIKE I_TABLE_DEF OCCURS 0 WITH HEADER LINE,

* NAME OF TABLE UPON WHICH THE VIEW IS BASED

LV_TAB_NAME TYPE TABNAM VALUE 'TCACS_ACT_CHAR',

 

LV_BUTTON TYPE I.

 

CALL FUNCTION 'CACS_POPUP_FOR_INTACT'

EXPORTING

HEADLINE = TEXT-008

TEXT1 = TEXT-009

* TEXT2 = <vim_total_key>

TEXT2 = TEXT-010

TICON = '@1D@'

BUTTON_1 = TEXT-011

BUTTON_2 = TEXT-012

IMPORTING

BUTTON_PRESSED = LV_BUTTON.

IF LV_BUTTON = 1.

ACTION = GELOESCHT.

* ELSEIF LV_BUTTON = 2.

* <action> = '0'.

ELSEIF LV_BUTTON = 2.

ACTION = ' '.

ENDIF.

 

LOOP AT EXTRACT.

MOVE <VIM_EXTRACT_STRUC> TO I_TABLE.

IF I_TABLE-VIM_MARK = 'M'.

MOVE ' ' TO I_TABLE-VIM_MARK.

IF ACTION = GELOESCHT.

APPEND I_TABLE.

ENDIF.

MOVE I_TABLE TO <VIM_EXTRACT_STRUC>.

MODIFY EXTRACT.

ENDIF.

ENDLOOP.

LOOP AT I_TABLE.

ACTION = 'D'.

MOVE I_TABLE TO I_TABLE_UEG.

CALL FUNCTION 'CACS_VIEW'

EXPORTING

I_TABNAM = LV_TAB_NAME

I_VIEW_NAME = 'VIEW'

TABLES

T_TABLE = I_TABLE_UEG

EXTRACT = EXTRACT

TOTAL = TOTAL

CHANGING

MAXLINES = MAXLINES

TABLE1 = <TABLE1>

ZEILE = I_TABLE_UEG

ACTION = ACTION

XACT = <XACT>

VIM_TOTAL_KEY = I_TABLE_UEG

KEY = <VIM_TOTAL_KEY>

EXCEPTIONS

ERROR = 1

OTHERS = 2.

ENDLOOP.

ENDFORM.

Event 21 (always use the view name for VIEW )

FORM VIEW_VERSION.

DATA: ACTION,

BEGIN OF I_TABLE_DEF.

INCLUDE STRUCTURE VIEW.

INCLUDE STRUCTURE VIMTBFLAGS.

DATA: END OF I_TABLE_DEF.

DATA: I_TABLE LIKE I_TABLE_DEF OCCURS 0 WITH HEADER LINE,

I_CACS_TABLE LIKE VIEW TABLE, *Only if view contains a text table

I_CACS_TABLE1 LIKE I_CACS_TABLE. *Only if view contains a text table

FIELD-SYMBOLS: <ACT>.

 

I_TABLE = VIEW.

APPEND I_TABLE.

 

MOVE VIEW TO <VIM_TOTAL_KEY>.

READ TABLE EXTRACT WITH KEY <VIM_TOTAL_KEY>.

 

MOVE-CORRESPONDING VIEW TO I_CACS_TABLE.

MOVE <VIM_EXTRACT_STRUC> TO VIEW.

MOVE-CORRESPONDING VIEW TO I_CACS_TABLE1.

 

IF I_CACS_TABLE = I_CACS_TABLE1.

IF NOT I_CACS_TABLE-BUSI_BEGIN IS INITIAL.

<TABLE1> = I_TABLE.

ELSE.

READ TABLE TOTAL INDEX 1.

MOVE <VIM_EXTRACT_STRUC> TO <TABLE1>.

STATUS = 'EULG'.

NEUER = 'N'.

ENDIF.

ELSE.

ACTION = STATUS-ACTION.

CALL FUNCTION 'CACS_VIEW'

EXPORTING

I_TABNAM = ‘TABLE NAME FOR VIEW‘

I_VIEW_NAME = VIEW_NAME

TABLES

T_TABLE = I_TABLE

EXTRACT = EXTRACT

TOTAL = TOTAL

CHANGING

MAXLINES = MAXLINES

TABLE1 = <TABLE1>

ZEILE = VIEW

ACTION = ACTION

XACT = <XACT>

VIM_TOTAL_KEY = I_TABLE

KEY = <VIM_TOTAL_KEY>

EXIND = EXIND

EXCEPTIONS

ERROR = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

<STATUS>-UPD_FLAG = ' '.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4 RAISING ERROR.

ELSE.

MOVE <VIM_EXTRACT_STRUC> TO I_TABLE.

IF I_TABLE-VERSION <> 0.

NEUER = 'N'.

ENDIF.

ENDIF.

ENDIF. * ENDIF ONLY WITH VIEWS WITH TEXT TABLES

ENDFORM.

 

 

 

 

Leaving content frame