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.

5 comments:

Naimesh Patel said...

Hi Sourav, Thanks for you comment on my blog.

You might like to see this blog: which can get the changed contents after the FM VIEW_MAINTENANCE_CALL

http://help-abap.blogspot.com/2008/09/capture-changed-content-after-fm.html

Anonymous said...

HOW shud i go about if instead of parameter, selecct-option is used ?

thanks

Rafael Camilo Rojas López said...

URL was moved to:
http://zevolving.com/2008/09/capture-changed-content-after-the-fm-view_maintenance_call/

mani said...

Iam really satisfy by your information.
It's well-written, to the point, and relative to what I do.
I like it very much for giving information on
SAP ABAP Online Training

.

yektek training said...

nice post thank you

Post a Comment