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: 

read data from maintenance view

Former Member
0 Kudos

hi all,

could anyone please tell me if there is any special way to read data from a maintenance view (if at all it is possible).

i wrote a simple select on it but it gave me a syntax error that the view is not defined in the dictionary. (i am able to see the view definition by double clicking and it is active too).

the following is my select.

select single lgnum from v_t320 into (w_lgnum) where werks eq p_i_werks and lgort eq p_i_lgort.

awaiting answers...

regards,

PJ

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Try this

CALL FUNCTION 'VIEW_MAINTENANCE_CALL'

EXPORTING

action = 'U'

view_name = 'table'

TABLES

dba_sellist = gt_typo

EXCEPTIONS

OTHERS = 14.

4 REPLIES 4

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You can not do a select over a maintenance view. Just do your select over the underlying table T320.




select single lgnum <b>from t320</b> into (w_lgnum) where werks eq p_i_werks and lgort eq p_i_lgort.

Regards,

Rich Heilman

Former Member
0 Kudos

Thanx Rich,

but the documentation on maintenance views says that we can have read access to them. Does that mean the data can only be seen via the DDIC and not from a select written in a program??

this is what i read...

Maintenance Status

The maintenance status of a view controls whether data records can also be changed or inserted in the tables contained in the view.

The maintenance status can be defined as follows:

Read only: Data can only be read through the view.

Read, change, delete, insert: Data of the tables contained in the view can be changed, deleted, and inserted through the view.

Only read access is permitted for database views that are defined through several tables. If a database view contains only one single table, data can be inserted in this table through the view (see Inserts Through Database Views).

The following status definitions are also possible for maintenance views:

Read and change: Existing view entries can be changed. However, records cannot be deleted or inserted.

Read and change (time-dependent views): Only entries whose non-time-dependent part of the key is the same as that of existing entries may be inserted.

you surely have earned some points here....just let me be clear of the concept behind this

regards,

PJ

Former Member
0 Kudos

Hi,

Try this

CALL FUNCTION 'VIEW_MAINTENANCE_CALL'

EXPORTING

action = 'U'

view_name = 'table'

TABLES

dba_sellist = gt_typo

EXCEPTIONS

OTHERS = 14.

0 Kudos

Well, if you try to do a select against a maint. view, the syntax check will yell at you about, saying that it needs to be a table, database view or projection view. The documentation which you speak of is mostly likly talking about the user interface to the view. Again, I would suggest reading the underlying table directly. The maintenacne view is only used for the table maintenance program.

Regards,

Rich Heilman