SlideShare ist ein Scribd-Unternehmen logo
1 von 65
ABAP Advanced List
 Control Break Report
 ALV Report
Types of ABAP Report
1. Report Listing
2. Drill-down Report
3. Control-break Report
4. ALV Report
1
3
4
Internal Table Processing Technique
Control-Break Report
Control Break Report Technique
 AT FIRST
 AT NEW <Control Break field>
 AT END OF <Control Break field>
 AT LAST
ENDAT
 SUM
Program Structure
…
LOOP AT tab.
*Print Header
AT FIRST.
…
ENDAT.
*Print Control Break Field
AT NEW name.
…
ENDAT.
*Print Normal Data
WRITE: / …
*Sub Total
AT END OF name.
…
ENDAT.
*Report Total
AT LAST.
…
ENDAT.
ENDLOOP.
name qty
tab
Example I
name qty
A 10
A 20
A 30
B 5
B 10
sales
Example I
…
LOOP AT SALES.
*Print Header
AT FIRST.
FORMAT COLOR 1.
WRITE: / 'Name', 23 'Qty', 35 ' '.
ULINE: /(35).
FORMAT COLOR OFF.
ENDAT.
*Print Control Break Field
AT NEW NAME.
WRITE: / SALES-NAME.
ULINE: /(5).
ENDAT.
*Print Normal Data
WRITE: /15 SALES-QTY.
Example I
*Print Total for each group data
AT END OF NAME.
ULINE: /(35).
SUM.
WRITE: /5 'Total' ,15 SALES-QTY COLOR 3.
ENDAT.
*Print Grand Total for the report
AT LAST.
ULINE: /(35).
SUM.
WRITE: /2 'Grand Total', 15 SALES-QTY COLOR 7.
ULINE: /(35).
ENDAT.
ENDLOOP.
Example II
name qty
A 10
A 20
A 30
B 5
B 10
sales
Example II
…
LOOP AT SALES.
AT FIRST.
FORMAT COLOR 1.
WRITE: / 'Name', 23 'Qty', 35 ' '.
ULINE: /(35).
FORMAT COLOR OFF.
ENDAT.
AT END OF NAME.
SUM.
WRITE: / SALES-NAME, 15 SALES-QTY.
ULINE: /(35).
ENDAT.
AT LAST.
SUM.
WRITE: /5 'Total', 15 SALES-QTY.
ULINE: /(35).
ENDAT.
ENDLOOP.
Exercise I
ZSALES
cust_id prod_id sale_date qty
1 A1 20020318 10
1 A1 20020319 100
1 A1 20020329 50
1 A2 20020318 50
1 A2 20020329 200
3 X1 20020321 90
Exercise I
ID
Product ID Quantity
1
A1 10
A1 100
A1 50
A2 50
A2 200
------------------------------
Total 410
3
X1 90
------------------------------
Total 90
------------------------------
Grand Total 500
----------------------------------
Example Data for Example III
Carrid Connid Cityfrom cityto distance
LH 0400 NY BK 100
LH 0402 BK NY 540
SQ 0110 SQ BK 250
spfli
Example III
Data flight like spfli occurs 0 with Header line.
Select * from spfli into table flight.
loop at flight.
at new carrid.
write : / flight-carrid.
endat.
write flight-connid.
at end of carrid.
uline / (25).
endat.
endloop.
LH 0400 0402
___________
SQ 0110
___________
Internal Table Processing Example
ID Name prodno Month YTD Accum
1 A 01 100.00 400.00 1,000.00
1 A 02 50.00 100.00 100.00
1 A 03 100.00 100.00 100.00
2 B 02 100.00 1,000.00 2,000.00
2 B 03 100.00 100.00 100.00
tab(internal table)
ID Name Month Y-T-D Accumulated
Product No.
------------------------------------------------------------------------------------
1 A
-----------------
01 100.00 400.00 1,000.00
02 50.00 100.00 100.00
03 100.00 100.00 100.00
----------------------------------------------------
250.00 600.00 1,200.00
2 B
-----------------
02 100.00 1,000.00 2,000.00
03 100.00 100.00 100.00
----------------------------------------------------
200.00 1,100.00 2,100.00
----------------------------------------------------
Total 450.00 1,340.00 3,200.00
----------------------------------------------------
...
loop at tab.
at first.
write: / ‘ID’ , 10 ‘Name’, 30 ‘Month’, 50 ‘Y-T-D’ ,
70 ‘Accumulated’.
write: /5 ‘Product No’.
uline /.
endat.
on change of tab-id.
write: / tab-id, 10 tab-name.
uline: /(20).
endon.
write: /5 tab-prodno, 30 tab-month, 50 tab-ytd,
70 tab-accum.
ABAP Program
at end of id.
uline /30(60).
sum.
write: /30 tab-month, 50 tab-ytd, 70 tab-accum.
skip.
endat.
at last.
sum.
uline /30(60).
write: /10 ‘Total’, 30 tab-month, 50 tab-ytd, 70 tab-accum.
uline /30(60).
endat.
endloop.
ABAP Program
Exercise II
id name city
1 John New York
2 Peter London
3 David Singapore
cust_id prod_id sale_date qty
1 A1 20020318 10
1 A1 20020319 100
1 A1 20020329 50
1 A2 20020318 50
1 A2 20020329 200
3 X1 20020321 90
ZSALES
ZCUSTOMERS
Exercise II
ID Name
____Product ID Quantity
1 John
A1 10
A1 100
A1 50
A2 50
A2 200
----------------------------
Total 410
3 Peter
X1 90
----------------------------
Total 90
----------------------------
Grand Total 500
-------------------------------
Control Break Report > 1 Level
f1 f2 f3
A 1 1
A 1 2
A 2 1
B 2 1
B 2 2
B 3 3
C 3 4
tab
Loop at tab.
…
at new f1.
…
endat.
at new f2.
…
endat.
write: / … “normal data
at end of f2.
…
endat.
at end of f1.
…
endat.
…
Endloop.
sort tab by f1 f2. Group Header Level
1
Group Header Level 2
Sub Total Level 2
Sub Total Level 1
Example IV (Control-break 2 Levels)
name date qty
A 20070126 10
A 20070126 20
A 20070128 30
B 20070126 5
B 20070126 10
sales
Example IV (Control-break 2 Levels)
…
AT NEW NAME.
WRITE: / SALES-NAME.
ULINE: /(5).
ENDAT.
AT NEW DATE.
WRITE: /10 SALES-DATE.
ULINE: /10(10).
ENDAT.
WRITE: /30 SALES-QTY.
AT END OF DATE.
ULINE: /(50).
SUM.
WRITE: /15 'Sub Total(Date)' ,30 SALES-QTY COLOR COL_TOTAL.
ENDAT.
AT END OF NAME.
ULINE: /(50).
SUM.
WRITE: /5 'Sub Total(Name)' ,30 SALES-QTY COLOR COL_TOTAL.
ENDAT.
…
Exercise III
cust_id prod_id sale_date qty
1 A1 20020318 10
1 A1 20020319 100
1 A1 20020329 50
1 A2 20020318 50
1 A2 20020329 200
3 X1 20020321 90
ZSALES
Exercise III
ALV ReportALV Report
ALV Report
 ALV Report Listing using Function
Module
 ALV Report using Control (ABAP Object)
ALV Grid Listing
 Call function ‘REUSE_ALV_GRID_DISPLAY’
ALV Grid Listing Example
REPORT ZALV01 NO STANDARD PAGE HEADING.
* Internal table
DATA: GT_TAB LIKE SFLIGHT OCCURS 0 WITH HEADER LINE.
* Load Data from DB into internal table
SELECT * FROM SFLIGHT INTO TABLE GT_TAB.
* Call ABAP List Viewer function
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'SFLIGHT'
TABLES
T_OUTTAB = GT_TAB.
ALV Example I
List/Grid Display
ALV List/Grid Display
REPORT ZALV02 NO STANDARD PAGE HEADING.
PARAMETERS: list radiobutton group grp1,
grid radiobutton group grp1.
DATA: gt_tab LIKE sflight OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.
SELECT * FROM sflight INTO TABLE gt_tab.
IF list = 'X'.
* Call ALV List Viewer
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'SFLIGHT'
TABLES
T_OUTTAB = GT_TAB.
ELSE.
* Call ALV Grid Viewer
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'SFLIGHT'
TABLES
T_OUTTAB = GT_TAB.
ENDIF..
ALV Report : Exercise I
ALV Example II
Using Field Catalog
ALV Field Catalog
REPORT ZALV03 NO STANDARD PAGE HEADING.
type-pools slis.
types: begin of i_structure,
carrid like sflight-carrid,
connid like sflight-connid,
fldate like sflight-fldate,
price like sflight-price,
end of i_structure.
data: gt_fieldcat type slis_t_fieldcat_alv,
gt_outtab type i_structure occurs 0 with header line.
initialization.
perform field_cat_init using gt_fieldcat[].
ALV Field Catalog
FORM field_cat_init using rt_fieldcat type slis_t_fieldcat_alv.
data: ls_fieldcat type slis_fieldcat_alv,
pos type i value 1.
clear LS_FIELDCAT.
*Column 1
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'CARRID'.
ls_fieldcat-ref_fieldname = 'CARRID'.
ls_fieldcat-ref_tabname = 'SFLIGHT'.
ls_fieldcat-key = 'X'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
ALV Field Catalog
*Column 2
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'CONNID'.
ls_fieldcat-ref_fieldname = 'CONNID'.
ls_fieldcat-ref_tabname = 'SFLIGHT'.
ls_fieldcat-key = 'X'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 3
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'FLDATE'.
ls_fieldcat-ref_fieldname = 'FLDATE'.
ls_fieldcat-ref_tabname = 'SFLIGHT'.
ls_fieldcat-key = 'X'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
ALV Field Catalog
*Column 4
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'PRICE'.
ls_fieldcat-ref_fieldname = 'PRICE'.
ls_fieldcat-ref_tabname = 'SFLIGHT'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
endform.
ALV Field Catalog
START-OF-SELECTION.
SELECT carrid connid fldate price
FROM SFLIGHT
INTO TABLE GT_OUTTAB.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'I_STRUCTURE'
IT_FIELDCAT = gt_fieldcat[]
TABLES
T_OUTTAB = gt_outtab.
ALV Field Catalog
ALV Report : Exercise II
ALV Example III
Using Field Catalog
(Add Derived Column)
ALV Field Catalog – Add
Field
…
types: begin of i_structure,
carrid like sflight-carrid,
connid like sflight-connid,
fldate like sflight-fldate,
price like sflight-price,
avail_seat like SFLIGHT-SEATSOCC,
end of i_structure.
…
START-OF-SELECTION.
select * from sflight.
move-corresponding sflight to gt_outtab.
gt_outtab-avail_seat = sflight-seatsmax - sflight-seatsocc.
append gt_outtab.
endselect.
ALV Field Catalog – Add Field
form field_cat_init using rt_fieldcat type slis_t_fieldcat_alv.
…
*Column 4
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'PRICE'.
ls_fieldcat-ref_fieldname = 'PRICE'.
ls_fieldcat-ref_tabname = 'SFLIGHT'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 5
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'AVAIL_SEAT'.
ls_fieldcat-SELTEXT_L = 'Available Seat'.
ls_fieldcat-DDICTXT = 'L'.
*ls_fieldcat-ref_fieldname = 'SEATSOCC'.
*ls_fieldcat-ref_tabname = 'SFLIGHT'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
endform.
ALV Field Catalog – Add Field
ALV Report : Exercise III
ALV Example IV
Using Field Catalog
(SELECT … INNER JOIN…)
ALV Field Catalog – Select … Inner Join …
…
types: begin of i_structure,
carrid LIKE spfli-carrid,
connid LIKE spfli-connid,
fldate LIKE sflight-fldate,
cityto LIKE spfli-cityto,
price LIKE sflight-price,
end of i_structure.
…
START-OF-SELECTION.
SELECT spfli~carrid spfli~connid sflight~fldate
spfli~cityto sflight~price
INTO TABLE gt_outtab
FROM spfli INNER JOIN sflight
ON spfli~carrid = sflight~carrid AND
spfli~connid = sflight~connid.
ALV Field Catalog
form field_cat_init using rt_fieldcat type slis_t_fieldcat_alv.
…
*Column 4
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'CITYTO'.
ls_fieldcat-ref_fieldname = 'CITYTO'.
ls_fieldcat-ref_tabname = 'SPFLI'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
*Column 5
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'PRICE'.
ls_fieldcat-ref_fieldname = 'PRICE'.
ls_fieldcat-ref_tabname = 'SFLIGHT'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ENDFORM. "field_cat_init
ALV Report : Example IV
Exercise IV
id name city
1 John New York
2 Peter London
3 David Singapore
cust_id prod_id sale_date qty
1 A1 20020318 10
1 A1 20020319 100
1 A1 20020329 50
1 A2 20020318 50
1 A2 20020329 200
3 X1 20020321 90
ZSALES
ZCUSTOMERS
p_id prod_name on_hand
A1 Pen 100
A2 Pencil 125
B1 Ruler 80
X1 Tape 120
ZPRODUCTS
ALV Report : Exercise IV
zcustomers-id
zcustomers-name zproducts-
prod_name
zsales-sale_date
zsales-qty
ALV Technique
ALV : Variant
ALV : Variant
REPORT ZALV06 NO STANDARD PAGE HEADING.
type-pools slis.
types: begin of i_structure,
carrid like sflight-carrid,
connid like sflight-connid,
fldate like sflight-fldate,
price like sflight-price,
end of i_structure.
data: gt_fieldcat type slis_t_fieldcat_alv,
isvariant like DISVARIANT. "ADD
gt_outtab type i_structure occurs 0 with header line.
initialization.
perform field_cat_init using gt_fieldcat[].
isvariant-report = 'ZALV06'. "ADD
ALV : Variant
START-OF-SELECTION.
SELECT carrid connid fldate price
FROM SFLIGHT
INTO TABLE GT_OUTTAB.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'I_STRUCTURE'
IT_FIELDCAT = gt_fieldcat[]
IS_VARIANT = isvariant "ADD
I_SAVE = 'A' "ADD
“ A = user&Global,U = user,X = globa
TABLES
T_OUTTAB = gt_outtab.
ALV : Zebra
ALV : Zebra
REPORT ZALV2 NO STANDARD PAGE HEADING.
type-pools slis.
types: begin of i_structure,
carrid like sflight-carrid,
connid like sflight-connid,
fldate like sflight-fldate,
price like sflight-price,
end of i_structure.
data: gt_fieldcat type slis_t_fieldcat_alv,
GT_LAYOUT TYPE SLIS_LAYOUT_ALV, "ADD
gt_outtab type i_structure occurs 0 with header line.
initialization.
perform field_cat_init using gt_fieldcat[].
GT_LAYOUT-ZEBRA = 'X'. "ADD
ALV : Zebra
START-OF-SELECTION.
SELECT carrid connid fldate price
FROM SFLIGHT
INTO TABLE GT_OUTTAB.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'I_STRUCTURE'
IT_FIELDCAT = gt_fieldcat[]
IS_LAYOUT = GT_LAYOUT "ADD
TABLES
T_OUTTAB = gt_outtab.
ALV : Title
ALV : Title
REPORT ZALV2 NO STANDARD PAGE HEADING.
type-pools slis.
types: begin of i_structure,
carrid like sflight-carrid,
connid like sflight-connid,
fldate like sflight-fldate,
price like sflight-price,
end of i_structure.
data: gt_fieldcat type slis_t_fieldcat_alv,
GT_GID_TITLE TYPE LVC_TITLE, "ADD
gt_outtab type i_structure occurs 0 with header line.
initialization.
perform field_cat_init using gt_fieldcat[].
concatenate 'Flight Information' ' for ALV Report' into GT_GID_TITLE. "ADD
ALV : Title
START-OF-SELECTION.
SELECT carrid connid fldate price
FROM SFLIGHT
INTO TABLE GT_OUTTAB.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'I_STRUCTURE'
IT_FIELDCAT = gt_fieldcat[]
I_GRID_TITLE = GT_GID_TITLE "ADD
TABLES
T_OUTTAB = gt_outtab.
Exercise
Exercise : Sale Order
VBAK
KNA1
VBAP
Exercise : Control-break Report
vbak-vbeln
vbak-audat
vbak-kunnr kna1-name1
vbap-matnr
vbap-netwr
Exercise : ALV Report
vbak-vbeln
vbak-audat
vbak-kunnr kna1-name1
vbap-matnr vbap-netwr

Weitere ähnliche Inhalte

Was ist angesagt?

List Processing in ABAP
List Processing in ABAPList Processing in ABAP
List Processing in ABAPsapdocs. info
 
Message, Debugging, File Transfer and Type Group
Message, Debugging, File Transfer and Type GroupMessage, Debugging, File Transfer and Type Group
Message, Debugging, File Transfer and Type Groupsapdocs. info
 
Alvedit programs
Alvedit programsAlvedit programs
Alvedit programsmcclintick
 
Common SQL Programming Mistakes
Common SQL Programming MistakesCommon SQL Programming Mistakes
Common SQL Programming MistakesPlamen Ratchev
 
Stack using Linked List
Stack using Linked ListStack using Linked List
Stack using Linked ListSayantan Sur
 
StackArray stack3
StackArray stack3StackArray stack3
StackArray stack3Rajendran
 
SQL-RDBMS Queries and Question Bank
SQL-RDBMS Queries and Question BankSQL-RDBMS Queries and Question Bank
SQL-RDBMS Queries and Question BankMd Mudassir
 
Tablas, Codigos Base De Datos Excelsa
Tablas, Codigos Base De Datos ExcelsaTablas, Codigos Base De Datos Excelsa
Tablas, Codigos Base De Datos ExcelsaHéctor
 
Data structures stacks
Data structures   stacksData structures   stacks
Data structures stacksmaamir farooq
 
[APJ] Common Table Expressions (CTEs) in SQL
[APJ] Common Table Expressions (CTEs) in SQL[APJ] Common Table Expressions (CTEs) in SQL
[APJ] Common Table Expressions (CTEs) in SQLEDB
 

Was ist angesagt? (20)

List Processing in ABAP
List Processing in ABAPList Processing in ABAP
List Processing in ABAP
 
Basic programming
Basic programmingBasic programming
Basic programming
 
Reports
ReportsReports
Reports
 
Sql lab experiments
Sql lab experimentsSql lab experiments
Sql lab experiments
 
Message, Debugging, File Transfer and Type Group
Message, Debugging, File Transfer and Type GroupMessage, Debugging, File Transfer and Type Group
Message, Debugging, File Transfer and Type Group
 
Alvedit programs
Alvedit programsAlvedit programs
Alvedit programs
 
To excel or not?
To excel or not?To excel or not?
To excel or not?
 
Program For Parsing2
Program For Parsing2Program For Parsing2
Program For Parsing2
 
Sql query [select, sub] 4
Sql query [select, sub] 4Sql query [select, sub] 4
Sql query [select, sub] 4
 
Zmalv output type_v1.1
Zmalv output type_v1.1Zmalv output type_v1.1
Zmalv output type_v1.1
 
Alv Block
Alv BlockAlv Block
Alv Block
 
Common SQL Programming Mistakes
Common SQL Programming MistakesCommon SQL Programming Mistakes
Common SQL Programming Mistakes
 
Stack using Linked List
Stack using Linked ListStack using Linked List
Stack using Linked List
 
Stack using Array
Stack using ArrayStack using Array
Stack using Array
 
StackArray stack3
StackArray stack3StackArray stack3
StackArray stack3
 
SQL-RDBMS Queries and Question Bank
SQL-RDBMS Queries and Question BankSQL-RDBMS Queries and Question Bank
SQL-RDBMS Queries and Question Bank
 
Tablas, Codigos Base De Datos Excelsa
Tablas, Codigos Base De Datos ExcelsaTablas, Codigos Base De Datos Excelsa
Tablas, Codigos Base De Datos Excelsa
 
Sql cheat sheet
Sql cheat sheetSql cheat sheet
Sql cheat sheet
 
Data structures stacks
Data structures   stacksData structures   stacks
Data structures stacks
 
[APJ] Common Table Expressions (CTEs) in SQL
[APJ] Common Table Expressions (CTEs) in SQL[APJ] Common Table Expressions (CTEs) in SQL
[APJ] Common Table Expressions (CTEs) in SQL
 

Ähnlich wie 07.advanced abap

03 abap3-090715081232-phpapp01-100511101016-phpapp02
03 abap3-090715081232-phpapp01-100511101016-phpapp0203 abap3-090715081232-phpapp01-100511101016-phpapp02
03 abap3-090715081232-phpapp01-100511101016-phpapp02tabish
 
03 abap3-090715081232-phpapp01
03 abap3-090715081232-phpapp0103 abap3-090715081232-phpapp01
03 abap3-090715081232-phpapp01wingsrai
 
Technical specification : SD(Logistics)_Order_Processing
Technical specification : SD(Logistics)_Order_ProcessingTechnical specification : SD(Logistics)_Order_Processing
Technical specification : SD(Logistics)_Order_ProcessingJoshiRavin
 
1582627
15826271582627
1582627tabish
 
The Ring programming language version 1.6 book - Part 9 of 189
The Ring programming language version 1.6 book - Part 9 of 189The Ring programming language version 1.6 book - Part 9 of 189
The Ring programming language version 1.6 book - Part 9 of 189Mahmoud Samir Fayed
 
Cobol Error Its states that my patron-line wasnt defined as a data .pdf
Cobol Error Its states that my patron-line wasnt defined as a data .pdfCobol Error Its states that my patron-line wasnt defined as a data .pdf
Cobol Error Its states that my patron-line wasnt defined as a data .pdfrydeberghal13313
 
Module-Pool-Tutorial.pdf
Module-Pool-Tutorial.pdfModule-Pool-Tutorial.pdf
Module-Pool-Tutorial.pdfSuman817957
 
Report zcomprasreporte abap
Report zcomprasreporte abapReport zcomprasreporte abap
Report zcomprasreporte abapDavid Roque
 
ABAP Dialog Programming Overview.ppt
ABAP Dialog Programming Overview.pptABAP Dialog Programming Overview.ppt
ABAP Dialog Programming Overview.pptGaneshP820675
 
OpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersOpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersConnor McDonald
 
StarPort_Capabilities_List_Rev_6
StarPort_Capabilities_List_Rev_6StarPort_Capabilities_List_Rev_6
StarPort_Capabilities_List_Rev_6kelliemcdaniel
 
The Ring programming language version 1.7 book - Part 10 of 196
The Ring programming language version 1.7 book - Part 10 of 196The Ring programming language version 1.7 book - Part 10 of 196
The Ring programming language version 1.7 book - Part 10 of 196Mahmoud Samir Fayed
 
kscope2013vst-130627142814-phpapp02.pdf
kscope2013vst-130627142814-phpapp02.pdfkscope2013vst-130627142814-phpapp02.pdf
kscope2013vst-130627142814-phpapp02.pdfTricantinoLopezPerez
 

Ähnlich wie 07.advanced abap (20)

Alv theory
Alv theoryAlv theory
Alv theory
 
03 abap3-090715081232-phpapp01-100511101016-phpapp02
03 abap3-090715081232-phpapp01-100511101016-phpapp0203 abap3-090715081232-phpapp01-100511101016-phpapp02
03 abap3-090715081232-phpapp01-100511101016-phpapp02
 
03 abap3-090715081232-phpapp01
03 abap3-090715081232-phpapp0103 abap3-090715081232-phpapp01
03 abap3-090715081232-phpapp01
 
Technical specification : SD(Logistics)_Order_Processing
Technical specification : SD(Logistics)_Order_ProcessingTechnical specification : SD(Logistics)_Order_Processing
Technical specification : SD(Logistics)_Order_Processing
 
Report zalv
Report  zalvReport  zalv
Report zalv
 
1582627
15826271582627
1582627
 
The Ring programming language version 1.6 book - Part 9 of 189
The Ring programming language version 1.6 book - Part 9 of 189The Ring programming language version 1.6 book - Part 9 of 189
The Ring programming language version 1.6 book - Part 9 of 189
 
Cobol Error Its states that my patron-line wasnt defined as a data .pdf
Cobol Error Its states that my patron-line wasnt defined as a data .pdfCobol Error Its states that my patron-line wasnt defined as a data .pdf
Cobol Error Its states that my patron-line wasnt defined as a data .pdf
 
Module-Pool-Tutorial.pdf
Module-Pool-Tutorial.pdfModule-Pool-Tutorial.pdf
Module-Pool-Tutorial.pdf
 
ZFINDALLZPROGAM
ZFINDALLZPROGAMZFINDALLZPROGAM
ZFINDALLZPROGAM
 
Sort presentation
Sort presentationSort presentation
Sort presentation
 
Report zcomprasreporte abap
Report zcomprasreporte abapReport zcomprasreporte abap
Report zcomprasreporte abap
 
ABAP Dialog Programming Overview.ppt
ABAP Dialog Programming Overview.pptABAP Dialog Programming Overview.ppt
ABAP Dialog Programming Overview.ppt
 
Classical report
Classical reportClassical report
Classical report
 
DBMS Lab
DBMS LabDBMS Lab
DBMS Lab
 
OpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersOpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developers
 
Alv a otro alv
Alv a otro alvAlv a otro alv
Alv a otro alv
 
StarPort_Capabilities_List_Rev_6
StarPort_Capabilities_List_Rev_6StarPort_Capabilities_List_Rev_6
StarPort_Capabilities_List_Rev_6
 
The Ring programming language version 1.7 book - Part 10 of 196
The Ring programming language version 1.7 book - Part 10 of 196The Ring programming language version 1.7 book - Part 10 of 196
The Ring programming language version 1.7 book - Part 10 of 196
 
kscope2013vst-130627142814-phpapp02.pdf
kscope2013vst-130627142814-phpapp02.pdfkscope2013vst-130627142814-phpapp02.pdf
kscope2013vst-130627142814-phpapp02.pdf
 

Kürzlich hochgeladen

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 

Kürzlich hochgeladen (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 

07.advanced abap

  • 1. ABAP Advanced List  Control Break Report  ALV Report
  • 2. Types of ABAP Report 1. Report Listing 2. Drill-down Report 3. Control-break Report 4. ALV Report 1 3 4
  • 3. Internal Table Processing Technique Control-Break Report
  • 4. Control Break Report Technique  AT FIRST  AT NEW <Control Break field>  AT END OF <Control Break field>  AT LAST ENDAT  SUM
  • 5. Program Structure … LOOP AT tab. *Print Header AT FIRST. … ENDAT. *Print Control Break Field AT NEW name. … ENDAT. *Print Normal Data WRITE: / … *Sub Total AT END OF name. … ENDAT. *Report Total AT LAST. … ENDAT. ENDLOOP. name qty tab
  • 6. Example I name qty A 10 A 20 A 30 B 5 B 10 sales
  • 7. Example I … LOOP AT SALES. *Print Header AT FIRST. FORMAT COLOR 1. WRITE: / 'Name', 23 'Qty', 35 ' '. ULINE: /(35). FORMAT COLOR OFF. ENDAT. *Print Control Break Field AT NEW NAME. WRITE: / SALES-NAME. ULINE: /(5). ENDAT. *Print Normal Data WRITE: /15 SALES-QTY.
  • 8. Example I *Print Total for each group data AT END OF NAME. ULINE: /(35). SUM. WRITE: /5 'Total' ,15 SALES-QTY COLOR 3. ENDAT. *Print Grand Total for the report AT LAST. ULINE: /(35). SUM. WRITE: /2 'Grand Total', 15 SALES-QTY COLOR 7. ULINE: /(35). ENDAT. ENDLOOP.
  • 9. Example II name qty A 10 A 20 A 30 B 5 B 10 sales
  • 10. Example II … LOOP AT SALES. AT FIRST. FORMAT COLOR 1. WRITE: / 'Name', 23 'Qty', 35 ' '. ULINE: /(35). FORMAT COLOR OFF. ENDAT. AT END OF NAME. SUM. WRITE: / SALES-NAME, 15 SALES-QTY. ULINE: /(35). ENDAT. AT LAST. SUM. WRITE: /5 'Total', 15 SALES-QTY. ULINE: /(35). ENDAT. ENDLOOP.
  • 11. Exercise I ZSALES cust_id prod_id sale_date qty 1 A1 20020318 10 1 A1 20020319 100 1 A1 20020329 50 1 A2 20020318 50 1 A2 20020329 200 3 X1 20020321 90
  • 12. Exercise I ID Product ID Quantity 1 A1 10 A1 100 A1 50 A2 50 A2 200 ------------------------------ Total 410 3 X1 90 ------------------------------ Total 90 ------------------------------ Grand Total 500 ----------------------------------
  • 13. Example Data for Example III Carrid Connid Cityfrom cityto distance LH 0400 NY BK 100 LH 0402 BK NY 540 SQ 0110 SQ BK 250 spfli
  • 14. Example III Data flight like spfli occurs 0 with Header line. Select * from spfli into table flight. loop at flight. at new carrid. write : / flight-carrid. endat. write flight-connid. at end of carrid. uline / (25). endat. endloop. LH 0400 0402 ___________ SQ 0110 ___________
  • 15. Internal Table Processing Example ID Name prodno Month YTD Accum 1 A 01 100.00 400.00 1,000.00 1 A 02 50.00 100.00 100.00 1 A 03 100.00 100.00 100.00 2 B 02 100.00 1,000.00 2,000.00 2 B 03 100.00 100.00 100.00 tab(internal table)
  • 16. ID Name Month Y-T-D Accumulated Product No. ------------------------------------------------------------------------------------ 1 A ----------------- 01 100.00 400.00 1,000.00 02 50.00 100.00 100.00 03 100.00 100.00 100.00 ---------------------------------------------------- 250.00 600.00 1,200.00 2 B ----------------- 02 100.00 1,000.00 2,000.00 03 100.00 100.00 100.00 ---------------------------------------------------- 200.00 1,100.00 2,100.00 ---------------------------------------------------- Total 450.00 1,340.00 3,200.00 ----------------------------------------------------
  • 17. ... loop at tab. at first. write: / ‘ID’ , 10 ‘Name’, 30 ‘Month’, 50 ‘Y-T-D’ , 70 ‘Accumulated’. write: /5 ‘Product No’. uline /. endat. on change of tab-id. write: / tab-id, 10 tab-name. uline: /(20). endon. write: /5 tab-prodno, 30 tab-month, 50 tab-ytd, 70 tab-accum. ABAP Program
  • 18. at end of id. uline /30(60). sum. write: /30 tab-month, 50 tab-ytd, 70 tab-accum. skip. endat. at last. sum. uline /30(60). write: /10 ‘Total’, 30 tab-month, 50 tab-ytd, 70 tab-accum. uline /30(60). endat. endloop. ABAP Program
  • 19. Exercise II id name city 1 John New York 2 Peter London 3 David Singapore cust_id prod_id sale_date qty 1 A1 20020318 10 1 A1 20020319 100 1 A1 20020329 50 1 A2 20020318 50 1 A2 20020329 200 3 X1 20020321 90 ZSALES ZCUSTOMERS
  • 20. Exercise II ID Name ____Product ID Quantity 1 John A1 10 A1 100 A1 50 A2 50 A2 200 ---------------------------- Total 410 3 Peter X1 90 ---------------------------- Total 90 ---------------------------- Grand Total 500 -------------------------------
  • 21. Control Break Report > 1 Level f1 f2 f3 A 1 1 A 1 2 A 2 1 B 2 1 B 2 2 B 3 3 C 3 4 tab Loop at tab. … at new f1. … endat. at new f2. … endat. write: / … “normal data at end of f2. … endat. at end of f1. … endat. … Endloop. sort tab by f1 f2. Group Header Level 1 Group Header Level 2 Sub Total Level 2 Sub Total Level 1
  • 22. Example IV (Control-break 2 Levels) name date qty A 20070126 10 A 20070126 20 A 20070128 30 B 20070126 5 B 20070126 10 sales
  • 23. Example IV (Control-break 2 Levels) … AT NEW NAME. WRITE: / SALES-NAME. ULINE: /(5). ENDAT. AT NEW DATE. WRITE: /10 SALES-DATE. ULINE: /10(10). ENDAT. WRITE: /30 SALES-QTY. AT END OF DATE. ULINE: /(50). SUM. WRITE: /15 'Sub Total(Date)' ,30 SALES-QTY COLOR COL_TOTAL. ENDAT. AT END OF NAME. ULINE: /(50). SUM. WRITE: /5 'Sub Total(Name)' ,30 SALES-QTY COLOR COL_TOTAL. ENDAT. …
  • 24. Exercise III cust_id prod_id sale_date qty 1 A1 20020318 10 1 A1 20020319 100 1 A1 20020329 50 1 A2 20020318 50 1 A2 20020329 200 3 X1 20020321 90 ZSALES
  • 27. ALV Report  ALV Report Listing using Function Module  ALV Report using Control (ABAP Object)
  • 28. ALV Grid Listing  Call function ‘REUSE_ALV_GRID_DISPLAY’
  • 29. ALV Grid Listing Example REPORT ZALV01 NO STANDARD PAGE HEADING. * Internal table DATA: GT_TAB LIKE SFLIGHT OCCURS 0 WITH HEADER LINE. * Load Data from DB into internal table SELECT * FROM SFLIGHT INTO TABLE GT_TAB. * Call ABAP List Viewer function CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING I_STRUCTURE_NAME = 'SFLIGHT' TABLES T_OUTTAB = GT_TAB.
  • 31. ALV List/Grid Display REPORT ZALV02 NO STANDARD PAGE HEADING. PARAMETERS: list radiobutton group grp1, grid radiobutton group grp1. DATA: gt_tab LIKE sflight OCCURS 0 WITH HEADER LINE. START-OF-SELECTION. SELECT * FROM sflight INTO TABLE gt_tab. IF list = 'X'. * Call ALV List Viewer CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' EXPORTING I_STRUCTURE_NAME = 'SFLIGHT' TABLES T_OUTTAB = GT_TAB. ELSE. * Call ALV Grid Viewer CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING I_STRUCTURE_NAME = 'SFLIGHT' TABLES T_OUTTAB = GT_TAB. ENDIF..
  • 32. ALV Report : Exercise I
  • 33. ALV Example II Using Field Catalog
  • 34. ALV Field Catalog REPORT ZALV03 NO STANDARD PAGE HEADING. type-pools slis. types: begin of i_structure, carrid like sflight-carrid, connid like sflight-connid, fldate like sflight-fldate, price like sflight-price, end of i_structure. data: gt_fieldcat type slis_t_fieldcat_alv, gt_outtab type i_structure occurs 0 with header line. initialization. perform field_cat_init using gt_fieldcat[].
  • 35. ALV Field Catalog FORM field_cat_init using rt_fieldcat type slis_t_fieldcat_alv. data: ls_fieldcat type slis_fieldcat_alv, pos type i value 1. clear LS_FIELDCAT. *Column 1 ls_fieldcat-col_pos = pos. ls_fieldcat-fieldname = 'CARRID'. ls_fieldcat-ref_fieldname = 'CARRID'. ls_fieldcat-ref_tabname = 'SFLIGHT'. ls_fieldcat-key = 'X'. append ls_fieldcat to rt_fieldcat. clear ls_fieldcat. pos = pos + 1.
  • 36. ALV Field Catalog *Column 2 ls_fieldcat-col_pos = pos. ls_fieldcat-fieldname = 'CONNID'. ls_fieldcat-ref_fieldname = 'CONNID'. ls_fieldcat-ref_tabname = 'SFLIGHT'. ls_fieldcat-key = 'X'. append ls_fieldcat to rt_fieldcat. clear ls_fieldcat. pos = pos + 1. *Column 3 ls_fieldcat-col_pos = pos. ls_fieldcat-fieldname = 'FLDATE'. ls_fieldcat-ref_fieldname = 'FLDATE'. ls_fieldcat-ref_tabname = 'SFLIGHT'. ls_fieldcat-key = 'X'. append ls_fieldcat to rt_fieldcat. clear ls_fieldcat. pos = pos + 1.
  • 37. ALV Field Catalog *Column 4 ls_fieldcat-col_pos = pos. ls_fieldcat-fieldname = 'PRICE'. ls_fieldcat-ref_fieldname = 'PRICE'. ls_fieldcat-ref_tabname = 'SFLIGHT'. append ls_fieldcat to rt_fieldcat. clear ls_fieldcat. pos = pos + 1. endform.
  • 38. ALV Field Catalog START-OF-SELECTION. SELECT carrid connid fldate price FROM SFLIGHT INTO TABLE GT_OUTTAB. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING I_STRUCTURE_NAME = 'I_STRUCTURE' IT_FIELDCAT = gt_fieldcat[] TABLES T_OUTTAB = gt_outtab.
  • 40. ALV Report : Exercise II
  • 41. ALV Example III Using Field Catalog (Add Derived Column)
  • 42. ALV Field Catalog – Add Field … types: begin of i_structure, carrid like sflight-carrid, connid like sflight-connid, fldate like sflight-fldate, price like sflight-price, avail_seat like SFLIGHT-SEATSOCC, end of i_structure. … START-OF-SELECTION. select * from sflight. move-corresponding sflight to gt_outtab. gt_outtab-avail_seat = sflight-seatsmax - sflight-seatsocc. append gt_outtab. endselect.
  • 43. ALV Field Catalog – Add Field form field_cat_init using rt_fieldcat type slis_t_fieldcat_alv. … *Column 4 ls_fieldcat-col_pos = pos. ls_fieldcat-fieldname = 'PRICE'. ls_fieldcat-ref_fieldname = 'PRICE'. ls_fieldcat-ref_tabname = 'SFLIGHT'. append ls_fieldcat to rt_fieldcat. clear ls_fieldcat. pos = pos + 1. *Column 5 ls_fieldcat-col_pos = pos. ls_fieldcat-fieldname = 'AVAIL_SEAT'. ls_fieldcat-SELTEXT_L = 'Available Seat'. ls_fieldcat-DDICTXT = 'L'. *ls_fieldcat-ref_fieldname = 'SEATSOCC'. *ls_fieldcat-ref_tabname = 'SFLIGHT'. append ls_fieldcat to rt_fieldcat. clear ls_fieldcat. pos = pos + 1. endform.
  • 44. ALV Field Catalog – Add Field
  • 45. ALV Report : Exercise III
  • 46. ALV Example IV Using Field Catalog (SELECT … INNER JOIN…)
  • 47. ALV Field Catalog – Select … Inner Join … … types: begin of i_structure, carrid LIKE spfli-carrid, connid LIKE spfli-connid, fldate LIKE sflight-fldate, cityto LIKE spfli-cityto, price LIKE sflight-price, end of i_structure. … START-OF-SELECTION. SELECT spfli~carrid spfli~connid sflight~fldate spfli~cityto sflight~price INTO TABLE gt_outtab FROM spfli INNER JOIN sflight ON spfli~carrid = sflight~carrid AND spfli~connid = sflight~connid.
  • 48. ALV Field Catalog form field_cat_init using rt_fieldcat type slis_t_fieldcat_alv. … *Column 4 ls_fieldcat-col_pos = pos. ls_fieldcat-fieldname = 'CITYTO'. ls_fieldcat-ref_fieldname = 'CITYTO'. ls_fieldcat-ref_tabname = 'SPFLI'. APPEND ls_fieldcat TO rt_fieldcat. CLEAR ls_fieldcat. pos = pos + 1. *Column 5 ls_fieldcat-col_pos = pos. ls_fieldcat-fieldname = 'PRICE'. ls_fieldcat-ref_fieldname = 'PRICE'. ls_fieldcat-ref_tabname = 'SFLIGHT'. APPEND ls_fieldcat TO rt_fieldcat. CLEAR ls_fieldcat. pos = pos + 1. ENDFORM. "field_cat_init
  • 49. ALV Report : Example IV
  • 50. Exercise IV id name city 1 John New York 2 Peter London 3 David Singapore cust_id prod_id sale_date qty 1 A1 20020318 10 1 A1 20020319 100 1 A1 20020329 50 1 A2 20020318 50 1 A2 20020329 200 3 X1 20020321 90 ZSALES ZCUSTOMERS p_id prod_name on_hand A1 Pen 100 A2 Pencil 125 B1 Ruler 80 X1 Tape 120 ZPRODUCTS
  • 51. ALV Report : Exercise IV zcustomers-id zcustomers-name zproducts- prod_name zsales-sale_date zsales-qty
  • 54. ALV : Variant REPORT ZALV06 NO STANDARD PAGE HEADING. type-pools slis. types: begin of i_structure, carrid like sflight-carrid, connid like sflight-connid, fldate like sflight-fldate, price like sflight-price, end of i_structure. data: gt_fieldcat type slis_t_fieldcat_alv, isvariant like DISVARIANT. "ADD gt_outtab type i_structure occurs 0 with header line. initialization. perform field_cat_init using gt_fieldcat[]. isvariant-report = 'ZALV06'. "ADD
  • 55. ALV : Variant START-OF-SELECTION. SELECT carrid connid fldate price FROM SFLIGHT INTO TABLE GT_OUTTAB. CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' EXPORTING I_STRUCTURE_NAME = 'I_STRUCTURE' IT_FIELDCAT = gt_fieldcat[] IS_VARIANT = isvariant "ADD I_SAVE = 'A' "ADD “ A = user&Global,U = user,X = globa TABLES T_OUTTAB = gt_outtab.
  • 57. ALV : Zebra REPORT ZALV2 NO STANDARD PAGE HEADING. type-pools slis. types: begin of i_structure, carrid like sflight-carrid, connid like sflight-connid, fldate like sflight-fldate, price like sflight-price, end of i_structure. data: gt_fieldcat type slis_t_fieldcat_alv, GT_LAYOUT TYPE SLIS_LAYOUT_ALV, "ADD gt_outtab type i_structure occurs 0 with header line. initialization. perform field_cat_init using gt_fieldcat[]. GT_LAYOUT-ZEBRA = 'X'. "ADD
  • 58. ALV : Zebra START-OF-SELECTION. SELECT carrid connid fldate price FROM SFLIGHT INTO TABLE GT_OUTTAB. CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' EXPORTING I_STRUCTURE_NAME = 'I_STRUCTURE' IT_FIELDCAT = gt_fieldcat[] IS_LAYOUT = GT_LAYOUT "ADD TABLES T_OUTTAB = gt_outtab.
  • 60. ALV : Title REPORT ZALV2 NO STANDARD PAGE HEADING. type-pools slis. types: begin of i_structure, carrid like sflight-carrid, connid like sflight-connid, fldate like sflight-fldate, price like sflight-price, end of i_structure. data: gt_fieldcat type slis_t_fieldcat_alv, GT_GID_TITLE TYPE LVC_TITLE, "ADD gt_outtab type i_structure occurs 0 with header line. initialization. perform field_cat_init using gt_fieldcat[]. concatenate 'Flight Information' ' for ALV Report' into GT_GID_TITLE. "ADD
  • 61. ALV : Title START-OF-SELECTION. SELECT carrid connid fldate price FROM SFLIGHT INTO TABLE GT_OUTTAB. CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' EXPORTING I_STRUCTURE_NAME = 'I_STRUCTURE' IT_FIELDCAT = gt_fieldcat[] I_GRID_TITLE = GT_GID_TITLE "ADD TABLES T_OUTTAB = gt_outtab.
  • 63. Exercise : Sale Order VBAK KNA1 VBAP
  • 64. Exercise : Control-break Report vbak-vbeln vbak-audat vbak-kunnr kna1-name1 vbap-matnr vbap-netwr
  • 65. Exercise : ALV Report vbak-vbeln vbak-audat vbak-kunnr kna1-name1 vbap-matnr vbap-netwr