Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to call a maintenance view from a program

Former Member
0 Kudos

Hello Abapers,

Can anybody explain with some examples. How to call a mainetenance view from a program.

Thanks

Ranjith.

2 REPLIES 2

Former Member
0 Kudos

Use FM 'VIEW_MAINTENANCE_CALL'.

REPORT zmaintaintest.

&----


  • VARIABLES / CONSTANTS

&----


CONSTANTS:

c_action(1) TYPE c VALUE 'U', "Update

c_viewname TYPE tabname value 'ZEMP_EXAMPLE', "View Name

c_field(6) TYPE c VALUE 'EMPNO'. "Field Name

&----


  • INTERNAL TABLES

&----


DATA: itab_rangetab TYPE STANDARD TABLE OF vimsellist,

v_empno TYPE zempno,

wa_rangetab TYPE vimsellist.

&----


  • SELECTION SCREEN

&----


PARAMETERS: p_empno TYPE zempno OBLIGATORY. "Emplyee ID

&----


  • AT SELECTION-SCREEN

&----


AT SELECTION-SCREEN.

  • Chcking the existence of the user in EMPLOYEE table

PERFORM validate_employee.

&----


  • START_OF_SELECTION

&----


START-OF-SELECTION.

  • This will restrict the user view so that user can only view/change

  • Table data corresponding to his/her Employee ID

PERFORM define_limited_data_area.

  • Displaying table maintenance view for a particular employee ID

PERFORM call_view_maintenance.

&----


*& Form validate_employee

&----


  • Validate plant entered in the selection screen

----


FORM validate_employee.

SELECT SINGLE empno u201CEmployee ID

FROM zemp_example u201CEmployee Table

INTO v_empno

WHERE empno = p_empno.

IF sy-subrc <> 0.

MESSAGE 'Not an Valid User' TYPE 'I'.

ENDIF.

ENDFORM. "validate_employee

&----


*& Form DEFINE_LIMITED_DATA_AREA

&----


  • To restrict the user view so that user can see/change table data

  • corresponding to his employee ID. Here one internal table is

  • getting populated with field name as u201CEMPNOu201D (Key field of the table)

  • And value as given by user in Selection Screen and this is passed as

  • Parameter in function module 'VIEW_MAINTENANCE_CALL'

&----


FORM define_limited_data_area.

CLEAR wa_rangetab.

wa_rangetab-viewfield = c_field.

wa_rangetab-operator = 'EQ'.

wa_rangetab-value = p_empno.

APPEND wa_rangetab TO itab_rangetab.

ENDFORM. "define_limited_data_area

&----


*& Form CALL_VIEW_MAINTENANCE.

&----


  • Displaying table maintenance view for a particular employee ID

&----


FORM call_view_maintenance.

CALL FUNCTION 'VIEW_MAINTENANCE_CALL'

EXPORTING

action = c_action

view_name = c_viewname

TABLES

dba_sellist = itab_rangetab.

ENDFORM. "call_view_maintenance

Regards,

Joy.

krishnendu_laha
Active Contributor
0 Kudos

Hi Friend,

Use function module 'VIEW_MAINTENANCE_CALL' to call a maintainance view from program.

Regards

Krishnendu