Sunday, February 13, 2011

SQL Example COUNT , Select single and sql function(ABAP Programming)


SQL Example COUNT , Select single and sql function(ABAP Programming) 

*** counting the database rows

REPORT  ZCount_Test.
parameters: p1 LIKE VBAP-VBELN.
write:/ p1.
Tables VBAP.
SELECT COUNT(*)
FROM VBAP INTO total
WHERE VBELN <= p1 AND POSNR = '30'.
write:/ total.

*** selecting single Rows using sql function

REPORT  ZSelect_single-Test.
parameters: p1 LIKE VBAP-VBELN.
write:/ p1.
parameters: p1 LIKE VBAP-VBELN.
write:/ p1.
tables VBAP.
select single * from VBAP
where VBELN IN (p1).
write: / VBAP-VBELN,VBAP-POSNR,VBAP-MATNR,VBAP-MATWA, VBAP-ARKTX .

No comments:

Post a Comment