U n it 2 : T a k in g A B A P
to H A N A
H A 4 0 0
F i g u r e 2 6 : O p e n S Q L U s in g S e c o n d a r y D a t a b a s e C o n n e c t i o n
F i g u r e 2 7 : R e s t r i c t i o n
5 4
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : A c c e s s t h e S A P H A N A D a ta b a s e U s in g O p e n S Q L a n d S e c o n d a r y C o n n e c t io n
L e s s o n S u m m a r y Y o u s h o u l d n o w b e a b l e t o : •
2 0 1 3
D e s c rib e h o w to a c c e s s th e S A P H A N A s e c o n d a r y d a t a b a s e c o n n e c t i o n
©
2 0 1 3 S A P
D a t a b a s e b y u s i n g O p e n S Q L a n d a
A G . A ll r ig h ts r e s e r v e d .
5 5
U n it 2 : T a k in g A B A P
L e s s o n :
to H A N A
H A 4 0 0
T a b le s in S A P L e s s o n
H A N A
S t u d io
O v e r v i e w
L e s s o n O b j e c t i v e s A f t e r c o m p l e t i n g t h i s l e s s o n , y o u w i l l b e a b l e t o : •
U n d e r s ta n d S c h e m a ta a n d T a b le s in S A P H A N A
S t u d io
•
A n a ly z e th e D e n itio n o f T a b le s in S A P H A N A
S t u d io
B u s i n e s s E x a m p l e
F ig u r e 2 8 : S A P
5 6
©
H A N A
2 0 1 3 S A P
S t u d io : S c h e m a a n d T a b le
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : T a b le s in
S A P
H A N A
S tu d io
F i g u r e 2 9 : T a b l e D e n i t i o n
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
5 7
U n it 2 : T a k in g A B A P
5 8
to H A N A
H A 4 0 0
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : T a b le s in
S A P
H A N A
S tu d io
E x e r c is e 5 : A c c e s s S A P H A N A v ia a s e c o n d a r y D a t a b a s e C o n n e c t i o n E x e r c i s e O b j e c t i v e s A f t e r c o m p l e t i n g t h i s e x e r c i s e , y o u w i l l b e a b l e t o : •
u n d e rs ta n d h o w
s e c o n d a r y d a t a b a s e c o n n e c t i o n s a r e m a i n t a i n e d t e s t e d
•
u n d e r s t a n d t h e p r e r e q u i s i t e s t o a c c e s s t a b l e s o f t h e s e c o n d a r y d a t a b a s e v i a o p e n S Q L
•
q u a n t i f y v a r i o u s i m p r o v e m e n t s o f d a t a b a s e a c c e s s e s f o r S A P H A N A
B u s i n e s s E x a m p l e T e m p l a t e :
R e p o r t Y H A 4 0 0 _ O P T I M I Z E _ O S Q L _ S 1 R e p o r t Y H A 4 0 0 _ O P T I M I Z E _ O S Q L _ S 2 R e p o r t Y H A 4 0 0 _ O P T I M I Z E _ O S Q L _ S 3 S o l u t i o n :
R e p o r t Y H A 4 0 0 _ S E C _ D B _ C O N _ S 1 R e p o r t Y H A 4 0 0 _ S E C _ D B _ C O N _ S 2 R e p o r t Y H A 4 0 0 _ S E C _ D B _ C O N _ S 3
T a s k 1 : C o p y a n d u n d e r s t a n d t e m p l a t e s C T p Z n
re IM a c H u m
a te c o p ie s o f r e p o r ts IZ E _ O S Q L _ S 2 a n d k a g e Z H A 4 0 0 _ # # (s A 4 0 0 _ # # _ S E C _ D B _ b e r ) . A c tiv a te th e p
Y H A 4 0 0 _ O Y H A 4 0 0 _ O u g g e s te d n a m 2 , Z H A 4 0 0 _ r o g r a m s .
P T IM P T IM e s: # # _ S
IZ IZ Z H E C
E _ E _ A 4 _ D
O S Q L _ S 1 ,Y O S Q L _ S 3 0 0 _ # # _ S E C B _ 3 , w h ere
H A in y _ D # #
4 0 0 _ O P - o u r B _ 1 , i s y o u r g r o u p
H i n t : A l t e r n a t i v e l y , y o u m a y u s e y o u r o w n s o l u t i o n s f r o m t h r e e e x e r c i s e s a s t e m p l a t e s f o r t h i s e x e r c i s e .
1 .
C r e a te c o p ie s o f t h e r e p o rts . P l a c e th e m a s s i g n t h e m t o y o u r w o r k b e n c h t a s k .
2 .
A c t i v a t e t h e p r o g r a m s .
t h e p r e v i o u s
i n y o u r p a c k a g e Z H A 4 0 0 _ 0 0 a n d
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
5 9
U n it 2 : T a k in g A B A P
to H A N A
H A 4 0 0
T a s k 2 : A n a l y z e L o o k f o r a s e c o n d a r y d a t a b a s e c o n n e c t i o n t h a t p o i n t s t o t h e S A P H A N A s e r v e r . F i n d o u t w h i c h t a b l e s c a n b e a c c e s s e d v i a t h i s c o n n e c t i o n u s i n g o p e n S Q L . 1 .
L o o k u p t h e s e c o n d a r y d a t a b a s e c o n n e c t i o n s w h i c h h a v e b e e n m a i n t a i n e d i n y o u r A S A B A P .
2 .
F i n d a d a ta b a s e c o n n e c tio n th a t p o in ts to y o u r S A P H A N A d o w n u s e r a n d c o n n e c t i o n I D .
3 .
T h e c o n n e c tio n ID s e r v e r i s
is
s e r v e r a n d n o te
a n d th e u s e r f o r th e S A P H A N A
F i l l i n t h e b l a n k s t o c o m p l e t e t h e s e n t e n c e .
4 .
G o t o S A P H A N A S t u d i o a n d o p e n t h e s c h e m a o f t h e s a m e n a m e a s t h e u s e r i n t h e d a t a b a s e c o n n e c t i o n .
5 .
L o o k f o r t h e t a b l e s y o u n d i n t h i s s c h e m a . T h o s e a r e t h e o n e s y o u c a n a c c e s s v i a t h e s e c o n d a r y d a t a b a s e c o n n e c t i o n u s i n g o p e n S Q L .
6 .
T h e t a b le s a r e :
7 .
V e r if y f o r a t le a s t o n e ta b le th a t t h e d e n itio n o n S A P H A N A t h e d e n i t i o n o n t h e p r i m a r y d a t a b a s e .
T a s k 3 : A c c e s s S A P
i s i d e n t i c a l t o
H A N A
C h a n g e y o u r t h r e e p r o g r a m s . I n a l l s e l e c t s t a t e m e n t s ( s u b r o u t i n e s g e t _ d a t a _ s o l u t i o n a n d s u b r o u t i n e g e t _ d a t a _ t e m p l a t e ) r e a d f r o m S A P H A N A r a t h e r t h a n t h e p r i m a r d a t a b a s e . 1 .
E d i t y o u r p r o g r a m Z H A 4 0 0 _ # # _ S E C _ D B _ 1 . S e a r c h f o r a l l S E L E C T - s t a t m e n t s a n d u s e a d d i t i o n C O N N E C T I O N t o a c c e s s t h e s e c o n d a r y d a t a b a s e r a t h e r t h a n t h e p r i m a r y d a t a b a s e . H i n t : I n s t e a d o f h a r d c o d i n g t h e c o n n e c t i o n i t i s r e c o m m e n d e d t o d e n e a g l o b a l c o n s t a n t o f t y p e s t r i n g .
2 .
R e p e a t w i t h p r o g r a m s Z H A 4 0 0 _ # # _ S E C _ D B _ 2 a n d Z H A 4 0 0 _ # # _ S E C _ D B _ 3 . C o n t i n u e d o n n e x t p a g e
6 0
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : T a b le s in
3 .
S A P
H A N A
S tu d io
A c t i v a t e a n d t e s t y o u r p r o g r a m s .
T a s k 4 : Q u a n t i f y i m p r o v e m e n t s w h e n u s in g S A P H A N A a s d a t a b a s e P e r f o r m r u n t i m e m e a s u r e m e n ts w i t h A B A P T r a c e ( S A T ) f o r a ll t h r e e p r o g r a m s . I n e a c h c a s e , c o m p a r e t h e r u n t i m e c o n s u m p t i o n o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e a n d s u b r o u t i n e g e t _ d a t a _ s o l u t i o n 1 .
P e r f o r m a r u n t i m e m e a s u r e m e n t w i t h A B A P T r a c e ( S A T ) f o r p r o g r a m Z H A 4 0 0 _ # # _ S E C _ D B _ 1 a n d c o m p a r e t h e g r o s s r u n ti m e o f t h e t w o s u b r o u t i n e s .
2 .
T h e m ic r _ _ _ _ % th
g r o s s r u n tim o se c o n d s . _ _ _ _ _ _ _ m ro u g h th e u
e o f su T h e g ro ic ro s e c sa g e o f
b ro u s s ru o n d s e ld
t i n e g e t _ d a t a _ t e m p l a t e i s : _ _ _ _ _ _ _ _ _ _ _ n t i m e o f s u b r o u t i n e g e t _ d a t a _ s o l u t i o n i s : . T h i s i s a r e d u c t i o n o f t h e r u n t i m e b y _ _ _ _ _ _ l i s t s
F i l l i n t h e b l a n k s t o c o m p l e t e t h e s e n t e n c e .
3 .
P e r f o r m a r u n t i m e m e a s u r e m e n t w i t h A B A P T r a c e ( S A T ) f o r p r o g r a m Z H A 4 0 0 _ # # _ S E C _ D B _ 2 a n d c o m p a r e t h e g r o s s r u n ti m e o f t h e t w o s u b r o u t i n e s .
4 .
T h e m ic r _ _ _ _ % th
g ro o s _ _ ro u
s s r u n tim e c o n d s . _ _ _ _ _ m g h th e u
e o T h e ic ro s a g e
f su g ro s e c o f
b r o u t i n e g s s ru n tim e o n d s . T h is a jo i n i n s t e
e t_ o f is a d
d a ta _ te m s u b r o u tin a re d u c tio o f n e s te d
p l a t e i s : _ _ _ _ _ _ _ _ _ _ _ e g e t _ d a t a _ s o l u t i o n i s : n o f t h e r u n t i m e b y _ _ _ _ _ _ s e l e c t s .
F i l l i n t h e b l a n k s t o c o m p l e t e t h e s e n t e n c e .
5 .
P e r f o r m a r u n t i m e m e a s u r e m e n t w i t h A B A P T r a c e ( S A T ) f o r p r o g r a m Z H A 4 0 0 _ # # _ S E C _ D B _ 3 a n d c o m p a r e t h e g r o s s r u n ti m e o f t h e t w o s u b r o u t i n e s .
6 .
T h e m ic r _ _ _ _ % th
g ro o s _ _ ro u
s s r u n tim e o e c o n d s . T h e _ _ _ _ _ m ic ro g h th e u s a g e
f su g ro s e c o f
b r o u t i n e g e t _ s s ru n tim e o f o n d s . T h is is fu ll b u ffe rin g
d a ta su b r a re d in s te
_ t e m p l a t e i s : _ _ o u t i n e g e t _ d a t a u c tio n o f th e ru n a d o f n e s te d s e le
_ _ _ _ _ _ _ _ _ _ s o l u t i o n i s : t i m e b y _ _ _ _ _ _ c t s .
F i l l i n t h e b l a n k s t o c o m p l e t e t h e s e n t e n c e .
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
6 1
U n it 2 : T a k in g A B A P
to H A N A
H A 4 0 0
S o lu tio n 5 : A c c e s s S A P H A N A v ia a s e c o n d a r y D a t a b a s e C o n n e c t i o n T a s k 1 : C o p y a n d u n d e r s t a n d t e m p l a t e s C T p Z n
re IM a c H u m
a te c o p ie s o f r e p o r ts IZ E _ O S Q L _ S 2 a n d k a g e Z H A 4 0 0 _ # # (s A 4 0 0 _ # # _ S E C _ D B _ b e r ) . A c tiv a te th e p
Y H A 4 0 0 _ O Y H A 4 0 0 _ O u g g e s te d n a m 2 , Z H A 4 0 0 _ r o g r a m s .
P T IM P T IM e s: # # _ S
IZ IZ Z H E C
E _ E _ A 4 _ D
O S Q L _ S 1 ,Y O S Q L _ S 3 0 0 _ # # _ S E C B _ 3 , w h ere
H A in y _ D # #
4 0 0 _ O P - o u r B _ 1 , i s y o u r g r o u p
H i n t : A l t e r n a t i v e l y , y o u m a y u s e y o u r o w n s o l u t i o n s f r o m t h r e e e x e r c i s e s a s t e m p l a t e s f o r t h i s e x e r c i s e .
1 .
C r e a te c o p ie s o f t h e r e p o rts . P l a c e th e m a s s i g n t h e m t o y o u r w o r k b e n c h t a s k . a )
2 .
t h e p r e v i o u s
i n y o u r p a c k a g e Z H A 4 0 0 _ 0 0 a n d
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
A c t i v a t e t h e p r o g r a m s . a )
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
T a s k 2 : A n a l y z e L o o k f o r a s e c o n d a r y d a t a b a s e c o n n e c t i o n t h a t p o i n t s t o t h e S A P H A N A s e r v e r . F i n d o u t w h i c h t a b l e s c a n b e a c c e s s e d v i a t h i s c o n n e c t i o n u s i n g o p e n S Q L . 1 .
2 .
3 .
L o o k u p t h e s e c o n d a r y d a t a b a s e c o n n e c t i o n s w h i c h h a v e b e e n m a i n t a i n e d i n y o u r A S A B A P . a )
S t a r t t r a n s a c t i o n S M 3 0 .
b )
E n t e r D B C O N a s t a b l e n a m e a n d c h o o s e D i s p l a y .
F i n d a d a ta b a s e c o n n e c tio n th a t p o in ts to y o u r S A P H A N A d o w n u s e r a n d c o n n e c t i o n I D .
s e r v e r a n d n o te
a )
O n t h e l i s t , l o o k f o r a c o n n e c t i o n w i t h H D B i n c o l u m n D B S .
b )
M a k e s u r e t h e s e r v e r i n c o l u m n c o n n e c t i o n i n f o r m a t i o n i s r i g h t .
T h e c o n n e c tio n ID i s S F L I G H T
is S F L I G H T a n d th e u se r f o r th e S A P H A N A
s e r v e r
A n s w e r : S F L I G H T , S F L I G H T
C o n t i n u e d o n n e x t p a g e
6 2
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : T a b le s in
4 .
5 .
H A N A
S tu d io
G o t o S A P H A N A S t u d i o a n d o p e n t h e s c h e m a o f t h e s a m e n a m e a s t h e u s e r i n t h e d a t a b a s e c o n n e c t i o n . a )
In S A P H A N A
b )
In th e N a v ig a tio n w in d o w
S t u d i o , o p e n p e r s p e c t i v e M o d e l e r . o n t h e l e f t , o p e n C a t a l o g - > S F L I G H T .
L o o k f o r t h e t a b l e s y o u n d i n t h i s s c h e m a . T h o s e a r e t h e o n e s y o u c a n a c c e s s v i a t h e s e c o n d a r y d a t a b a s e c o n n e c t i o n u s i n g o p e n S Q L . a )
6 .
S A P
U n d e r s c h e m a S F L I G H T , o p e n n o d e t a b l e s .
T h e t a b le s a r e : A n s w e r : M A R A , S B O O K , S A R R , S C U S T O M , S F L I G H T , S P F L I , T C U R F , T C U R R , T C U R V , T C U R X
7 .
V e rif y f o r a t le a s t o n e ta b le th a t th e d e n i tio n o n S A P H A N A t h e d e n i t i o n o n t h e p r i m a r y d a t a b a s e .
i s i d e n t i c a l t o
a )
D o u b l e c l i c k o n o n e o f t h e t a b l e s t o s e e t h e l i s t o f e l d s , t h e i r S Q L d a t a t y p e s a n d d i m e n s i o n s .
b )
O n t h e A S A B A P , o p e n t h e d e n i t i o n o f t h i s t a b l e i n t h e A B A P D i c t i o n a r y ( t r a n s a c t i o n S E 1 1 o r S E 8 0 ) .
c )
F r o m t h e m e n u c h o o s e U t i l i t i e s - > D a t a b a s e O b j e c t - > D i s p l a y t o s e e t h e d e n i t i o n o f t h i s t a b l e o n t h e p r i m a r y d a t a b a s e .
T a s k 3 : A c c e s s S A P
H A N A
C h a n g e y o u r t h r e e p r o g r a m s . I n a l l s e l e c t s t a t e m e n t s ( s u b r o u t i n e s g e t _ d a t a _ s o l u t i o n a n d s u b r o u t i n e g e t _ d a t a _ t e m p l a t e ) r e a d f r o m S A P H A N A r a t h e r t h a n t h e p r i m a r d a t a b a s e . 1 .
E d i t y o u r p r o g r a m Z H A 4 0 0 _ # # _ S E C _ D B _ 1 . S e a r c h f o r a l l S E L E C T - s t a t m e n t s a n d u s e a d d i t i o n C O N N E C T I O N t o a c c e s s t h e s e c o n d a r y d a t a b a s e r a t h e r t h a n t h e p r i m a r y d a t a b a s e . H i n t : I n s t e a d o f h a r d c o d i n g t h e c o n n e c t i o n i t i s r e c o m m e n d e d t o d e n e a g l o b a l c o n s t a n t o f t y p e s t r i n g .
a ) 2 .
m o d e l s o l u t i o n .
R e p e a t w i t h p r o g r a m s Z H A 4 0 0 _ # # _ S E C _ D B _ 2 a n d Z H A 4 0 0 _ # # _ S E C _ D B _ 3 . a )
3 .
S e e s o u r c e c o d e e x tr a c t f r o m
S e e s o u r c e c o d e e x tr a c t f r o m
m o d e l s o l u t i o n .
A c t i v a t e a n d t e s t y o u r p r o g r a m s . a )
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s . C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
6 3
U n it 2 : T a k in g A B A P
to H A N A
H A 4 0 0
T a s k 4 : Q u a n t i f y i m p r o v e m e n t s w h e n u s in g S A P H A N A a s d a t a b a s e P e r f o r m r u n t i m e m e a s u r e m e n t s w i t h A B A P T r a c e ( S A T ) f o r a ll t h r e e p r o g r a m s . I n e a c h c a s e , c o m p a r e t h e r u n t i m e c o n s u m p t i o n o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e a n d s u b r o u t i n e g e t _ d a t a _ s o l u t i o n 1 .
P e r f o r m a r u n t i m e m e a s u r e m e n t w i t h A B A P T r a c e ( S A T ) f o r p r o g r a m Z H A 4 0 0 _ # # _ S E C _ D B _ 1 a n d c o m p a r e t h e g r o s s r u n ti m e o f t h e t w o s u b r o u t i n e s . a )
2 .
P e rfo rm
t h i s s t e p a s b e f o r e .
T h e g ro s s ru n tim m ic ro s e c o n d s . _ _ _ _ _ _ _ _ _ _ _ m % th ro u g h th e u
e o f s u T h e g ro ic ro s e c s a g e o f
b ro u s s ru o n d s e ld
t i n e g e t _ d a t a _ t e m p l a t e i s : _ _ _ _ _ _ _ _ _ _ _ n t i m e o f s u b r o u t i n e g e t _ d a t a _ s o l u t i o n i s : . T h i s i s a r e d u c t i o n o f t h e r u n t i m e b y _ _ _ _ _ _ l i s t s
A n s w e r :
3 .
P e r f o r m a r u n t i m e m e a s u r e m e n t w i t h A B A P T r a c e ( S A T ) f o r p r o g r a m Z H A 4 0 0 _ # # _ S E C _ D B _ 2 a n d c o m p a r e t h e g r o s s r u n ti m e o f t h e t w o s u b r o u t i n e s . a )
4 .
P e rfo rm
T h e g ro s m ic ro s e _ _ _ _ _ _ _ % th ro u g
t h i s s t e p a s b e f o r e .
s ru n tim c o n d s . _ _ _ _ m h th e u
e o T h e ic ro s a g e
f s u g ro se c o f
b r o u t i n e g s s ru n tim e o n d s . T h is a jo in in s te
e t_ o f is a d
d a ta _ te m s u b r o u tin a re d u c tio o f n e s te d
p l a t e i s : _ _ _ _ _ _ _ _ _ _ _ e g e t _ d a t a _ s o l u t i o n i s : n o f t h e r u n t i m e b y _ _ _ _ _ _ s e l e c t s .
A n s w e r :
5 .
P e r f o r m a r u n t i m e m e a s u r e m e n t w i t h A B A P T r a c e ( S A T ) f o r p r o g r a m Z H A 4 0 0 _ # # _ S E C _ D B _ 3 a n d c o m p a r e t h e g r o s s r u n ti m e o f t h e t w o s u b r o u t i n e s . a )
6 .
P e rfo rm
T h e g ro m ic ro s _ _ _ _ _ _ % th r o u
t h i s s t e p a s b e f o r e .
s s ru n tim e o e c o n d s . T h e _ _ _ _ _ m ic ro g h th e u s a g e
f s u g ro se c o f
b r o u t i n e g e t _ s s ru n tim e o f o n d s . T h is is fu ll b u ffe rin g
d a ta su b r a re d in s te
_ t e m p l a t e i s : _ _ _ _ _ _ _ _ _ _ _ o u t i n e g e t _ d a t a _ s o l u t i o n i s : u c t i o n o f t h e r u n t i m e b y _ _ _ _ _ _ a d o f n e s t e d s e l e c t s .
A n s w e r :
C o n t i n u e d o n n e x t p a g e
6 4
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : T a b le s in
S A P
H A N A
S tu d io
R e s u l t
S o u r c e c o d e e x t r a c t f r o m m o d e l s o l u t i o n ( P r o g r a m Y H A 4 0 0 _ S E C _ D B _ C O N _ S 1 ) R E P O R T
y h a 4 0 0 _ s e c _ d b _ c o n _ s 1 .
. . . *
D a t a b a s e
C O N S T A N T S
c o n n e c t i o n c _ c o n
T Y P E
s t r i n g
V A L U E
' S F L I G H T ' .
. . . * & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * &
F o r m
g e t _ d a t a _ t e m p l a t e
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * F O R M *
g e t _ d a t a _ t e m p l a t e
C H A N G I N G
c t _ c u s t o m e r s
T Y P E
t y _ t _ c u s t o m e r s .
D e c l a r a t i o n s
* * * * * * * * * * * * * * * * *
*
W o r k
A r e a
D A T A
l s _ c u s t o m e r
T a r g e t s D A T A :
*
*
f o r
f o r
R e s u l t L I K E
L I N E
O F
c t _ c u s t o m e r s .
S e l e c t
l s _ s c u s t o m
T Y P E
s c u s t o m ,
l s _ s b o o k
T Y P E
s b o o k .
h e l p
v a r i a b l e s
D A T A
l v _ c o u n t
T Y P E
i .
P r o c e s s i n g
* * * * * * * * * * * * * * * * * C L E A R
c t _ c u s t o m e r s .
S E L E C T
*
F R O M
C O N N E C T I O N I N T O
s c u s t o m ( c _ c o n )
l s _ s c u s t o m .
l s _ c u s t o m e r - i d
=
l s _ c u s t o m e r - n a m e
=
l s _ s c u s t o m - i d . l s _ s c u s t o m - n a m e .
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
6 5
U n it 2 : T a k in g A B A P
to H A N A
H A 4 0 0
l s _ c u s t o m e r - p o s t c o d e
=
l s _ c u s t o m e r - c i t y
l s _ s c u s t o m - p o s t c o d e . =
l s _ c u s t o m e r - c o u n t r y
l s _ s c u s t o m - c i t y .
=
l s _ s c u s t o m - c o u n t r y .
C L E A R
l s _ c u s t o m e r - d a y s _ a h e a d .
C L E A R
l v _ c o u n t .
S E L E C T
*
F R O M
C O N N E C T I O N I N T O
s b o o k ( c _ c o n )
l s _ s b o o k W H E R E
c u s t o m i d
A N D
=
l s _ s c u s t o m - i d
c a n c e l l e d
=
s p a c e .
l s _ c u s t o m e r - d a y s _ a h e a d l v _ c o u n t
=
l v _ c o u n t
+
=
l s _ c u s t o m e r - d a y s _ a h e a d
+
(
l s _ s b o o k - f l d a t e
l s _ c u s t o m e r - d a y s _ a h e a d
/
l v _ c o u n t .
-
l s _ s b o o k - o r d e r _ d a t
1 .
E N D S E L E C T . I F
l v _ c o u n t
< >
0 .
l s _ c u s t o m e r - d a y s _ a h e a d I N S E R T
l s _ c u s t o m e r
=
I N T O
T A B L E
c t _ c u s t o m e r s .
E N D I F . E N D S E L E C T . S O R T
c t _ c u s t o m e r s
B Y
i d .
E N D F O R M .
"
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * &
F o r m
g e t _ d a t a _ s o l u t i o n
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * F O R M *
g e t _ d a t a _ s o l u t i o n
C H A N G I N G
c t _ c u s t o m e r s
T Y P E
t y _ t _ c u s t o m e r s .
D e c l a r a t i o n s
* * * * * * * * * * * * * * * * *
T y p e s T Y P E S :
f o r
t a r g e t
B E G I N
E N D
O F
f i e l d s l t y _ s _ c u s t ,
i d
T Y P E
s c u s t o m - i d ,
n a m e
T Y P E
s c u s t o m - n a m e ,
p o s t c o d e
T Y P E
s c u s t o m - p o s t c o d e ,
c i t y
T Y P E
s c u s t o m - c i t y ,
c o u n t r y
T Y P E
s c u s t o m - c o u n t r y ,
O F
l t y _ s _ c u s t .
C o n t i n u e d o n n e x t p a g e
6 6
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : T a b le s in
T Y P E S :
B E G I N
O F
o r d e r _ d a t e
*
*
A r e a
D A T A
l s _ c u s t o m e r
T a r g e t s
*
f o r
f o r
S tu d io
T Y P E
s b o o k - f l d a t e ,
T Y P E
s b o o k - o r d e r _ d a t e ,
l t y _ s _ b o o k .
W o r k
D A T A :
*
O F
H A N A
l t y _ s _ b o o k ,
f l d a t e E N D
S A P
R e s u l t L I K E
L I N E
O F
c t _ c u s t o m e r s .
S e l e c t
l s _ s c u s t o m
T Y P E
l t y _ s _ c u s t ,
l s _ s b o o k
T Y P E
l t y _ s _ b o o k .
h e l p
v a r i a b l e s
D A T A
l v _ c o u n t
T Y P E
i .
P r o c e s s i n g
* * * * * * * * * * * * * * * * * C L E A R
c t _ c u s t o m e r s .
S E L E C T
i d
F R O M
n a m e
p o s t c o d e
c i t y
c o u n t r y
s c u s t o m
C O N N E C T I O N I N T O
( c _ c o n )
l s _ s c u s t o m .
l s _ c u s t o m e r - i d
=
l s _ c u s t o m e r - n a m e
l s _ s c u s t o m - i d .
=
l s _ c u s t o m e r - p o s t c o d e
=
l s _ c u s t o m e r - c i t y
l s _ s c u s t o m - n a m e . l s _ s c u s t o m - p o s t c o d e .
=
l s _ c u s t o m e r - c o u n t r y
=
l s _ s c u s t o m - c i t y . l s _ s c u s t o m - c o u n t r y .
C L E A R
l s _ c u s t o m e r - d a y s _ a h e a d .
C L E A R
l v _ c o u n t .
S E L E C T F R O M
f l d a t e s b o o k
C O N N E C T I O N I N T O W H E R E A N D
o r d e r _ d a t e ( c _ c o n )
l s _ s b o o k c u s t o m i d
=
c a n c e l l e d
l s _ s c u s t o m - i d =
s p a c e .
l s _ c u s t o m e r - d a y s _ a h e a d
=
l s _ c u s t o m e r - d a y s _ a h e a d
+
(
l s _ s b o o k - f l d a t e
-
l s _ s b o o k - o r d e r
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
6 7
U n it 2 : T a k in g A B A P
to H A N A
H A 4 0 0
l v _ c o u n t
=
l v _ c o u n t
+
1 .
E N D S E L E C T . I F
l v _ c o u n t
< >
0 .
l s _ c u s t o m e r - d a y s _ a h e a d I N S E R T
l s _ c u s t o m e r
I N T O
=
l s _ c u s t o m e r - d a y s _ a h e a d T A B L E
/
l v _ c o u n t .
c t _ c u s t o m e r s .
E N D I F . E N D S E L E C T . S O R T
c t _ c u s t o m e r s
B Y
E N D F O R M .
6 8
i d .
"
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : T a b le s in
S A P
H A N A
S tu d io
L e s s o n S u m m a r y Y o u s h o u l d n o w b e a b l e t o :
2 0 1 3
•
U n d e rs ta n d S c h e m a ta a n d T a b le s in S A P H A N A
S t u d i o
•
A n a ly z e th e D e n itio n o f T a b le s in S A P H A N A
S t u d i o
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
6 9
U n it 2 : T a k in g A B A P
L e s s o n :
to H A N A
H A 4 0 0
P e r f o r m a n c e R u l e s a n d G u i d e li n e s f o r S A P H A N A L e s s o n
O v e r v i e w
L e s s o n O b j e c t i v e s A f t e r c o m p l e t i n g t h i s l e s s o n , y o u w i l l b e a b l e t o : •
U n d e r s t a n d t h e p e r f o r m a n c e r u l e s a n d g u i d e l i n e s f o r H A N A
B u s i n e s s E x a m p l e
7 0
F ig u r e 3 0 : C o n c lu s io n
I
F ig u r e 3 1 : C o n c lu s io n
I I
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : P e r fo r m a n c e R u le s a n d G u id e lin e s fo r S A P H A N A
F ig u r e 3 2 : C o n c lu s io n
2 0 1 3
©
I I I
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
7 1
U n it 2 : T a k in g A B A P
to H A N A
H A 4 0 0
L e s s o n S u m m a r y Y o u s h o u l d n o w b e a b l e t o : •
7 2
U n d e r s t a n d t h e p e r f o r m a n c e r u l e s a n d g u i d e l i n e s f o r H A N A
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
U n it S u m m a r y
U n it S u m m a r y Y o u s h o u l d n o w b e a b l e t o :
2 0 1 3
•
U n d e r s t a n d t h e R u n t i m e A n a l y s i s ( S E 3 0 )
•
U n d e r s t a n d t h e A B A P T r a c e ( S A T )
•
U n d e r s t a n d t h e C o d e I n s p e c t o r ( S C I )
•
U n d e r s t a n d t h e S Q L T r a c e ( S T 0 5 )
•
D e s c rib e h o w to a c c e s s th e S A P H A N A s e c o n d a r y d a t a b a s e c o n n e c t i o n
•
U n d e rs ta n d S c h e m a ta a n d T a b le s in S A P H A N A
S t u d i o
•
A n a ly z e th e D e n itio n o f T a b le s in S A P H A N A
S t u d i o
•
U n d e r s t a n d t h e p e r f o r m a n c e r u l e s a n d g u i d e l i n e s f o r H A N A
©
2 0 1 3 S A P
D a t a b a s e b y u s i n g O p e n S Q L a n d a
A G . A ll r ig h ts r e s e r v e d .
7 3
U n it S u m m a r y
7 4
H A 4 0 0
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
U n i t 3 Im p le m e n tin g A B A P
R e p o r t o n H A N A U s in g A D B C
U n i t O v e r v i e w T h i s U n i t i s d e s i g n e d t o t e a c h t h e f o l l o w i n g t o p i c s : •
W h y a r e w e u s in g n a tiv e S Q L ?
•
A B A P D a t a b a s e C o n n e c t i v i t y ( A D B C )
•
N a tiv e S Q L S y n ta x
U n i t O b j e c t i v e s A f t e r c o m p l e t i n g t h i s u n i t , y o u w i l l b e a b l e t o : •
D e s c r i b e t h e u s e o f n a t i v e S Q L i n t h e c o n te x t o f S A P H A N A
•
U n d e r s t a n d A B A P D a t a b a s e C o n n e c t i v it y ( A D B C )
•
U s e A D B C t o e x e c u t e n a t i v e S Q L s t a t e m e n ts
•
U n d e r s t a n d t h e m a i n d i f f e r e n c e b e t w e e n n a t i v e S Q L S y n t a x a n d O p e n S Q L S y n t a x
•
W r i t e s y n t a c t i c a l l y c o r r e c t N a t i v e S Q L S t a t e m e n t s
U n i t C o n t e n t s L e s s o n : W h y a r e w e u s in g n a tiv e S Q L ? . . . . . . L e s s o n : A B A P D a t a b a s e C o n n e c t iv it y ( A D B C L e s s o n : N a tiv e S Q L S y n ta x . . . . . . . . . . . . . . . . . . . . E x e r c is e 6 : U s e A B A P D a t a b a s e C o n n e c S Q L S E L E C T s ta te m e n t. . .. . .. .. . .. . .. .. . .. E x e r c is e 7 : I s s u e a n a t iv e S Q L J o in v ia A (A D B C )........................................ E x e r c is e 8 : M a k e u s e o f n a t i v e S Q L t o a fu n c tio n s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 0 1 3
©
2 0 1 3 S A P
................... ) ................. . .. .. .. .. .. .. .. .. .. t iv it y ( A D B C ) t o ... ... .. ... ... .. ... B A P D a ta b a s e ................... c c e s s d a ta b a s e ...................
A G . A ll r ig h ts r e s e r v e d .
..... ..... .. .. . is s u ... .. C o n ..... s p e .....
. . . . . . . . 7 6 . . . . . . . . 7 9 . . . . . . . . 8 3 e a n a t i v e . . . . . . . . 8 5 n e c t iv it y . . . . . . . . 9 1 c i c . . . . . . . 1 0 1
7 5
U n it 3 : Im p le m e n tin g A B A P
L e s s o n :
R e p o r t o n H A N A
U s in g A D B C
H A 4 0 0
W h y a r e w e u s in g n a t iv e S Q L ? L e s s o n
O v e r v i e w
L e s s o n O b j e c t i v e s A f t e r c o m p l e t i n g t h i s l e s s o n , y o u w i l l b e a b l e t o : •
D e s c r i b e t h e u s e o f n a t i v e S Q L i n t h e c o n t e x t o f S A P H A N A
B u s i n e s s E x a m p l e
F ig u r e 3 3 : R e m in d e r : S Q L In A
N u t s h e ll
F ig u r e 3 4 : O p e n S Q L in A B A P
7 6
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : W h y a r e w e u s in g
n a tiv e S Q L ?
F i g u r e 3 5 : E x a m p l e : T r a n s la t i o n o f O p e n S Q L t o N a t i v e S Q L
F ig u r e 3 6 : R e s tr ic tio n s o f O p e n
2 0 1 3
©
2 0 1 3 S A P
S Q L
A G . A ll r ig h ts r e s e r v e d .
7 7
U n it 3 : Im p le m e n tin g A B A P
R e p o r t o n H A N A
U s in g A D B C
H A 4 0 0
L e s s o n S u m m a r y Y o u s h o u l d n o w b e a b l e t o : •
7 8
D e s c r i b e t h e u s e o f n a t i v e S Q L i n t h e c o n t e x t o f S A P H A N A
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : A B A P
L e s s o n :
D a ta b a s e C o n n e c tiv ity (A D B C )
A B A P
D a t a b a s e C o n n e c t i v i t y ( A D B C )
L e s s o n
O v e r v i e w
L e s s o n O b j e c t i v e s A f t e r c o m p l e t i n g t h i s l e s s o n , y o u w i l l b e a b l e t o : •
U n d e r s t a n d A B A P D a t a b a s e C o n n e c t i v it y ( A D B C )
•
U s e A D B C t o e x e c u t e n a t i v e S Q L s t a t e m e n ts
B u s i n e s s E x a m p l e
F i g u r e 3 7 : B a s i c F e a t u r e s o f A D B C
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
7 9
U n it 3 : Im p le m e n tin g A B A P
R e p o r t o n H A N A
U s in g A D B C
H A 4 0 0
F i g u r e 3 8 : S e q u e n c e f o r R e a d i n g D a t a w i t h A D B C
F ig u r e 3 9 : C o d in g E x a m p le : A B A P
8 0
©
2 0 1 3 S A P
D a t a b a s e C o n n e c t i v it y ( A D B C )
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : A B A P
D a ta b a s e C o n n e c tiv ity (A D B C )
F i g u r e 4 0 : A D B C : I m p o r t a n t T h i n g s t o K e e p i n M i n d
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
8 1
U n it 3 : Im p le m e n tin g A B A P
R e p o r t o n H A N A
U s in g A D B C
H A 4 0 0
L e s s o n S u m m a r y Y o u s h o u l d n o w b e a b l e t o :
8 2
•
U n d e r s t a n d A B A P D a t a b a s e C o n n e c t i v it y ( A D B C )
•
U s e A D B C t o e x e c u te n a t i v e S Q L s t a t e m e n t s
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n :
L e s s o n :
N a tiv e
S Q L
S y n ta x
N a t i v e S Q L S y n t a x L e s s o n
O v e r v i e w
L e s s o n O b j e c t i v e s A f t e r c o m p l e t i n g t h i s l e s s o n , y o u w i l l b e a b l e t o : •
U n d e r s t a n d t h e m a i n d i f f e r e n c e b e t w e e n n a t i v e S Q L S y n t a x a n d O p e n S Q L S y n t a x
•
W r i t e s y n t a c t i c a l l y c o r r e c t N a t i v e S Q L S t a t e m e n t s
B u s i n e s s E x a m p l e
F i g u r e 4 1 : N a t i v e S Q L i n A B A P
F ig u r e 4 2 : N a t iv e S Q L S y n ta x →
2 0 1 3
©
2 0 1 3 S A P
O p e n S Q L S y n ta x
A G . A ll r ig h ts r e s e r v e d .
8 3
U n it 3 : Im p le m e n tin g A B A P
R e p o r t o n H A N A
U s in g A D B C
H A 4 0 0
F ig u r e 4 3 : E x a m p le 1 : O p e n S Q L S y n t a x a n d N a tiv e S Q L S y n t a x
F ig u r e 4 4 : E x a m p le 2 : J o in s in O p e n S Q L a n d N a tiv e S Q L
8 4
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n :
N a tiv e
S Q L
S y n ta x
E x e r c is e 6 : U s e A B A P D a t a b a s e C o n n e c t i v i t y ( A D B C ) t o i s s u e a n a t i v e S Q L S E L E C T s t a t e m e n t E x e r c i s e O b j e c t i v e s A f t e r c o m p l e t i n g t h i s e x e r c i s e , y o u w i l l b e a b l e t o : •
u s e A B A P D a ta b a s e C o n n e c tiv ity ( A D B C ) t o r e a d d a ta f r o m
a D a t a b a s e
•
u n d e r s t a n d t h e m a i n d i f f e r e n c e s b e t w e e n t h e s y n t a x o f n a t i v e S Q L a n d o p e n S Q L
B u s i n e s s E x a m p l e T e m p l a t e :
R e p o r t Y H A 4 0 0 _ A D B C _ T 1 S o l u t i o n :
R e p o r t Y H A 4 0 0 _ A D B C _ S 1
T a s k 1 : C o p y a n d u n d e r s t a n d t e m p l a t e C r e a t e a c o p y o f r e p o r t Y H A 4 0 0 _ A D B C _ T 1 i n y o u r p a c k a g e Z H A 4 0 0 _ # # ( s u g g e s t e d n a m e : Z H A 4 0 0 _ # # _ A D B C _ 1 , w h e r e # # i s y o u r g r o u p n u m b e r ) . A c t i v a t e a n d e x e c u t e t h e p r o g r a m . 1 .
C r e a t e a c o p y o f t h e r e p o r t . P l a c e i t i n y o u r p a c k a g e Z H A 4 0 0 _ 0 0 a n d a s s i g n i t t o y o u r w o r k b e n c h t a s k .
2 .
A c t i v a t e a n d e x e c u t e t h e p r o g r a m .
T a s k 2 : U s e A D B C E s S A
d it y o u b ro u Q L S D B C
u r tin E L . M
p ro g ra e g e t _ d E C T o a k e su
m . C o p y a ta _ s o lu n S C U S T re y o u re
to a c c e s s S A P H A N A th tio O a d
e so u rc e c o d e o f su n . I n s u b r o u t i n e g e M w ith a n a tiv e S Q e x a c tly th e s a m e d
v ia n a t iv e S Q L
b r o u t i n e g e t _ d a t a _ t e m p l a t e t o t _ d a t a _ s o l u t i o n , r e p l a c e t h e o p e n L S E L E C T i s s u e d b y m e a n s o f a t a .
1 .
C o p y t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e t o s u b r o u t i n e g e t _ d a t a _ s o l u t i o n
2 .
I n s u b r o u t i n e g e t _ d a t a _ s o l u t i o n , c r e a t e a n i n s t a n c e o f c l a s s C L _ S Q L _ C O N N E C T I O N . H i n t : U s e p u b l i c s t a t i c m e t h o d g e t _ c o n n e c t i o n o f t h a t c l a s s .
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
8 5
U n it 3 : Im p le m e n tin g A B A P
R e p o r t o n H A N A
U s in g A D B C
H A 4 0 0
3 .
C r e a t e a n i n s t a n c e o f c la s s C L _ S Q L _ S T A T E M E N T , h a n d i n g o v e r t h e i n s t a n c e o f C L _ S Q L _ C O N N E C T I O N t o t h e c o n s t r u c t o r
4 .
D e n e n a tiv e th e te m s tr in g -
a s tr in g v a r ia b le ( s u g g e s te d S Q L s y n ta x th a t c o rre sp o n d s p la te . U s e e ith e r a c la s s ic a l te m p la te /- e x p r e s s io n a p p r o a c
n a m e : l v _ s q l ) a n d l l i t w i t h t h e t o t h e o p e n S Q L s t a t e m e n t f o u n d i n C O N C A T E N A T E o r a m o r e m o d e r n h .
C a u t i o n : M a k e s u r e t o u s e “ , ” a s s e p a r a t o r i n t h e e l d l i s t a n d t h e O R D E R B Y - a d d it i o n a n d d o n ’ t f o r g e t t o a d d a W H E R E - c l a u s e f o r t h e c l i e n t .
5 .
C r e a t e a n i n s t a n c e o f C L _ S Q L _ R E S U L T _ S E T b y e x e c u t i n g t h e q u e r y . H i n t : U s e p u b l i c i n s t a n c e m e t h o d e x e c u t e _ q u e r y o f c l a s s C L _ S Q L _ S T A T E M E N T .
6 .
D e n e a r e f e r e n c e v a r i a b l e o f t y p e R E F T O D A T A , l e t i t p o i n t t o t h e t a r g e t d a t a o b j e c t a n d h a n d t h i s r e f e r e n c e o v e r t o t h e i n s t a n c e o f C L _ S Q L _ R E S U L T _ S E T . H i n t : U s e m e t h o d s e t _ p a r a m _ t a b l e o f c l a s s C L _ S Q L _ R E - S U L T _ S E T .
7 .
R e t r i e v e t h e r e s u l t a n d c l o s e t h e q u e r y . H i n t : U s e m e t h o d s n e x t _ p a c k a g e a n d c l o s e o f c l a s s C L _ S Q L _ R E S U L T _ S E T .
8 6
8 .
I m p l e m e n t a n e x c e p t i o n h a n d l i n g f o r a l l c l a s s b a s e d e x c e p t i o n s t h a t m i g h t b e r a i s e d b y t h e c a l l e d A D B C - m e t h o d s .
9 .
A c t i v a t e a n d t e s t y o u r p r o g r a m . M a k e s u r e t h e t w o s u b r o u t i n e s d e l i v e r e x a c t l y t h e s a m e d a t a .
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n :
N a tiv e
S Q L
S y n ta x
S o lu t io n 6 : U s e A B A P D a t a b a s e C o n n e c t i v i t y ( A D B C ) t o i s s u e a n a t i v e S Q L S E L E C T s t a t e m e n t T a s k 1 : C o p y a n d u n d e r s t a n d t e m p l a t e C r e a t e a c o p y o f r e p o r t Y H A 4 0 0 _ A D B C _ T 1 i n y o u r p a c k a g e Z H A 4 0 0 _ # # ( s u g g e s t e d n a m e : Z H A 4 0 0 _ # # _ A D B C _ 1 , w h e r e # # i s y o u r g r o u p n u m b e r ) . A c t i v a t e a n d e x e c u t e t h e p r o g r a m . 1 .
C r e a t e a c o p y o f t h e r e p o r t . P l a c e i t i n y o u r p a c k a g e Z H A 4 0 0 _ 0 0 a n d a s s i g n i t t o y o u r w o r k b e n c h t a s k . a )
2 .
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
A c t i v a t e a n d e x e c u t e t h e p r o g r a m . a )
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
T a s k 2 : U s e A D B C E s S A
d it y o u b ro u Q L S D B C
1 .
u r tin E L . M
m . C o p y a ta _ s o lu n S C U S T re y o u re
th tio O a d
e so u rc e c o d e o f su n . I n s u b r o u t i n e g e M w ith a n a tiv e S Q e x a c tly th e s a m e d
v ia n a t iv e S Q L
b r o u t i n e g e t _ d a t a _ t e m p l a t e t o t _ d a t a _ s o l u t i o n , r e p l a c e t h e o p e n L S E L E C T i s s u e d b y m e a n s o f a t a .
C o p y t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e t o s u b r o u t i n e g e t _ d a t a _ s o l u t i o n a )
2 .
p ro g ra e g e t _ d E C T o a k e su
to a c c e s s S A P H A N A
U s e C o p y &
P a s t e - f u n c t i o n o f t h e A B A P E d i t o r .
I n s u b r o u t i n e g e t _ d a t a _ s o l u t i o n , c r e a t e a n i n s t a n c e o f c l a s s C L _ S Q L _ C O N N E C T I O N . H i n t : U s e p u b l i c s t a t i c m e t h o d g e t _ c o n n e c t i o n o f t h a t c l a s s .
a ) 3 .
m o d e l s o l u t i o n .
C r e a t e a n i n s t a n c e o f c la s s C L _ S Q L _ S T A T E M E N T , h a n d i n g o v e r t h e i n s t a n c e o f C L _ S Q L _ C O N N E C T I O N t o t h e c o n s t r u c t o r a )
4 .
S e e s o u r c e c o d e e x tr a c t f r o m
S e e s o u r c e c o d e e x tr a c t f r o m
D e n e n a tiv e th e te m s tr in g -
a s trin S Q L s p la te . te m p la
g v a ria b le (s u g g e s te d y n ta x th a t c o rre sp o n d s U s e e ith e r a c la s s ic a l te / - e x p r e s s io n a p p r o a c
m o d e l s o l u t i o n . n a m e : l v _ s q l ) a n d l l i t w i t h t h e t o t h e o p e n S Q L s t a t e m e n t f o u n d i n C O N C A T E N A T E o r a m o r e m o d e r n h .
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
8 7
U n it 3 : Im p le m e n tin g A B A P
R e p o r t o n H A N A
U s in g A D B C
H A 4 0 0
C a u t i o n : M a k e s u r e t o u s e “ , ” a s s e p a r a t o r i n t h e e l d l i s t a n d t h e O R D E R B Y - a d d it i o n a n d d o n ’ t f o r g e t t o a d d a W H E R E - c l a u s e f o r t h e c l i e n t .
a ) 5 .
S e e s o u rc e c o d e e x tra c t f ro m
m o d e l s o l u t i o n .
C r e a t e a n i n s t a n c e o f C L _ S Q L _ R E S U L T _ S E T b y e x e c u t i n g t h e q u e r y . H i n t : U s e p u b l i c i n s t a n c e m e t h o d e x e c u t e _ q u e r y o f c l a s s C L _ S Q L _ S T A T E M E N T .
a ) 6 .
S e e s o u rc e c o d e e x tra c t f ro m
m o d e l s o l u t i o n .
D e n e a r e f e r e n c e v a r i a b l e o f t y p e R E F T O D A T A , l e t i t p o i n t t o t h e t a r g e t d a t a o b j e c t a n d h a n d t h i s r e f e r e n c e o v e r t o t h e i n s t a n c e o f C L _ S Q L _ R E S U L T _ S E T . H i n t : U s e m e t h o d s e t _ p a r a m _ t a b l e o f c l a s s C L _ S Q L _ R E - S U L T _ S E T .
a ) 7 .
S e e s o u rc e c o d e e x tra c t f ro m
m o d e l s o l u t i o n .
R e t r i e v e t h e r e s u l t a n d c l o s e t h e q u e r y . H i n t : U s e m e t h o d s n e x t _ p a c k a g e a n d c l o s e o f c l a s s C L _ S Q L _ R E S U L T _ S E T .
a ) 8 .
m o d e l s o l u t i o n .
I m p l e m e n t a n e x c e p t i o n h a n d l i n g f o r a l l c l a s s b a s e d e x c e p t i o n s t h a t m i g h t b e r a i s e d b y t h e c a l l e d A D B C - m e t h o d s . a )
9 .
S e e s o u rc e c o d e e x tra c t f ro m
S e e s o u rc e c o d e e x tra c t f ro m
m o d e l s o l u t i o n .
A c t i v a t e a n d t e s t y o u r p r o g r a m . M a k e s u r e t h e t w o s u b r o u t i n e s d e l i v e r e x a c t l y t h e s a m e d a t a . a )
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
R e s u l t
S o u r c e c o d e e x t r a c t f r o m m o d e l ( P r o g r a m Y H A 4 0 0 _ A D B C _ S 1 )
s o l u t i o n
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
C o n t i n u e d o n n e x t p a g e
8 8
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n :
* &
F o r m
N a tiv e
S Q L
S y n ta x
g e t _ d a t a _ t e m p l a t e
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * F O R M
g e t _ d a t a _ t e m p l a t e
C L E A R
C H A N G I N G
c t _ c u s t o m e r s
T Y P E
t y _ t _ c u s t o m e r s .
c t _ c u s t o m e r s .
S E L E C T
i d
n a m e
p o s t c o d e
c i t y
F R O M
s c u s t o m
c o u n t r y
C O N N E C T I O N
( c _ c o n )
I N T O
c t _ c u s t o m e r s
T A B L E
O R D E R
B Y
i d .
E N D F O R M .
"
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * &
F o r m
g e t _ d a t a _ s o l u t i o n
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * F O R M
*
g e t _ d a t a _ s o l u t i o n
C H A N G I N G
c t _ c u s t o m e r s
T Y P E
t y _ t _ c u s t o m e r s .
D e c l a r a t i o n s
* * * * * * * * * * * * * * * * *
A D B C D A T A :
*
O b j e c t s
a n d
l o _ c o n
T Y P E
R E F
T O
c l _ s q l _ c o n n e c t i o n ,
l o _ s q l
T Y P E
R E F
T O
c l _ s q l _ s t a t e m e n t ,
l o _ r e s u l t
T Y P E
R E F
T O
c l _ s q l _ r e s u l t _ s e t ,
l v _ s q l
T Y P E
s t r i n g ,
l r _ d a t a
T Y P E
R E F
E x c e p t i o n D A T A :
T O
d a t a .
H a n d l i n g l x _ s q l _ e x c l v _ t e x t
*
V a r i a b l e s
T Y P E
T Y P E
R E F
T O
c x _ s q l _ e x c e p t i o n ,
s t r i n g .
P r o c e s s i n g
* * * * * * * * * * * * * * * * * * * * * * * * * * * * C L E A R *
c t _ c u s t o m e r s .
S E L E C T
i d
n a m e
p o s t c o d e
c i t y
*
F R O M
s c u s t o m
*
C O N N E C T I O N
c o u n t r y
s f l i g h t
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
8 9
U n it 3 : Im p le m e n tin g A B A P
*
R e p o r t o n H A N A
I N T O
T A B L E
U s in g A D B C
H A 4 0 0
c t _ c u s t o m e r s .
T R Y . *
G e t
s e c o n d a r y l o _ c o n
*
C r e a t e
D B
=
C o n n e c t i o n
c l _ s q l _ c o n n e c t i o n = > g e t _ c o n n e c t i o n (
c _ c o n
) .
s t a t e m e n t
C R E A T E
O B J E C T
l o _ s q l
E X P O R T I N G c o n _ r e f *
c r e a t e
S Q L
=
l o _ c o n .
s t a t e m e n t
C O N C A T E N A T E
` S E L E C T
I D ,
` F R O M
N A M E ,
P O S T C O D E ,
C I T Y ,
C O U N T R Y `
S F L I G H T . S C U S T O M `
` W H E R E
M A N D T
=
`
s y - m a n d t ` O R D E R I N T O
A l t e r n a t i v e :
*
l v _ s q l
U s e =
M A N D T ,
B Y
s t r i n g
| S E L E C T
t e m p l a t e s
I D ,
N A M E ,
| F R O M
*
| W H E R E
M A N D T
*
| O R D E R
B Y
E x e c u t e
R e a d
r e s u l t G E T
S F L I G H T . S C U S T O M =
{
s t r i n g
P O S T C O D E , |
M A N D T ,
I D
e x p r e s s i o n s
C I T Y ,
C O U N T R Y
|
& &
& &
s y - m a n d t
=
}
|
& &
| .
l o _ s q l - > e x e c u t e _ q u e r y (
i n t o
R E F E R E N C E
i n t e r n a l O F
c t _ c u s t o m e r s
l o _ r e s u l t - > n e x t _ p a c k a g e ( l o _ r e s u l t - > c l o s e (
=
M E S S A G E
l v _ t e x t
) .
I N T O
l r _ d a t a .
l r _ d a t a
) .
) .
) .
c x _ s q l _ e x c e p t i o n
l v _ t e x t
l v _ s q l
T a b l e
l o _ r e s u l t - > s e t _ p a r a m _ t a b l e (
C A T C H
a n d
Q u e r y
l o _ r e s u l t *
`
s p a c e .
*
*
I D
l v _ s q l
S E P A R A T E D *
B Y
I N T O
l x _ s q l _ e x c .
l x _ s q l _ e x c - > g e t _ t e x t ( T Y P E
"
E x c e p t i o n
C l a s s
f o r
S Q L
E r r o r
) .
' E ' .
E N D T R Y . E N D F O R M .
9 0
"
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n :
N a tiv e
S Q L
S y n ta x
E x e r c is e 7 : I s s u e a n a t i v e S Q L J o i n v ia A B A P D a t a b a s e C o n n e c t i v i t y ( A D B C ) E x e r c i s e O b j e c t i v e s A f t e r c o m p l e t i n g t h i s e x e r c i s e , y o u w i l l b e a b l e t o : •
u s e A B A P D a ta b a s e C o n n e c tiv ity ( A D B C ) t o r e a d d a ta f r o m
•
u n d e r s t a n d t h e s y n t a x o f j o i n s i n n a t i v e S Q L
a d a t a b a s e
B u s i n e s s E x a m p l e T e m p l a t e :
R e p o r t Y H A 4 0 0 _ A D B C _ T 2 S o l u t i o n :
R e p o r t Y H A 4 0 0 _ A D B C _ S 2
T a s k 1 : C o p y a n d u n d e r s t a n d t e m p l a t e C r e a t e a c o p y o f r e p o r t Y H A 4 0 0 _ A D B C _ T 2 i n y o u r p a c k a g e Z H A 4 0 0 _ # # ( s u g g e s t e d n a m e : Z H A 4 0 0 _ # # _ A D B C _ 2 , w h e r e # # i s y o u r g r o u p n u m b e r ) . A c t i v a t e a n d e x e c u t e t h e p r o g r a m . 1 .
C r e a t e a c o p y o f t h e r e p o r t . P l a c e i t i n y o u r p a c k a g e Z H A 4 0 0 _ 0 0 a n d a s s i g n i t t o y o u r w o r k b e n c h t a s k .
2 .
A c t i v a t e a n d e x e c u t e t h e p r o g r a m .
T a s k 2 : U s e A D B C t o s e n d a n a t iv e S Q L - S E L E C T w it h a jo in t o t h e S A P H A N A d a t a b a s e E s S m
d it y o u b ro u Q L S e a n s
1 .
u r tin E L o f
p ro g ra m e g e t _ d a E C T o n A D B C .
. C o p ta _ s o l S C U S M a k e
y th e s o u u t i o n . I n T O M a n su re y o u
rc e c o d s u b ro u d S B O O re a d e x
e o f su b ro u t i n e g e t _ d a K w ith a n a c tly th e s a
t i n e g e t _ d a t a _ t e m p l a t e t o t a _ s o l u t i o n , r e p l a c e t h e o p e n a t i v e S Q L S E L E C T i s s u e d b y m e d a t a .
C o p y t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e t o s u b r o u t i n e g e t _ d a t a _ s o l u t i o n
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
9 1
U n it 3 : Im p le m e n tin g A B A P
2 .
R e p o r t o n H A N A
U s in g A D B C
H A 4 0 0
I n s u b r o u t i n e g e t _ d a t a _ s o l u t i o n , c r e a t e a n i n s t a n c e o f c l a s s C L _ S Q L _ C O N - N E C T I O N . C r e a t e a n i n s t a n c e o f c l a s s C L _ S Q L _ S T A T E M E N T , h a n d i n g o v e r t h e i n s t a n c e o f C L _ S Q L _ C O N N E C T I O N t o t h e c o n s t r u c t o r H i n t : A s o f N e t w e a v e r 7 . 0 2 , y o u m a y c h a i n t h e s e t w o m e t h o d s t o g e t h e r , t h u s o m i t t i n g t h e r e f e r e n c e v a r i a b l e f o r t h e c o n n e c t i o n o b j e c t .
3 .
D e n e n a tiv e th e te m s tr in g -
a s tr in g v a r ia b le ( s u g g e s te d S Q L s y n ta x th a t c o rre sp o n d s p la te . U s e e ith e r a c la s s ic a l te m p la te /- e x p r e s s io n a p p r o a c
n a m e : l v _ s q l ) a n d l l i t w i t h t h e t o t h e o p e n S Q L s t a t e m e n t f o u n d i n C O N C A T E N A T E o r a m o r e m o d e r n h .
C a u t i o n : M a k e s u r e t o u s e “ . ” i n s t e a d o f “ ~ ” a s e l d s e l e c t o r .
4 .
E x e c u t e t h e q u e r y , a s s i g n t h e t a r g e t d a t a o b j e c t , r e t r i e v e t h e d a t a a n d c l o s e t h e q u e r y . H i n t : C h e c k t h e d e n i t i o n o f t h e t a r g e t d a t a o b j e c t c a r e f u l l y .
9 2
5 .
W h a t d o y o u h a v e t o c h a n g e t o m a k e t h e d a t a o b je c t w o r k a s t a r g e t f o r A D B C ?
6 .
I m p l e m e n t a n e x c e p t i o n h a n d l i n g f o r a l l c l a s s b a s e d e x c e p t i o n s t h a t m i g h t b e r a i s e d b y t h e c a l l e d A D B C - m e t h o d s .
7 .
A c t i v a t e a n d t e s t y o u r p r o g r a m . M a k e s u r e t h e t w o s u b r o u t i n e s d e l i v e r e x a c t l y t h e s a m e d a t a .
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n :
N a tiv e
S Q L
S y n ta x
S o l u t i o n 7 : I s s u e a n a t i v e S Q L J o i n v ia A B A P D a t a b a s e C o n n e c t i v i t y ( A D B C ) T a s k 1 : C o p y a n d u n d e r s t a n d t e m p l a t e C r e a t e a c o p y o f r e p o r t Y H A 4 0 0 _ A D B C _ T 2 i n y o u r p a c k a g e Z H A 4 0 0 _ # # ( s u g g e s t e d n a m e : Z H A 4 0 0 _ # # _ A D B C _ 2 , w h e r e # # i s y o u r g r o u p n u m b e r ) . A c t i v a t e a n d e x e c u t e t h e p r o g r a m . 1 .
C r e a t e a c o p y o f t h e r e p o r t . P l a c e i t i n y o u r p a c k a g e Z H A 4 0 0 _ 0 0 a n d a s s i g n i t t o y o u r w o r k b e n c h t a s k . a )
2 .
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
A c t i v a t e a n d e x e c u t e t h e p r o g r a m . a )
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
T a s k 2 : U s e A D B C t o s e n d a n a t iv e S Q L - S E L E C T w it h a jo in t o t h e S A P H A N A d a t a b a s e E s S m
d it y o u b ro u Q L S e a n s
1 .
u r tin E L o f
. C o p ta _ s o l S C U S M a k e
y th e s o u u t i o n . I n T O M a n su re y o u
rc e c o d s u b ro u d S B O O re a d e x
e o f su b ro u t i n e g e t _ d a K w ith a n a c tly th e s a
t i n e g e t _ d a t a _ t e m p l a t e t o t a _ s o l u t i o n , r e p l a c e t h e o p e n a t i v e S Q L S E L E C T i s s u e d b y m e d a t a .
C o p y t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e t o s u b r o u t i n e g e t _ d a t a _ s o l u t i o n a )
2 .
p ro g ra m e g e t _ d a E C T o n A D B C .
U s e C o p y &
P a s t e - f u n c t i o n o f t h e A B A P E d i t o r .
I n s u b r o u t i n e g e t _ d a t a _ s o l u t i o n , c r e a t e a n i n s t a n c e o f c l a s s C L _ S Q L _ C O N - N E C T I O N . C r e a t e a n i n s t a n c e o f c l a s s C L _ S Q L _ S T A T E M E N T , h a n d i n g o v e r t h e i n s t a n c e o f C L _ S Q L _ C O N N E C T I O N t o t h e c o n s t r u c t o r H i n t : A s o f N e t w e a v e r 7 . 0 2 , y o u m a y c h a i n t h e s e t w o m e t h o d s t o g e t h e r , t h u s o m i t t i n g t h e r e f e r e n c e v a r i a b l e f o r t h e c o n n e c t i o n o b j e c t .
a ) 3 .
S e e s o u r c e c o d e e x tr a c t f r o m
D e n e n a tiv e th e te m s tr in g -
a s trin S Q L s p la te . te m p la
g v a ria b le (s u g g e s te d y n ta x th a t c o rre sp o n d s U s e e ith e r a c la s s ic a l te / - e x p r e s s io n a p p r o a c
m o d e l s o l u t i o n . n a m e : l v _ s q l ) a n d l l i t w i t h t h e t o t h e o p e n S Q L s t a t e m e n t f o u n d i n C O N C A T E N A T E o r a m o r e m o d e r n h .
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
9 3
U n it 3 : Im p le m e n tin g A B A P
R e p o r t o n H A N A
U s in g A D B C
H A 4 0 0
C a u t i o n : M a k e s u r e t o u s e “ . ” i n s t e a d o f “ ~ ” a s e l d s e l e c t o r .
a ) 4 .
S e e s o u rc e c o d e e x tra c t f ro m
m o d e l s o l u t i o n .
E x e c u t e t h e q u e r y , a s s i g n t h e t a r g e t d a t a o b j e c t , r e t r i e v e t h e d a t a a n d c l o s e t h e q u e r y . H i n t : C h e c k t h e d e n i t i o n o f t h e t a r g e t d a t a o b j e c t c a r e f u l l y .
a ) 5 .
S e e s o u rc e c o d e e x tra c t f ro m
m o d e l s o l u t i o n .
W h a t d o y o u h a v e t o c h a n g e t o m a k e t h e d a t a o b je c t w o r k a s t a r g e t f o r A D B C ? A n s w e r : S o r t e d t a b l e s a s t a r g e t s a r e n o t s u p p o r t e d b y A D B C .
6 .
I m p l e m e n t a n e x c e p t i o n h a n d l i n g f o r a l l c l a s s b a s e d e x c e p t i o n s t h a t m i g h t b e r a i s e d b y t h e c a l l e d A D B C - m e t h o d s . a )
7 .
S e e s o u rc e c o d e e x tra c t f ro m
m o d e l s o l u t i o n .
A c t i v a t e a n d t e s t y o u r p r o g r a m . M a k e s u r e t h e t w o s u b r o u t i n e s d e l i v e r e x a c t l y t h e s a m e d a t a . a )
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
R e s u l t
S o u r c e c o d e e x t r a c t f r o m m o d e l ( P r o g r a m Y H A 4 0 0 _ A D B C _ S 2 )
s o l u t i o n
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * &
F o r m
g e t _ d a t a _ t e m p l a t e
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * F O R M *
g e t _ d a t a _ t e m p l a t e
C H A N G I N G
c t _ c u s t o m e r s
T Y P E
t y _ t _ c u s t o m e r s .
D e c l a r a t i o n s
* * * * * * * * * * * * * * * * *
T y p e s T Y P E S :
f o r
t a r g e t
B E G I N
O F
f i e l d s l t y _ s _ c u s t _ b o o k ,
i d
T Y P E
s c u s t o m - i d ,
n a m e
T Y P E
s c u s t o m - n a m e ,
p o s t c o d e
T Y P E
s c u s t o m - p o s t c o d e ,
C o n t i n u e d o n n e x t p a g e
9 4
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n :
c i t y
T Y P E
s c u s t o m - c i t y ,
c o u n t r y
T Y P E
s c u s t o m - c o u n t r y ,
f l d a t e
T Y P E
s b o o k - f l d a t e ,
o r d e r _ d a t e
T Y P E
s b o o k - o r d e r _ d a t e ,
E N D *
*
O F
A r e a
D A T A
l s _ c u s t o m e r
D A T A :
f o r
f o r
*
S y n ta x
R e s u l t L I K E
L I N E
O F
c t _ c u s t o m e r s .
S e l e c t
l t _ c u s t _ b o o k
T Y P E
l s _ c u s t _ b o o k *
S Q L
l t y _ s _ c u s t _ b o o k .
W o r k
T a r g e t s
N a tiv e
h e l p
v a r i a b l e s
D A T A
l v _ c o u n t
T Y P E
T Y P E
S O R T E D
T A B L E
O F
l t y _ s _ c u s t _ b o o k
W I T H
N O N - U N I Q U E
K E Y
l t y _ s _ c u s t _ b o o k .
i .
P r o c e s s i n g
* * * * * * * * * * * * * * * * * C L E A R
c t _ c u s t o m e r s .
S E L E C T
c ~ i d
c ~ n a m e
F R O M
s c u s t o m
O N
c ~ i d
A S
=
c ~ p o s t c o d e c
I N N E R
J O I N
( c _ c o n )
I N T O
l t _ c u s t _ b o o k
W H E R E O R D E R L O O P I F
A T
B Y
b ~ c a n c e l l e d
l t _ c u s t _ b o o k =
I N T O
b ~ o r d e r _ d a t e
b
=
s p a c e
l s _ c u s t _ b o o k .
1 .
l s _ c u s t o m e r - i d
=
l s _ c u s t o m e r - n a m e =
l s _ c u s t o m e r - c i t y
l s _ c u s t _ b o o k - n a m e . l s _ c u s t _ b o o k - p o s t c o d e .
=
l s _ c u s t o m e r - c o u n t r y
l s _ c u s t _ b o o k - c i t y .
=
l s _ c u s t _ b o o k - i d
l s _ c u s t _ b o o k - c o u n t r y .
< >
l s _ c u s t o m e r - d a y s _ a h e a d l s _ c u s t o m e r
l s _ c u s t _ b o o k - i d .
=
l s _ c u s t o m e r - p o s t c o d e
I N S E R T
A S
b ~ f l d a t e
c ~ i d .
s y - t a b i x
E L S E I F
s b o o k
c ~ c o u n t r y
b ~ c u s t o m i d
C O N N E C T I O N T A B L E
c ~ c i t y
I N T O
l s _ c u s t o m e r - i d . =
l s _ c u s t o m e r - d a y s _ a h e a d T A B L E
/
l v _ c o u n t .
c t _ c u s t o m e r s .
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
9 5
i d ,
U n it 3 : Im p le m e n tin g A B A P
R e p o r t o n H A N A
U s in g A D B C
C L E A R
l s _ c u s t o m e r .
C L E A R
l v _ c o u n t .
l s _ c u s t o m e r - i d
=
l s _ c u s t o m e r - n a m e
l s _ c u s t _ b o o k - i d .
=
l s _ c u s t o m e r - p o s t c o d e
l s _ c u s t _ b o o k - n a m e .
=
l s _ c u s t o m e r - c i t y
l s _ c u s t _ b o o k - p o s t c o d e . =
l s _ c u s t o m e r - c o u n t r y
H A 4 0 0
l s _ c u s t _ b o o k - c i t y .
=
l s _ c u s t _ b o o k - c o u n t r y .
E N D I F . l v _ c o u n t
=
l v _ c o u n t
+
1 .
l s _ c u s t o m e r - d a y s _ a h e a d
=
l s _ c u s t o m e r - d a y s _ a h e a d
+
l s _ c u s t _ b o o k - f l d a t e
-
l s _ c u s t _ b o o k - o r d e r
E N D L O O P . l s _ c u s t o m e r - d a y s _ a h e a d I N S E R T *
S O R T
l s _ c u s t o m e r c t _ c u s t o m e r s
=
I N T O B Y
l s _ c u s t o m e r - d a y s _ a h e a d T A B L E
i d .
E N D F O R M .
/
l v _ c o u n t .
c t _ c u s t o m e r s .
" a l r e a d y
s o r t e d
"
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * &
F o r m
g e t _ d a t a _ s o l u t i o n
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * F O R M *
g e t _ d a t a _ s o l u t i o n
C H A N G I N G
c t _ c u s t o m e r s
T Y P E
t y _ t _ c u s t o m e r s .
D e c l a r a t i o n s
* * * * * * * * * * * * * * * * *
T y p e s
f o r
T Y P E S :
t a r g e t
B E G I N
W o r k
l t y _ s _ c u s t _ b o o k ,
i d
T Y P E
s c u s t o m - i d ,
n a m e
T Y P E
s c u s t o m - n a m e ,
p o s t c o d e
T Y P E
s c u s t o m - p o s t c o d e ,
c i t y
T Y P E
s c u s t o m - c i t y ,
c o u n t r y
T Y P E
s c u s t o m - c o u n t r y ,
f l d a t e
T Y P E
s b o o k - f l d a t e ,
o r d e r _ d a t e
T Y P E
s b o o k - o r d e r _ d a t e ,
E N D *
O F
f i e l d s
A r e a
O F f o r
l t y _ s _ c u s t _ b o o k . R e s u l t
C o n t i n u e d o n n e x t p a g e
9 6
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n :
D A T A
l s _ c u s t o m e r
*
T a r g e t s
*
D A T A : D A T A :
f o r
L I K E
*
l t _ c u s t _ b o o k l t _ c u s t _ b o o k
h e l p
v a r i a b l e s
D A T A
l v _ c o u n t
A D B C
O b j e c t s
D A T A :
*
S O R T E D
T Y P E T Y P E
T Y P E a n d
T A B L E
S T A N D A R D
O F
T A B L E
O F
l t y _ s _ c u s t _ b o o k l t y _ s _ c u s t _ b o o k
W I T H W I T H
N O N - U N I Q U E N O N - U N I Q U E
K E Y K E Y
l t y _ s _ c u s t _ b o o k .
i .
v a r i a b l e s T Y P E
R E F
T O
c l _ s q l _ c o n n e c t i o n ,
l o _ s q l
T Y P E
R E F
T O
c l _ s q l _ s t a t e m e n t ,
l o _ r e s u l t
T Y P E
R E F
T O
c l _ s q l _ r e s u l t _ s e t ,
l v _ s q l
T Y P E
s t r i n g ,
l r _ d a t a
T Y P E
R E F
T O
d a t a .
h a n d l i n g l x _ s q l _ e x c l v _ t e x t
*
T Y P E
S y n ta x
c t _ c u s t o m e r s .
l o _ c o n
E c e p t i o n D A T A :
O F
S Q L
S e l e c t
l s _ c u s t _ b o o k *
L I N E
N a tiv e
T Y P E
T Y P E
R E F
T O
c x _ s q l _ e x c e p t i o n ,
s t r i n g .
P r o c e s s i n g
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * C L E A R
c t _ c u s t o m e r s .
*
S E L E C T
c ~ i d
c ~ n a m e
*
F R O M
s c u s t o m
*
O N
c ~ i d
*
C O N N E C T I O N
( c _ c o n )
*
I N T O
l t _ c u s t _ b o o k
=
T A B L E
*
A S
c ~ p o s t c o d e c
I N N E R
J O I N
c ~ c i t y s b o o k
c ~ c o u n t r y A S
b ~ f l d a t e
b ~ o r d e r _ d a t e
b
b ~ c u s t o m i d
W H E R E
b ~ c a n c e l l e d
=
s p a c e .
T R Y . *
G e t
s e c o n d a r y
D B
C o n n e c t i o n
l o _ c o n
=
C R E A T E
O B J E C T
a n d
C r e a t e
s t a t e m e n t
c l _ s q l _ c o n n e c t i o n = > g e t _ c o n n e c t i o n (
o b j e c t c _ c o n
) .
l o _ s q l
E X P O R T I N G c o n _ r e f *
o p t i o n a l
a s
o f
=
l o _ c o n .
N W
7 . 0 2
*
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
9 7
i d ,
"
i d ,
s o r
U n it 3 : Im p le m e n tin g A B A P
*
R e p o r t o n H A N A
C R E A T E
*
H A 4 0 0
l o _ s q l
E X P O R T I N G
* *
O B J E C T
U s in g A D B C
c o n _ r e f c r e a t e
S Q L
=
c l _ s q l _ c o n n e c t i o n = > g e t _ c o n n e c t i o n (
c _ c o n
) .
s t a t e m e n t
C O N C A T E N A T E
` S E L E C T ` F R O M ` O N
C . I D ,
C . P O S T C O D E ,
S F L I G H T . S C U S T O M
C . M A N D T
` A N D
C . N A M E ,
C . I D
` W H E R E
=
=
A S
C
C . C I T Y ,
I N N E R
J O I N
C . C O U N T R Y ,
S F L I G H T . S B O O K
B . F L D A T E , A S
B `
B . M A N D T `
B . C U S T O M I D `
C . M A N D T
=
`
s y - m a n d t ` A N D
B . C A N C E L L E D
` O R D E R I N T O
A l t e r n a t i v e :
*
l v _ s q l
U s e =
B Y
| S E L E C T | F R O M
*
| O N
*
| W H E R E
*
| A N D
*
| O R D E R E x e c u t e
R e a d
r e s u l t G E T
t e m p l a t e s
C . I D ,
a n d
C . N A M E ,
S F L I G H T . S C U S T O M
C . M A N D T
=
C . M A N D T
B . M A N D T
s t r i n g A S
C
I N N E R
A N D
C . I D
{
s y - m a n d t
B . C A N C E L L E D
=
{
B Y
C . M A N D T ,
e x p r e s s i o n s
C . P O S T C O D E ,
=
=
S P A C E
C . I D
} }
|
J O I N =
|
C . C I T Y ,
C . C O U N T R Y
S F L I G H T . S B O O K
B . C U S T O M I D
|
|
& & A S
B
|
& &
& &
& & & &
| .
l o _ s q l - > e x e c u t e _ q u e r y (
i n t o
R E F E R E N C E
i n t e r n a l O F
l t _ c u s t _ b o o k
l o _ r e s u l t - > n e x t _ p a c k a g e ( l o _ r e s u l t - > c l o s e (
=
M E S S A G E
l v _ t e x t
) .
I N T O
l r _ d a t a .
l r _ d a t a
) .
) .
) .
c x _ s q l _ e x c e p t i o n
l v _ t e x t
l v _ s q l
T a b l e
l o _ r e s u l t - > s e t _ p a r a m _ t a b l e (
C A T C H
C . I D `
Q u e r y
l o _ r e s u l t *
C . M A N D T ,
' `
s p a c e .
s t r i n g
*
*
'
l v _ s q l
S E P A R A T E D *
B Y
=
I N T O
l x _ s q l _ e x c .
l x _ s q l _ e x c - > g e t _ t e x t ( T Y P E
"
E x c e p t i o n
C l a s s
f o r
S Q L
E r r o r
) .
' E ' .
E N D T R Y . S O R T
l t _ c u s t _ b o o k
B Y
i d .
L O O P
A T
l t _ c u s t _ b o o k
I N T O
l s _ c u s t _ b o o k .
C o n t i n u e d o n n e x t p a g e
9 8
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
B . O R D E R _ D A T E
H A 4 0 0
L e s s o n :
I F
s y - t a b i x
=
=
l s _ c u s t o m e r - n a m e
S y n ta x
l s _ c u s t _ b o o k - i d .
=
l s _ c u s t o m e r - p o s t c o d e
l s _ c u s t _ b o o k - n a m e .
=
l s _ c u s t o m e r - c i t y
l s _ c u s t _ b o o k - p o s t c o d e . =
l s _ c u s t o m e r - c o u n t r y
l s _ c u s t _ b o o k - c i t y .
=
l s _ c u s t _ b o o k - i d
l s _ c u s t _ b o o k - c o u n t r y .
< >
l s _ c u s t o m e r - i d .
l s _ c u s t o m e r - d a y s _ a h e a d I N S E R T
S Q L
1 .
l s _ c u s t o m e r - i d
E L S E I F
N a tiv e
l s _ c u s t o m e r
=
l s _ c u s t o m e r - d a y s _ a h e a d
I N T O
C L E A R
l s _ c u s t o m e r .
C L E A R
l v _ c o u n t .
l s _ c u s t o m e r - i d
T A B L E
=
l s _ c u s t o m e r - n a m e
l s _ c u s t _ b o o k - p o s t c o d e . =
l s _ c u s t o m e r - c o u n t r y
c t _ c u s t o m e r s .
l s _ c u s t _ b o o k - n a m e .
=
l s _ c u s t o m e r - c i t y
l v _ c o u n t .
l s _ c u s t _ b o o k - i d .
=
l s _ c u s t o m e r - p o s t c o d e
/
l s _ c u s t _ b o o k - c i t y .
=
l s _ c u s t _ b o o k - c o u n t r y .
E N D I F . l v _ c o u n t
=
l v _ c o u n t
+
1 .
l s _ c u s t o m e r - d a y s _ a h e a d
=
l s _ c u s t o m e r - d a y s _ a h e a d
+
l s _ c u s t _ b o o k - f l d a t e
-
l s _ c u s t _ b o o k - o
E N D L O O P . l s _ c u s t o m e r - d a y s _ a h e a d I N S E R T *
S O R T
l s _ c u s t o m e r c t _ c u s t o m e r s
=
I N T O B Y
l s _ c u s t o m e r - d a y s _ a h e a d T A B L E
i d .
2 0 1 3
l v _ c o u n t .
c t _ c u s t o m e r s .
" a l r e a d y
E N D F O R M .
/
s o r t e d
"
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
9 9
U n it 3 : Im p le m e n tin g A B A P
1 0 0
R e p o r t o n H A N A
©
2 0 1 3 S A P
U s in g A D B C
A G . A ll r ig h ts r e s e r v e d .
H A 4 0 0
2 0 1 3
H A 4 0 0
L e s s o n :
N a tiv e
S Q L
S y n ta x
E x e r c is e 8 : M a k e u s e o f n a t i v e S Q L t o a c c e s s d a t a b a s e s p e c i c f u n c t i o n s E x e r c i s e O b j e c t i v e s A f t e r c o m p l e t i n g t h i s e x e r c i s e , y o u w i l l b e a b l e t o : •
u s e A B A P D a ta b a s e C o n n e c tiv ity ( A D B C ) t o r e a d d a ta f r o m
•
u n d e r s t a n d t h e s y n t a x o f n a t i v e S Q L
a d a t a b a s e
B u s i n e s s E x a m p l e T e m p l a t e :
R e p o r t Y H A 4 0 0 _ A D B C _ T 3 S o l u t i o n :
R e p o r t Y H A 4 0 0 _ A D B C _ S 3
T a s k 1 : C o p y a n d u n d e r s t a n d t e m p l a t e C r e a t e a c o p y o f r e p o r t Y H A 4 0 0 _ A D B C _ T 3 i n y o u r p a c k a g e Z H A 4 0 0 _ # # ( s u g g e s t e d n a m e : Z H A 4 0 0 _ # # _ A D B C _ 3 , w h e r e # # i s y o u r g r o u p n u m b e r ) . A c t i v a t e a n d e x e c u t e t h e p r o g r a m . 1 .
C r e a t e a c o p y o f t h e r e p o r t . P l a c e i t i n y o u r p a c k a g e Z H A 4 0 0 _ 0 0 a n d a s s i g n i t t o y o u r w o r k b e n c h t a s k .
2 .
A c t i v a t e a n d e x e c u t e t h e p r o g r a m .
T a s k 2 : U s e A D B C a n d n a t iv e S Q L t o r e p la c e t h e c o m p l e t e d a t a r e t r i e v a l b y j u s t o n e S E L E C T E s n f S o
d it y o u b ro u a tiv e u r th e r E L E C f S Q L
1 .
u r p ro g ra m . C t i n e g e t _ d a t a _ S Q L S E L E C T p r o c e s s in g . M T s c a lc u la tio n . M a k e su re y
o p y th e s o u rc e c o d s o l u t i o n . I n s u b r o u th a t lls in te rn a l ta a k e u s e o f th e fa c t s a re p o s s ib le . A ls o o u re a d e x a c tly th e
e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t i n e g e t _ d a t a _ s o l u t i o n . I m p l e m e b l e c t _ c u s t o m e r s d i r e c t l y w i t h o u th a t w ith in th e e ld lis t o f n a tiv e u s e a g g r e g a tio n a n d o r d e rin g te c s a m e d a t a .
t e t o n t a t a n y S Q L h n i q u e s
C o p y t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e t o s u b r o u t i n e g e t _ d a t a _ s o l u t i o n
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 0 1
U n it 3 : Im p le m e n tin g A B A P
2 .
R e p o r t o n H A N A
U s in g A D B C
H A 4 0 0
I n s u b r o u t i n e g e t _ d a t a _ s o l u t i o n , c h a n g e t h e n a t i v e S Q L S t a t e m e n t . E l i m i n a t e e ld s B . O R D E R _ D A T E a n d B . F L D A T E f r o m t h e e ld l i s t a n d r e p l a c e t h e m b y t h e a g g r e g a t e d d i f f e r e n c e . H i n t : T h e c o r r e c t s y n t a x
i s A V G ( D A Y S _ B E T W E E N ( B . O R D E R _ D A T E , B . F L D A T E ) D A Y S _ A H E A D
1 0 2
)
A S
3 .
I n th e n a tiv e S Q L S y n ta x , a d d a G R O U P B Y a n d a l l e l d s f o u n d i n t h e e l d l i s t .
4 .
R e p l a c e t a r g e t d a t a o b j e c t l t _ c u s t _ b o o k w i t h c t _ c u s t o m e r s .
5 .
R e m o v e t h e n o w s u p e r u o u s l o o p o v e r l t _ c u s t _ b o o k w i t h t h e c a l c u l a t i o n a n d a g g r e g a t i o n .
6 .
A c t i v a t e a n d t e s t y o u r p r o g r a m . M a k e s u r e t h e t w o s u b r o u t i n e s d e l i v e r e x a c t l y t h e s a m e d a t a .
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
a d d it i o n t h a t l i s t s t h e c l i e n t
2 0 1 3
H A 4 0 0
L e s s o n :
N a tiv e
S Q L
S y n ta x
S o l u t i o n 8 : M a k e u s e o f n a t iv e S Q L t o a c c e s s d a t a b a s e s p e c i c f u n c t i o n s T a s k 1 : C o p y a n d u n d e r s t a n d t e m p l a t e C r e a t e a c o p y o f r e p o r t Y H A 4 0 0 _ A D B C _ T 3 i n y o u r p a c k a g e Z H A 4 0 0 _ # # ( s u g g e s t e d n a m e : Z H A 4 0 0 _ # # _ A D B C _ 3 , w h e r e # # i s y o u r g r o u p n u m b e r ) . A c t i v a t e a n d e x e c u t e t h e p r o g r a m . 1 .
C r e a t e a c o p y o f t h e r e p o r t . P l a c e i t i n y o u r p a c k a g e Z H A 4 0 0 _ 0 0 a n d a s s i g n i t t o y o u r w o r k b e n c h t a s k . a )
2 .
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
A c t i v a t e a n d e x e c u t e t h e p r o g r a m . a )
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
T a s k 2 : U s e A D B C a n d n a t iv e S Q L t o r e p la c e t h e c o m p l e t e d a t a r e t r i e v a l b y j u s t o n e S E L E C T E s n f S o
d it y o u b ro u a tiv e u r th e r E L E C f S Q L
1 .
u r p ro g ra m . C t i n e g e t _ d a t a _ S Q L S E L E C T p r o c e s s in g . M T s c a lc u la tio n . M a k e su re y
e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t i n e g e t _ d a t a _ s o l u t i o n . I m p l e m e b l e c t _ c u s t o m e r s d i r e c t l y w i t h o u th a t w ith in th e e ld lis t o f n a tiv e u s e a g g r e g a tio n a n d o r d e rin g te c s a m e d a t a .
t e t o n t a t a n y S Q L h n i q u e s
C o p y t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e t o s u b r o u t i n e g e t _ d a t a _ s o l u t i o n a )
2 .
o p y th e s o u rc e c o d s o l u t i o n . I n s u b r o u th a t lls in te rn a l ta a k e u s e o f th e fa c t s a re p o s s ib le . A ls o o u re a d e x a c tly th e
U s e C o p y &
P a s t e - f u n c t i o n o f t h e A B A P E d i t o r .
I n s u b r o u t i n e g e t _ d a t a _ s o l u t i o n , c h a n g e t h e n a t i v e S Q L S t a t e m e n t . E l i m i n a t e e ld s B . O R D E R _ D A T E a n d B . F L D A T E f r o m t h e e ld l i s t a n d r e p l a c e t h e m b y t h e a g g r e g a t e d d i f f e r e n c e . H i n t : T h e c o r r e c t s y n t a x
i s A V G ( D A Y S _ B E T W E E N ( B . O R D E R _ D A T E , B . F L D A T E ) D A Y S _ A H E A D a ) 3 .
S e e s o u r c e c o d e e x tr a c t f r o m
S e e s o u r c e c o d e e x tr a c t f r o m
A S
m o d e l s o l u t i o n .
I n th e n a tiv e S Q L S y n ta x , a d d a G R O U P B Y a n d a l l e l d s f o u n d i n t h e e l d l i s t . a )
)
a d d it i o n t h a t l i s t s t h e c l i e n t
m o d e l s o l u t i o n .
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 0 3
U n it 3 : Im p le m e n tin g A B A P
4 .
R e p o r t o n H A N A
U s in g A D B C
H A 4 0 0
R e p l a c e t a r g e t d a t a o b j e c t l t _ c u s t _ b o o k w i t h c t _ c u s t o m e r s . a )
5 .
S e e s o u rc e c o d e e x tra c t f ro m
m o d e l s o l u t i o n .
R e m o v e t h e n o w s u p e r u o u s l o o p o v e r l t _ c u s t _ b o o k w i t h t h e c a l c u l a t i o n a n d a g g r e g a t i o n . a )
6 .
S e e s o u rc e c o d e e x tra c t f ro m
m o d e l s o l u t i o n .
A c t i v a t e a n d t e s t y o u r p r o g r a m . M a k e s u r e t h e t w o s u b r o u t i n e s d e l i v e r e x a c t l y t h e s a m e d a t a . a )
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
R e s u l t
S o u r c e c o d e e x t r a c t f r o m m o d e l ( P r o g r a m Y H A 4 0 0 _ A D B C _ S 3 )
s o l u t i o n
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * &
F o r m
g e t _ d a t a _ t e m p l a t e
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * F O R M *
g e t _ d a t a _ t e m p l a t e
C H A N G I N G
c t _ c u s t o m e r s
T Y P E
t y _ t _ c u s t o m e r s .
D e c l a r a t i o n s
* * * * * * * * * * * * * * * * *
T y p e s
f o r
T Y P E S :
t a r g e t
B E G I N
l t y _ s _ c u s t _ b o o k ,
i d
T Y P E
s c u s t o m - i d ,
n a m e
T Y P E
s c u s t o m - n a m e ,
p o s t c o d e
T Y P E
s c u s t o m - p o s t c o d e ,
c i t y
T Y P E
s c u s t o m - c i t y ,
c o u n t r y
T Y P E
s c u s t o m - c o u n t r y ,
f l d a t e
T Y P E
s b o o k - f l d a t e ,
o r d e r _ d a t e
T Y P E
s b o o k - o r d e r _ d a t e ,
E N D *
O F
O F
A r e a
D A T A
l s _ c u s t o m e r
T a r g e t s
*
D A T A :
f o r
l t y _ s _ c u s t _ b o o k .
W o r k
*
f i e l d s
f o r
R e s u l t L I K E
L I N E
O F
c t _ c u s t o m e r s .
T Y P E
S O R T E D
S e l e c t
l t _ c u s t _ b o o k
T A B L E
O F
l t y _ s _ c u s t _ b o o k
W I T H
N O N - U N I Q U E
K E Y
C o n t i n u e d o n n e x t p a g e
1 0 4
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
i d ,
"
s o r e t e d
H A 4 0 0
L e s s o n :
D A T A :
l t _ c u s t _ b o o k
T Y P E
l s _ c u s t _ b o o k *
*
h e l p
v a r i a b l e s
D A T A
l v _ c o u n t
A D B C
O b j e c t s
D A T A :
*
T Y P E a n d
O F
l t y _ s _ c u s t _ b o o k
W I T H
S Q L
S y n ta x
N O N - U N I Q U E
K E Y
i d ,
l t y _ s _ c u s t _ b o o k .
i .
v a r i a b l e s T Y P E
R E F
T O
c l _ s q l _ c o n n e c t i o n ,
l o _ s q l
T Y P E
R E F
T O
c l _ s q l _ s t a t e m e n t ,
l o _ r e s u l t
T Y P E
R E F
T O
c l _ s q l _ r e s u l t _ s e t ,
l v _ s q l
T Y P E
s t r i n g ,
l r _ d a t a
T Y P E
R E F
T O
d a t a .
h a n d l i n g l x _ s q l _ e x c l v _ t e x t
*
T A B L E
l o _ c o n
E c e p t i o n D A T A :
T Y P E
S T A N D A R D
N a tiv e
T Y P E
T Y P E
R E F
T O
c x _ s q l _ e x c e p t i o n ,
s t r i n g .
P r o c e s s i n g
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * C L E A R
c t _ c u s t o m e r s .
*
S E L E C T
c ~ i d
*
F R O M
s c u s t o m
*
O N
c ~ i d
*
C O N N E C T I O N
s f l i g h t
*
I N T O
l t _ c u s t _ b o o k
T A B L E
*
c ~ n a m e =
c ~ p o s t c o d e
A S
c
I N N E R
c ~ c i t y
J O I N
c ~ c o u n t r y
s b o o k
A S
b ~ f l d a t e
b ~ o r d e r _ d a t e
b
b ~ c u s t o m i d
W H E R E
b ~ c a n c e l l e d
=
s p a c e .
T R Y . *
G e t
s e c o n d a r y l o _ c o n
*
C r e a t e
=
D B
C o n n e c t i o n
c l _ s q l _ c o n n e c t i o n = > g e t _ c o n n e c t i o n (
c _ c o n
) .
s t a t e m e n t
C R E A T E
O B J E C T
l o _ s q l
E X P O R T I N G c o n _ r e f *
c r e a t e
S Q L
=
l o _ c o n .
s t a t e m e n t
C O N C A T E N A T E
` S E L E C T ` F R O M ` O N
C . I D ,
S F L I G H T . S C U S T O M
C . M A N D T
` A N D
C . N A M E ,
C . I D
` W H E R E
=
=
C . P O S T C O D E , A S
C
I N N E R
C . C I T Y , J O I N
C . C O U N T R Y ,
S F L I G H T . S B O O K
B . F L D A T E , A S
B `
B . M A N D T `
B . C U S T O M I D `
C . M A N D T
=
`
s y - m a n d t
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 0 5
B . O R D E R _ D
U n it 3 : Im p le m e n tin g A B A P
R e p o r t o n H A N A
` A N D
U s in g A D B C
B . C A N C E L L E D
` O R D E R I N T O
A l t e r n a t i v e :
*
U s e
l v _ s q l
=
B Y
| S E L E C T | F R O M
*
| O N
*
| W H E R E
*
| A N D
*
| O R D E R E x e c u t e
R e a d
r e s u l t G E T
C . M A N D T ,
t e m p l a t e s
C . I D ,
C . I D `
a n d
C . N A M E ,
S F L I G H T . S C U S T O M
C . M A N D T
=
B . M A N D T
C . M A N D T
s t r i n g A S
C
I N N E R
A N D
C . I D
{
s y - m a n d t
B . C A N C E L L E D
=
{
B Y
C . M A N D T ,
e x p r e s s i o n s
C . P O S T C O D E ,
=
=
S P A C E
C . I D
}
J O I N =
|
}
|
C . C I T Y ,
C . C O U N T R Y
|
S F L I G H T . S B O O K
B . C U S T O M I D
|
& & A S
B
|
& &
& &
& & & &
| .
l o _ s q l - > e x e c u t e _ q u e r y (
i n t o
i n t e r n a l
R E F E R E N C E
O F
l t _ c u s t _ b o o k
l o _ r e s u l t - > n e x t _ p a c k a g e ( l o _ r e s u l t - > c l o s e (
=
M E S S A G E
l v _ t e x t
) .
I N T O
l r _ d a t a .
l r _ d a t a
) .
) .
) .
c x _ s q l _ e x c e p t i o n
l v _ t e x t
l v _ s q l
T a b l e
l o _ r e s u l t - > s e t _ p a r a m _ t a b l e (
C A T C H
' `
Q u e r y
l o _ r e s u l t *
'
s p a c e .
s t r i n g
*
*
=
l v _ s q l
S E P A R A T E D *
B Y
H A 4 0 0
I N T O
l x _ s q l _ e x c .
l x _ s q l _ e x c - > g e t _ t e x t ( T Y P E
"
E x c e p t i o n
C l a s s
f o r
S Q L
E r r o r
) .
' E ' .
E N D T R Y . S O R T
l t _ c u s t _ b o o k
L O O P
A T
I F
B Y
i d .
l t _ c u s t _ b o o k
I N T O
s y - t a b i x
=
l s _ c u s t _ b o o k .
1 .
l s _ c u s t o m e r - i d
=
l s _ c u s t o m e r - n a m e
=
l s _ c u s t o m e r - p o s t c o d e
=
l s _ c u s t o m e r - c i t y
l s _ c u s t _ b o o k - p o s t c o d e .
C L E A R
l s _ c u s t _ b o o k - c o u n t r y .
< >
l s _ c u s t o m e r - d a y s _ a h e a d l s _ c u s t o m e r
l s _ c u s t _ b o o k - c i t y .
=
l s _ c u s t _ b o o k - i d
I N S E R T
l s _ c u s t _ b o o k - n a m e .
=
l s _ c u s t o m e r - c o u n t r y E L S E I F
l s _ c u s t _ b o o k - i d .
I N T O
l s _ c u s t o m e r - i d . =
r o u n d ( T A B L E
v a l
=
l s _ c u s t o m e r - d a y s _ a h e a d
/
l v _ c o u n t
d e c
c t _ c u s t o m e r s .
l s _ c u s t o m e r .
C o n t i n u e d o n n e x t p a g e
1 0 6
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
=
2
m o d e
=
c
H A 4 0 0
L e s s o n :
C L E A R
N a tiv e
S Q L
S y n ta x
l v _ c o u n t .
l s _ c u s t o m e r - i d
=
l s _ c u s t o m e r - n a m e
l s _ c u s t _ b o o k - i d .
=
l s _ c u s t o m e r - p o s t c o d e
l s _ c u s t _ b o o k - n a m e .
=
l s _ c u s t o m e r - c i t y
l s _ c u s t _ b o o k - p o s t c o d e . =
l s _ c u s t o m e r - c o u n t r y
l s _ c u s t _ b o o k - c i t y .
=
l s _ c u s t _ b o o k - c o u n t r y .
E N D I F . l v _ c o u n t
=
l v _ c o u n t
+
1 .
l s _ c u s t o m e r - d a y s _ a h e a d
=
l s _ c u s t o m e r - d a y s _ a h e a d
+
l s _ c u s t _ b o o k - f l d a t e
-
l s _ c u s t _ b o o k - o
E N D L O O P . l s _ c u s t o m e r - d a y s _ a h e a d I N S E R T *
S O R T
l s _ c u s t o m e r
=
I N T O
c t _ c u s t o m e r s
B Y
r o u n d ( T A B L E
i d .
v a l
l s _ c u s t o m e r - d a y s _ a h e a d
/
l v _ c o u n t
d e c
=
c t _ c u s t o m e r s .
" a l r e a d y
E N D F O R M .
=
s o r t e d
"
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * &
F o r m
g e t _ d a t a _ s o l u t i o n
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * F O R M *
g e t _ d a t a _ s o l u t i o n
C H A N G I N G
c t _ c u s t o m e r s
T Y P E
t y _ t _ c u s t o m e r s .
D e c l a r a t i o n s
* * * * * * * * * * * * * * * * * *
T y p e s
f o r
t a r g e t
f i e l d s
* *
T Y P E S :
B E G I N
O F
l t y _ s _ c u s t _ b o o k ,
*
i d
T Y P E
s c u s t o m - i d ,
*
n a m e
T Y P E
s c u s t o m - n a m e ,
*
p o s t c o d e
T Y P E
s c u s t o m - p o s t c o d e ,
*
c i t y
T Y P E
s c u s t o m - c i t y ,
*
c o u n t r y
T Y P E
s c u s t o m - c o u n t r y ,
*
f l d a t e
T Y P E
s b o o k - f l d a t e ,
*
o r d e r _ d a t e
T Y P E
s b o o k - o r d e r _ d a t e ,
*
E N D
O F
l t y _ s _ c u s t _ b o o k .
* * *
W o r k
A r e a
f o r
R e s u l t
*
D A T A
l s _ c u s t o m e r
L I K E
L I N E
O F
c t _ c u s t o m e r s .
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 0 7
2
m o d e
=
c
U n it 3 : Im p le m e n tin g A B A P
R e p o r t o n H A N A
U s in g A D B C
H A 4 0 0
* * * *
T a r g e t s
*
D A T A :
f o r
S e l e c t
l t _ c u s t _ b o o k
*
T Y P E
l s _ c u s t _ b o o k
T Y P E
S T A N D A R D
T A B L E
O F
l t y _ s _ c u s t _ b o o k
W I T H
N O N - U N I Q U E
K E Y
i d ,
l t y _ s _ c u s t _ b o o k .
* * *
h e l p
v a r i a b l e s
*
D A T A
l v _ c o u n t
*
A D B C
O b j e c t s
D A T A :
*
a n d
v a r i a b l e s T Y P E
R E F
T O
c l _ s q l _ c o n n e c t i o n ,
l o _ s q l
T Y P E
R E F
T O
c l _ s q l _ s t a t e m e n t ,
l o _ r e s u l t
T Y P E
R E F
T O
c l _ s q l _ r e s u l t _ s e t ,
l v _ s q l
T Y P E
s t r i n g ,
l r _ d a t a
T Y P E
R E F
T O
d a t a .
h a n d l i n g l x _ s q l _ e x c l v _ t e x t
*
i .
l o _ c o n
E c e p t i o n D A T A :
T Y P E
T Y P E
T Y P E
R E F
T O
c x _ s q l _ e x c e p t i o n ,
s t r i n g .
P r o c e s s i n g
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * C L E A R
c t _ c u s t o m e r s .
T R Y . *
G e t
s e c o n d a r y l o _ c o n
*
C r e a t e
=
D B
C o n n e c t i o n
c l _ s q l _ c o n n e c t i o n = > g e t _ c o n n e c t i o n (
c _ c o n
) .
s t a t e m e n t
C R E A T E
O B J E C T
l o _ s q l
E X P O R T I N G c o n _ r e f *
c r e a t e
S Q L
=
l o _ c o n .
s t a t e m e n t
C O N C A T E N A T E
` S E L E C T ` F R O M ` O N ` A N D
C . I D ,
C . N A M E ,
S F L I G H T . S C U S T O M
C . M A N D T C . I D
` W H E R E
=
=
C . P O S T C O D E , A S
C
I N N E R
C . C I T Y , J O I N
C . C O U N T R Y ,
S F L I G H T . S B O O K
A V G ( A S
D A Y S _ B E T W E E N ( B . O R D
B `
B . M A N D T `
B . C U S T O M I D `
C . M A N D T
=
`
s y - m a n d t ` A N D
I N T O
B . C A N C E L L E D
=
'
' `
` G R O U P
B Y
C . M A N D T ,
C . I D ,
` O R D E R
B Y
C . M A N D T ,
C . I D
C . N A M E ,
C . P O S T C O D E ,
C . C I T Y ,
C . C O U N T R Y `
`
l v _ s q l
C o n t i n u e d o n n e x t p a g e
1 0 8
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n :
S E P A R A T E D *
A l t e r n a t i v e :
*
l v _ s q l
U s e =
B Y
t e m p l a t e s
C . I D ,
a n d
C . N A M E ,
*
| O N
*
| W H E R E
*
| A N D
*
| G R O U P
B Y
C . M A N D T ,
C . I D ,
*
| O R D E R
B Y
C . M A N D T ,
C . I D
R e a d
r e s u l t
*
G E T G E T
C . M A N D T
=
B . M A N D T
C . M A N D T
C
I N N E R
A N D
C . I D
=
{
s y - m a n d t
B . C A N C E L L E D
=
{
=
S P A C E
}
|
}
|
J O I N =
C . C O U N T R Y
A V G (
S F L I G H T . S B O O K
B . C U S T O M I D
|
A S
D A Y S _ B E T W E E N ( B . O R B
|
& &
& &
& &
|
& &
C . N A M E ,
l o _ s q l - > e x e c u t e _ q u e r y (
i n t o
i n t e r n a l
C . P O S T C O D E ,
C . C I T Y ,
C . C O U N T R Y
.
R E F E R E N C E R E F E R E N C E
O F O F
l t _ c u s t _ b o o k c t _ c u s t o m e r s
l o _ r e s u l t - > n e x t _ p a c k a g e ( l o _ r e s u l t - > c l o s e (
=
M E S S A G E
l v _ t e x t
) .
I N T O I N T O
l r _ d a t a
l r _ d a t a . l r _ d a t a . ) .
) .
) .
c x _ s q l _ e x c e p t i o n
l v _ t e x t
l v _ s q l
T a b l e
l o _ r e s u l t - > s e t _ p a r a m _ t a b l e (
C A T C H
A S
C . C I T Y ,
Q u e r y
l o _ r e s u l t *
S y n ta x
e x p r e s s i o n s
C . P O S T C O D E ,
| F R O M
E x e c u t e
S F L I G H T . S C U S T O M
s t r i n g
*
*
S Q L
s p a c e .
s t r i n g
| S E L E C T
N a tiv e
I N T O
l x _ s q l _ e x c .
l x _ s q l _ e x c - > g e t _ t e x t ( T Y P E
"
E x c e p t i o n
C l a s s
f o r
S Q L
E r r o r
) .
' E ' .
E N D T R Y . E N D F O R M .
2 0 1 3
"
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 0 9
|
& &
U n it 3 : Im p le m e n tin g A B A P
R e p o r t o n H A N A
U s in g A D B C
H A 4 0 0
L e s s o n S u m m a r y Y o u s h o u l d n o w b e a b l e t o :
1 1 0
•
U n d e r s t a n d t h e m a i n d i f f e r e n c e b e t w e e n n a t i v e S Q L S y n t a x a n d O p e n S Q L S y n t a x
•
W r i t e s y n t a c t i c a l l y c o r r e c t N a t i v e S Q L S t a t e m e n t s
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
U n it S u m m a r y
U n it S u m m a r y Y o u s h o u l d n o w b e a b l e t o :
2 0 1 3
•
D e s c r i b e t h e u s e o f n a t i v e S Q L i n t h e c o n te x t o f S A P H A N A
•
U n d e r s t a n d A B A P D a t a b a s e C o n n e c t i v it y ( A D B C )
•
U s e A D B C t o e x e c u t e n a t i v e S Q L s t a t e m e n ts
•
U n d e r s t a n d t h e m a i n d i f f e r e n c e b e t w e e n n a t i v e S Q L S y n t a x a n d O p e n S Q L S y n t a x
•
W r i t e s y n t a c t i c a l l y c o r r e c t N a t i v e S Q L S t a t e m e n t s
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 1 1
U n it S u m m a r y
1 1 2
H A 4 0 0
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
U n i t 4 C o n s u m in g H A N A V ie w s a n d P r o c e d u r e s i n A B A P U n i t O v e r v i e w T h i s U n i t i s d e s i g n e d t o t e a c h t h e f o l l o w i n g t o p i c s : •
W o rk in g w ith v ie w s in S A P H A N A
•
O v e rv ie w
•
C o n s u m in g S A P H A N A
•
C a llin g S A P H A N A
S tu d i o
o f d if f e r e n t T y p e s o f S A P H A N A
v i e w s
v ie w s i n A B A P
p r o c e d u r e s i n A B A P
U n i t O b j e c t i v e s A f t e r c o m p l e t i n g t h i s u n i t , y o u w i l l b e a b l e t o : •
W o rk w ith v ie w s in th e S A P H A N A
S tu d io
•
D e s c rib e th e d iffe re n t T y p e s o f S A P H A N A
•
C o n su m e H A N A
•
C a ll H A N A
v i e w s
v ie w s in A B A P
p r o c e d u r e s i n A B A P
U n i t C o n t e n t s L e s s o L e s s o L e s s o E x n a E x S Q L e s s o E x c a
2 0 1 3
n : W o r k in g w it h V ie w s in S A P H A N A S n : O v e r v ie w o f D iff e r e n t T y p e s o f S A P n : C o n s u m in g S A P H A N A V ie w s in A B e r c is e 9 : A n a ly z e a v ie w d e n e d o n S t iv e S Q L S E L E C T . . . . . . . . . . . . . . . . . . . . . . . e r c is e 1 0 : C a l l a S A P H A N A v ie w w i t h L S E L E C T . .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. n : C a l lin g S A P H A N A P r o c e d u r e s in A e r c is e 1 1 : A n a ly z e a s t o r e d p r o c e d u r e ll it in a n a t iv e S Q L s t a t e m e n t . . . . . . . . . .
©
2 0 1 3 S A P
tu d H A A P A P .. .. a n .. .. B A d e . ...
io . . . . . . . . . . . N A V ie w s . ............. H A N A a n d .. .. .. .. .. .. .. in p u t p a r a m .. .. .. .. .. .. .. P ............ n e d o n S A ... .. ... ... .. .
A G . A ll r ig h ts r e s e r v e d .
........ ........ ........ u s e it .. .. .. .. e te r in .. .. .. .. ........ P H A N .. ... .. .
. . . . . . 1 1 4 . . . . . . 1 1 9 . . . . . . 1 2 3 in a . . . . . . 1 2 5 a n a t iv e . . . . . . 1 3 7 . . . . . . 1 4 6 A a n d . . . . . . 1 4 9
1 1 3
U n it 4 : C o n s u m in g H A N A
L e s s o n :
V ie w s a n d P r o c e d u r e s in A B A P
H A 4 0 0
W o r k in g w ith V ie w s in S A P H A N A L e s s o n
S t u d io
O v e r v i e w
L e s s o n O b j e c t i v e s A f t e r c o m p l e t i n g t h i s l e s s o n , y o u w i l l b e a b l e t o : •
W o rk w ith v ie w s in th e S A P H A N A
S tu d i o
B u s i n e s s E x a m p l e
F i g u r e 4 5 : S e a r c h F u n c t i o n s – G l o b a l S e a r c h
1 1 4
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : W o r k in g
w ith
V ie w s in
S A P
H A N A
S tu d io
F i g u r e 4 6 : S e a r c h F u n c t i o n s – L o c a l S e a r c h i n C o n t e n t
F i g u r e 4 7 : W o r k in g w i t h V i e w s – O p e n D e n i t i o n a n d D a t a P r e v ie w
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 1 5
U n it 4 : C o n s u m in g H A N A
V ie w s a n d P r o c e d u r e s in A B A P
F ig u r e 4 8 : W o r k in g w it h V i e w s – P r e v ie w
H A 4 0 0
o f R a w
D a t a
F i g u r e 4 9 : W o r k i n g w i t h V i e w s – A n a l y s i s o f D i s t i n c t V a l u e s
1 1 6
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : W o r k in g
F ig u r e 5 0 : W o r k in g
2 0 1 3
w ith
V ie w s in
S A P
H A N A
S tu d io
w i t h V i e w s – G r a p h i c a l A n a l y s is
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 1 7
U n it 4 : C o n s u m in g H A N A
V ie w s a n d P r o c e d u r e s in A B A P
H A 4 0 0
L e s s o n S u m m a r y Y o u s h o u l d n o w b e a b l e t o : •
1 1 8
W o rk w ith v ie w s in th e S A P H A N A
©
2 0 1 3 S A P
S tu d i o
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : O v e r v ie w
L e s s o n :
O v e r v ie w L e s s o n
o f D iffe r e n t T y p e s
o f S A P
o f D iffe r e n t T y p e s o f S A P H A N A
H A N A
V ie w s
V i e w s
O v e r v i e w
L e s s o n O b j e c t i v e s A f t e r c o m p l e t i n g t h i s l e s s o n , y o u w i l l b e a b l e t o : •
D e s c rib e th e d iffe re n t T y p e s o f S A P H A N A
v i e w s
B u s i n e s s E x a m p l e
F i g u r e 5 1 : A t t r i b u t e V i e w
F ig u r e 5 2 : E x a m p le : A ttr ib u te V ie w
2 0 1 3
©
2 0 1 3 S A P
w i t h R e f e r e n t i a l J o i n
A G . A ll r ig h ts r e s e r v e d .
1 1 9
U n it 4 : C o n s u m in g H A N A
V ie w s a n d P r o c e d u r e s in A B A P
H A 4 0 0
F i g u r e 5 3 : A n a l y t i c V i e w
1 2 0
F ig u r e 5 4 : E x a m p le : A n a ly tic V ie w
w i t h C a l c u l a t e d C o l u m n
F ig u r e 5 5 : E x a m p le : A n a ly tic V ie w
w i t h C u r r e n c y C o n v e r s i o n
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : O v e r v ie w
o f D iffe r e n t T y p e s
o f S A P
H A N A
V ie w s
F i g u r e 5 6 : C a l c u l a t i o n V i e w
F ig u r e 5 7 : E x a m p le : G r a p h i c a l C a lc u la tio n V ie w a n d F i l t e r
F ig u r e 5 8 : E x a m p le : C a lc u la tio n V i e w
2 0 1 3
©
2 0 1 3 S A P
w i t h A g g r e g a t e d C o l u m n s
b a s e d o n S Q L S c r i p t
A G . A ll r ig h ts r e s e r v e d .
1 2 1
U n it 4 : C o n s u m in g H A N A
V ie w s a n d P r o c e d u r e s in A B A P
H A 4 0 0
L e s s o n S u m m a r y Y o u s h o u l d n o w b e a b l e t o : •
1 2 2
D e s c r ib e th e d if f e r e n t T y p e s o f S A P H A N A
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
v i e w s
2 0 1 3
H A 4 0 0
L e s s o n : C o n s u m in g
L e s s o n :
C o n s u m in g S A P L e s s o n
H A N A
S A P
H A N A
V ie w s in
A B A P
V ie w s in A B A P
O v e r v i e w
L e s s o n O b j e c t i v e s A f t e r c o m p l e t i n g t h i s l e s s o n , y o u w i l l b e a b l e t o : •
C o n su m e H A N A
v ie w s in A B A P
B u s i n e s s E x a m p l e
2 0 1 3
F ig u r e 5 9 : C o n s u m in g H A N A
V ie w
F ig u r e 6 0 : C o n s u m in g H A N A
V i e w s – N a tiv e S Q L S y n t a x
©
2 0 1 3 S A P
– L o g i c a l P i c t u r e
A G . A ll r ig h ts r e s e r v e d .
1 2 3
U n it 4 : C o n s u m in g H A N A
V ie w s a n d P r o c e d u r e s in A B A P
F ig u r e 6 1 : C o n s u m in g H A N A
V i e w s w i t h I n p u t P a r a m e t e r s – L o g i c a l V i e w
F ig u r e 6 2 : In p u t P a r a m e te rs in H A N A
F ig u r e 6 3 : C o n s u m in g H A N A S y n t a x
1 2 4
©
2 0 1 3 S A P
H A 4 0 0
V i e w s – T h e F a c ts
V i e w s w i t h I n p u t P a r a m e t e r s – N a t i v e S Q L
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : C o n s u m in g
S A P
H A N A
V ie w s in
A B A P
E x e r c is e 9 : A n a ly z e a v i e w d e n e d o n S A P H A N A a n d u s e it in a n a t iv e S Q L S E L E C T E x e r c i s e O b j e c t i v e s A f t e r c o m p l e t i n g t h i s e x e r c i s e , y o u w i l l b e a b l e t o : •
a n a l y z e a n d u n d e r s t a n d v i e w s d e n e d o n S A P H A N A
•
u se S A P H A N A
v i e w s i n t h e F R O M - c l a u s e o f n a t i v e S Q L S E L E C T s
B u s i n e s s E x a m p l e T e m p l a t e :
R e p o r t Y H A 4 0 0 _ U S E _ H A N A _ V I E W T 1 S o l u t i o n :
R e p o rt Y H A 4 0 0 _ U S E _ H A N A _ V IE W
_ S 1
T a s k 1 : C o p y a n d u n d e r s t a n d t e m p l a t e C r e a t e a c o p y o f r e p o r t Y H A 4 0 0 _ H A N A _ V I E W _ T 1 i n y o u r p a c k a g e Z H A 4 0 0 _ # # ( s u g g e s t e d n a m e : Z H A 4 0 0 _ # # _ H V I E W _ 1 , w h e r e # # i s y o u r g r o u p n u m b e r ) . A c t i v a t e a n d e x e c u t e t h e p r o g r a m . 1 .
C r e a t e a c o p y o f t h e r e p o r t . P l a c e i t i n y o u r p a c k a g e Z H A 4 0 0 _ 0 0 a n d a s s i g n i t t o y o u r w o r k b e n c h t a s k .
2 .
A c t i v a t e a n d e x e c u t e t h e p r o g r a m .
T a s k 2 : F in d a n d a n a ly z e a S A P H A N A I f o a a
n th e S A P H A ro m ta b le s S C f d a y s b e tw e g g r e g a tio n , y n d d o a little
1 .
N A S tu U S T O M en o rd e r e t. C h e c a n a ly s is
d io , s e a rc h fo r a v ie w th a n d S B O O K , in c lu d in d a te a n d i g h t d a te . T h k a ll re le v a n t p r o p e rtie s o f th e v ie w ’s c o n te n t w
V i e w
a t c o n ta in s th e r e le g a c a lc u la te d e ld e v ie w s h o u ld n o t o f th e v ie w , d is p la ith th e d a ta p r e v ie w
v a n t in f o fo r th e n p r o v id e a y th e ra w t o o l .
r m a t i o n u m b e r n y d a t a
G o t o t h e S A P H A N A S t u d i o a n d s e a r c h t h e C o n t e n t f o r v ie w s h a v in g “ d a y s ” i n t h e i r n a m e s . H i n t : K e e p i n m i n d t h a t S A P H A N A u s e s “ % ” a s w i l d c a r d s y m b o l ( a s c o m m o n i n S Q L ) r a t h e r t h a n t h e “ * ” c h a r a c t e r k n o w n f r o m S A P G U I s e l e c t i o n s c r e e n s .
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 2 5
U n it 4 : C o n s u m in g H A N A
V ie w s a n d P r o c e d u r e s in A B A P
H A 4 0 0
2 .
T h e l i s t c o n t a i n s t h e f o l l o w i n g v i e w s :
3 .
B o t h v i e w s a r e l o c a t e d i n p a c k a g e
4 .
A c c o r d i n g t o n a m i n g c o n v e n t i o n s , w h i c h o f t h e v i e w s c a n y o u e x p e c t t o b e a n a t t r i b u t e v i e w ?
5 .
C h o o s e t h e a t t r i b u t e v i e w a n d a n a l y z e i t s d e n i t i o n .
6 .
V ie w ta b le j o i n e v ie w rig h t
s
a n d d b y a jo i n o f c a c o n s is ts o f e ld s fro m th e le ft ta b ta b le a n d 1 c a lc u la te d e ld . T h e c a lc . It’s c a lc u la tio n e x
is b a s e d . T rd in a lity le , e ld s u la te d e ld ’s p re s sio n re a d
h f n s
o n d a ta b a s e e ta b le s a re . T h e r o m t h e a m e i s a s f o l l o w s :
T h e v i e w c o n t a i n s o n e l t e r c o n d i t i o n : O n l y s u c h e n t r i e s a r e s e l e c t e d w h e re th e e ld c o n ta in s th e v a lu e . T h e v ie w s rs t e l d s a r e k e y e l d s . T h e e l d w i t h n a m e i s h i d d e n . F i l l i n t h e b l a n k s t o c o m p l e t e t h e s e n t e n c e .
C o n t i n u e d o n n e x t p a g e
1 2 6
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : C o n s u m in g
T a s k 3 : U s e th e S A P H A N A E s n f a
d it y o u b ro u a tiv e u rth e r g g re g
u r p ro g ra m . C o p y th e s o u rc e c o d t i n e g e t _ d a t a _ s o l u t i o n . I n s u b r o u S Q L S E L E C T th a t lls in te rn a l ta p r o c e s s in g . S e le c t f r o m th e v ie w a tio n ( c a lc u la tio n o f a v e r a g e ) in th
V ie w
S A P
H A N A
V ie w s in
A B A P
in a n a t i v e S Q L S e le c t
e o f s u b r o u t i n e g e t _ d a t a _ t i n e g e t _ d a t a _ s o l u t i o n . I m b l e c t _ c u s t o m e r s d i r e c t l y y o u ju s t f o u n d a n d im p le e S E L E C T s t a t e m e n t .
te m p p le m w ith o m e n t
l a t e t o e n t a u t a n y t h e
1 .
C o p y t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e t o s u b r o u t i n e g e t _ d a t a _ s o l u t i o n
2 .
I n s u b r o u t i n e g e t _ d a t a _ s o l u t i o n , c h a n g e t h e n a t i v e S Q L S t a t e m e n t . I n t h e F R O M - c l a u s e , r e p l a c e t h e jo i n o f t a b l e s S C U S T O M a n d S B O O K w i t h t h e v i e w y o u ju s t f o u n d . H i n t : R e m e m b e r t o s t a t e t h e v i e w ’ s n a m e w i t h i t ’ s c o m p l e t e p a t h , i . e . _ S Y S _ B I C / < p a c k a g e n a m e > . < s u b p a c k a g e n a m e > . . . / < v i e w n a m e > C a u t i o n : N a m e s o n S A P H A N A a r e c a s e s e n s i t i v e . B u t e v e r y t h i n g n o t i n c l u d e d i n “ ” w i l l b e t r a n s l a t e d t o u p p e r c a s e !
2 0 1 3
3 .
A c D a
d ju s t t o rre sp o A Y S _ A d d itio n
h e n d H th
e ld lis t o f to th e e ld E A D , u s i n g a t lis ts th e c
4 .
R e m o v e e l d C A N C E L L E D f r o m t h e W H E R E - c l a u s e a s t h i s l t e r c o n d i t i o n i s a l r e a d y p a r t o f t h e v i e w ’ s d e n i t i o n .
5 .
R e p l a c e t a r g e t d a t a o b j e c t l t _ c u s t _ b o o k w i t h c t _ c u s t o m e r s .
6 .
R e m o v e t h e n o w s u p e r u o u s l o o p o v e r l t _ c u s t _ b o o k w i t h t h e c a l c u l a t i o n a n d a g g r e g a t i o n .
7 .
A c t i v a t e a n d t e s t y o u r p r o g r a m . M a k e s u r e t h e t w o s u b r o u t i n e s d e l i v e r e x a c t l y t h e s a m e d a t a .
©
y o u r S n a m e s a g g re g lie n t a n
2 0 1 3 S A P
Q L in a tio d a
s ta te m th e v ie n fu n c ll e ld
e n t w . D tio n s fro
to m e n A V G m th
a k e e a n ( ) a e e
A G . A ll r ig h ts r e s e r v e d .
th a n ld
e e ld n a m e s g g r e g a t i o n o f e l d d a d d a G R O U P B Y l i s t .
1 2 7
U n it 4 : C o n s u m in g H A N A
V ie w s a n d P r o c e d u r e s in A B A P
H A 4 0 0
S o l u t io n 9 : A n a l y z e a v i e w d e n e d o n S A P H A N A a n d u s e it in a n a t iv e S Q L S E L E C T T a s k 1 : C o p y a n d u n d e r s t a n d t e m p l a t e C r e a t e a c o p y o f r e p o r t Y H A 4 0 0 _ H A N A _ V I E W _ T 1 i n y o u r p a c k a g e Z H A 4 0 0 _ # # ( s u g g e s t e d n a m e : Z H A 4 0 0 _ # # _ H V I E W _ 1 , w h e r e # # i s y o u r g r o u p n u m b e r ) . A c t i v a t e a n d e x e c u t e t h e p r o g r a m . 1 .
C r e a t e a c o p y o f t h e r e p o r t . P l a c e i t i n y o u r p a c k a g e Z H A 4 0 0 _ 0 0 a n d a s s i g n i t t o y o u r w o r k b e n c h t a s k . a )
2 .
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
A c t i v a t e a n d e x e c u t e t h e p r o g r a m . a )
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
T a s k 2 : F in d a n d a n a ly z e a S A P H A N A I f o a a
n th e S A P H A ro m ta b le s S C f d a y s b e tw e g g re g a tio n , y n d d o a little
1 .
N A S tu U S T O M en o rd e r e t. C h e c a n a ly s is
d io a d a k a o f
, s e a rc h fo r a v ie w th n d S B O O K , in c lu d in te a n d i g h t d a te . T h ll re le v a n t p r o p e rtie s th e v ie w ’s c o n te n t w
V ie w
a t c o n ta in s th e r e le g a c a lc u la te d e ld e v ie w s h o u ld n o t o f th e v ie w , d is p la ith th e d a ta p r e v ie w
v a n t in fo fo r th e n p r o v id e a y th e ra w t o o l .
r m a t i o n u m b e r n y d a t a
G o t o t h e S A P H A N A S t u d i o a n d s e a r c h t h e C o n t e n t f o r v ie w s h a v in g “ d a y s ” i n t h e i r n a m e s . H i n t : K e e p i n m i n d t h a t S A P H A N A u s e s “ % ” a s w i l d c a r d s y m b o l ( a s c o m m o n i n S Q L ) r a t h e r t h a n t h e “ * ” c h a r a c t e r k n o w n f r o m S A P G U I s e l e c t i o n s c r e e n s .
2 .
a )
I n th e N a v ig a to r w in d o w a n d c h o o s e F i n d .
o n t h e l e f t s i d e , r i g h t - c l i c k o n n o d e C o n t e n t
b )
E n t e r t h e s e a r c h s t r i n g ( e . g . “ % d a y s ” ) .
T h e l i s t c o n t a i n s t h e f o l l o w i n g v i e w s : A n s w e r :
A T _ D A Y S _ A H E A D C A _ C U S T _ W I T H _ A V G _ D A Y S _ A H E A D 3 .
B o t h v i e w s a r e l o c a t e d i n p a c k a g e A n s w e r : y h a 4 0 0 . d e m o
C o n t i n u e d o n n e x t p a g e
1 2 8
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : C o n s u m in g
4 .
S A P
H A N A
V ie w s in
A B A P
A c c o r d i n g t o n a m i n g c o n v e n t i o n s , w h i c h o f t h e v i e w s c a n y o u e x p e c t t o b e a n a t t r i b u t e v i e w ? A n s w e r : A T _ D A Y S _ A H E A D , a s A T s t a n d s f o r a t t r i b u t e v i e w .
5 .
6 .
C h o o s e t h e a t t r i b u t e v i e w a n d a n a l y z e i t s d e n i t i o n . a )
D o u b l e c l i c k t h e v i e w i n t h e s e a r c h r e s u l t o r c l i c k o n i t a n d c h o o s e O K .
b )
D o u b l e c l i c k o n D a t a F o u n d a t i o n t o s e e a g r a p h i c a l d i s p l a y o f t h e d a t a b a s e t a b l e s , t h e j o i n c o n d i t i o n s , t h e e l d s o f t h e o u t p u t a n d t h e i r o r i g i n . F i l t e r i c o n s i n d i c a t e e l d s w h e r e l t e r s a r e i n p l a c e .
c )
D o u b l e c l i c k o n o n e o f t h e j o i n l i n e s t o s e e t h e j o i n t y p e a n d t h e c a r d i n a l i t y .
d )
I n t h e o u t p u t - f r a m e o n t h e r i g h t , d o u b l e c l i c k o n t h e c a l c u l a t e d e l d D A Y S _ A H E A D t o s e e t h e c a l c u l a t i o n r u l e .
e )
D o u b l e c l i c k o n S e m a n t i c s t o s e e a l i s t o f t h e o u t p u t e l d s w i t h t h e i r v i s i b i l i t y a n d t h e i r c l a s s i c a t i o n a s k e y a t t r i b u t e s o r n o r m a l a t t r i b u t e s .
V S v c e d a
i e w A T _ D A Y S _ A H E A D i s b a s e d o n d a t a b a s e t a b l e s C U S T O M . T h e t a b l e s a r e jo i n e d b y a r e f e r e n t i a l jo i n o f i e w c o n s is ts o f 6 e ld s f r o m th e le f t t a b le , 5 e ld s f r o m a l c u l a t e d e l d . T h e c a l c u l a t e d e l d ’ s n a m e i s d a y s _ a h x p re s s io n r e a d s a s f o llo w s : d a y s b e tw e e n ( d a te (" O R D E a te (" F L D A T E " ) ) . T h e v ie w c o n ta in s o n e lte r c o n d itio r e s e le c te d w h e r e th e e ld C A N C E L L E D c o n ta in s th e r s t 5 e ld s a r e k e y e ld s . T h e e ld w ith n a m e O R D E R
S B O O K a n d c a r d i n a l i t y n . . 1 . T h e t h e r i g h t t a b l e a n d 1 e a d . I t ’ s c a l c u l a t i o n R _ D A T E " ) , n : O n l y s u c h e n t r i e s v a l u e ’ ’ . T h e v i e w s _ D A T E i s h i d d e n .
A n s w e r : A T _ D A Y S _ A H E A D , S B O O K , S C U S T O M , r e f e r e n t i a l , n . . 1 , 6 , 5 , d a y s _ a h e a d , d a y s b e t w e e n ( d a t e ( " O R D E R _ D A T E " ) , d a t e ( " F L D A T E " ) ) , C A N C E L L E D , ’ ’ , 5 , O R D E R _ D A T E
T a s k 3 : U s e th e S A P H A N A E s n f a
d it y o u b ro u a tiv e u rth e r g g re g
1 .
u r p ro g ra m . C o p y th e s o u rc e c o d t i n e g e t _ d a t a _ s o l u t i o n . I n s u b r o u S Q L S E L E C T th a t lls in te rn a l ta p r o c e s s in g . S e le c t f r o m th e v ie w a tio n ( c a lc u la tio n o f a v e r a g e ) in th
V ie w
in a n a t i v e S Q L S e le c t
e o f s u b r o u t i n e g e t _ d a t a _ t i n e g e t _ d a t a _ s o l u t i o n . I m b l e c t _ c u s t o m e r s d i r e c t l y y o u ju s t f o u n d a n d im p le e S E L E C T s t a t e m e n t .
te m p p le m w ith o m e n t
l a t e t o e n t a u t a n y t h e
C o p y t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e t o s u b r o u t i n e g e t _ d a t a _ s o l u t i o n a )
U s e C o p y &
P a s t e - f u n c t i o n o f t h e A B A P E d i t o r .
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 2 9
U n it 4 : C o n s u m in g H A N A
2 .
V ie w s a n d P r o c e d u r e s in A B A P
H A 4 0 0
I n s u b r o u t i n e g e t _ d a t a _ s o l u t i o n , c h a n g e t h e n a t i v e S Q L S t a t e m e n t . I n t h e F R O M - c l a u s e , r e p l a c e t h e j o i n o f t a b l e s S C U S T O M a n d S B O O K w i t h t h e v i e w y o u ju s t f o u n d . H i n t : R e m e m b e r t o s t a t e t h e v i e w ’ s n a m e w i t h i t ’ s c o m p l e t e p a t h , i . e . _ S Y S _ B I C / < p a c k a g e n a m e > . < s u b p a c k a g e n a m e > . . . / < v i e w n a m e > C a u t i o n : N a m e s o n S A P H A N A a r e c a s e s e n s i t i v e . B u t e v e r y t h i n g n o t i n c l u d e d i n “ ” w i l l b e t r a n s l a t e d t o u p p e r c a s e !
a ) 3 .
A c D a
S e e s o u rc e c o d e e x tra c t f ro m
d ju s t t o rre sp o A Y S _ A d d itio n
a ) 4 .
S e e s o u rc e c o d e e x tra c t f ro m
s ta te m th e v ie n fu n c ll e ld
e n t w . D tio n s fro
to m e n A V G m th
a k e e a n ( ) a e e
th a n ld
e e ld n a m e s g g r e g a t i o n o f e l d d a d d a G R O U P B Y l i s t .
m o d e l s o l u t i o n .
m o d e l s o l u t i o n .
R e p l a c e t a r g e t d a t a o b j e c t l t _ c u s t _ b o o k w i t h c t _ c u s t o m e r s . S e e s o u rc e c o d e e x tra c t f ro m
m o d e l s o l u t i o n .
R e m o v e t h e n o w s u p e r u o u s l o o p o v e r l t _ c u s t _ b o o k w i t h t h e c a l c u l a t i o n a n d a g g r e g a t i o n . a )
7 .
y o u r S Q L n a m e s in a g g re g a tio lie n t a n d a
R e m o v e e l d C A N C E L L E D f r o m t h e W H E R E - c l a u s e a s t h i s l t e r c o n d i t i o n i s a l r e a d y p a r t o f t h e v i e w ’ s d e n i t i o n .
a ) 6 .
e ld lis t o f to th e e ld E A D , u s i n g a t l is ts th e c
S e e s o u rc e c o d e e x tra c t f ro m
a ) 5 .
h e n d H th
m o d e l s o l u t i o n .
S e e s o u rc e c o d e e x tra c t f ro m
m o d e l s o l u t i o n .
A c t i v a t e a n d t e s t y o u r p r o g r a m . M a k e s u r e t h e t w o s u b r o u t i n e s d e l i v e r e x a c t l y t h e s a m e d a t a . a )
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
R e s u l t
S o u r c e c o d e e x t r a c t f r o m m o d e l s o l u t i o n ( P r o g r a m Y H A 4 0 0 _ U S E _ H A N A _ V I E W _ S 1 ) * & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * &
F o r m
g e t _ d a t a _ t e m p l a t e
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * F O R M
g e t _ d a t a _ t e m p l a t e
C H A N G I N G
c t _ c u s t o m e r s
T Y P E
t y _ t _ c u s t o m e r s .
C o n t i n u e d o n n e x t p a g e
1 3 0
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : C o n s u m in g
*
S A P
H A N A
V ie w s in
A B A P
D e c l a r a t i o n s
* * * * * * * * * * * * * * * * *
T y p e s
f o r
T Y P E S :
t a r g e t
B E G I N
*
l t y _ s _ c u s t _ b o o k ,
i d
T Y P E
s c u s t o m - i d ,
n a m e
T Y P E
s c u s t o m - n a m e ,
p o s t c o d e
T Y P E
s c u s t o m - p o s t c o d e ,
c i t y
T Y P E
s c u s t o m - c i t y ,
c o u n t r y
T Y P E
s c u s t o m - c o u n t r y ,
f l d a t e
T Y P E
s b o o k - f l d a t e ,
o r d e r _ d a t e
T Y P E
s b o o k - o r d e r _ d a t e ,
E N D *
O F
O F
l t y _ s _ c u s t _ b o o k .
W o r k
A r e a
D A T A
l s _ c u s t o m e r
T a r g e t s D A T A :
f i e l d s
f o r
f o r
R e s u l t L I K E
*
l t _ c u s t _ b o o k
h e l p
v a r i a b l e s
D A T A
l v _ c o u n t
A D B C
O b j e c t s
D A T A :
*
T Y P E T Y P E
T Y P E a n d
S T A N D A R D
T A B L E
O F
l t y _ s _ c u s t _ b o o k
W I T H
N O N - U N I Q U E
K E Y
l t y _ s _ c u s t _ b o o k .
i .
v a r i a b l e s T Y P E
R E F
T O
c l _ s q l _ c o n n e c t i o n ,
l o _ s q l
T Y P E
R E F
T O
c l _ s q l _ s t a t e m e n t ,
l o _ r e s u l t
T Y P E
R E F
T O
c l _ s q l _ r e s u l t _ s e t ,
l v _ s q l
T Y P E
s t r i n g ,
l r _ d a t a
T Y P E
R E F
T O
d a t a .
h a n d l i n g l x _ s q l _ e x c l v _ t e x t
*
c t _ c u s t o m e r s .
l o _ c o n
E c e p t i o n D A T A :
O F
S e l e c t
l s _ c u s t _ b o o k *
L I N E
T Y P E
T Y P E
R E F
T O
c x _ s q l _ e x c e p t i o n ,
s t r i n g .
P r o c e s s i n g
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * C L E A R
c t _ c u s t o m e r s .
T R Y .
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 3 1
i d ,
U n it 4 : C o n s u m in g H A N A
*
G e t
V ie w s a n d P r o c e d u r e s in A B A P
s e c o n d a r y l o _ c o n
*
C r e a t e
D B
=
H A 4 0 0
C o n n e c t i o n
c l _ s q l _ c o n n e c t i o n = > g e t _ c o n n e c t i o n (
c _ c o n
) .
s t a t e m e n t
C R E A T E
O B J E C T
l o _ s q l
E X P O R T I N G c o n _ r e f *
c r e a t e
S Q L
=
l o _ c o n .
s t a t e m e n t
C O N C A T E N A T E
` S E L E C T ` F R O M ` O N
C . I D ,
C . P O S T C O D E ,
S F L I G H T . S C U S T O M
C . M A N D T
` A N D
C . N A M E ,
C . I D
` W H E R E
=
=
A S
C
C . C I T Y ,
I N N E R
J O I N
C . C O U N T R Y ,
S F L I G H T . S B O O K
B . F L D A T E , A S
B `
B . M A N D T `
B . C U S T O M I D `
C . M A N D T
=
`
s y - m a n d t ` A N D
B . C A N C E L L E D
` O R D E R I N T O
A l t e r n a t i v e :
*
l v _ s q l
U s e =
B Y
| S E L E C T | F R O M
*
| O N
*
| W H E R E
*
| A N D
*
| O R D E R E x e c u t e
R e a d
r e s u l t G E T
t e m p l a t e s
C . I D ,
a n d
C . N A M E ,
S F L I G H T . S C U S T O M
C . M A N D T
=
C . M A N D T
B . M A N D T
s t r i n g A S
C
I N N E R
A N D
C . I D
{
s y - m a n d t
B . C A N C E L L E D
=
{
B Y
C . M A N D T ,
e x p r e s s i o n s
C . P O S T C O D E ,
=
=
S P A C E
C . I D
} }
|
J O I N =
|
C . C I T Y ,
C . C O U N T R Y
S F L I G H T . S B O O K
B . C U S T O M I D
|
|
& & A S
B
|
& &
& &
& & & &
| .
l o _ s q l - > e x e c u t e _ q u e r y (
i n t o
R E F E R E N C E
i n t e r n a l O F
l t _ c u s t _ b o o k
l o _ r e s u l t - > n e x t _ p a c k a g e ( l o _ r e s u l t - > c l o s e (
=
M E S S A G E
l v _ t e x t
) .
I N T O
l r _ d a t a .
l r _ d a t a
) .
) .
) .
c x _ s q l _ e x c e p t i o n
l v _ t e x t
l v _ s q l
T a b l e
l o _ r e s u l t - > s e t _ p a r a m _ t a b l e (
C A T C H
C . I D `
Q u e r y
l o _ r e s u l t *
C . M A N D T ,
' `
s p a c e .
s t r i n g
*
*
'
l v _ s q l
S E P A R A T E D *
B Y
=
I N T O
l x _ s q l _ e x c .
l x _ s q l _ e x c - > g e t _ t e x t ( T Y P E
"
E x c e p t i o n
C l a s s
f o r
S Q L
E r r o r
) .
' E ' .
E N D T R Y . S O R T
l t _ c u s t _ b o o k
B Y
i d .
C o n t i n u e d o n n e x t p a g e
1 3 2
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
B . O R D E R _ D A T E
H A 4 0 0
L e s s o n : C o n s u m in g
L O O P
A T
I F
l t _ c u s t _ b o o k
s y - t a b i x
=
I N T O
V ie w s in
A B A P
1 . =
l s _ c u s t o m e r - n a m e
l s _ c u s t _ b o o k - i d .
=
l s _ c u s t o m e r - p o s t c o d e
l s _ c u s t _ b o o k - n a m e .
=
l s _ c u s t o m e r - c i t y
l s _ c u s t _ b o o k - p o s t c o d e . =
l s _ c u s t o m e r - c o u n t r y
l s _ c u s t _ b o o k - c i t y .
=
l s _ c u s t _ b o o k - i d
l s _ c u s t _ b o o k - c o u n t r y .
< >
l s _ c u s t o m e r - i d .
l s _ c u s t o m e r - d a y s _ a h e a d I N S E R T
H A N A
l s _ c u s t _ b o o k .
l s _ c u s t o m e r - i d
E L S E I F
S A P
l s _ c u s t o m e r
=
r o u n d (
I N T O
C L E A R
l s _ c u s t o m e r .
C L E A R
l v _ c o u n t .
l s _ c u s t o m e r - i d
T A B L E
=
l s _ c u s t o m e r - n a m e
/
l v _ c o u n t
d e c
=
2
m o d e
c t _ c u s t o m e r s .
l s _ c u s t _ b o o k - p o s t c o d e . =
l s _ c u s t o m e r - c o u n t r y
l s _ c u s t o m e r - d a y s _ a h e a d
l s _ c u s t _ b o o k - n a m e .
=
l s _ c u s t o m e r - c i t y
=
l s _ c u s t _ b o o k - i d .
=
l s _ c u s t o m e r - p o s t c o d e
v a l
l s _ c u s t _ b o o k - c i t y .
=
l s _ c u s t _ b o o k - c o u n t r y .
E N D I F . l v _ c o u n t
=
l v _ c o u n t
+
1 .
l s _ c u s t o m e r - d a y s _ a h e a d
=
l s _ c u s t o m e r - d a y s _ a h e a d
+
l s _ c u s t _ b o o k - f l d a t e
-
l s _ c u s t _ b o o k - o
E N D L O O P . l s _ c u s t o m e r - d a y s _ a h e a d I N S E R T *
S O R T
l s _ c u s t o m e r c t _ c u s t o m e r s
=
I N T O B Y
r o u n d ( T A B L E
i d .
v a l
l s _ c u s t o m e r - d a y s _ a h e a d
/
l v _ c o u n t
d e c
=
c t _ c u s t o m e r s .
" a l r e a d y
E N D F O R M .
=
s o r t e d
"
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * &
F o r m
g e t _ d a t a _ s o l u t i o n
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * F O R M *
g e t _ d a t a _ s o l u t i o n
C H A N G I N G
c t _ c u s t o m e r s
T Y P E
t y _ t _ c u s t o m e r s .
D e c l a r a t i o n s
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 3 3
2
m o d e
=
c
U n it 4 : C o n s u m in g H A N A
*
*
V ie w s a n d P r o c e d u r e s in A B A P
W o r k
A r e a
D A T A
l s _ c u s t o m e r
L I K E
A D B C
O b j e c t s
v a r i a b l e s
D A T A :
*
f o r
R e s u l t
a n d
L I N E
O F
c t _ c u s t o m e r s .
l o _ c o n
T Y P E
R E F
T O
c l _ s q l _ c o n n e c t i o n ,
l o _ s q l
T Y P E
R E F
T O
c l _ s q l _ s t a t e m e n t ,
l o _ r e s u l t
T Y P E
R E F
T O
c l _ s q l _ r e s u l t _ s e t ,
l v _ s q l
T Y P E
s t r i n g ,
l r _ d a t a
T Y P E
R E F
E c e p t i o n D A T A :
T O
d a t a .
h a n d l i n g l x _ s q l _ e x c l v _ t e x t
*
H A 4 0 0
T Y P E
T Y P E
R E F
T O
c x _ s q l _ e x c e p t i o n ,
s t r i n g .
P r o c e s s i n g
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * C L E A R
c t _ c u s t o m e r s .
T R Y . l o _ c o n
=
c l _ s q l _ c o n n e c t i o n = > g e t _ c o n n e c t i o n (
C R E A T E
O B J E C T
c _ c o n
) .
l o _ s q l
E X P O R T I N G c o n _ r e f *
c r e a t e
S Q L
=
l o _ c o n .
s t a t e m e n t
l v _ s q l
=
| S E L E C T | F R O M
l o _ r e s u l t G E T
I D ,
N A M E ,
P O S T C O D E ,
M A N D T
| G R O U P
B Y
M A N D T ,
I D ,
| O R D E R
B Y
M A N D T ,
I D
=
{
s y - m a n d t
O F
l o _ r e s u l t - > n e x t _ p a c k a g e ( l o _ r e s u l t - > c l o s e ( C A T C H
=
M E S S A G E
l v _ t e x t
|
A S
D A Y S _ A H E A D
& &
& &
P O S T C O D E ,
C I T Y ,
C O U N T R Y
|
& &
I N T O
l v _ s q l
) .
l r _ d a t a .
l r _ d a t a
) .
) .
) .
c x _ s q l _ e x c e p t i o n
l v _ t e x t
|
A V G ( D A Y S _ A H E A D )
| .
c t _ c u s t o m e r s
l o _ r e s u l t - > s e t _ p a r a m _ t a b l e (
}
N A M E ,
l o _ s q l - > e x e c u t e _ q u e r y (
R E F E R E N C E
C O U N T R Y ,
_ S Y S _ B I C . " y h a 4 0 0 . d e m o / A T _ D A Y S _ A H E A D "
| W H E R E
=
C I T Y ,
I N T O
l x _ s q l _ e x c .
l x _ s q l _ e x c - > g e t _ t e x t ( T Y P E
"
E x c e p t i o n
C l a s s
f o r
S Q L
E r r o r
) .
' E ' .
E N D T R Y .
C o n t i n u e d o n n e x t p a g e
1 3 4
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
|
& &
H A 4 0 0
L e s s o n : C o n s u m in g
E N D F O R M .
2 0 1 3
S A P
H A N A
V ie w s in
A B A P
"
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 3 5
U n it 4 : C o n s u m in g H A N A
1 3 6
V ie w s a n d P r o c e d u r e s in A B A P
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
H A 4 0 0
2 0 1 3
H A 4 0 0
L e s s o n : C o n s u m in g
S A P
H A N A
V ie w s in
A B A P
E x e r c i s e 1 0 : C a l l a S A P H A N A v i e w w i t h a n i n p u t p a r a m e t e r i n a n a t i v e S Q L S E L E C T E x e r c i s e O b j e c t i v e s A f t e r c o m p l e t i n g t h i s e x e r c i s e , y o u w i l l b e a b l e t o : •
a n a l y z e a n d u n d e r s t a n d s c r i p t e d c a l c u l a t i o n v i e w s d e n e d o n S A P H A N A
•
k n o w h o w
to p ro v id e v a lu e s fo r in p u t p a ra m e te rs o f S A P H A N A
v ie w s
B u s i n e s s E x a m p l e T e m p l a t e :
R e p o r t Y H A 4 0 0 _ U S E _ H A N A _ V I E W T 2 S o l u t i o n :
R e p o rt Y H A 4 0 0 _ U S E _ H A N A _ V IE W
_ S 2
T a s k 1 : C o p y a n d u n d e r s t a n d t e m p l a t e C r e a t e a c o p y o f r e p o r t Y H A 4 0 0 _ H A N A _ V I E W _ T 2 i n y o u r p a c k a g e Z H A 4 0 0 _ # # ( s u g g e s t e d n a m e : Z H A 4 0 0 _ # # _ H V I E W _ 2 , w h e r e # # i s y o u r g r o u p n u m b e r ) . A c t i v a t e a n d e x e c u t e t h e p r o g r a m . 1 .
C r e a t e a c o p y o f t h e r e p o r t . P l a c e i t i n y o u r p a c k a g e Z H A 4 0 0 _ 0 0 a n d a s s i g n i t t o y o u r w o r k b e n c h t a s k .
2 .
A n a l y z e t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e . P a y s p e c i a l a tt e n t i o n t o t h e W H E R E - c la u s e o f t h e S E L E C T s t a t e m e n t .
3 .
W h a t i s d i f f e r e n t t o t h e p r o g r a m s u s e d i n t h e p r e v i o u s e x e r c i s e s ?
4 .
A c t i v a t e a n d e x e c u t e t h e p r o g r a m .
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 3 7
U n it 4 : C o n s u m in g H A N A
V ie w s a n d P r o c e d u r e s in A B A P
H A 4 0 0
T a s k 2 : A n a l y z e a s c r i p t e d c a l c u l a t i o n v i e w I C v d
n th A _ ie w a ta
e S A P C U S T , d is p l p re v ie
H A N _ W IT a y th e w to o
A
S t u d i o , a n a l y z e t h e d e n i t i o n o f t h e s c r i p t e d c a l c u l a t i o n v i e w H _ A V G _ D A Y S _ A H E A D . C h e c k a l l r e l e v a n t p r o p e r t i e s o f t h e r a w d a t a a n d d o a l i t t l e a n a l y s i s o f t h e v i e w ’ s c o n t e n t w i t h t h e l .
1 .
G o t o t h e S A P H A N A S tu d i o , s e a r c h f o r v i e w C A _ C U S T _ W I T H _ A V G _ D A Y S _ A H E A D a n d o p e n i t s d e n i t i o n .
2 .
A n a l y z e t h e v i e w s d e n i t i o n .
3 .
V ie w C A _ C U S T _ W IT H _ A V G _ D A Y S _ A H E A c a lc u la tio n v ie w . T h e s c r ip t h a s in p u t p a . T p a r a m e t e r v a r _ o u t h a s c o m p o n e n ts . T h e A ll d a ta
a re
s e le c te d
D
i s a s c r i p t e d r a m e t e r n a m e d h e s c r i p t ’ s o u t p u t s c r i p t r s t d e c i d e s ,
f r o m .
T h e V ie w s o u tp u t c o n s is ts o f e l d s , a l l o f w h ic h a r e m a p p e d t o t h e c o m p o n e n ts o f . . O n e o f th e v ie w
e ld s is c la s s i e d a s .
, th e r e s t a r e
F i l l i n t h e b l a n k s t o c o m p l e t e t h e s e n t e n c e .
T a s k 3 : U s e th e S A P H A N A E s S C p
d it u b r Q L A _ a ra
y o u r p ro g ra m o u t i n e g e t _ d a S E L E C T fro C U S T _ W IT H m e t e r F L I G H
. C o p y th ta _ s o lu tio m A T _ D A _ A V G _ D T S _ B E F O
V ie w
e s o u rc e c o d e o f su b n . I n s u b r o u t i n e g e t _ Y S _ A H E A D w ith a A Y S _ A H E A D . M a k R E w i t h t h e c u r r e n t
in a n a t iv e S Q L S e le c t r o u t i n e g e t _ d a t a _ t e m p l a t e t o d a t a _ s o l u t i o n . R e p l a c e t h e n a t i v e s e l e c t f r o m c a l c u l a t i o n v i e w e s u r e t o s u p p l y t h e v i e w ’ s i n p u t d a t e .
1 .
C o p y t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e t o s u b r o u t i n e g e t _ d a t a _ s o l u t i o n
2 .
I n s u b r o u t i n e g e t _ d a t a _ s o l u t i o n , c h a n g e t h e n a t i v e S Q L S t a t e m e n t . I n t h e F R O M - c l a u s e , r e p l a c e t h e a t t r i b u t e v i e w w i t h t h e c a l c u l a t i o n v i e w y o u j u s t f o u n d .
3 .
A d ju s t t h e c a lc u la tio n s c rip t, r e m a d d itio n . A in s id e th e
e ld lis t o f y o u r S Q v ie w . B e c a u s e th e o v e th e a g g re g a tio n ls o re m o v e th e O R v i e w .
L s ta te m a g g re g a fu n c tio D E R B Y
e n t to m a tc h th e e ld n a tio n is a lr e a d y d o n e in th n A V G ( ) a n d th e G R O U a d d itio n a s it t o o is p a rt
m e s o f t h e e v i e w ’ s P B Y o f t h e s c r i p t
C o n t i n u e d o n n e x t p a g e
1 3 8
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : C o n s u m in g
4 .
S A P
H A N A
S u p p l y th e v ie w s in p u t p a r a m e te r w it h th e c u r r e n t d a te f r o m ( s y - d a t u m )
V ie w s in
s y s te m
A B A P
e l d
H i n t : T h e H A N A n a t i v e S Q L s y n t a x i s ( ’ P L A C E - H O L D E R ’ = ( ’ $ $ F L I G H T S _ B E F O R E $ $ ’ , ’ < v a l u e > ’ ) ) , w h e r e < v a l u e > s t a n d s f o r t h e c u r r e n t d a t e i n i n t e r n a l f o r m a t .
5 .
2 0 1 3
A c t i v a t e a n d t e s t y o u r p r o g r a m . M a k e s u r e t h e t w o s u b r o u t i n e s d e l i v e r e x a c t l y t h e s a m e d a t a .
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 3 9
U n it 4 : C o n s u m in g H A N A
V ie w s a n d P r o c e d u r e s in A B A P
H A 4 0 0
S o l u t i o n 1 0 : C a l l a S A P H A N A v i e w w i t h a n i n p u t p a r a m e t e r i n a n a t i v e S Q L S E L E C T T a s k 1 : C o p y a n d u n d e r s t a n d t e m p l a t e C r e a t e a c o p y o f r e p o r t Y H A 4 0 0 _ H A N A _ V I E W _ T 2 i n y o u r p a c k a g e Z H A 4 0 0 _ # # ( s u g g e s t e d n a m e : Z H A 4 0 0 _ # # _ H V I E W _ 2 , w h e r e # # i s y o u r g r o u p n u m b e r ) . A c t i v a t e a n d e x e c u t e t h e p r o g r a m . 1 .
C r e a t e a c o p y o f t h e r e p o r t . P l a c e i t i n y o u r p a c k a g e Z H A 4 0 0 _ 0 0 a n d a s s i g n i t t o y o u r w o r k b e n c h t a s k . a )
2 .
A n a l y z e t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e . P a y s p e c i a l a tt e n ti o n t o t h e W H E R E - c la u s e o f t h e S E L E C T s t a te m e n t . a )
3 .
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
W h a t i s d i f f e r e n t t o t h e p r o g r a m s u s e d i n t h e p r e v i o u s e x e r c i s e s ? A n s w e r : O n l y s u c h b o o k i n g s a r e t a k e n i n t o a c c o u n t w h e r e t h e i g h t d a t e l i e s i n t h e p a s t .
4 .
A c t i v a t e a n d e x e c u t e t h e p r o g r a m . a )
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
T a s k 2 : A n a l y z e a s c r i p t e d c a l c u l a t i o n v i e w I C v d
n th A _ ie w a ta
1 .
e S A P C U S T , d is p l p re v ie
A
S t u d i o , a n a l y z e t h e d e n i t i o n o f t h e s c r i p t e d c a l c u l a t i o n v i e w H _ A V G _ D A Y S _ A H E A D . C h e c k a l l r e l e v a n t p r o p e r t i e s o f t h e r a w d a t a a n d d o a l i t t l e a n a l y s i s o f t h e v i e w ’ s c o n t e n t w i t h t h e l .
G o t o t h e S A P H A N A S tu d i o , s e a r c h f o r v i e w C A _ C U S T _ W I T H _ A V G _ D A Y S _ A H E A D a n d o p e n i t s d e n i t i o n . a )
2 .
H A N _ W IT a y th e w to o
P e rfo rm
t h i s s t e p a s b e f o r e .
A n a l y z e t h e v i e w s d e n i t i o n . a )
D o u b l e c l i c k o n S c r i p t _ . . . t o s e e t h e S Q L s c r i p t i n s i d e t h e v i e w , t h e o u t p u t p a r a m e t e r o f t h e s c r i p t a n d i t s i n p u t p a r a m e t e r s .
b )
D o u b l e c l i c k o n O u t p u t t o s e e h o w t h e c o m p o n e n t s o f t h e s c r i p t ’ s i n p u t p a r a m e t e r a r e m a p p e d t o e l d s o f t h e c a l c u l a t i o n v i e w .
C o n t i n u e d o n n e x t p a g e
1 4 0
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : C o n s u m in g
3 .
S A P
H A N A
V ie w s in
A B A P
V i e w C A _ C U S T _ W I T H _ A V G _ D A Y S _ A H E A D i s a s c r i p te d c a l c u la t i o n v i e w . T h e s c r i p t h a s 1 i n p u t p a r a m e t e r n a m e d F L I G H T S _ B E F O R E . T h e s c r i p t ’ s o u t p u t p a r a m e t e r v a r _ o u t h a s 7 c o m p o n e n t s . T h e s c r i p t r s t d e c i d e s , w h e t h e r t h e i n p u t p a r a m e t e r c o n t a i n s a n o n - i n i t i a l v a l u e o r n o t . A l l d a t a a r e s e l e c t e d f r o m a t t r i b u t e v i e w A T _ D A Y S _ A H E A D . T h e V i e w s o u t p u t c o n s i s t s o f 7 e l d s , a l l o f w h i c h a r e m a p p e d t o t h e c o m p o n e n t s o f t h e s c r i p t s o u t p u t p a r a m e t e r v a r _ o u t . . O n e o f t h e v i e w e l d s i s c l a s s i e d a s M e a s u r e , t h e r e s t a r e A t t r i b u t e s . A n s w e r : 1 , F L I G H T S _ B E F O R E , 7 , w h e t h e r t h e i n p u t p a r a m e t e r c o n t a i n s a n o n - i n i t i a l v a l u e o r n o t , a t t r i b u t e v i e w A T _ D A Y S _ A H E A D , 7 , t h e s c r i p t s o u t p u t p a r a m e t e r v a r _ o u t , M e a s u r e , A t t r i b u t e s
T a s k 3 : U s e th e S A P H A N A E s S C p
d it u b r Q L A _ a ra
1 .
y o u r p ro g ra m o u t i n e g e t _ d a S E L E C T fro C U S T _ W IT H m e t e r F L I G H
U s e C o p y &
P a s t e - f u n c t i o n o f t h e A B A P E d i t o r .
S e e s o u r c e c o d e e x tr a c t f r o m
A d ju s t t h e c a lc u l a tio n s c r ip t, r e m a d d itio n . A in s id e th e a )
4 .
b r o u t i n e g e t _ d a t a _ t e m p l a t e t o t _ d a t a _ s o l u t i o n . R e p l a c e t h e n a t i v e a s e l e c t f r o m c a l c u l a t i o n v i e w k e s u r e t o s u p p ly t h e v ie w ’ s i n p u t t d a t e .
I n s u b r o u t i n e g e t _ d a t a _ s o l u t i o n , c h a n g e t h e n a t i v e S Q L S t a t e m e n t . I n t h e F R O M - c l a u s e , r e p l a c e t h e a t t r i b u t e v i e w w i t h t h e c a l c u l a t i o n v i e w y o u j u s t f o u n d . a )
3 .
e so u rc e c o d e o f su n . I n s u b r o u t i n e g e Y S _ A H E A D w ith A Y S _ A H E A D . M a R E w i t h t h e c u r r e n
in a n a t i v e S Q L S e le c t
C o p y t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e t o s u b r o u t i n e g e t _ d a t a _ s o l u t i o n a )
2 .
. C o p y th ta _ s o lu tio m A T _ D A _ A V G _ D T S _ B E F O
V ie w
e ld lis t v ie w . B o v e th e a ls o re m o v i e w .
o f y o u r S Q e c a u s e th e g g re g a tio n v e th e O R
m o d e l s o l u t i o n .
L s ta te m a g g re g a fu n c tio D E R B Y
S e e s o u r c e c o d e e x tr a c t f r o m
e n t to m tio n is a n A V G ( a d d itio
a tc h th e e ld n a lr e a d y d o n e in th ) a n d th e G R O U n a s it to o is p a rt
m e s o f t h e e v i e w ’ s P B Y o f t h e s c r i p t
m o d e l s o l u t i o n .
S u p p l y th e v ie w s in p u t p a r a m e te r w it h th e c u r r e n t d a te f r o m ( s y - d a t u m )
s y s te m
e l d
H i n t : T h e H A N A n a t i v e S Q L s y n t a x i s ( ’ P L A C E - H O L D E R ’ = ( ’ $ $ F L I G H T S _ B E F O R E $ $ ’ , ’ < v a l u e > ’ ) ) , w h e r e < v a l u e > s t a n d s f o r t h e c u r r e n t d a t e i n i n t e r n a l f o r m a t .
a )
S e e s o u r c e c o d e e x tr a c t f r o m
m o d e l s o l u t i o n . C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 4 1
U n it 4 : C o n s u m in g H A N A
5 .
V ie w s a n d P r o c e d u r e s in A B A P
H A 4 0 0
A c t i v a t e a n d t e s t y o u r p r o g r a m . M a k e s u r e t h e t w o s u b r o u t i n e s d e l i v e r e x a c t l y t h e s a m e d a t a . a )
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
R e s u l t
S o u r c e c o d e e x t r a c t f r o m m o d e l s o l u t i o n ( P r o g r a m Y H A 4 0 0 _ U S E _ H A N A _ V I E W _ S 2 ) * & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * &
F o r m
g e t _ d a t a _ t e m p l a t e
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * F O R M *
g e t _ d a t a _ t e m p l a t e
C H A N G I N G
c t _ c u s t o m e r s
T Y P E
t y _ t _ c u s t o m e r s .
D e c l a r a t i o n s
* * * * * * * * * * * * * * * * *
*
W o r k
A r e a
D A T A
l s _ c u s t o m e r
L I K E
A D B C
O b j e c t s
v a r i a b l e s
D A T A :
*
R e s u l t
a n d
O F
c t _ c u s t o m e r s .
T Y P E
R E F
T O
c l _ s q l _ c o n n e c t i o n ,
l o _ s q l
T Y P E
R E F
T O
c l _ s q l _ s t a t e m e n t ,
l o _ r e s u l t
T Y P E
R E F
T O
c l _ s q l _ r e s u l t _ s e t ,
l v _ s q l
T Y P E
s t r i n g ,
l r _ d a t a
T Y P E
R E F
T O
d a t a .
h a n d l i n g l x _ s q l _ e x c l v _ t e x t
*
L I N E
l o _ c o n
E c e p t i o n D A T A :
f o r
T Y P E
T Y P E
R E F
T O
c x _ s q l _ e x c e p t i o n ,
s t r i n g .
P r o c e s s i n g
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * C L E A R
c t _ c u s t o m e r s .
T R Y . l o _ c o n
=
c l _ s q l _ c o n n e c t i o n = > g e t _ c o n n e c t i o n (
C R E A T E
O B J E C T
c _ c o n
) .
l o _ s q l
E X P O R T I N G
C o n t i n u e d o n n e x t p a g e
1 4 2
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : C o n s u m in g
c o n _ r e f *
c r e a t e
S Q L
=
V ie w s in
A B A P
l o _ c o n .
=
| S E L E C T | F R O M
l o _ r e s u l t
I D ,
N A M E ,
P O S T C O D E ,
C I T Y ,
C O U N T R Y ,
_ S Y S _ B I C . " y h a 4 0 0 . d e m o / A T _ D A Y S _ A H E A D "
| W H E R E
M A N D T
=
{
s y - m a n d t
}
|
& &
| A N D
F L D A T E
<
{
s y - d a t u m
}
|
& &
| G R O U P
B Y
M A N D T ,
I D ,
| O R D E R
B Y
M A N D T ,
I D
=
N A M E ,
O F
c t _ c u s t o m e r s
l o _ r e s u l t - > s e t _ p a r a m _ t a b l e ( l o _ r e s u l t - > n e x t _ p a c k a g e ( l o _ r e s u l t - > c l o s e (
=
M E S S A G E
l v _ t e x t
C I T Y ,
|
A S
D A Y S _ A H E A D
& &
C O U N T R Y
|
& &
I N T O
l r _ d a t a
l v _ s q l
) .
l r _ d a t a . ) .
) .
) .
c x _ s q l _ e x c e p t i o n
l v _ t e x t
P O S T C O D E ,
A V G ( D A Y S _ A H E A D )
| .
l o _ s q l - > e x e c u t e _ q u e r y (
R E F E R E N C E
C A T C H
H A N A
s t a t e m e n t
l v _ s q l
G E T
S A P
I N T O
l x _ s q l _ e x c .
l x _ s q l _ e x c - > g e t _ t e x t ( T Y P E
"
E x c e p t i o n
C l a s s
f o r
S Q L
E r r o r
) .
' E ' .
E N D T R Y . E N D F O R M .
"
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * &
F o r m
g e t _ d a t a _ s o l u t i o n
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * F O R M
*
g e t _ d a t a _ s o l u t i o n
C H A N G I N G
c t _ c u s t o m e r s
T Y P E
t y _ t _ c u s t o m e r s .
D e c l a r a t i o n s
* * * * * * * * * * * * * * * * *
*
W o r k
A r e a
D A T A
l s _ c u s t o m e r
L I K E
A D B C
O b j e c t s
v a r i a b l e s
D A T A :
*
R e s u l t
a n d
L I N E
O F
c t _ c u s t o m e r s .
l o _ c o n
T Y P E
R E F
T O
c l _ s q l _ c o n n e c t i o n ,
l o _ s q l
T Y P E
R E F
T O
c l _ s q l _ s t a t e m e n t ,
l o _ r e s u l t
T Y P E
R E F
T O
c l _ s q l _ r e s u l t _ s e t ,
l v _ s q l
T Y P E
s t r i n g ,
l r _ d a t a
T Y P E
R E F
E c e p t i o n D A T A :
f o r
T O
d a t a .
h a n d l i n g l x _ s q l _ e x c
T Y P E
R E F
T O
c x _ s q l _ e x c e p t i o n ,
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 4 3
|
U n it 4 : C o n s u m in g H A N A
V ie w s a n d P r o c e d u r e s in A B A P
l v _ t e x t *
T Y P E
H A 4 0 0
s t r i n g .
P r o c e s s i n g
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * C L E A R
c t _ c u s t o m e r s .
T R Y . l o _ c o n
=
c l _ s q l _ c o n n e c t i o n = > g e t _ c o n n e c t i o n (
C R E A T E
O B J E C T
c _ c o n
) .
l o _ s q l
E X P O R T I N G c o n _ r e f *
c r e a t e
S Q L
=
l o _ c o n .
s t a t e m e n t
l v _ s q l
=
| S E L E C T | F R O M
I D ,
N A M E ,
P O S T C O D E ,
C I T Y ,
C O U N T R Y ,
_ S Y S _ B I C . " y h a 4 0 0 . d e m o / C A _ C U S T _ W I T H _ A V G _ D A Y S _ A H E A D "
| ( ' P L A C E H O L D E R ' = ( ' $ $ F L I G H T S _ B E F O R E $ $ ' , ' { | W H E R E l o _ r e s u l t G E T
=
M A N D T
=
{
s y - m a n d t
l o _ s q l - > e x e c u t e _ q u e r y (
R E F E R E N C E
O F
c t _ c u s t o m e r s
l o _ r e s u l t - > s e t _ p a r a m _ t a b l e ( l o _ r e s u l t - > n e x t _ p a c k a g e ( l o _ r e s u l t - > c l o s e ( C A T C H
A V G _ D A Y S _ A H E A D
=
M E S S A G E
l v _ t e x t
} ' ) )
|
|
D A Y S _ A H E A D & &
& &
| .
l v _ s q l
) .
l r _ d a t a .
l r _ d a t a
) .
) .
) .
c x _ s q l _ e x c e p t i o n
l v _ t e x t
I N T O
}
s y - d a t u m
A S
I N T O
l x _ s q l _ e x c .
l x _ s q l _ e x c - > g e t _ t e x t ( T Y P E
"
E x c e p t i o n
C l a s s
f o r
S Q L
E r r o r
) .
' E ' .
E N D T R Y . E N D F O R M .
1 4 4
"
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
|
& &
H A 4 0 0
L e s s o n : C o n s u m in g
S A P
H A N A
V ie w s in
A B A P
L e s s o n S u m m a r y Y o u s h o u l d n o w b e a b l e t o : •
2 0 1 3
C o n su m e H A N A
©
v ie w s in A B A P
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 4 5
U n it 4 : C o n s u m in g H A N A
L e s s o n :
V ie w s a n d P r o c e d u r e s in A B A P
C a llin g S A P L e s s o n
H A N A
H A 4 0 0
P r o c e d u r e s i n A B A P
O v e r v i e w
L e s s o n O b j e c t i v e s A f t e r c o m p l e t i n g t h i s l e s s o n , y o u w i l l b e a b l e t o : •
C a ll H A N A
p r o c e d u r e s i n A B A P
B u s i n e s s E x a m p l e
F ig u r e 6 4 : C a llin g H A N A
1 4 6
©
2 0 1 3 S A P
P r o c e d u r e s w i t h O v e r v i e w
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
2 0 1 3
L e s s o n : C a llin g
S A P
H A N A
P r o c e d u r e s in
F ig u r e 6 5 : C a llin g H A N A
P r o c e d u r e s – R e t r i e v e o n e R e s u l t S e t
F ig u r e 6 6 : C a llin g H A N A
P r o c e d u r e s w it h O v e r v ie w
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
A B A P
– N a t i v e S Q L S y n t a x
1 4 7
U n it 4 : C o n s u m in g H A N A
V ie w s a n d P r o c e d u r e s in A B A P
H A 4 0 0
F ig u r e 6 7 : C o d i n g E x a m p le : C a llin g H A N A
F ig u r e 6 8 : C o d in g
1 4 8
©
E x a m p le : R e tr ie v in g
2 0 1 3 S A P
P r o c e d u r e w i t h O v e r v ie w
R e s u lt f ro m
A G . A ll r ig h ts r e s e r v e d .
O v e r v i e w
2 0 1 3
H A 4 0 0
L e s s o n : C a llin g
S A P
H A N A
P r o c e d u r e s in
A B A P
E x e r c i s e 1 1 : A n a l y z e a s t o r e d p r o c e d u r e d e n e d o n S A P H A N A a n d c a ll it in a n a t i v e S Q L s t a t e m e n t E x e r c i s e O b j e c t i v e s A f t e r c o m p l e t i n g t h i s e x e r c i s e , y o u w i l l b e a b l e t o : •
a n a l y z e a n d u n d e r s t a n d s t o r e d p r o c e d u r e s d e n e d o n S A P H A N A
•
c a ll S A P H A N A
s t o r e d p r o c e d u r e s v ia n a t i v e S Q L
B u s i n e s s E x a m p l e T e m p l a t e :
R e p o r t Y H A 4 0 0 _ C A L L _ P R O C E D U R E _ T 1 S o l u t i o n :
R e p o r t Y H A 4 0 0 _ C A L L _ P R O C E D U R E _ S 1
T a s k 1 : C o p y a n d u n d e r s t a n d t e m p l a t e C r e a t e a c o p y o f r e p o r t Y H A 4 0 0 _ C A L L _ P R O C E D U R E _ T 1 i n y o u r p a c k a g e Z H A 4 0 0 _ # # ( s u g g e s t e d n a m e : Z H A 4 0 0 _ # # _ H P R O C _ 1 , w h e r e # # i s y o u r g r o u p n u m b e r ) . A n a l y z e t h e s o u r c e c o d e , a c t i v a t e a n d e x e c u t e t h e p r o g r a m . 1 .
C r e a t e a c o p y o f t h e r e p o r t . P l a c e i t i n y o u r p a c k a g e Z H A 4 0 0 _ 0 0 a n d a s s i g n i t t o y o u r w o r k b e n c h t a s k .
2 .
A n a l y z e t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e . P a y s p e c i a l a t t e n t i o n t o t h e c h a n g i n g p a r a m e t e r s o f t h e r o u t i n e a n d h o w t h e y a r e l l e d w i t h d a t a .
3 .
W h a t i s th e m a in d if f e r e n c e b e tw e e n th is p ro g ra m b e f o r e ?
4 .
A c t i v a t e a n d e x e c u t e t h e p r o g r a m .
a n d t h e o n e s w e u s e d
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 4 9
U n it 4 : C o n s u m in g H A N A
V ie w s a n d P r o c e d u r e s in A B A P
H A 4 0 0
T a s k 2 : A n a ly z e a S A P H A N A
s t o r e d p r o c e d u r e
I n t h e S A P H A N A S t u d i o , a n a l y z e t h e d e n i t i o n o f t h e s t o r e d p r o c e d u r e S P _ E A R L Y _ B I R D _ A N D _ L A S T _ M I N U T E . C h e c k a l l r e l e v a n t p r o p e r t i e s o f t h e p r o c e d u r e . 1 .
G o t o t h e S A P H A N A S t u d i o , s e a r c h f o r p r o c e d u r e S P _ E A R L Y _ B I R D _ A N D _ L A S T _ M I N U T E a n d o p e n i t s d e n i - t i o n .
2 .
A n a l y z e t h e p r o c e d u r e ’ s d e n i t i o n .
3 .
S to r e d p r o c e d u r e S P _ E A R L Y _ B I R D _ A N D _ L A S T _ M I N U T E h a s in p u t p a r a m e te r s o f n a m e . T h e y a r e u s e d t o T h e s c rip t h a s
o u tp u t p a r a m e t e r s n a m e d a n d E T _ L A S T _ M I N U T E . T h e s c r i p t c o n t a i n s t w o s e l e c t s t a t e m e n t s w h i c h l o o k a l m o s t i d e n t i c a l . T h e o n l y d i f f e r e n c e i s F i l l i n t h e b l a n k s t o c o m p l e t e t h e s e n t e n c e .
T a s k 3 : C a ll th e S A P H A N A S t a t e m e n t E s a O U f
d it y o u r p ro g ra m . C o p y th e s o u rc e u b r o u t i n e g e t _ d a t a _ s o l u t i o n . I n s u b n a tiv e S Q L S ta te m e n t th a t c a lls th e V E R V I E W t o r e c e i v e r s t a l i s t o f n s in g th is lis t, r e trie v e th e c o n te n t o f r o m t h e d a t a b a s e .
P r o c e d u r e i n a n a t i v e S Q L
c o d e o f s u b r o u t i n e g e t _ d r o u t i n e g e t _ d a t a _ s o l u t i o s to r e d p r o c e d u r e . U s e a a m e /v a lu e p a ir s f o r th e e th e e x p o r t p a ra m e te r s v ia
a ta _ te m p n . I m p l e m d d i t i o n W x p o rt p a ra n a tiv e S Q
l a t e t o e n t I T H m e t e r s . L S e l e c t s
1 .
C o p y t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e t o s u b r o u t i n e g e t _ d a t a _ s o l u t i o n
2 .
I n s u b r o u t i n e g e t _ d a t a _ s o l u t i o n , r e p l a c e t h e s t r i n g w i t h t h e n a t i v e S Q L S E L E C T w i t h c a l l o f t h e s t o r e d p r o c e d u r e . U s e a d d i t i o n W I T H O V E R V I E W .
H in T h e th e m tw o su p p
t : T h e p r o c e d u r e e x p e rs t tw o a re in p u t p a r ( c o n t e n t o f d a t a o b je p a r a m e te rs c o r r e s p o n d lie d w ith “ n u ll” w h e n
c ts f o u r p a r a m e te rs s e p a a m e te rs . P r o v i d e s u ita b c t s p v _ n u m b e r a n d s y - m to th e o u t p u t p a r a m e te u s i n g a d d i t i o n W I T H O
r a t e d b y c o l o n s . l e v a l u e s f o r a n d t ) . T h e l a s t r s . t h e y c a n b e V E R V I E W .
C o n t i n u e d o n n e x t p a g e
1 5 0
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
2 0 1 3
L e s s o n : C a llin g
S A P
H A N A
P r o c e d u r e s in
A B A P
3 .
D e n e a n i n t e r n a l t a b l e w i t h t w o c o l u m n s o f t y p e s t r i n g . ( s u g g e s t e d n a m e f o r t h e t a b l e : l t _ o v e r v i e w , s u g g e s t e d n a m e s f o r t h e c o l u m n s : p a r a m a n d v a l u e ) . R e p l a c e t a r g e t d a t a o b j e c t c t _ c u s t _ l a t e w i t h t h i s n e w i n t e r n a l t a b l e . .
4 .
A R c c B d S
5 .
A fte lin e p a r a F R O p a r a
6 .
A c t i v a t e a n d t e s t y o u r p r o g r a m . U s e t h e d e b u g g e r t o a n a l y z e t h e c o n t e n t o f t h e o v e r v i e w t a b l e a n d t h e r e t r i e v a l o f t h e p r o c e d u r e s r e s u l t s . M a k e s u r e t h e t w o s u b r o u t i n e s d e l i v e r e x a c t l y t h e s a m e d a t a .
fte r E A D o n ta o n te y th a ta b E L E
y o u c lo s e d th e r s t q u e r y T A B L E t o r e a d t h e l i n e in s th e n a m e o f p r o c e d u r e n t o f c o l u m n v a l u e i n t h e a t y o u re a d th e c o n te n t o f a s e . U s e th e s u b r o u tin e s p C T - s t a t e m e n t .
r y o u c lo s e d f r o m l t _ o v e r m e t e r E T _ L A M -c la u s e o f m e t e r c t _ c u s
©
th is s e c o v i e w w h S T _ M IN a n a tiv e t _ l a t e a s
2 0 1 3 S A P
n d e re U S Q th
w ith th e c a ll o f th e p ro c e d u re , u s e s ta f r o m l t _ o v e r v i e w w h e r e c o l u m n p a r p a r a m e t e r E T _ E A R L Y _ B I R D S . U s e F R O M -c la u se o f a n a tiv e S Q L S E L E th e p r o c e d u r e s e x p o r t p a ra m e te r f r o m a r a m e t e r c t _ c u s t _ e a r l y a s t a r g e t f o r
q u e r y , u s e s t a t e m e n t R E c o l u m n p a r a m c o n t a i n s T E . A g a i n , u s e t h e c o n t e n L S E L E C T . B u t th is tim e ta rg e t f o r th e S E L E C T -
A G . A ll r ig h ts r e s e r v e d .
A D T A B L E t o th e n a m e o f p r t o f c o l u m n v a e u s e th e s u b ro s t a t e m e n t .
t e m e n t a m t h e C T . t h e t h i s re a d o c e d u l u e i n u tin e
t h e r e t h e s
1 5 1
U n it 4 : C o n s u m in g H A N A
V ie w s a n d P r o c e d u r e s in A B A P
H A 4 0 0
S o l u t i o n 1 1 : A n a l y z e a s t o r e d p r o c e d u r e d e n e d o n S A P H A N A a n d c a ll it in a n a t i v e S Q L s t a t e m e n t T a s k 1 : C o p y a n d u n d e r s t a n d t e m p l a t e C r e a t e a c o p y o f r e p o r t Y H A 4 0 0 _ C A L L _ P R O C E D U R E _ T 1 i n y o u r p a c k a g e Z H A 4 0 0 _ # # ( s u g g e s t e d n a m e : Z H A 4 0 0 _ # # _ H P R O C _ 1 , w h e r e # # i s y o u r g r o u p n u m b e r ) . A n a l y z e t h e s o u r c e c o d e , a c t i v a t e a n d e x e c u t e t h e p r o g r a m . 1 .
C r e a t e a c o p y o f t h e r e p o r t . P l a c e i t i n y o u r p a c k a g e Z H A 4 0 0 _ 0 0 a n d a s s i g n i t t o y o u r w o r k b e n c h t a s k . a )
2 .
A n a l y z e t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e . P a y s p e c i a l a t t e n t i o n t o t h e c h a n g i n g p a r a m e t e r s o f t h e r o u t i n e a n d h o w t h e y a r e l l e d w i t h d a t a . a )
3 .
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
W h a t is th e m a in d if f e r e n c e b e tw e e n th is p ro g ra m b e f o r e ? A n s w lis t o f d a te a d a te a
4 .
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
a n d t h e o n e s w e u s e d
e r : I n s t e a d o f j u s t o n e l i s t o f a l l c u s t o m e r s t w o l i s t s a r e g a t h e r e d : O n e c u s t o m e r s w i t h t h e l o n g e s t a v e r a g e t i m e b e t w e e n o r d e r d a t e a n d i g h t n d l i s t o f c u s t o m e r s w i t h t h e s h o r t e s t a v e r a g e t i m e b e t w e e n o r d e r n d i g h t d a t e .
A c t i v a t e a n d e x e c u t e t h e p r o g r a m . a )
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
T a s k 2 : A n a ly z e a S A P H A N A
s t o r e d p r o c e d u r e
I n t h e S A P H A N A S t u d i o , a n a l y z e t h e d e n i t i o n o f t h e s t o r e d p r o c e d u r e S P _ E A R L Y _ B I R D _ A N D _ L A S T _ M I N U T E . C h e c k a l l r e l e v a n t p r o p e r t i e s o f t h e p r o c e d u r e . 1 .
G o t o t h e S A P H A N A S t u d i o , s e a r c h f o r p r o c e d u r e S P _ E A R L Y _ B I R D _ A N D _ L A S T _ M I N U T E a n d o p e n i t s d e n i - t i o n . a )
2 .
P e rfo rm
t h i s s t e p a s b e f o r e .
A n a l y z e t h e p r o c e d u r e ’ s d e n i t i o n . a )
A l l r e l e v a n t i n f o r m a t i o n i s d i r e c t l y v i s i b l e i n t h e p r o c e d u r e d e n i t i o n .
C o n t i n u e d o n n e x t p a g e
1 5 2
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : C a llin g
3 .
S p c o E s o
to r e d p r o c e d u r e S P _ E A R a r a m e t e r s o f n a m e i v _ n u lie n t in th e s e le c t s ta te m e f d a ta s e ts th a t a r e s e le c te T _ E A R L Y _ B I R D S a n d E ta te m e n ts w h i c h lo o k a lm r d e r (o n e s o r ts a s c e n d in g
A n s w s ta te m s e le c t th e o t
e r : 2 , i v _ n e n ts o f th e e d , 2 , E T _ E h e r d e s c en d
U s e C o p y &
a )
c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p r o u t i n e g e t _ d a t a _ s o l u t i o n . I m p l e m s t o r e d p r o c e d u r e . U s e a d d i t i o n W a m e /v a lu e p a ir s f o r th e e x p o r t p a r a th e e x p o r t p a ra m e te rs v ia n a tiv e S Q
l a t e t o e n t I T H m e t e r s . L S e l e c t s
P a s t e - f u n c t i o n o f t h e A B A P E d i t o r .
t : T h e rs t tw (c o n t p a ra m lie d w
p r o c e d u r e e x p e c ts fo u r o a re in p u t p a r a m e te rs e n t o f d a t a o b j e c t s p v _ e te rs c o r r e s p o n d to th e ith “ n u l l” w h e n u s in g a
S e e s o u r c e c o d e e x tr a c t f r o m
p a r a m e te rs s e p a . P ro v id e s u ita b n u m b e r a n d s y - m o u t p u t p a r a m e te d d i t i o n W I T H O
r a t e d b y c o l o n s . l e v a l u e s f o r a n d t ) . T h e l a s t r s . t h e y c a n b e V E R V I E W .
m o d e l s o l u t i o n .
D e n e a n i n t e r n a l t a b l e w i t h t w o c o l u m n s o f t y p e s t r i n g . ( s u g g e s t e d n a m e f o r t h e t a b l e : l t _ o v e r v i e w , s u g g e s t e d n a m e s f o r t h e c o l u m n s : p a r a m a n d v a l u e ) . R e p l a c e t a r g e t d a t a o b j e c t c t _ c u s t _ l a t e w i t h t h i s n e w i n t e r n a l t a b l e . . a )
4 .
P r o c e d u r e in a n a t iv e S Q L
I n s u b r o u t i n e g e t _ d a t a _ s o l u t i o n , r e p l a c e t h e s t r i n g w i t h t h e n a t i v e S Q L S E L E C T w i t h c a l l o f t h e s t o r e d p r o c e d u r e . U s e a d d i t i o n W I T H O V E R V I E W .
H in T h e th e m tw o s u p p
3 .
A B A P
C o p y t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e t o s u b r o u t i n e g e t _ d a t a _ s o l u t i o n a )
2 .
P r o c e d u r e s in
u m b e r a n d i v _ m a n d t , r e s t r i c t t h e c l i e n t i n t h e s e l e c t p r o c e d u r e a n d t o r e s t r i c t t h e n u m b e r o f d a t a s e t s t h a t a r e A R L Y _ B I R D S , t h e s o r t i n g o r d e r ( o n e s o r t s a s c e n d i n g , i n g )
d it y o u r p ro g ra m . C o p y th e s o u rc e u b r o u t i n e g e t _ d a t a _ s o l u t i o n . I n s u b n a tiv e S Q L S ta te m e n t th a t c a lls th e V E R V I E W t o r e c e i v e r s t a l i s t o f n s in g th is lis t, r e trie v e th e c o n te n t o f r o m t h e d a t a b a s e .
1 .
H A N A
L Y _ B I R D _ A N D _ L A S T _ M I N U T E h a s 2 i n p u t m b e r a n d i v _ m a n d t . T h e y a r e u s e d t o r e s t r i c t t h e n t s o f t h e p r o c e d u r e a n d t o r e s t r i c t t h e n u m b e r d . T h e s c r i p t h a s 2 o u t p u t p a r a m e t e r s n a m e d T _ L A S T _ M I N U T E . T h e s c r i p t c o n t a i n s t w o s e l e c t o s t i d e n t i c a l . T h e o n l y d i f f e r e n c e i s t h e s o r t i n g , t h e o t h e r d e s c e n d i n g )
T a s k 3 : C a ll th e S A P H A N A S t a t e m e n t E s a O U f
S A P
S e e s o u r c e c o d e e x tr a c t f r o m
m o d e l s o l u t i o n .
A f t e r y o u c l o s e d t h e r s t q u e r y w i t h t h e c a l l o f t h e p r o c e d u r e , u s e s t a t e m e n t R E A D T A B L E t o r e a d t h e l i n e f r o m l t _ o v e r v i e w w h e r e c o l u m n p a r a m c o n t a i n s t h e n a m e o f p r o c e d u r e p a r a m e t e r E T _ E A R L Y _ B I R D S . U s e t h e C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 5 3
U n it 4 : C o n s u m in g H A N A
c B d S
V ie w s a n d P r o c e d u r e s in A B A P
o n te y th a ta b E L E
a ) 5 .
n v a l u e i n t h e F R O M - c l a u s e o f a n a t i v e S Q L S E L E C T . t h e c o n t e n t o f t h e p r o c e d u r e s e x p o r t p a r a m e t e r f r o m t h e e s u b r o u t i n e s p a r a m e t e r c t _ c u s t _ e a r l y a s t a r g e t f o r t h i s e n t .
S e e s o u rc e c o d e e x tra c t f ro m
A fte lin e p a r a F R O p a r a a )
6 .
n t o f c o lu m a t y o u re a d a s e . U s e th C T - s ta te m
H A 4 0 0
r y o u c lo s e d f r o m l t _ o v e r m e t e r E T _ L A M - c la u s e o f m e t e r c t _ c u s
th is s e c o v i e w w h S T _ M IN a n a tiv e t _ l a t e a s
n d e re U S Q th
m o d e l s o l u t i o n .
q u e r y , u s e s t a t e m e n t R E c o l u m n p a r a m c o n t a i n s T E . A g a i n , u s e t h e c o n t e n L S E L E C T . B u t th is tim e ta rg e t f o r th e S E L E C T -
S e e s o u rc e c o d e e x tra c t f ro m
A D T A B L E t o r e a d t h e t h e n a m e o f p r o c e d u r e t o f c o l u m n v a l u e i n t h e e u s e t h e s u b r o u t i n e s s t a t e m e n t .
m o d e l s o l u t i o n .
A c t i v a t e a n d t e s t y o u r p r o g r a m . U s e t h e d e b u g g e r t o a n a l y z e t h e c o n t e n t o f t h e o v e r v i e w t a b l e a n d t h e r e t r i e v a l o f t h e p r o c e d u r e s r e s u l t s . M a k e s u r e t h e t w o s u b r o u t i n e s d e l i v e r e x a c t l y t h e s a m e d a t a . a )
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
R e s u l t
S o u r c e c o d e e x t r a c t f r o m m o d e l s o l u t i o n ( P r o g r a m Y H A 4 0 0 _ C A L L _ P R O C E D U R E _ S 1 ) * & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * &
F o r m
g e t _ d a t a _ t e m p l a t e
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * F O R M
*
g e t _ d a t a _ t e m p l a t e
U S I N G
p v _ n u m b e r
T Y P E
i
C H A N G I N G
c t _ c u s t _ e a r l y
T Y P E
t y _ t _ c u s t o m e r s
c t _ c u s t _ l a t e
T Y P E
t y _ t _ c u s t o m e r s .
D e c l a r a t i o n s
* * * * * * * * * * * * * * * * *
*
h e l p
v a r i a b l e s
D A T A
l v _ c o u n t
A D B C
O b j e c t s
D A T A :
T Y P E a n d
i .
v a r i a b l e s
l o _ c o n
T Y P E
R E F
T O
c l _ s q l _ c o n n e c t i o n ,
l o _ s q l
T Y P E
R E F
T O
c l _ s q l _ s t a t e m e n t ,
l o _ r e s u l t
T Y P E
R E F
T O
c l _ s q l _ r e s u l t _ s e t ,
l v _ s q l
T Y P E
s t r i n g ,
l r _ d a t a
T Y P E
R E F
T O
d a t a .
C o n t i n u e d o n n e x t p a g e
1 5 4
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : C a llin g
*
E c e p t i o n D A T A :
H A N A
P r o c e d u r e s in
A B A P
h a n d l i n g l x _ s q l _ e x c l v _ t e x t
*
S A P
T Y P E
T Y P E
R E F
T O
c x _ s q l _ e x c e p t i o n ,
s t r i n g .
P r o c e s s i n g
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * C L E A R :
c t _ c u s t _ e a r l y , c t _ c u s t _ l a t e .
T R Y . *
G e t
s e c o n d a r y l o _ c o n
*
C r e a t e
=
D B
C o n n e c t i o n
c l _ s q l _ c o n n e c t i o n = > g e t _ c o n n e c t i o n (
c _ c o n
) .
s t a t e m e n t
C R E A T E
O B J E C T
l o _ s q l
E X P O R T I N G c o n _ r e f *
c r e a t e
S Q L
l v _ s q l
=
l o _ c o n .
s t a t e m e n t =
| S E L E C T | I D ,
E x e c u t e
R e a d
r e s u l t G E T
p v _ n u m b e r
P O S T C O D E ,
& &
C I T Y ,
C O U N T R Y ,
| W H E R E
M A N D T
=
| G R O U P
B Y
M A N D T ,
I D ,
| O R D E R
B Y
M A N D T ,
D A Y S _ A H E A D
=
{
s y - m a n d t
}
N A M E ,
l o _ s q l - > e x e c u t e _ q u e r y (
i n t o
i n t e r n a l
A V G ( D A Y S _ A H E A D )
|
|
A S
D A Y S _ A H E A D
R E F E R E N C E
O F
c t _ c u s t _ e a r l y
l o _ r e s u l t - > c l o s e ( s e c o n d
l v _ s q l
=
S Q L
& &
|
& &
& &
& &
P O S T C O D E , D E S C
C I T Y ,
C O U N T R Y
|
& &
| .
l v _ s q l
) .
I N T O
l r _ d a t a .
l r _ d a t a
) .
) .
) .
s t a t e m e n t
| S E L E C T | I D ,
T O P
{
N A M E ,
| F R O M
p v _ n u m b e r
P O S T C O D E ,
}
|
& &
C I T Y ,
C O U N T R Y ,
A V G ( D A Y S _ A H E A D )
_ S Y S _ B I C . " y h a 4 0 0 . d e m o / A T _ D A Y S _ A H E A D "
| W H E R E
M A N D T
| G R O U P
B Y
=
{
M A N D T ,
s y - m a n d t I D ,
N A M E ,
}
|
|
A S
D A Y S _ A H E A D
& &
& &
P O S T C O D E ,
C I T Y ,
C O U N T R Y
|
& &
C o n t i n u e d o n n e x t p a g e
2 0 1 3
|
T a b l e
l o _ r e s u l t - > n e x t _ p a c k a g e (
c r e a t e
|
_ S Y S _ B I C . " y h a 4 0 0 . d e m o / A T _ D A Y S _ A H E A D "
l o _ r e s u l t - > s e t _ p a r a m _ t a b l e (
*
}
Q u e r y
l o _ r e s u l t *
{
N A M E ,
| F R O M
*
T O P
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 5 5
U n it 4 : C o n s u m in g H A N A
V ie w s a n d P r o c e d u r e s in A B A P
| O R D E R *
E x e c u t e
R e a d
M A N D T ,
D A Y S _ A H E A D
A S C
| .
Q u e r y
l o _ r e s u l t *
B Y
H A 4 0 0
r e s u l t G E T
=
l o _ s q l - > e x e c u t e _ q u e r y (
i n t o
i n t e r n a l
R E F E R E N C E
O F
l o _ r e s u l t - > s e t _ p a r a m _ t a b l e ( l o _ r e s u l t - > n e x t _ p a c k a g e (
C A T C H
=
M E S S A G E
l v _ t e x t
I N T O
l r _ d a t a .
l r _ d a t a
) .
) .
) .
c x _ s q l _ e x c e p t i o n
l v _ t e x t
) .
T a b l e
c t _ c u s t _ l a t e
l o _ r e s u l t - > c l o s e (
l v _ s q l
I N T O
l x _ s q l _ e x c .
l x _ s q l _ e x c - > g e t _ t e x t ( T Y P E
"
E x c e p t i o n
C l a s s
f o r
S Q L
E r r o r
) .
' E ' .
E N D T R Y . E N D F O R M .
"
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * &
F o r m
g e t _ d a t a _ s o l u t i o n
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * F O R M
g e t _ d a t a _ s o l u t i o n
U S I N G
p v _ n u m b e r
T Y P E
C H A N G I N G
c t _ c u s t _ e a r l y c t _ c u s t _ l a t e
*
i T Y P E T Y P E
t y _ t _ c u s t o m e r s t y _ t _ c u s t o m e r s .
D e c l a r a t i o n s
* * * * * * * * * * * * * * * * *
t y p e
f o r
T Y P E S :
r e s u l t
B E G I N
D a t a D A T A :
*
*
O F
l t y _ s _ o v e r v i e w ,
p a r a m
T Y P E
s t r i n g ,
v a l u e
T Y P E
s t r i n g ,
E N D *
o v e r v i e w
O F
o b j e c t s
l t y _ s _ o v e r v i e w . f o r
o v e r v i e w
l t _ o v e r v i e w
T Y P E
T A B L E
l s _ o v e r v i e w
T Y P E
l t y _ s _ o v e r v i e w .
h e l p
v a r i a b l e s
D A T A
l v _ c o u n t
A D B C
O b j e c t s
D A T A :
r e s u l t
T Y P E a n d
O F
l t y _ s _ o v e r v i e w ,
i .
v a r i a b l e s
l o _ c o n
T Y P E
R E F
T O
c l _ s q l _ c o n n e c t i o n ,
l o _ s q l
T Y P E
R E F
T O
c l _ s q l _ s t a t e m e n t ,
C o n t i n u e d o n n e x t p a g e
1 5 6
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : C a llin g
*
l o _ r e s u l t
T Y P E
R E F
l v _ s q l
T Y P E
s t r i n g ,
l r _ d a t a
T Y P E
R E F
E c e p t i o n
H A N A
P r o c e d u r e s in
A B A P
c l _ s q l _ r e s u l t _ s e t ,
T O
d a t a .
h a n d l i n g
D A T A :
l x _ s q l _ e x c l v _ t e x t
*
T O
S A P
T Y P E
T Y P E
R E F
T O
c x _ s q l _ e x c e p t i o n ,
s t r i n g .
P r o c e s s i n g
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * C L E A R :
c t _ c u s t _ e a r l y , c t _ c u s t _ l a t e .
T R Y . *
G e t
s e c o n d a r y l o _ c o n
*
C r e a t e
=
D B
C o n n e c t i o n
c l _ s q l _ c o n n e c t i o n = > g e t _ c o n n e c t i o n (
c _ c o n
) .
s t a t e m e n t
C R E A T E
O B J E C T
l o _ s q l
E X P O R T I N G c o n _ r e f *
c r e a t e
S Q L
E x e c u t e
=
| C A L L
R e a d
r e s u l t G E T
_ S Y S _ B I C . " y h a 4 0 0 . d e m o / S P _ E A R L Y _ B I R D _ A N D _ L A S T _ M I N U T E " (
=
l o _ s q l - > e x e c u t e _ q u e r y (
o v e r v i e w
R E F E R E N C E
O F
i n t o
i n t e r n a l
l t _ o v e r v i e w
l o _ r e s u l t - > s e t _ p a r a m _ t a b l e ( l o _ r e s u l t - > n e x t _ p a c k a g e ( l o _ r e s u l t - > c l o s e ( *
R e t r i e v e
*
1 .
t h e
l v _ s q l
) .
T a b l e I N T O
l r _ d a t a .
l r _ d a t a
) .
) .
) .
e t _ e a r l y _ b i r d s
T A B L E
l v _ s q l
=
l o _ r e s u l t G E T
p v _ n u m b e r
r e s u l t s
P a r a m e t e r R E A D
{
Q u e r y
l o _ r e s u l t *
l o _ c o n .
s t a t e m e n t
l v _ s q l *
=
l t _ o v e r v i e w
| S E L E C T =
*
F R O M
I N T O {
l s _ o v e r v i e w
l s _ o v e r v i e w - v a l u e
l o _ s q l - > e x e c u t e _ q u e r y (
R E F E R E N C E
O F
W I T H
c t _ c u s t _ e a r l y
l o _ r e s u l t - > s e t _ p a r a m _ t a b l e (
I N T O
l r _ d a t a
l v _ s q l
K E Y }
p a r a m
=
' E T _ E A R L Y _ B I R D S ' .
| .
) .
l r _ d a t a . ) .
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 5 7
}
U n it 4 : C o n s u m in g H A N A
V ie w s a n d P r o c e d u r e s in A B A P
l o _ r e s u l t - > n e x t _ p a c k a g e ( l o _ r e s u l t - > c l o s e (
*
2 .
P a r a m e t e r R E A D
=
) .
l t _ o v e r v i e w
| S E L E C T
l o _ r e s u l t G E T
) .
e t _ l a s t _ m i n u t e
T A B L E
l v _ s q l
=
*
I N T O
F R O M
{
l s _ o v e r v i e w
l o _ s q l - > e x e c u t e _ q u e r y (
R E F E R E N C E
O F
c t _ c u s t _ l a t e
l o _ r e s u l t - > n e x t _ p a c k a g e ( l o _ r e s u l t - > c l o s e (
=
M E S S A G E
l v _ t e x t
I N T O
l v _ s q l
K E Y }
p a r a m
=
' E T _ L A S T _ M I N U T E ' .
| .
) .
l r _ d a t a .
l r _ d a t a
) .
) .
) .
c x _ s q l _ e x c e p t i o n
l v _ t e x t
W I T H
l s _ o v e r v i e w - v a l u e
l o _ r e s u l t - > s e t _ p a r a m _ t a b l e (
C A T C H
H A 4 0 0
I N T O
l x _ s q l _ e x c .
l x _ s q l _ e x c - > g e t _ t e x t ( T Y P E
"
E x c e p t i o n
C l a s s
f o r
S Q L
E r r o r
) .
' E ' .
E N D T R Y . E N D F O R M .
1 5 8
"
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n : C a llin g
S A P
H A N A
P r o c e d u r e s in
A B A P
L e s s o n S u m m a r y Y o u s h o u l d n o w b e a b l e t o : •
2 0 1 3
C a ll H A N A
p r o c e d u r e s i n A B A P
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 5 9
U n it S u m m a r y
H A 4 0 0
U n it S u m m a r y Y o u s h o u l d n o w b e a b l e t o :
1 6 0
•
W o rk w ith v ie w s in th e S A P H A N A
•
D e s c r ib e th e d if f e r e n t T y p e s o f S A P H A N A
•
C o n su m e H A N A
•
C a ll H A N A
©
S tu d i o v i e w s
v ie w s in A B A P
p r o c e d u r e s i n A B A P
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
U n i t 5 C r e a t i n g A n a l y t i c a l V i e w U n i t O v e r v i e w T h i s U n i t i s d e s i g n e d t o t e a c h t h e c r e a t i o n o f A n a l y t i c V i e w s
U n i t O b j e c t i v e s A f t e r c o m p l e t i n g t h i s u n i t , y o u w i l l b e a b l e t o : •
C r e a t e a n A n a l y ti c v ie w
U n i t C o n t e n t s L e s s o n : C r e a t i n g A n a l y t i c V i e w . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 6 2 E x e r c is e 1 2 : C r e a te a S A P H A N A a n a ly t ic v ie w a n d u s e it in A B A P v ia a n a t i v e S Q L S E L E C T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 6 7
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 6 1
U n it 5 : C r e a tin g A n a ly tic a l V ie w
L e s s o n :
H A 4 0 0
C r e a t i n g A n a l y t i c V i e w L e s s o n
O v e r v i e w
L e s s o n O b j e c t i v e s A f t e r c o m p l e t i n g t h i s l e s s o n , y o u w i l l b e a b l e t o : •
C r e a t e a n A n a l y ti c v ie w
B u s i n e s s E x a m p l e
1 6 2
F ig u r e 6 9 : C r e a t in g
A n a l y t i c V i e w
F ig u r e 7 0 : C r e a tin g
A n a ly tic V ie w
©
2 0 1 3 S A P
– S e t P r o p e r t i e s
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
2 0 1 3
L e s s o n :
C r e a tin g
A n a ly tic
F ig u r e 7 1 : C r e a tin g A n a ly tic V ie w
– D a t a F o u n d a t i o n – T a b l e J o i n
F ig u r e 7 2 : C r e a tin g
– L o g i c a l J o i n
A n a ly tic V ie w
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
V ie w
1 6 3
U n it 5 : C r e a tin g A n a ly tic a l V ie w
H A 4 0 0
F i g u r e 7 3 : E x a m p l e : D e n e R e s t r i c t e d C o l u m n
F i g u r e 7 4 : E x a m p l e : D e n e C a lc u l a t e d M e a s u r e
1 6 4
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
2 0 1 3
L e s s o n :
C r e a tin g
F ig u r e 7 5 : C r e a tin g
A n a ly tic V ie w
– S e m a n t i c s
F ig u r e 7 6 : C r e a tin g
A n a ly tic V ie w
– S a v e a n d A c t i v a t e
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
A n a ly tic
V ie w
1 6 5
U n it 5 : C r e a tin g A n a ly tic a l V ie w
H A 4 0 0
F ig u r e 7 7 : C r e a tin g
1 6 6
©
A n a ly tic V ie w
2 0 1 3 S A P
– D a t a P r e v i e w
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n :
C r e a tin g
A n a ly tic
V ie w
E x e r c is e 1 2 : C r e a t e a S A P H A N A a n a ly t i c v ie w a n d u s e it i n A B A P v ia a n a t iv e S Q L S E L E C T E x e r c i s e O b j e c t i v e s A f t e r c o m p l e t i n g t h i s e x e r c i s e , y o u w i l l b e a b l e t o : •
c re a te a n a n a ly tic v ie w
o n S A P H A N A
•
u n d e rs ta n d a n d u s e th e S A P H A N A
•
u se S A P H A N A S E L E C T
b u il t - i n c u r r e n c y c o n v e r s i o n
a n a l y t i c v i e w s i n A B A P u s i n g A D B C a n d a n a t i v e S Q L
B u s i n e s s E x a m p l e T e m p l a t e :
R e p o r t Y H A 4 0 0 _ C R E A T E _ H A N A _ V I E W T 1 S o l u t i o n :
R e p o rt Y H A 4 0 0 _ C R E A T E _ H A N A _ V IE W
_ S 1
T a s k 1 : C o p y a n d u n d e r s t a n d t e m p l a t e C r e a t e a c o p y o f r e p o r t Y H A 4 0 0 _ C R E A T E _ H A N A _ V I E W _ T 1 i n y o u r p a c k a g e Z H A 4 0 0 _ # # ( s u g g e s t e d n a m e : Z H A 4 0 0 _ # # _ C V I E W _ 1 , w h e r e # # i s y o u r g r o u p n u m b e r ) . A c t i v a t e , a n a l y z e a n d e x e c u t e t h e p r o g r a m . 1 .
C r e a t e a c o p y o f t h e r e p o r t . P l a c e i t i n y o u r p a c k a g e Z H A 4 0 0 _ 0 0 a n d a s s i g n i t t o y o u r w o r k b e n c h t a s k .
2 .
A n a l y z e t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e .
3 .
W h a t i s c a l c u l a t e d i n t h e l o o p o v e r t h e c u s t o m e r s i g h t b o o k i n g s ? H o w i s t h i s d o n e ?
4 .
A c t i v a t e a n d e x e c u t e t h e p r o g r a m .
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 6 7
U n it 5 : C r e a tin g A n a ly tic a l V ie w
H A 4 0 0
T a s k 2 : C r e a t e a n a n a l y t i c v i e w I n t h e S A P H A N A S t u d i o , c r e a t e a v i e w t h a t c o n t a i n s t h e c o m p l e t e a n a l y s i s f o u n d i n s u b r o u t i n e g e t _ d a t a _ t e m p l a t e . M a k e u s e o f t h e f a c t t h a t S A P H A N A s u p p o r t s c u r r e n c y c o n v e r s i o n s a n d a g g r e g a t i o n s i n a n a l y t i c v i e w s . 1 .
G o t o t h e S A P H A N A S t u d i o . I n t h e N a v ig a t o r , s e a r c h f o r t h e c o n t e n t p a c k a g e y o u c r e a t e d i n E x e r c i s e 1 .
2 .
I n y o u r p a c k a g e , c r e a te a n e w a n a ly tic v ie w A N _ C U S T _ W I T H _ P A Y S U M ) .
3 .
I n t h e D a t a F o u n d a t i o n , d e n e a r e f e r e n t i a l j o i n o f t a b l e s S C U S T O M S B O O K w i t h a s u i t a b l e j o i n c o n d i t i o n .
4 .
A d d a l l r e q u i r e d e l d s t o t h e v i e w s o u t p u t ( S e e t e m p l a t e p r o g r a m ) . S e t a l t e r o n c o l u m n C A N C E L L E D t o m a k e s u r e o n l y n o n - c a n c e l l e d b o o k i n g s a r e c o n s i d e r e d .
5 .
I n t h e L o g i c a l J o i n o f t h e v i e w , d e n a m e : P A Y S U M _ C O N V ) o f s u i t a b l e c o l u m n F O R C U R A M t o c u r r e n c y U T Y P E _ O F _ R A T E ) a n d c o n v e r s i o n d t e m p l a t e p r o g r a m .
6 .
I n t h e S e m a n t i c s o f t h e v i e w , d e c l a r e t h e c a l c u l a t e d c o l u m n P A Y S U M a n d t h e c u r r e n c y a m o u n t F O R C U R A M t o b e o f t y p e M e a s u r e a n d a l l o t h e r c o l u m n s t o b e o f t y p e A t t r i b u t e .
7 .
B a c k i n t h e o f t h e v i e w , h i d e a l l c o l u m n s f r o m t h e v i e w ’ s o u t p u t t h a t a r e o n l y n e e d e d a s i n p u t f o r t h e c u r r e n c y c o n v e r s i o n .
8 .
S a v e a n d A c t i v a t e y o u r v i e w .
T a s k 3 : U s e th e S A P H A N A E d it s u b r S E L j u s t
1 6 8
y o u r p ro g o u t i n e g e t E C T s , th e o n e s e le c t
ra m . _ d a ta n e ste fro m
C o p y _ s o lu d L O y o u r
th e s o u rc t i o n . I n s u O P s , th e c a n a ly tic v
n e ty S D a te
a c a lc p e th a . U s e u s e d
V ie w
( s u g g e s t e d n a m e :
u la te t c o n th e s fo r th
d c o lu m n v e r ts th e a m e e x c h e fu n c tio
(s c o a n n m
a n d
u g g e s t e d n t e n t o f g e t y p e ( = o d u l e i n t h e
in a n a t iv e S Q L S e le c t
e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e t o b r o u t i n e g e t _ d a t a _ s o l u t i o n . R e p l a c e t h e t w o u r r e n c y c o n v e r s i o n a n d t h e a g g r e g a t i o n b y i e w .
1 .
C o p y t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e t o s u b r o u t i n e g e t _ d a t a _ s o l u t i o n
2 .
I n s u b r o u t i n e g e t _ d a t a _ s o l u t i o n , i m p l e m e n t a n A D B C c a l l o f a n a t i v e S Q L S E L E C T t h a t r e a d s d a t a f r o m t h e v i e w y o u j u s t c r e a t e d . M a k e t h e s e l e c t r e a d i n t o d a t a o b j e c t s c t _ c u s t o m e r s d i r e c t l y .
3 .
A c t i v a t e a n d t e s t y o u r p r o g r a m . M a k e s u r e t h e t w o s u b r o u t i n e s d e l i v e r e x a c t l y t h e s a m e d a t a .
4 .
P e r f o r m a R u n t i m e M e a s u r e m e n t a n d Q u a n t i f y t h e i m p r o v e m e n t y o u a c h i e v e d .
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n :
C r e a tin g
A n a ly tic
V ie w
S o l u t i o n 1 2 : C r e a t e a S A P H A N A a n a ly t i c v ie w a n d u s e it i n A B A P v ia a n a t iv e S Q L S E L E C T T a s k 1 : C o p y a n d u n d e r s t a n d t e m p l a t e C r e a t e a c o p y o f r e p o r t Y H A 4 0 0 _ C R E A T E _ H A N A _ V I E W _ T 1 i n y o u r p a c k a g e Z H A 4 0 0 _ # # ( s u g g e s t e d n a m e : Z H A 4 0 0 _ # # _ C V I E W _ 1 , w h e r e # # i s y o u r g r o u p n u m b e r ) . A c t i v a t e , a n a l y z e a n d e x e c u t e t h e p r o g r a m . 1 .
C r e a t e a c o p y o f t h e r e p o r t . P l a c e i t i n y o u r p a c k a g e Z H A 4 0 0 _ 0 0 a n d a s s i g n i t t o y o u r w o r k b e n c h t a s k . a )
2 .
A n a l y z e t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e . a )
3 .
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
W h a t i s c a l c u l a t e d i n t h e l o o p o v e r t h e c u s t o m e r s i g h t b o o k i n g s ? H o w i s t h i s d o n e ? A n s w e r : T h e p a y m e n t i n l o c a l c u r r e n c y i s c o n v e r t e d t o U S D o l l a r . T h i s i s d o n e v i a f u n c t i o n m o d u l e C O N V E R T _ T O _ L O C A L _ C U R R E N C Y . T h e p a y m e n t s a r e t h e n s u m m e d u p p e r c u s t o m e r .
4 .
A c t i v a t e a n d e x e c u t e t h e p r o g r a m . a )
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
T a s k 2 : C r e a t e a n a n a l y t i c v i e w I n t h e S A P H A N A S t u d i o , c r e a t e a v i e w t h a t c o n t a i n s t h e c o m p l e t e a n a l y s i s f o u n d i n s u b r o u t i n e g e t _ d a t a _ t e m p l a t e . M a k e u s e o f t h e f a c t t h a t S A P H A N A s u p p o r t s c u r r e n c y c o n v e r s i o n s a n d a g g r e g a t i o n s i n a n a l y t i c v i e w s . 1 .
G o t o t h e S A P H A N A S t u d i o . I n t h e N a v i g a t o r , s e a r c h f o r t h e c o n t e n t p a c k a g e y o u c r e a t e d i n E x e r c i s e 1 . a )
2 .
P e rfo rm
t h i s s t e p a s b e f o r e .
I n y o u r p a c k a g e , c r e a te a n e w a n a ly tic v ie w A N _ C U S T _ W I T H _ P A Y S U M ) .
( s u g g e s t e d n a m e :
a )
R i g h t c l i c k o n t h e p a c k a g e a n d c h o o s e N e w - > A n a l y t i c V i e w . . . .
b )
E n te r th e n a m e o f th e v ie w
a n d a d e s c r i p t i o n , t h e n p r e s s F i n i s h
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 6 9
U n it 5 : C r e a tin g A n a ly tic a l V ie w
3 .
4 .
H A 4 0 0
I n t h e D a t a F o u n d a t i o n , d e n e a r e f e r e n t i a l j o i n o f t a b l e s S C U S T O M S B O O K w i t h a s u i t a b l e j o i n c o n d i t i o n .
a n d
a )
I n t h e N a v i g a t o r , o p e n t h e s c h e m a a n d t h e n o d e w i t h t h e t w o t a b l e s .
b )
U s e t h e D r a g &
c )
U s e t h e D r a g & D r o p - f u n c t i o n t o j o i n e l d S C U S T O M . M A N D T w i t h S B O O K . M A N D T a n d S C U S T O M . I D w i t h S B O O K . C U S T O M I D .
d )
C l i c k o n o n e o f t h e j o i n l i n e s a n d , o n t h e l o w e r r i g h t , c h e c k t h e j o i n t y p e a n d c a r d i n a l i t y . A d j u s t t h i s i n f o r m a t i o n i f n e c e s s a r y .
D r o p - f u n c t i o n t o a d d t h e t a b l e s t o t h e d a t a f o u n d a t i o n .
A d d a l l r e q u i r e d e l d s t o t h e v i e w s o u t p u t ( S e e t e m p l a t e p r o g r a m ) . S e t a l t e r o n c o l u m n C A N C E L L E D t o m a k e s u r e o n l y n o n - c a n c e l l e d b o o k i n g s a r e c o n s i d e r e d . a )
b )
C l i c k o n t h e g r e y b u l l e t n e x t t o a t a b l e e l d t o a d d i t t o t h e o u t p u t ( t h e b u l l e t ’ s c o l o r w i l l t h e n c h a n g e t o o r a n g e ) . T h e r e q u i r e d e l d s a r e : •
S C U S T O M .M A N D T
•
S C U S T O M .I D
•
S C U S T O M .N A M E
•
S C U S T O M .P O S T C O D E
•
S C U S T O M .C I T Y
•
S C U S T O M .C O U N T R Y
•
S B O O K .O R D E R _ D A T E
•
S B O O K . F O R C U R A M
•
S B O O K . F O R C U R K E Y
R i g h t c l i c k o n e l d S B O O K . C A N C E L L E D a n d c h o o s e A p p l y l t e r t o s e t t h e l t e r .
C o n t i n u e d o n n e x t p a g e
1 7 0
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n :
5 .
6 .
7 .
I n t h e L o g i c a n a m e : P A Y S U c o l u m n F O R T Y P E _ O F _ R te m p la te p r o g
l J o i n o f t h e v i e w , d e M _ C O N V ) o f s u i t a b l e C U R A M t o c u r r e n c y U A T E ) a n d c o n v e r s i o n d r a m .
n e ty S D a te
a c a lc p e th a . U se u s e d
u la te t c o n th e s fo r th
C r e a tin g
d c o lu m n v e rts th e a m e e x c h e fu n c tio
A n a ly tic
V ie w
( s u g g e s t e d c o n t e n t o f a n g e t y p e ( = n m o d u l e i n t h e
a )
I n t h e S c e n a r i o w i n d o w o n t h e l e f t , c l i c k o n L o g i c a l J o i n t o s w i t c h t o t h e d e n i t i o n o f t h e v i e w l o g i c .
b )
I n t h e O u t p u t w i n d o w o n t h e r i g h t , r i g h t - c l i c k o n n o d e C a l c u l a t e d C o l u m n s a n d C h o o s e N e w . . .
c )
E n t e r a n a m e a n d a d e s c r i p t i o n f o r t h e c a l c u l a t e d c o l u m n a n d s e t t h e d a t a t y p e t o D E C I M A L w i t h d i m e n s i o n = 1 6 a n d s c a l e = 4
d )
C h a n g e t h e c o l u m n t y p e f r o m A t t r i b u t e t o M e a s u r e t o a l l o w l o g i c a n d a g g r e g a t i o n .
e )
I n t h e E x p r e s s i o n E d i t o r , j u s t a d d t h e c o l u m n t o b e c o n v e r t e d ( F O R C U R A M ) .
f)
S w i t c h t o t a b A d v a n c e d t o d e n e t h e c u r r e n c y c o n v e r s i o n r u l e . S e t t h e t y p e t o A m o u n t w i t h C u r r e n c y a n d c h o o s e E n a b l e f o r C o n v e r s i o n .
g )
L e f t - c l i c k o n t h e v a l u e - h e l p b u t t o n n e x t t o i n p u t e l d C u r r e n c y , c h o o s e C o l u m n a n d a s s i g n t h e c o l u m n w i t h t h e s o u r c e c u r r e n c y c o d e ( F O R C U R K E Y ) .
h )
E n t e r T a r g e t C u r r e n c y “ U S D ” a n d E x c h a n g e T y p e “ M ” . F o r C o n v e r s i o n D a t e a s s i g n c o l u m n O D E R _ D A T E . F i n a l l y S e t S c h e m a f o r C o n v e r s i o n t o S F L I G H T a n d C l i e n t f o r C u r r e n c y C o n v e r s i o n t o D y n a m i c C l i e n .t
i)
F i n a l l y , c h o o s e C a l c u l a t e b e f o r e A g g r e g a t i o n a n d s e t t h e A g g r e g a t i o n t y p e t o S U M . T h e n c l o s e t h e d e n i t i o n o f t h e c a l c u l a t e d c o l u m n b y c l i c k i n g o n O K .
c o n v e r s i o n
I n t h e S e m a n t i c s o f t h e v i e w , d e c l a r e t h e c a l c u l a t e d c o l u m n P A Y S U M a n d t h e c u r r e n c y a m o u n t F O R C U R A M t o b e o f t y p e M e a s u r e a n d a l l o t h e r c o l u m n s t o b e o f t y p e A t t r i b u t e . a )
I n t h e S c e n a r i o w i n d o w
o n t h e l e f t , c l i c k o n S e m a n t i c s .
b )
O n t h e l i s t o f c o l u m n s e d i t t h e t y p e o f t h e c o l u m n s .
B a c k i n t h e o f t h e v i e w , h i d e a l l c o l u m n s f r o m t h e v i e w ’ s o u t p u t t h a t a r e o n l y n e e d e d a s i n p u t f o r t h e c u r r e n c y c o n v e r s i o n . a )
G o b a c k t o t h e L o g i c a l J o i n o f t h e v i e w . I n t h e O u t p u t w i n d o w , d o u b l e c l i c k o n t h e c o l u m n . I n t h e P r o p e r t i e s w i n d o w b e l o w , c h a n g e t h e v a l u e o f p r o p e r t y H i d d e n f r o m F a l s e t o T r u e .
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 7 1
U n it 5 : C r e a tin g A n a ly tic a l V ie w
8 .
H A 4 0 0
S a v e a n d A c t i v a t e y o u r v i e w . a )
O n t h e t o o l b a r w i t h t h e n a m e o f t h e v i e w , c h o o s e b u t t o n S a v e a n d A c t i v a t e . P a y a t t e n t i o n t o t h e J o b L o g w i n d o w o n t h e b o t t o m .
T a s k 3 : U s e th e S A P H A N A E d it s u b r S E L j u s t 1 .
y o u r p ro g o u t i n e g e t E C T s , th e o n e s e le c t
ra m . _ d a ta n e ste fro m
C o p y _ s o lu d L O y o u r
th e s o u rc t i o n . I n s u O P s , th e c a n a ly tic v
V ie w
in a n a t iv e S Q L S e le c t
e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e t o b r o u t i n e g e t _ d a t a _ s o l u t i o n . R e p l a c e t h e t w o u r r e n c y c o n v e r s i o n a n d t h e a g g r e g a t i o n b y i e w .
C o p y t h e s o u r c e c o d e o f s u b r o u t i n e g e t _ d a t a _ t e m p l a t e t o s u b r o u t i n e g e t _ d a t a _ s o l u t i o n a )
2 .
U s e C o p y &
P a s t e - f u n c t i o n o f t h e A B A P E d i t o r .
I n s u b r o u t i n e g e t _ d a t a _ s o l u t i o n , i m p l e m e n t a n A D B C c a l l o f a n a t i v e S Q L S E L E C T t h a t r e a d s d a t a f r o m t h e v i e w y o u j u s t c r e a t e d . M a k e t h e s e l e c t r e a d i n t o d a t a o b j e c t s c t _ c u s t o m e r s d i r e c t l y . a )
3 .
S e e s o u rc e c o d e e x tra c t f ro m
m o d e l s o l u t i o n .
A c t i v a t e a n d t e s t y o u r p r o g r a m . M a k e s u r e t h e t w o s u b r o u t i n e s d e l i v e r e x a c t l y t h e s a m e d a t a . a )
4 .
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
P e r f o r m a R u n t i m e M e a s u r e m e n t a n d Q u a n t i f y t h e i m p r o v e m e n t y o u a c h i e v e d . a )
C o m p l e t e t h i s s t e p a s y o u l e a r n e d t o d o i n p r e v i o u s c l a s s e s .
R e s u l t
S o u r c e c o d e e x t r a c t f r o m m o d e l s o l u t i o n ( P r o g r a m Y H A 4 0 0 _ C R E A T E _ H A N A _ V I E W _ S 1 ) * & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * &
F o r m
g e t _ d a t a _ t e m p l a t e
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * F O R M *
g e t _ d a t a _ t e m p l a t e
C H A N G I N G
c t _ c u s t o m e r s
T Y P E
t y _ t _ c u s t o m e r s .
D e c l a r a t i o n s
* * * * * * * * * * * * * * * * *
T y p e s
f o r
t a r g e t
f i e l d s
C o n t i n u e d o n n e x t p a g e
1 7 2
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n :
T Y P E S :
B E G I N
O F
T Y P E S :
T Y P E
s c u s t o m - i d ,
n a m e
T Y P E
s c u s t o m - n a m e ,
p o s t c o d e
T Y P E
s c u s t o m - p o s t c o d e ,
c i t y
T Y P E
s c u s t o m - c i t y ,
c o u n t r y
T Y P E
s c u s t o m - c o u n t r y ,
O F
B E G I N
*
*
*
c u s t o m i d
T Y P E
s b o o k - c u s t o m i d ,
o r d e r _ d a t e
T Y P E
s b o o k - o r d e r _ d a t e ,
f o r c u r a m
T Y P E
s b o o k - f o r c u r a m ,
f o r c u r k e y
T Y P E
s b o o k - f o r c u r k e y ,
O F
l t y _ s _ b o o k .
A r e a
D A T A
l s _ c u s t o m e r
D A T A :
*
l t y _ s _ b o o k ,
W o r k
T a r g e t s
f o r
f o r
V ie w
l t y _ s _ c u s t .
O F
E N D
A n a ly tic
l t y _ s _ c u s t ,
i d
E N D
C r e a tin g
R e s u l t L I K E
L I N E
O F
c t _ c u s t o m e r s .
S e l e c t
l t _ s c u s t o m
T Y P E
S O R T E D
l s _ s c u s t o m
T Y P E
l t y _ s _ c u s t ,
l t _ s b o o k
T Y P E
S O R T E D
l s _ s b o o k
T Y P E
l t y _ s _ b o o k .
h e l p
v a r i a b l e s
D A T A
l v _ a m n t _ c o n v
T Y P E
p
T A B L E T A B L E
L E N G T H
1 6
O F
l t y _ s _ c u s t
W I T H
N O N - U N I Q U E
K E Y
i d ,
O F
l t y _ s _ b o o k
W I T H
N O N - U N I Q U E
K E Y
c u s t o m i d ,
D E C I M A L S
4 .
P r o c e s s i n g
* * * * * * * * * * * * * * * * * C L E A R
c t _ c u s t o m e r s .
S E L E C T F R O M
i d
n a m e
p o s t c o d e
c i t y
s c u s t o m
C O N N E C T I O N
( c _ c o n )
I N T O
l t _ s c u s t o m
O R D E R S E L E C T F R O M
T A B L E B Y
i d .
c u s t o m i d
o r d e r _ d a t e
f o r c u r a m
f o r c u r k e y
s b o o k
C O N N E C T I O N
( c _ c o n )
I N T O
l t _ s b o o k
W H E R E
c o u n t r y
T A B L E
c a n c e l l e d
=
s p a c e
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 7 3
U n it 5 : C r e a tin g A n a ly tic a l V ie w
O R D E R L O O P
H A 4 0 0
B Y
A T
c u s t o m i d .
l t _ s c u s t o m
I N T O
l s _ s c u s t o m .
l s _ c u s t o m e r - i d
=
l s _ c u s t o m e r - n a m e
=
l s _ c u s t o m e r - p o s t c o d e
=
C L E A R L O O P
l s _ s c u s t o m - n a m e . l s _ s c u s t o m - p o s t c o d e .
l s _ c u s t o m e r - c i t y
=
l s _ c u s t o m e r - c o u n t r y
l s _ s c u s t o m - i d .
=
l s _ s c u s t o m - c i t y . l s _ s c u s t o m - c o u n t r y .
l s _ c u s t o m e r - p a y s u m . A T
l t _ s b o o k
I N T O
l s _ s b o o k
W H E R E l v _ a m n t _ c o n v C A L L
=
F U N C T I O N
c u s t o m i d
=
l s _ s c u s t o m - i d .
l s _ s b o o k - f o r c u r a m . ' C O N V E R T _ T O _ L O C A L _ C U R R E N C Y '
E X P O R T I N G d a t e
=
f o r e i g n _ a m o u n t
=
f o r e i g n _ c u r r e n c y *
l s _ s b o o k - o r d e r _ d a t e l v _ a m n t _ c o n v
=
l s _ s b o o k - f o r c u r k e y
l o c a l _ c u r r e n c y
=
' U S D '
T Y P E _ O F _ R A T E
=
' M '
r e a d _ t c u r r
=
' X '
I M P O R T I N G l o c a l _ a m o u n t
=
l v _ a m n t _ c o n v
=
1
E X C E P T I O N S n o _ r a t e _ f o u n d o v e r f l o w
I F
=
2
n o _ f a c t o r s _ f o u n d
=
3
n o _ s p r e a d _ f o u n d
=
4
d e r i v e d _ 2 _ t i m e s
=
5 .
s y - s u b r c M E S S A G E
< >
0 .
' C u r r e n c y
c o n v e r s i o n
f a i l e d '
T Y P E
' E ' .
E N D I F . l s _ c u s t o m e r - p a y s u m
=
l s _ c u s t o m e r - p a y s u m
+
l v _ a m n t _ c o n v .
E N D L O O P . I F
l s _ c u s t o m e r - p a y s u m I N S E R T
l s _ c u s t o m e r
< > I N T O
0 . T A B L E
c t _ c u s t o m e r s .
E N D I F . E N D L O O P .
C o n t i n u e d o n n e x t p a g e
1 7 4
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n :
E N D F O R M .
C r e a tin g
A n a ly tic
V ie w
"
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * &
F o r m
g e t _ d a t a _ s o l u t i o n
* & - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * F O R M *
g e t _ d a t a _ s o l u t i o n
A D B C
O b j e c t s
D A T A :
*
T Y P E
t y _ t _ c u s t o m e r s .
v a r i a b l e s T Y P E
R E F
T O
c l _ s q l _ c o n n e c t i o n ,
l o _ s q l
T Y P E
R E F
T O
c l _ s q l _ s t a t e m e n t ,
l o _ r e s u l t
T Y P E
R E F
T O
c l _ s q l _ r e s u l t _ s e t ,
l v _ s q l
T Y P E
s t r i n g ,
l r _ d a t a
T Y P E
R E F
T O
d a t a .
h a n d l i n g l x _ s q l _ e x c l v _ t e x t
*
c t _ c u s t o m e r s
l o _ c o n
E c e p t i o n D A T A :
a n d
C H A N G I N G
T Y P E
T Y P E
R E F
T O
c x _ s q l _ e x c e p t i o n ,
s t r i n g .
P r o c e s s i n g
* * * * * * * * * * * * * * * * * C L E A R
c t _ c u s t o m e r s .
T R Y . *
G e t
s e c o n d a r y l o _ c o n
*
C r e a t e
=
D B
C o n n e c t i o n
c l _ s q l _ c o n n e c t i o n = > g e t _ c o n n e c t i o n (
c _ c o n
) .
s t a t e m e n t
C R E A T E
O B J E C T
l o _ s q l
E X P O R T I N G c o n _ r e f *
c r e a t e
S Q L
=
l o _ c o n .
s t a t e m e n t
C O N C A T E N A T E
` S E L E C T
I D ,
` F R O M
N A M E ,
P O S T C O D E ,
C I T Y ,
C O U N T R Y ,
P A Y S U M `
_ S Y S _ B I C . " y h a 4 0 0 . s o l u t i o n / A N _ C U S T _ W I T H _ P A Y S U M " `
` W H E R E
M A N D T
=
`
s y - m a n d t ' O R D E R I N T O
* *
A l t e r n a t i v e : l v _ s q l
U s e =
M A N D T ,
I D
'
l v _ s q l
S E P A R A T E D *
B Y
B Y
s p a c e .
s t r i n g
| S E L E C T | F R O M
t e m p l a t e s
I D ,
N A M E ,
a n d
s t r i n g
P O S T C O D E ,
e x p r e s s i o n s
C I T Y ,
C O U N T R Y ,
P A Y S U M M
_ S Y S _ B I C . " y h a 4 0 0 . s o l u t i o n / A N _ C U S T _ W I T H _ P A Y S U M
|
& & |
& &
C o n t i n u e d o n n e x t p a g e
2 0 1 3
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 7 5
U n it 5 : C r e a tin g A n a ly tic a l V ie w
H A 4 0 0
*
| W H E R E
M A N D T
*
| O R D E R
B Y
*
E x e c u t e
R e a d
r e s u l t G E T
{
s y - m a n d t
M A N D T ,
I D
=
|
& &
| .
l o _ s q l - > e x e c u t e _ q u e r y (
i n t o
R E F E R E N C E
i n t e r n a l O F
c t _ c u s t o m e r s
l o _ r e s u l t - > n e x t _ p a c k a g e ( l o _ r e s u l t - > c l o s e (
=
M E S S A G E
l v _ t e x t
) .
I N T O
l r _ d a t a .
l r _ d a t a
) .
) .
) .
c x _ s q l _ e x c e p t i o n
l v _ t e x t
l v _ s q l
T a b l e
l o _ r e s u l t - > s e t _ p a r a m _ t a b l e (
C A T C H
}
Q u e r y
l o _ r e s u l t *
=
I N T O
l x _ s q l _ e x c .
l x _ s q l _ e x c - > g e t _ t e x t ( T Y P E
"
E x c e p t i o n
C l a s s
f o r
S Q L
E r r o r
) .
' E ' .
E N D T R Y . E N D F O R M .
1 7 6
"
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
L e s s o n :
C r e a tin g
A n a ly tic
V ie w
L e s s o n S u m m a r y Y o u s h o u l d n o w b e a b l e t o : •
2 0 1 3
C r e a t e a n A n a l y ti c v ie w
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
1 7 7
U n it S u m m a r y
H A 4 0 0
U n it S u m m a r y Y o u s h o u l d n o w b e a b l e t o : •
1 7 8
C r e a t e a n A n a l y ti c v ie w
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3
H A 4 0 0
C o u rs e
S u m m a ry
C o u r s e S u m m a r y Y o u s h o u l d n o w b e a b l e t o :
2 0 1 3
•
U n d e rs ta n d th e T e c h n ic a l S A P H A N A
•
U n d e r s ta n d O p tim iz a tio n o f c la s s ic a l A B A P in H A N A
•
D e s c r i b e t h e u s a g e o f A n a l y s i s T o o l s ( R u n t i m e A n a l y s i s , C o d e I n s p e c t o r , S Q L T r a c e )
•
U n d e r s t a n d S Q L P e r f o r m a n c e R u l e s o f A B A P f o r H A N A
•
E x p la in Im p le m e n tin g A B A P re p o rt o n H A N A B a s e C o n n e c t i v i t y )
•
E x p la in C o n s u m in g H A N A
•
E x p la in C re a tin g H A N A
©
2 0 1 3 S A P
c o n c e p ts C o n t e x t
u s i n g A D B C ( A B A P D a t a
v i e w s i n A B A P
v i e w s a n d C o n s u m i n g i n A B A P
A G . A ll r ig h ts r e s e r v e d .
1 7 9
C o u rs e S u m m a r y
1 8 0
H A 4 0 0
©
2 0 1 3 S A P
A G . A ll r ig h ts r e s e r v e d .
2 0 1 3