ABAP sample with Database View..

..and some code, as usual.

First, I created a Database View with the following properties:





It is now a good time to give some detailed information about these tables and their fields..

Table: VBRK
Description: Billing Document - Header Data

Table: KNA1
Description: General Data in Customer Master

Our Join Conditions are as follows:
KNA1-MANDT == VBRK-MANDT
KNA1-KUNNR == VBRK-KUNAG

Let 's further inspect these fields:

KNA1-MANDT
--------------------


KNA1-KUNNR
--------------------


VBRK-MANDT
--------------------


VBRK-KUNAG
--------------------


And now let 's move on to our code:
REPORT ztmp_test LINE-COUNT 10(2) NO STANDARD PAGE HEADING.
 
TABLES: z_kna1_vbrk.
 
DATA total TYPE vbrk-netwr.
 
PARAMETERS ccode TYPE vbrk-bukrs DEFAULT 2000 VALUE CHECK.
 
SELECT * FROM z_kna1_vbrk WHERE bukrs = ccode.
WRITE: /  z_kna1_vbrk-mandt, z_kna1_vbrk-kunnr, z_kna1_vbrk-vbeln, z_kna1_vbrk-name1,
          z_kna1_vbrk-ort01, z_kna1_vbrk-fkdat, z_kna1_vbrk-kurrf, z_kna1_vbrk-bukrs, 
          z_kna1_vbrk-netwr, z_kna1_vbrk-waerk.
 
z_kna1_vbrk-netwr = z_kna1_vbrk-netwr * z_kna1_vbrk-kurrf.
total = z_kna1_vbrk-netwr + total.
ENDSELECT.
 
WRITE: / total.


And the output will be: