Application Development and Automation 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 only

Selection from maintenance view

Former Member
0 Likes
842

Hi,

I have created and activated a maintenance view from tables EKPO and EKKO. I needed an outer join so I had to use maintenance view instead of datbase view. When I see the data in the view using SE11 it works fine. However, when I try to select some fields from it using code it gives me an error message.

Eg.

REPORT Z_TEST_REP.

TABLES: Z_MAINTVIEW.

SELECT * FROM Z_MAINTVIEW.

WRITE: / Z_MAINTVIEW-MYFIELD1.

ENDSELECT.

When activating, this gives me the error message: "Z_MAINTVIEW" is not defined in the ABAP Dictionary as a table, projection view or database view.

Does this mean that it is not possible to select single fields from a maintenance view using the select statement? Is there any way I can do this? Any help is appreciated. Thanks.

Khan

1 ACCEPTED SOLUTION
Read only

Clemenss
Active Contributor
0 Likes
750

Hi Khan,

a maintenance view is thought dor data maintenance (insert, update, delete). You will never do that with EKKO/EKPO data.

Why create a view, you can select from ekpo INNER join ekpo because EKPO records can not exists without EKKO records. And EKKO without EKPO does not make any sense at all. Re-Think your idea about outer join.

Regards,

Clemens

4 REPLIES 4
Read only

Former Member
0 Likes
750

views doesn' t contain any data so use a transperent table to get the data.

please don't write these codes it will only confuse you

Read only

Clemenss
Active Contributor
0 Likes
751

Hi Khan,

a maintenance view is thought dor data maintenance (insert, update, delete). You will never do that with EKKO/EKPO data.

Why create a view, you can select from ekpo INNER join ekpo because EKPO records can not exists without EKKO records. And EKKO without EKPO does not make any sense at all. Re-Think your idea about outer join.

Regards,

Clemens

Read only

Former Member
0 Likes
750

Hey Clemens,

Thanks for your answer. The thing is, I am trying to achieve a join based on EBELN. Now the way the data is stored in the tables is that for every value of EBELN in EKKO, multiple rows exist in EKPO with the same value for EBELN. I need all those entries, hence the need for an outer join. I was able to do what I wanted by putting the product of the outer join into an itab, but coding standards at my workplace require that views be implemented wherever possible. So I was experimenting with maintenance joins, having never used them before. Being new to SAP, I must admit that I also wanted to try it simply for the sake of increasing my knowledge on the subject. If you know of any resources on ABAP tricks and workarounds on standard constraints, I'd love to hear about them. Thanks again.

Khan

Read only

Clemenss
Active Contributor
0 Likes
750

Hi Khan,

it is in the nature of EKKO (header) and EKPO (items) that you have 1 to n records (ittems) in EKPO with the same EBELN (purchase order document number). They all have different EBELP (item number values).

I just tried: You can create a database view with tables EKKO and EKPO with join condition EKKO-EBELN = EKPO-EBELN. In the view you also need EKKO-MANDT = EKPO-MANDT to make sure you stay in your client.

In the view fields, put all fields you want and/or need.

You can select from this view; works great.

Alternative: Use BAPI_PO_GETDETAIL to get all the header and item data you need. This is 100 % compliant with standard and (as I am convinced) with any programming guidelines.

- OK as I don't know the business scenario, it might be lesss than most appropriate...

Regards,

Clemens