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

Database View is not appearing in the ABAP Coding

Former Member
0 Likes
1,444

Dear Friends,

I am very much new in the ABAP. Actually I worked last 8 years in the Oracle PL/SQL. Recently, my company implements SAP. The database is Oracle 10g. I would like to use my oracle experience in the project. But in everywhere I faced some problem.

I have created one Database view by the Native sql. Here I am giving you the code.

-


Create OR REPLACE view ZVMVSL_ALLTPORT

AS

SELECT T1.MVESSEL_NO, T1.MVESSEL_NAME, T1.SHIPPINGLINE, T2.MVOYAGENUMBER,

T2.TRANSHIPMENTA AS TPORT, T2.ETDTSHIPMENTA AS ETD_TPORT,

T3.MVESSEL_SRL_NO,

T3.PORTOFDISCHARGE POD, T3.ETAPORT

FROM ZSD_MOTHER_MST T1, ZSD_MOTHER_DTL T2, ZSD_MOTHER_VIA T3

WHERE T1.MANDT = T2.MANDT

AND T1.MVESSEL_NO = T2.MVESSEL_NO

AND T1.MVESSEL_NO = T3.MVESSEL_NO

AND T2.MVOYAGENUMBER = T3.MVOYAGENUMBER

AND T2.TRANSHIPMENTA <>' '

UNION

SELECT T1.MVESSEL_NO, T1.MVESSEL_NAME, T1.SHIPPINGLINE, T2.MVOYAGENUMBER,

T2.TRANSHIPMENTB AS TPORT, T2.ETDTSHIPMENTB AS ETD_TPORT,

T3.MVESSEL_SRL_NO,

T3.PORTOFDISCHARGE POD, T3.ETAPORT

FROM ZSD_MOTHER_MST T1, ZSD_MOTHER_DTL T2, ZSD_MOTHER_VIA T3

WHERE T1.MANDT = T2.MANDT

AND T1.MVESSEL_NO = T2.MVESSEL_NO

AND T1.MVESSEL_NO = T3.MVESSEL_NO

AND T2.MVOYAGENUMBER = T3.MVOYAGENUMBER

AND T2.TRANSHIPMENTB <>' '

-


This view i could not use from ABAP codes, ABAP/4 only identified by views which we would create from T-code se11. Now tell me how could I solve this issue. Because in this query i did some UNION which is not directly available in teh se11.

Please help me how to handle this situation. Because if I can use this sort of native sql views, I could solve lot of things in the development.

rgds

Farhad

Dear Friends,

I am very much new in the ABAP. Actually I worked last 8 years in the Oracle PL/SQL. Recently, my company implements SAP. The database is Oracle 10g. I would like to use my oracle experience in the project. But in everywhere I faced some problem.

I have created one Database view by the Native sql. Here I am giving you the code.

-


Create OR REPLACE view ZVMVSL_ALLTPORT

AS

SELECT T1.MVESSEL_NO, T1.MVESSEL_NAME, T1.SHIPPINGLINE, T2.MVOYAGENUMBER,

T2.TRANSHIPMENTA AS TPORT, T2.ETDTSHIPMENTA AS ETD_TPORT,

T3.MVESSEL_SRL_NO,

T3.PORTOFDISCHARGE POD, T3.ETAPORT

FROM ZSD_MOTHER_MST T1, ZSD_MOTHER_DTL T2, ZSD_MOTHER_VIA T3

WHERE T1.MANDT = T2.MANDT

AND T1.MVESSEL_NO = T2.MVESSEL_NO

AND T1.MVESSEL_NO = T3.MVESSEL_NO

AND T2.MVOYAGENUMBER = T3.MVOYAGENUMBER

AND T2.TRANSHIPMENTA <>' '

UNION

SELECT T1.MVESSEL_NO, T1.MVESSEL_NAME, T1.SHIPPINGLINE, T2.MVOYAGENUMBER,

T2.TRANSHIPMENTB AS TPORT, T2.ETDTSHIPMENTB AS ETD_TPORT,

T3.MVESSEL_SRL_NO,

T3.PORTOFDISCHARGE POD, T3.ETAPORT

FROM ZSD_MOTHER_MST T1, ZSD_MOTHER_DTL T2, ZSD_MOTHER_VIA T3

WHERE T1.MANDT = T2.MANDT

AND T1.MVESSEL_NO = T2.MVESSEL_NO

AND T1.MVESSEL_NO = T3.MVESSEL_NO

AND T2.MVOYAGENUMBER = T3.MVOYAGENUMBER

AND T2.TRANSHIPMENTB <>' '

-


This view i could not use from ABAP codes, ABAP/4 only identified by views which we would create from T-code se11. Now tell me how could I solve this issue. Because in this query i did some UNION which is not directly available in teh se11.

Please help me how to handle this situation. Because if I can use this sort of native sql views, I could solve lot of things in the development.

rgds

Farhad

8 REPLIES 8
Read only

Former Member
0 Likes
1,343

If you have created a view in native SQL, and want to use it anyway, try querying it by using execute SQL statement from ABAP.

Read only

0 Likes
1,343

Dear Harish,

how can i populate one internal table by using a database view....as this was not been created by ABAP structure....rather it has been created by using execute SQL statement from ABAP.

please give me on example code for that.....

Rgds

Farhad

Read only

0 Likes
1,343

I am waiting for reply....is there any one can help me?

Read only

0 Likes
1,343

pls guys pls give the solution....

Read only

Former Member
0 Likes
1,343

You are right UNION is not available as option when you create a view in SE11. You could solve this as follows:

- Create a view for the first query

- Create a second view for your second query

- In the coding do the following


select ........ from VIEW1
  into table lt_table
  where .........

select ....... from VIEW2
  appending table lt_table
  where .........

This would append the data selected in the second query to the data selected in the first query.

Hope that helps,

Michael

Read only

christine_evans
Active Contributor
0 Likes
1,343

>

> This view i could not use from ABAP codes, ABAP/4 only identified by views which we would create from T-code se11. Now tell me how could I solve this issue. Because in this query i did some UNION which is not directly available in teh se11.

>

>

> Please help me how to handle this situation. Because if I can use this sort of native sql views, I could solve lot of things in the development.

>

> rgds

> Farhad

You can use real SQL to query non SE11 created database tables - look at the SAP help on EXEC SQL - but this is really not a good idea. For example, it is database specific which removes one of the 'advantages' of SAP ie that it is portable between different database platforms;using SAP's Open SQL should mean that if your company moves to eg SQL Server it shouldn't be necessary to doing any re-coding whereas anything you've done in Oracle SQL will have to be re-coded. There are also other disadvantages of using real SQL eg you don't get any help from the syntax checker and I think you would bypass the whole SAP security level - SAP security is defined at application level and not via database grants.

I would bet a reasonable amount of money that there is nothing that you can do in real SQL that you can't replicate in SAP's Open SQL . Ok the Open SQL solution might be a bit more convoluted and possibly less elegant but you can make it do the same thing. If you want to stick with Oracle then I guess you should look for a job that uses Oracle rather than SAP.

Read only

0 Likes
1,343

Christine Evans

your big essay doesnt mean to me anything.....I am a customer, I would like to use Oracle or any thing....that up to me......I don't need your suggession such as....

If you can give me the solution in ABAP, give me that....otherwise....dont misutilize our time......

Rgds

Farhad

Read only

0 Likes
1,343

>

> Christine Evans

>

> your big essay doesnt mean to me anything.....I am a customer, I would like to use Oracle or any thing....that up to me......I don't need your suggession such as....

>

> If you can give me the solution in ABAP, give me that....otherwise....dont misutilize our time......

>

> Rgds

> Farhad

Just trying to be helpful. If you have to work with SAP then the easiest and - more importantly - most easily maintainable way to do it is to use the SAP supplied tools rather than distorting a development to suit your own particular skills set.

By the way, I did provide the ABAP solution. In the first sentence. As did one of the earlier posts.