0% found this document useful (0 votes)
714 views3 pages

Master SAP ABAP: Assignment 5 Submission

This document contains the solutions to 3 questions about mastering ABAP on HANA. Q1's solution provides a SQL hint to disable the FDA. Q2's solution uses CROSS JOIN to display fields from two temporary tables created from sample data. Q3's solution uses common table expressions (CTEs) in 5 steps to join data from various tables, retrieve required fields, and display the final results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
714 views3 pages

Master SAP ABAP: Assignment 5 Submission

This document contains the solutions to 3 questions about mastering ABAP on HANA. Q1's solution provides a SQL hint to disable the FDA. Q2's solution uses CROSS JOIN to display fields from two temporary tables created from sample data. Q3's solution uses common table expressions (CTEs) in 5 steps to join data from various tables, retrieve required fields, and display the final results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment 5 Submission

Master SAP ABAP on HANA

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_t000 AS ( SELECT mandt , mtext FROM t000 ), " UP TO 5 ROWS ),

+it_t100 AS ( SELECT arbgb, sprsl, msgnr, text FROM t100 ) "UP TO 20 ROWS )

SELECT t~mandt , m~sprsl, m~arbgb, m~msgnr, t~mtext


FROM +it_t000 AS t CROSS JOIN +it_t100 AS m INTO TABLE @DATA(it_final_out) up to
100 rows.

Q3. Achieve below with the help of CTEs –

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).

WhatsApp +1-251-727-9273 All ZAPYard’s LIVE Training History mail@ZAPYard.com Page1


Assignment 5 – Master ABAP on HANA
Step5. Get the final data as +VBAK~VBELN, +VBAK~VKORG, +VBAP~EBELP,
+VBAP~MATNR, +MAKT~MAKTX, +KNA1~KUNNR and Display VBAP~`MATNR
SOL:
WITH

"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 ) ),

"Step5. Get the final data as +VBAK~VBELN, +VBAK~VKORG, +VBAP~EBELP, +VBAP~MATNR,


+MAKT~MAKTX, +KNA1~KUNNR
+result AS ( SELECT vbk~VBELN, vbk~VKORG, vbp~posnr, vbp~MATNR, mkt~MAKTX, kna~KUNNR
from +vbak AS vbk
INNER JOIN +vbap AS vbp ON vbp~vbeln = vbk~vbeln
inner join +kna1 AS kna ON kna~kunnr = vbk~kunnr
inner join +makt AS mkt ON mkt~matnr = vbp~matnr )

"Step 6. Display VBAP~`MATNR

SELECT matnr FROM +result


INTO TABLE @DATA(it_final_out).
*ENDWITH

cl_demo_output=>display_data(
EXPORTING
value = it_final_out
).

WhatsApp +1-251-727-9273 All ZAPYard’s LIVE Training History mail@ZAPYard.com Page2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy