但是新建或者新导入创建的表不能直接使用SM30维护,要做一个操作,其含步骤如下:
原文如下:
STEPS:
1. go to SE11 and key in your table name - ZPP_RTG_DATA.
2. click on change.
3. Go to UTILITIES->Table Maintainnce Generaror
4. Select an Authorisation GRP. If nyou don;t know key in '&NC&'.
5. Key in Function Module name. Recommended Same as table name - ZPP_RTG_DATA.
6. Select One Step.
7. Key in Screen number. Example 1
8. And click on CREATE.
1\使用SE11选择要维护的表
2\进入UTILITIES->Table Maintainnce Generaror
3\选择
组,如果你不知道的话,选择'&NC&';输入函数组名,不知道的话建议选择与表名同名;选择一步或者是两步,(原来的都是两步);输入屏幕编号(注意以后的提示);创建
4\完成
表维护:SM30里可以写代码吗?
我们建简单的基本资料表时, 可以用SM30来维护, 但当我用到多语言支持时, 希望SPRAS可以自动得到当前环境的语言代码,并且不显示出来.还能用SM30来做吗?如果可以,请问我要怎么做?
类同的问题, 也就是说:能不能在SM30里写代码什么的?
请知道的朋友, 帮忙解答一下.
Re: 表维护:SM30里可以写代码吗?
答案是可以的!
SAP 有提供一个TABLE Maintenance 的功能,让你设定可以通过SM30来维护数据.
可以通过T-CODE:SE11进去设定, 设定完后得到SAP自动产生的程序名:SAPL+'你的表名'.
进入该程序,就可以添加你自己需要的逻辑进去!
Re: 表维护:SM30里可以写代码吗?
对于怎么获取系统当前的语言代码,可以用Table maintenance dialog的events, event 05可以在new entry时给屏幕字段自动赋值,比如读取系统登陆的language。
events维护的路径是在生成Table maintenance dialog的屏幕上,Environment -> Modification -> Events,可以在里面自己建一个events routine。比如table的名字是ZTABLE01,里面有一个字段langu,那么就针对event 05建一个routine,form_evt05,里面的代码可以是:ZTABLE01-Langu = sy-langu.
SAP 中给表维护分配事务代码
在SAP中,经常需要自定义数据库表。而且可能需要维护该数据库的内容。定义了维护表视图后,可以通过SM30,对表内容进行维护,但是,因SM30标准事务代码维护权限过大,不便于直接分配该事务代码权限。此时,可以直接给该表维护分配新的事务代码,通过分配该新的事务代码,达到权限控制的目的。
分配新的事务代码的方法较多。简单介绍几种(第一种不需要程序基础,重点描述):
一、1、se11创建自定义数据库表(略)
2、se11,输入已经创建的自定义数据库表,点击修改。
3、实用程序-表格维护生成器(输入权限组,函数组,屏幕号等,保存,激活)
4、se93,创建时选择Transaction with parameters (parameter transaction)。
5、事务选SM30,选择跳过起始屏幕。
6、选中“Inherit GUI attribute”;输入默认字段:VIEWNAME = '自定义的表名' 和UPDATE = 'X';保存激活即可;
使用TCODE调用SM30维护表数据
二、通过编写程序,写选择屏幕,调用SM30实现。不过多描述。
一、通过RS_TABLE_LIST_CREATE函数建立新程序来建立TCODE。不过多描述。
二、通过View_Maintenance_Call函数建立新程序来建立TCODE,代码可以参见SAP的标准程序RFT042D_CALL。不过多描述。
通过SM30对TABLE的数据进行更新操作,也是通过代码实现的。创建了更新试图,应该是系统自动生成了代码,放在建立的FUNCTION GROUP下。
Sm30产生的视图可以用VIEW_MAINTENANCE_CALL调用,例如下:
使用VIEW_MAINTENANCE_CALL维护tableview
REPORT ztest.
TABLES t001b.
TYPES:
BEGIN OF ty_mkoar,
mkoar TYPE mkoar,
END OF ty_mkoar.
DATA: it_vimsellist TYPE TABLE OF vimsellist,
iw_vimsellist TYPE vimsellist,
it_vimexclfun TYPE TABLE OF vimexclfun,
iw_vimexclfun TYPE vimexclfun.
DATA: it_mkoar TYPE TABLE OF ty_mkoar,
iw_mkoar TYPE ty_mkoar.
DATA: w_flg TYPE c.
PARAMETERS p_bukrs TYPE t001b-bukrs.
SELECT-OPTIONS: s_mkoar FOR t001b-mkoar.
START-OF-SELECTION.
SELECT mkoar
INTO CORRESPONDING FIELDS OF TABLE it_mkoar
FROM t001b
WHERE mkoar IN s_mkoar.
*编辑过滤数据条件
iw_vimsellist-viewfield = 'BUKRS'.
iw_vimsellist-operator = 'EQ'.
iw_vimsellist-and_or = 'AND'.
iw_vimsellist-value = p_bukrs.
APPEND iw_vimsellist TO it_vimsellist.
LOOP AT it_mkoar INTO iw_mkoar.
iw_vimsellist-viewfield = 'MKOAR'.
iw_vimsellist-operator = 'EQ'.
iw_vimsellist-and_or = 'OR'.
iw_vimsellist-value = iw_mkoar-mkoar.
APPEND iw_vimsellist TO it_vimsellist.
CLEAR iw_mkoar.
ENDLOOP.
*屏蔽按钮(按T-CODE)
iw_vimexclfun-function = 'NEWL'.
APPEND iw_vimexclfun TO it_vimexclfun.
iw_vimexclfun-function = 'KOPE'.
APPEND iw_vimexclfun TO it_vimexclfun.
iw_vimexclfun-function = 'DELE'.
APPEND iw_vimexclfun TO it_vimexclfun.
CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
EXPORTING
action = 'U'
view_name = 'V_T001B'
TABLES
dba_sellist = it_vimsellist
excl_cua_funct = it_vimexclfun
EXCEPTIONS
client_reference = 1
foreign_lock = 2
invalid_action = 3
no_clientindependent_auth = 4
no_database_function = 5
no_editor_function = 6
no_show_auth = 7
no_tvdir_entry = 8
no_upd_auth = 9
only_show_allowed = 10
system_failure = 11
unknown_field_in_dba_sellist = 12
view_not_found = 13
maintenance_prohibited = 14
OTHERS = 15.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
带参数吧选择屏幕直接转换到查询条件。方便
REPORT ZTEST1.
TABLES: T001.
DATA: LS_VIMSELLIST LIKE VIMSELLIST,
LT_VIMSELLIST LIKE TABLE OF VIMSELLIST,
LT_VCL_SEL_LIST TYPE VCLTY_SELLIST_TABLE,
LS_VCL_SEL_LIST TYPE LINE OF VCLTY_SELLIST_TABLE.
DATA: LS_SEL_LIST LIKE LINE OF LS_VCL_SEL_LIST-SELLIST.
DATA: L_FIELDNAME TYPE VIMSELLIST-VIEWFIELD.
DATA: L_VIEWCLUSTER_NAME LIKE VCLDIR-VCLNAME.
SELECT-OPTIONS: S_BUKRS FOR T001-BUKRS.
LS_VCL_SEL_LIST-OBJECT = 'ZTRV9040_2'.
L_FIELDNAME = 'BUKRS'.
CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'
EXPORTING
FIELDNAME = L_FIELDNAME
APPEND_CONJUNCTION = 'AND'
TABLES
SELLIST = LT_VIMSELLIST
RANGETAB = S_BUKRS.
LS_VCL_SEL_LIST-SELLIST = LT_VIMSELLIST.
APPEND LS_VCL_SEL_LIST TO LT_VCL_SEL_LIST.
L_VIEWCLUSTER_NAME = 'ZTRVC_CONFIG'.
CALL FUNCTION 'VIEWCLUSTER_MAINTENANCE_CALL'
EXPORTING
VIEWCLUSTER_NAME = L_VIEWCLUSTER_NAME
MAINTENANCE_ACTION = 'U'
TABLES
* DBA_SELLIST = LT_VIMSELLIST
DBA_SELLIST_CLUSTER = LT_VCL_SEL_LIST
EXCEPTIONS
CLIENT_REFERENCE = 1
FOREIGN_LOCK = 2
VIEWCLUSTER_NOT_FOUND = 3
VIEWCLUSTER_IS_INCONSISTENT = 4
MISSING_GENERATED_FUNCTION = 5
NO_UPD_AUTH = 6
NO_SHOW_AUTH = 7
OBJECT_NOT_FOUND = 8
NO_TVDIR_ENTRY = 9
NO_CLIENTINDEP_AUTH = 10
INVALID_ACTION = 11
SAVING_CORRECTION_FAILED = 12
SYSTEM_FAILURE = 13
UNKNOWN_FIELD_IN_DBA_SELLIST = 14
MISSING_CORR_NUMBER = 15
OTHERS = 16.
也可以这样拼接
REPORT ztest.
TABLES t001b.
TYPES:
BEGIN OF ty_mkoar,
mkoar TYPE mkoar,
END OF ty_mkoar.
DATA: it_vimsellist TYPE TABLE OF vimsellist,
iw_vimsellist TYPE vimsellist,
it_vimexclfun TYPE TABLE OF vimexclfun,
iw_vimexclfun TYPE vimexclfun.
DATA: it_mkoar TYPE TABLE OF ty_mkoar,
iw_mkoar TYPE ty_mkoar.
DATA: w_flg TYPE c.
PARAMETERS p_bukrs TYPE t001b-bukrs.
SELECT-OPTIONS: s_mkoar FOR t001b-mkoar.
START-OF-SELECTION.
SELECT mkoar
INTO CORRESPONDING FIELDS OF TABLE it_mkoar
FROM t001b
WHERE mkoar IN s_mkoar.
*编辑过滤数据条件
iw_vimsellist-viewfield = 'BUKRS'.
iw_vimsellist-operator = 'EQ'.
iw_vimsellist-and_or = 'AND'.
iw_vimsellist-value = p_bukrs.
APPEND iw_vimsellist TO it_vimsellist.
LOOP AT it_mkoar INTO iw_mkoar.
iw_vimsellist-viewfield = 'MKOAR'.
iw_vimsellist-operator = 'EQ'.
iw_vimsellist-and_or = 'OR'.
iw_vimsellist-value = iw_mkoar-mkoar.
APPEND iw_vimsellist TO it_vimsellist.
CLEAR iw_mkoar.
ENDLOOP.
*屏蔽按钮(按T-CODE)
iw_vimexclfun-function = 'NEWL'.
APPEND iw_vimexclfun TO it_vimexclfun.
iw_vimexclfun-function = 'KOPE'.
APPEND iw_vimexclfun TO it_vimexclfun.
iw_vimexclfun-function = 'DELE'.
APPEND iw_vimexclfun TO it_vimexclfun.
CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
EXPORTING
action = 'U'
view_name = 'V_T001B'
TABLES
dba_sellist = it_vimsellist
excl_cua_funct = it_vimexclfun
EXCEPTIONS
client_reference = 1
foreign_lock = 2
invalid_action = 3
no_clientindependent_auth = 4
no_database_function = 5
no_editor_function = 6
no_show_auth = 7
no_tvdir_entry = 8
no_upd_auth = 9
only_show_allowed = 10
system_failure = 11
unknown_field_in_dba_sellist = 12
view_not_found = 13
maintenance_prohibited = 14
OTHERS = 15.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
例子
*&---------------------------------------------------------------------*
*& Report ZPPD174
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZPPC010.
TABLES:T001W.
TABLES:ZPPC001.
TABLES:ZPPC002.
DATA:GT_ZPPC001 TYPE STANDARD TABLE OF ZPPC001.
DATA:GT_ZPPC002 TYPE STANDARD TABLE OF ZPPC002.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TITLE.
SELECT-OPTIONS:S_WERKS FOR ZPPC001-WERKS.
SELECT-OPTIONS:S_ZRTID FOR ZPPC001-ZRTID.
SELECT-OPTIONS:S_ZNAME FOR ZPPC001-ZRTNAME.
SELECT-OPTIONS:S_PARTN FOR ZPPC002-PARTNER.
SELECTION-SCREEN END OF BLOCK B1.
PARAMETERS:P_RD1 RADIOBUTTON GROUP RAD1 DEFAULT 'X' USER-COMMAND FLAG. "
PARAMETERS:P_RD2 RADIOBUTTON GROUP RAD1 . "
PARAMETERS:P_RD3 RADIOBUTTON GROUP RAD1 . "
INITIALIZATION.
TITLE = '查询条件'.
AT SELECTION-SCREEN.
PERFORM PAI.
AT SELECTION-SCREEN OUTPUT.
PERFORM PBO.
START-OF-SELECTION.
PERFORM MAIN.
*&---------------------------------------------------------------------*
*& Form PAI
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM PAI .
ENDFORM.
*&---------------------------------------------------------------------*
*& Form PBO
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM PBO .
ENDFORM.
*&---------------------------------------------------------------------*
*& Form MAIN
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM MAIN .
CASE 'X'.
WHEN P_RD1.
PERFORM ZPPC010.
WHEN P_RD2.
PERFORM ZPPC001.
WHEN P_RD3.
PERFORM ZPPC002.
WHEN OTHERS.
ENDCASE.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form ZPPC010
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM ZPPC010 .
DATA:LT_VIMSELLIST TYPE STANDARD TABLE OF VIMSELLIST.
DATA:LS_VIMSELLIST TYPE VIMSELLIST.
DATA:LT_VCL_SEL_LIST TYPE VCLTY_SELLIST_TABLE.
DATA:LS_VCL_SEL_LIST TYPE VCLTY_SELLIST_FOR_OBJECT.
DATA:LS_SEL_LIST LIKE LINE OF LS_VCL_SEL_LIST-SELLIST.
DATA:L_FIELDNAME TYPE VIMSELLIST-VIEWFIELD.
DATA:L_VIEWCLUSTER_NAME LIKE VCLDIR-VCLNAME.
L_VIEWCLUSTER_NAME = 'ZPPC010'.
CLEAR:LS_VCL_SEL_LIST-SELLIST.
LS_VCL_SEL_LIST-OBJECT = 'ZPPC001'.
L_FIELDNAME = 'WERKS'.
CLEAR:LT_VIMSELLIST.
CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'
EXPORTING
FIELDNAME = L_FIELDNAME
APPEND_CONJUNCTION = 'AND'
TABLES
SELLIST = LT_VIMSELLIST
RANGETAB = S_WERKS.
APPEND LINES OF LT_VIMSELLIST TO LS_VCL_SEL_LIST-SELLIST.
L_FIELDNAME = 'ZRTID'.
CLEAR:LT_VIMSELLIST.
CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'
EXPORTING
FIELDNAME = L_FIELDNAME
APPEND_CONJUNCTION = 'AND'
TABLES
SELLIST = LT_VIMSELLIST
RANGETAB = S_ZRTID.
APPEND LINES OF LT_VIMSELLIST TO LS_VCL_SEL_LIST-SELLIST.
L_FIELDNAME = 'ZRTNAME'.
CLEAR:LT_VIMSELLIST.
CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'
EXPORTING
FIELDNAME = L_FIELDNAME
APPEND_CONJUNCTION = 'AND'
TABLES
SELLIST = LT_VIMSELLIST
RANGETAB = S_ZNAME.
APPEND LINES OF LT_VIMSELLIST TO LS_VCL_SEL_LIST-SELLIST.
APPEND LS_VCL_SEL_LIST TO LT_VCL_SEL_LIST.
CLEAR:LS_VCL_SEL_LIST-SELLIST.
LS_VCL_SEL_LIST-OBJECT = 'ZPPC002'.
L_FIELDNAME = 'PARTNER'.
CLEAR:LT_VIMSELLIST.
CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'
EXPORTING
FIELDNAME = L_FIELDNAME
APPEND_CONJUNCTION = 'AND'
TABLES
SELLIST = LT_VIMSELLIST
RANGETAB = S_PARTN.
APPEND LINES OF LT_VIMSELLIST TO LS_VCL_SEL_LIST-SELLIST.
APPEND LS_VCL_SEL_LIST TO LT_VCL_SEL_LIST.
CALL FUNCTION 'VIEWCLUSTER_MAINTENANCE_CALL'
EXPORTING
VIEWCLUSTER_NAME = L_VIEWCLUSTER_NAME
MAINTENANCE_ACTION = 'U'
TABLES
"* DBA_SELLIST = LT_VIMSELLIST
DBA_SELLIST_CLUSTER = LT_VCL_SEL_LIST
EXCEPTIONS
CLIENT_REFERENCE = 1
FOREIGN_LOCK = 2
VIEWCLUSTER_NOT_FOUND = 3
VIEWCLUSTER_IS_INCONSISTENT = 4
MISSING_GENERATED_FUNCTION = 5
NO_UPD_AUTH = 6
NO_SHOW_AUTH = 7
OBJECT_NOT_FOUND = 8
NO_TVDIR_ENTRY = 9
NO_CLIENTINDEP_AUTH = 10
INVALID_ACTION = 11
SAVING_CORRECTION_FAILED = 12
SYSTEM_FAILURE = 13
UNKNOWN_FIELD_IN_DBA_SELLIST = 14
MISSING_CORR_NUMBER = 15
OTHERS = 16.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form ZPPC001
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM ZPPC001 .
DATA: L_VIEW_NAME LIKE DD02V-TABNAME.
DATA:LT_VIMSELLIST_TMP TYPE STANDARD TABLE OF VIMSELLIST.
DATA:LT_VIMSELLIST TYPE STANDARD TABLE OF VIMSELLIST.
DATA:LS_VIMSELLIST TYPE VIMSELLIST.
DATA:L_FIELDNAME TYPE VIMSELLIST-VIEWFIELD.
L_VIEW_NAME = 'ZPPC001'.
"* GS_VIMSELLIST-VIEWFIELD = 'MATNR'.
"* GS_VIMSELLIST-OPERATOR = 'EQ'.
"* GS_VIMSELLIST-VALUE = GS_ZMM_MAT_DESC-MATNR.
"* GS_VIMSELLIST-AND_OR = 'OR'.
"* APPEND LS_VIMSELLIST TO LT_VIMSELLIST.
"*
L_FIELDNAME = 'WERKS'.
CLEAR:LT_VIMSELLIST_TMP.
CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'
EXPORTING
FIELDNAME = L_FIELDNAME
APPEND_CONJUNCTION = 'AND'
TABLES
SELLIST = LT_VIMSELLIST_TMP
RANGETAB = S_WERKS.
APPEND LINES OF LT_VIMSELLIST_TMP TO LT_VIMSELLIST.
L_FIELDNAME = 'ZRTID'.
CLEAR:LT_VIMSELLIST_TMP.
CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'
EXPORTING
FIELDNAME = L_FIELDNAME
APPEND_CONJUNCTION = 'AND'
TABLES
SELLIST = LT_VIMSELLIST_TMP
RANGETAB = S_ZRTID.
APPEND LINES OF LT_VIMSELLIST_TMP TO LT_VIMSELLIST.
L_FIELDNAME = 'ZRTNAME'.
CLEAR:LT_VIMSELLIST_TMP.
CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'
EXPORTING
FIELDNAME = L_FIELDNAME
APPEND_CONJUNCTION = 'AND'
TABLES
SELLIST = LT_VIMSELLIST_TMP
RANGETAB = S_ZNAME.
APPEND LINES OF LT_VIMSELLIST_TMP TO LT_VIMSELLIST.
CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
EXPORTING
ACTION = 'U'
VIEW_NAME = L_VIEW_NAME
TABLES
DBA_SELLIST = LT_VIMSELLIST
EXCEPTIONS
CLIENT_REFERENCE = 1
FOREIGN_LOCK = 2
INVALID_ACTION = 3
NO_CLIENTINDEPENDENT_AUTH = 4
NO_DATABASE_FUNCTION = 5
NO_EDITOR_FUNCTION = 6
NO_SHOW_AUTH = 7
NO_TVDIR_ENTRY = 8
NO_UPD_AUTH = 9
ONLY_SHOW_ALLOWED = 10
SYSTEM_FAILURE = 11
UNKNOWN_FIELD_IN_DBA_SELLIST = 12
VIEW_NOT_FOUND = 13
MAINTENANCE_PROHIBITED = 14
OTHERS = 15.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form ZPPC002
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM ZPPC002 .
DATA: L_VIEW_NAME LIKE DD02V-TABNAME.
DATA:LT_VIMSELLIST_TMP TYPE STANDARD TABLE OF VIMSELLIST.
DATA:LT_VIMSELLIST TYPE STANDARD TABLE OF VIMSELLIST.
DATA:LS_VIMSELLIST TYPE VIMSELLIST.
DATA:L_FIELDNAME TYPE VIMSELLIST-VIEWFIELD.
L_VIEW_NAME = 'ZPPC002'.
"* GS_VIMSELLIST-VIEWFIELD = 'MATNR'.
"* GS_VIMSELLIST-OPERATOR = 'EQ'.
"* GS_VIMSELLIST-VALUE = GS_ZMM_MAT_DESC-MATNR.
"* GS_VIMSELLIST-AND_OR = 'OR'.
"* APPEND LS_VIMSELLIST TO LT_VIMSELLIST.
"*
L_FIELDNAME = 'PARTNER'.
CLEAR:LT_VIMSELLIST_TMP.
CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'
EXPORTING
FIELDNAME = L_FIELDNAME
APPEND_CONJUNCTION = 'AND'
TABLES
SELLIST = LT_VIMSELLIST_TMP
RANGETAB = S_PARTN.
APPEND LINES OF LT_VIMSELLIST_TMP TO LT_VIMSELLIST.
L_FIELDNAME = 'ZRTID'.
CLEAR:LT_VIMSELLIST_TMP.
CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'
EXPORTING
FIELDNAME = L_FIELDNAME
APPEND_CONJUNCTION = 'AND'
TABLES
SELLIST = LT_VIMSELLIST_TMP
RANGETAB = S_ZRTID.
APPEND LINES OF LT_VIMSELLIST_TMP TO LT_VIMSELLIST.
CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
EXPORTING
ACTION = 'U'
VIEW_NAME = L_VIEW_NAME
TABLES
DBA_SELLIST = LT_VIMSELLIST
EXCEPTIONS
CLIENT_REFERENCE = 1
FOREIGN_LOCK = 2
INVALID_ACTION = 3
NO_CLIENTINDEPENDENT_AUTH = 4
NO_DATABASE_FUNCTION = 5
NO_EDITOR_FUNCTION = 6
NO_SHOW_AUTH = 7
NO_TVDIR_ENTRY = 8
NO_UPD_AUTH = 9
ONLY_SHOW_ALLOWED = 10
SYSTEM_FAILURE = 11
UNKNOWN_FIELD_IN_DBA_SELLIST = 12
VIEW_NOT_FOUND = 13
MAINTENANCE_PROHIBITED = 14
OTHERS = 15.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
se54 创建权限组
使用se16->TDDAT 添加新增加的权限组赋值给t030表
在SAP中,经常需要自定义数据库表。而且可能需要维护该数据库的内容。定义了维护表视图后,可以通过SM30,对表内容进行维护,但是,因SM30标准事务代码维护权限过大,不便于直接分配该事务代码权限。此时,可以直接给该表维护分配新的事务代码,通过分配该新的事务代码,达到权限控制的目的。
分配新的事务代码的方法较多。简单介绍几种(第一种不需要程序基础,重点描述):
一、1、se11创建自定义数据库表(略)
2、se11,输入已经创建的自定义数据库表,点击修改。
3、实用程序-表格维护生成器(输入权限组,函数组,屏幕号等,保存,激活)
4、se93,创建时选择 Transaction with parameters (parameter transaction)。
5、事务选SM30,选择跳过起始屏幕。
6、选中“Inherit GUI attribute”;输入默认字段:VIEWNAME = '自定义的表名' 和UPDATE = 'X';保存激活即可;
二、通过编写程序,写选择屏幕,调用SM30实现。不过多描述。
一、通过RS_TABLE_LIST_CREATE函数建立新程序来建立TCODE。不过多描述。
二、通过View_Maintenance_Call 函数建立新程序来建立TCODE,代码可以参见SAP的标准程序RFT042D_CALL。不过多描述。
1. sap的视图的类型
sap的视图的类型有五种:
Database views :和数据库的视图形同,连接条件是必须自定义.
Projection views: 用于屏蔽一些字段(一般用于保护数据时使用).
Help views: 该类视图可以用搜索帮助的"selection method"中使用,参与连接表必须存在外键.
Maintenance views:允许你进行对几个表的数据进行修改,参与连接表必须存在外键,他们的连接条件是不能自定义的.
Append Views:这种视图主要用于增强;
在四种类型视图只有Database views是通过inner join来建立.其他类型的视图使用的outer join 语句建立的.
2. 对于Help视图和Maintenance视图的一些限制
对于用于定义Help视图和Maintenance视图的第二层表必须和主表有N:1的关系,其他加入的第三层表又的和第二层表有N:1的关系.
3. 各种视图允许的操作
如果database视图和Protection视图能进行select操作,其他视图不能进行查询;
对于多表连接的database视图,只能进行读操作;
如果database视图是单个表,则可以插入纪录;
如果database视图含有表的所有关键字,则可以修改;
对其他三种视图都可以进行插入和修改操作,具体参见maintance status的设置.
4. 相关TCODE
SE11
PS:我们在创建sap的VIEW时必须把mandt加入View Field,否则会把所有client中的数据都读取出来
SAP的视图有4种,数据库视图、维护视图、投影视图和帮助视图。
数据库视图通过inner join的方式把若干个数据库表连接起来,可以类似的作为一个数据库表在ABAP里使用。
维护视图是通过outer join的方式把数据表连接起来,可以作为维护表格内容的一种方式,很多配置都是通过维护视图实现的;
投影视图有点类型数据库视图,但是是通过outer join的方式,可以隐藏一些字段内容。
帮助视图用于创建ABAP的搜索帮助。