Showing posts with label TMG. Show all posts
Showing posts with label TMG. Show all posts

Call Maintenance View from a program using FM VIEW_MAINTENANCE_CALL

This code demonstrates how to call function module VIEW_MAINTENANCE_CALL to call a table maintenance view from any program.







The Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
*&---------------------------------------------------------------------*
*& Report Z_TEST_PROGRAM
*&---------------------------------------------------------------------*
*& Demo program for blog http://abap-explorer.blogspot.com/
*&---------------------------------------------------------------------*
REPORT z_test_program.
DATA:
i_sellist TYPE STANDARD TABLE OF vimsellist INITIAL SIZE 0,
i_header TYPE STANDARD TABLE OF vimdesc INITIAL SIZE 0,
i_namtab TYPE STANDARD TABLE OF vimnamtab INITIAL SIZE 0.

PARAMETERS: p_view TYPE viewname MATCHCODE OBJECT viewmaint OBLIGATORY.

AT SELECTION-SCREEN.

CALL FUNCTION 'VIEW_GET_DDIC_INFO'
EXPORTING
viewname = p_view
* VARIANT_FOR_SELECTION = ' '
TABLES
sellist = i_sellist
x_header = i_header
x_namtab = i_namtab
EXCEPTIONS
no_tvdir_entry = 1
table_not_found = 2
OTHERS = 3
.
IF sy-subrc <> 0.
data: l_message type NATXT.
CONCATENATE 'Table/View' p_view
INTO l_message SEPARATED BY space.
MESSAGE e001(00) WITH l_message ' not in the Dictonary'.
ENDIF.

START-OF-SELECTION.

CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
EXPORTING
action = 'S'
view_name = p_view
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 i001(00) WITH 'Error while calling the view'.
LEAVE LIST-PROCESSING.
ENDIF.