SAP TOCX_CREATE_VIEW_ON_DATABASE Function Module for Structures: Create the view and write it to the database









TOCX_CREATE_VIEW_ON_DATABASE is a standard tocx create view on database SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Structures: Create the view and write it to the database processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.


See here to view full function module documentation and code listing for tocx create view on database FM, simply by entering the name TOCX_CREATE_VIEW_ON_DATABASE into the relevant SAP transaction such as SE37 or SE38.

Function Group: DSYP
Program Name: SAPLDSYP
Main Program:
Appliation area: S
Release date: N/A
Mode(Normal, Remote etc): Remote-Enabled
Update:



Function TOCX_CREATE_VIEW_ON_DATABASE pattern details

In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.
CALL FUNCTION 'TOCX_CREATE_VIEW_ON_DATABASE'"Structures: Create the view and write it to the database
EXPORTING
OUTLINE_FROM = "Name of the structure to be modified
OUTLINE_TO = "Name of the modified structure
* SWITCH_ON_FLAG = 'X' "Flag: if 'X', chapters are enabled.
* VIEWNAME_FROM = 'STANDARD' "
* VIEWNAME_TO = '___NONE___' "
VIEW_TYP = "
* SPRAS = SY-LANGU "
* VIEW_TITLE = ' ' "

TABLES
LIST_OF_CHAPTERS = "Table with chapter classes/names
LIST_OF_CREATED_VIEWS = "
PARAMETERS_OF_VIEW = "

EXCEPTIONS
VIEWNAMES_ARE_IDENTICAL = 1 MISSING_VIEWNAME_TO = 2 OUTLINE_NOT_FOUND = 3 OUTLINE_NOT_IDENTICAL = 4 VIEW_NOT_CREATED = 5
.



IMPORTING Parameters details for TOCX_CREATE_VIEW_ON_DATABASE

OUTLINE_FROM - Name of the structure to be modified

Data type: DSYAH-OUTLINE
Optional: No
Call by Reference: No ( called with pass by value option)

OUTLINE_TO - Name of the modified structure

Data type: DSYAH-OUTLINE
Optional: No
Call by Reference: No ( called with pass by value option)

SWITCH_ON_FLAG - Flag: if 'X', chapters are enabled.

Data type: HITAB-IMPLODE
Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)

VIEWNAME_FROM -

Data type: DSYAD-VIEWNAME
Default: 'STANDARD'
Optional: Yes
Call by Reference: No ( called with pass by value option)

VIEWNAME_TO -

Data type: DSYAD-VIEWNAME
Default: '___NONE___'
Optional: Yes
Call by Reference: No ( called with pass by value option)

VIEW_TYP -

Data type: DSYAV-VIEW_TYP
Optional: No
Call by Reference: No ( called with pass by value option)

SPRAS -

Data type: SY-LANGU
Default: SY-LANGU
Optional: Yes
Call by Reference: No ( called with pass by value option)

VIEW_TITLE -

Data type: DSYAW-SHORTTEXT
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

TABLES Parameters details for TOCX_CREATE_VIEW_ON_DATABASE

LIST_OF_CHAPTERS - Table with chapter classes/names

Data type: DSYSOBJ
Optional: No
Call by Reference: No ( called with pass by value option)

LIST_OF_CREATED_VIEWS -

Data type: DSYAV
Optional: No
Call by Reference: No ( called with pass by value option)

PARAMETERS_OF_VIEW -

Data type: DSYAX
Optional: No
Call by Reference: No ( called with pass by value option)

EXCEPTIONS details

VIEWNAMES_ARE_IDENTICAL - Same application for source and target structure

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

MISSING_VIEWNAME_TO - Application of the modified structure is missing

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

OUTLINE_NOT_FOUND - The structure to be modified does not exist

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

OUTLINE_NOT_IDENTICAL - Target and source structure are different

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

VIEW_NOT_CREATED -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

Copy and paste ABAP code example for TOCX_CREATE_VIEW_ON_DATABASE Function Module

The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.

DATA:
lv_outline_from  TYPE DSYAH-OUTLINE, "   
lt_list_of_chapters  TYPE STANDARD TABLE OF DSYSOBJ, "   
lv_viewnames_are_identical  TYPE DSYSOBJ, "   
lv_outline_to  TYPE DSYAH-OUTLINE, "   
lv_missing_viewname_to  TYPE DSYAH, "   
lt_list_of_created_views  TYPE STANDARD TABLE OF DSYAV, "   
lv_switch_on_flag  TYPE HITAB-IMPLODE, "   'X'
lv_outline_not_found  TYPE HITAB, "   
lt_parameters_of_view  TYPE STANDARD TABLE OF DSYAX, "   
lv_viewname_from  TYPE DSYAD-VIEWNAME, "   'STANDARD'
lv_outline_not_identical  TYPE DSYAD, "   
lv_viewname_to  TYPE DSYAD-VIEWNAME, "   '___NONE___'
lv_view_not_created  TYPE DSYAD, "   
lv_view_typ  TYPE DSYAV-VIEW_TYP, "   
lv_spras  TYPE SY-LANGU, "   SY-LANGU
lv_view_title  TYPE DSYAW-SHORTTEXT. "   SPACE

  CALL FUNCTION 'TOCX_CREATE_VIEW_ON_DATABASE'  "Structures: Create the view and write it to the database
    EXPORTING
         OUTLINE_FROM = lv_outline_from
         OUTLINE_TO = lv_outline_to
         SWITCH_ON_FLAG = lv_switch_on_flag
         VIEWNAME_FROM = lv_viewname_from
         VIEWNAME_TO = lv_viewname_to
         VIEW_TYP = lv_view_typ
         SPRAS = lv_spras
         VIEW_TITLE = lv_view_title
    TABLES
         LIST_OF_CHAPTERS = lt_list_of_chapters
         LIST_OF_CREATED_VIEWS = lt_list_of_created_views
         PARAMETERS_OF_VIEW = lt_parameters_of_view
    EXCEPTIONS
        VIEWNAMES_ARE_IDENTICAL = 1
        MISSING_VIEWNAME_TO = 2
        OUTLINE_NOT_FOUND = 3
        OUTLINE_NOT_IDENTICAL = 4
        VIEW_NOT_CREATED = 5
. " TOCX_CREATE_VIEW_ON_DATABASE




ABAP code using 7.40 inline data declarations to call FM TOCX_CREATE_VIEW_ON_DATABASE

The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.

"SELECT single OUTLINE FROM DSYAH INTO @DATA(ld_outline_from).
 
 
 
"SELECT single OUTLINE FROM DSYAH INTO @DATA(ld_outline_to).
 
 
 
"SELECT single IMPLODE FROM HITAB INTO @DATA(ld_switch_on_flag).
DATA(ld_switch_on_flag) = 'X'.
 
 
 
"SELECT single VIEWNAME FROM DSYAD INTO @DATA(ld_viewname_from).
DATA(ld_viewname_from) = 'STANDARD'.
 
 
"SELECT single VIEWNAME FROM DSYAD INTO @DATA(ld_viewname_to).
DATA(ld_viewname_to) = '___NONE___'.
 
 
"SELECT single VIEW_TYP FROM DSYAV INTO @DATA(ld_view_typ).
 
"SELECT single LANGU FROM SY INTO @DATA(ld_spras).
DATA(ld_spras) = SY-LANGU.
 
"SELECT single SHORTTEXT FROM DSYAW INTO @DATA(ld_view_title).
DATA(ld_view_title) = ' '.
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!