Master SAP ABAP: Assignment 5 Submission
Master SAP ABAP: Assignment 5 Submission
Submitted by – Salim
Assignment 5 – Master ABAP on HANA
Q1. Write down the SQL Hint is needed to apply in order to disable the FDA.
SOL: %_HINTS HDB ‘&prefer_join 1& &prefer_join_with_fda 0&’
Q2. Take any 5 records (fields: MANDT, MTEXT) from t000 table and put into temporary
table say +it_t000.
Again take any 20 records (fields: ARBGB, SPRSL, MSGNR, TEXT) from t100 table and put
into temporary table say +it_t100.
Now perform the CROSS join and display t000~mandt, t100~SPRSL, t100~arbgb,
t100~msgnr, t100~text
Note: use CROSS JOIN
SOL: We cannot use UP TO clause in the Sub Query and hence selected upto 100 records.
WITH
+it_t100 AS ( SELECT arbgb, sprsl, msgnr, text FROM t100 ) "UP TO 20 ROWS )
Step 1. Get Sales order detail – VBELN, VKORG, VTWEG, KUNNR from VBAK table=> (say
CTE is +VBAK)
Step 2. Get Customer Detail – KUNNR, LAND1, NAME1 for KUNNR which are present in
+VBAK => (Say this CTE is + KNA1)
Step3. Get all the Sales order Line Item Details(VBELN, VBELP, MATNR) from VBAP for all
Sales order(VBELN) which are present in +VBAK => ( Say this CTE is +VBAP )
Step 4. Get MATNR, MAKTX from MAKT for all the Material fetched in +VBAP (Say this
CTE is +MAKT).
"Step 1. Get Sales order detail – VBELN, VKORG, VTWEG, KUNNR from VBAK table=> (say
CTE is +VBAK)
+vbak AS ( SELECT VBELN, VKORG, VTWEG, KUNNR FROM vbak where auart ='JOR' ),
"Step 2. Get Customer Detail – KUNNR, LAND1, NAME1 for KUNNR which are present in
+VBAK => (Say this CTE is + KNA1)
+kna1 AS ( SELECT KUNNR, LAND1, NAME1 FROM kna1 where kunnr IN ( SELECT DISTINCT
kunnr FROM +vbak ) ),
"Step3. Get all the Sales order Line Item Details(VBELN, VBELP, MATNR) from VBAP for
all Sales order(VBELN)
"which are present in +VBAK => ( Say this CTE is +VBAP )
+vbap AS ( SELECT VBELN, POSNR, MATNR FROM vbap where vbeln IN ( SELECT DISTINCT
vbeln FROM +vbak ) ),
"Step 4. Get MATNR, MAKTX from MAKT for all the Material fetched in +VBAP (Say this
CTE is +MAKT).
+makt AS ( SELECT MATNR, MAKTX FROM makt where matnr IN ( SELECT DISTINCT matnr FROM
+vbap ) ),
cl_demo_output=>display_data(
EXPORTING
value = it_final_out
).