Consume HANA Artifacts Using ABAP-External View Abhishek Agrawal

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Consume HANA artifacts using ABAP- External View

Abhishek Agrawal

Step 1: In HANA studios go to SAP HANA Development or Modeler prospective.

Step 2: Open Content folder and create a new package (if you do not have a
package).

Step 3: Right click on above created package and under New select Attribute
View (or any other depends on your requirement.)

Step 4: Give name and description of your view and click on finish.

Step 5: Select tables from Catalog folder and drag n drop it to Data Foundation.

Step 6: Create join links between table fields and add output fields and calculated
fields as per requirement.

Step 7: Save and Activate the view and check the data by using Data Preview
option.

At this point we are done with our HANA view, now we need to create External
View corresponding to this HANA view.

Steps to create external view:


Step 1: Go to ABAP prospective.

Step 2: Right click on ABAP package under which you want to create this external
view. Under New click on Other ABAP Repository Object

Step 3: Expand Dictionary folder and click on Dictionary View.

Step 4: Enter name and description of view and select External View radio
button and browse and select your HANA view.

Step 5: Click on Next, Finish and then activate the view, this will create your
external view in you ABAP system, you can cross check in SE11.

Note: In case if you make any changes to your HANA view then you need to come
to your external view and synchronize if by using Synchronize button(check in
above screen shot).
At this point of time we have our External View ready that is pointing to HANA
View.

Steps to consume external View:


External view is just like any table in your ABAP system (like MARA) and you
can fetch data from it just like any other table.
Code snippet to get data from external view.
REPORT ztest_oia_t049_open_days_ex_v.
TYPES: BEGIN OF ty_bp_order,
bp_id TYPE snwd_bpa-bp_id,
open_days TYPE int4,
END OF ty_bp_order.
DATA: lt_bp_order TYPE TABLE OF ty_bp_order.
SELECT bp_id SUM( open_days )
INTO TABLE lt_bp_order
FROM zoia_opn_days_ex
GROUP BY bp_id.
SORT lt_bp_order BY bp_id.
LOOP AT lt_bp_order ASSIGNING FIELD-SYMBOL(<fs>).
WRITE: / 'Order placed by BP' ,<fs>-bp_id.
WRITE: '=', <fs>-open_days, /.
ENDLOOP.

You might also like