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 database view in report

Former Member
0 Kudos

Hi i have a small problem in report

the problem is like this i had created a database view in which i got all the values displayed but can any one of you tell me how to declare this database view in report with example

i had created a database view named as znew1

and the fields are

LIFNR LIKE EKKO-LIFNR,

EBELN LIKE EKKO-EBELN,

LIFNR1 LIKE LFA1-LIFNR,

NAME1 LIKE LFA1-NAME1,

EKBE LIKE EKBE-EBELN,

VGABE LIKE EKBE-VGABE,

MATNR LIKE EKPO-MATNR,

WERKS LIKE EKPO-WERKS,

NETWR LIKE EKPO-NETWR,

MENGE LIKE EKPO-MENGE,

MWSKZ LIKE EKPO-MWSKZ,

TXZ01 LIKE EKPO-TXZ01,

KOSTL LIKE EKKN-KOSTL,

PS_PSP_PNR LIKE EKKN-PS_PSP_PNR,

EBELN1 LIKE EKKN-EBELN,

8 REPLIES 8

Former Member
0 Kudos

Hi,

Just do in the same way as you do with a Database table.

In abap reports there's no difference between a view & a table.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

It would be the same as if you were declaring an internal table for one table.

data: iznew1  type table of znew1  with header line.


select * into table iznew1  from znew1 up to 100 rows.

Regards,

Rich Heilman

0 Kudos

HI Mr.Rich Heilman

i had followed your procedure but the output is not displaying

0 Kudos

Can you please post your code and let me know what exactly you want to ouput?

Regards,

Rich Heilman

0 Kudos

Hi Mr. Rich

This is the program code and i want this output int he alv grid format

TABLES:EKKO,EKBE,EKPO.

DATA:BEGIN OF RTAB_ALV OCCURS 30,

LIFNR LIKE EKKO-LIFNR,

EBELN LIKE EKKO-EBELN,

LIFNR1 LIKE LFA1-LIFNR,

NAME1 LIKE LFA1-NAME1,

EKBE LIKE EKBE-EBELN,

VGABE LIKE EKBE-VGABE,

MATNR LIKE EKPO-MATNR,

WERKS LIKE EKPO-WERKS,

NETWR LIKE EKPO-NETWR,

MENGE LIKE EKPO-MENGE,

MWSKZ LIKE EKPO-MWSKZ,

TXZ01 LIKE EKPO-TXZ01,

KOSTL LIKE EKKN-KOSTL,

PS_PSP_PNR LIKE EKKN-PS_PSP_PNR,

EBELN1 LIKE EKKN-EBELN,

END OF RTAB_ALV.

DATA:IZNEW1 TYPE TABLE OF ZNEW1 WITH HEADER LINE.

select * into table IZNEW1 FROM ZNEW1 UP TO 10000 ROWS.

0 Kudos

Add ZNEW1 in the tables declarations :

TABLES:EKKO,EKBE,EKPO, ZNEW1.

Hope this helps,

Erwan

0 Kudos

Does your RTAB_ALV internal table have the same exact field names as the custom view ZNEW1. If so you SELECT directly into that internal table.

select * into corresponding fields of table rtab_alv
               FROM ZNEW1 UP TO 10000 ROWS.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi,

Try...

DATA: ITAB_ZNEW1 TYPE STANDARD TABLE OF ZNEW1 OCCURS 0.

SELECT * FROM ZNEW1 INTO TABLE ITAB_ZNEW1 UP TO 100 ROWS.

And also check the data in ITAB_ZNEW1 in debug mode.

I guess there's some problem in your code where u r displaying.

null