Ds
Ds
............................................ (wa)
(tt structure)
................................................
Consuming view with Parameters into another View with Parameters
Basic View
..........
.........
*
Composite View
....... .....
Instr( ) ==> returns the position of a substring in a string
@AbapCatalog.sqlViewName: 'ZXXXXXX'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Test CDS for substring'
define view ZXXXXXX as select from bkpf as posted{
posted.mandt,
posted.bukrs,
posted.belnr,
posted.gjahr,
xblnr,
substring( xblnr , 1 , instr( posted.xblnr , ' ' ) ) as test -- you can replace it with a input parameter
}
@AbapCatalog.sqlViewName: 'ZXXXXX'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Test CDS viewn'
define view ZXXX_XX_XX with parameters p_test : abap.numc(2) as select from bkpf as posted{
posted.mandt,
posted.bukrs,
posted.belnr,
posted.gjahr,
xblnr,
substring(xblnr , 1, :p_test) as test
}
@EndUserText--> heading label quickInfo
View on View
Association is always left outer join, you can force it to inner join in the following way [inner] always follows dot .
Table Function:
CL_DEMO_AMDP_FUNCTIONS
ENDCLASS.
1
......................
Shitty in NW 7.4, use @odata.publish: true -- but you an expose only 1 service per CDS view
3
Simple AMDP:
4
AMDP II
5
6
ABAP Report
7
8
OLD ABAP
NEW ABAP:
With New SQL ony a line code will replace all the above code
9
-----…………………………
13
14
15
……..
16
String Functions:
Numeric Functions:
17
tt_po_data.
dot
..........
ABAP Report.
zcl_sapyard_po_amdp=>get_o_data (
ex .
ip_lifnr = p_matnr
im. ).
ex_po_data = DATA(result)
Types:
20
Begion OF ty_name,
End OF ty_name.
Types:
tt_name TYPE standard table of
ty_name with empty key.
......................
........................
.....
....
21
AMDP - CHEATED
22
Consuming AMDP in ABAP Program/Report: I will call my AMDP class from the ABAP Program
…..
Showing an inner join for practice in method implementation
24
We need to include above internal table itab_vbap in the structure definition of Class
AMDP’s
................
25
APPLY_FILTER
ENDCLASS
ABAP ReportAMDP Source
Sample AMDP:
Continued Below:_
-
;
..................
................ ...............
for table funtion
..........
Return ........
......
;
Why you use Table Functions?
- This view will fail as data type mismatch on the join columns
- To overcome this issue, we’ll use Table Function
View won’t fail, as the join won’t happen, ‘cuz, we are not exposing the association above:, after adding it below, it throws error
Final view: TABLE FUNCTION TO FIX DATA TYPE MISMATCH:- RAW vs Char10
The earlier issue with join sc.partner_no = sp.partner_guid works fine and is gone Finally F8 on Table Function to see
the output