SlideShare a Scribd company logo
1 of 10
Contoh/Example Syntax ALV Grid / List (ALV
Programming)
27/07/2010 β€” eryanta

Untukkeperluan reporting, SAP menyediakan Function Module ALV (ABAP List
Viewer/Apllication List Viewer).Berikutinicontoh syntax untukmembuat ALV Grid atau List.

Syntax di Include TOP

type-POOLs: slis, icon.
TYPES : BEGIN OF ty_ekpo,
cell,
icon(5),
ebeln TYPE ekpo-ebeln,
ebeln1 TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
line_color(4),
END OF ty_ekpo.

data: t_ekpo TYPE TABLE OF ty_ekpo,
x_ekpo TYPE ty_ekpo.

*ALV Data declaration
data: t_fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
d_tab_group TYPE slis_t_sp_group_alv,
x_layout TYPE slis_layout_alv,
d_repid like sy-repid,
t_events TYPE slis_t_event,
x_prntparams TYPE slis_print_alv,
t_sort TYPE slis_t_sortinfo_alv,
t_alv_isort TYPE slis_t_sortinfo_alv WITH HEADER LINE,
t_alv_extab TYPE slis_t_extab WITH HEADER LINE.

Syntax di Include F01

PERFORM f_get_data.
PERFORM f_build_fieldcatalog.
PERFORM f_build_layout.
PERFORM f_build_events.
PERFORM f_build_print_params.
PERFORM f_display_alv_report.
*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*
*& Form F_GET_DATA
*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*
FORM f_get_data .
DATA ld_color.
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
UP TO 10 ROWS FROM ekpo
INTO CORRESPONDING FIELDS OF TABLE t_ekpo.

*Populate field with color attributes
LOOP AT t_ekpo INTO x_ekpo.
x_ekpo-ebeln1 = x_ekpo-ebeln.
* Populate color variable with colour properties
* Char 1 = C (This is a color property)
* Char 2 = 3 (Color codes: 1 - 7)
* Char 3 = Intensified on/off ( 1 or 0 )
* Char 4 = Inverse display on/off ( 1 or 0 )
*       i.e. wa_ekpo-line_color = ’C410β€²
ld_color = ld_color + 1.

* Only 7 colours so need to reset color value
IF ld_color = 8.
ld_color = 1.
ENDIF.
CONCATENATE ’C' ld_color ’10β€² INTO x_ekpo-line_color.

* Show Icon
IF ld_color = 1.
x_ekpo-icon = ’@08@’.
ELSEif ld_color = 2.
x_ekpo-icon = ’@09@’.
else.
x_ekpo-icon = ’@0A@’.
ENDIF.

* wa_ekpo-line_color = ’C410β€².
MODIFY t_ekpo FROM x_ekpo.
ENDLOOP.
ENDFORM.β€œ F_GET_DATA

*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*
*& Form F_BUILD_FIELDCATALOG
*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*
FORM f_build_fieldcatalog .
PERFORM f_sub_fill_alv_field_catalog USING:
’01β€² ’01β€² ’ICON’ ’T_EKPO’ ’R' ’Light Status’ ” ” ” ”,
’01β€² ’02β€² ’EBELN1β€² ’T_EKPO’ ’L' ’Purchase Order’ ” ” ” ”,
’01β€² ’02β€² ’EBELN’ ’T_EKPO’ ’L' ’Purchase Order’ ’X' ’X' ” ”,
’01β€² ’03β€² ’EBELP’ ’T_EKPO’ ’L' ’PO Item’      ” ” ” ”,
’01β€² ’04β€² ’STATU’ ’T_EKPO’ ’L' ’Statu’      ” ” ” ”,
’01β€² ’05β€² ’AEDAT’ ’T_EKPO’ ’L' ’Item change date’ ” ” ” ”,
’01β€² ’06β€² ’MATNR’ ’T_EKPO’ ’L' ’Material Number’ ” ” ” ”,
’01β€² ’07β€² ’MENGE’ ’T_EKPO’ ’L' ’PO Quantity’     ” ” ” ”,
’01β€² ’08β€² ’MEINS’ ’T_EKPO’ ’L' ’Order Unit’    ” ” ” ”,
’01β€² ’09β€² ’NETPR’ ’T_EKPO’ ’R' ’Net Price’    ” ” ” ”,
’01β€² ’10β€² ’PEINH’ ’T_EKPO’ ’L' ’Price Unit’   ” ” ” ”.

* DATA SORTING AND SUBTOTAL
DATA: lx_sort TYPE slis_sortinfo_alv.
CLEAR lx_sort.
lx_sort-fieldname = ’EBELN’.
lx_sort-spos = 1.
lx_sort-up = ’X’.
lx_sort-subtot = ’X’.
APPEND lx_sort to t_sort.
ENDFORM.β€œ F_BUILD_FIELDCATALOG
*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*
*& Form F_BUILD_LAYOUT
*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*
FORM f_build_layout .
x_layout-colwidth_optimize = ’X’.
x_layout-box_tabname = ’T_EKPO’.
x_layout-zebra = ’X’.
*x_layout-edit = ’X’.
x_layout-info_fieldname = ’LINE_COLOR’.
x_layout-box_fieldname = ’CELL’.
ENDFORM.β€œ F_BUILD_LAYOUT
*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*
*& Form F_BUILD_EVENTS
*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*
FORM f_build_events .
DATA: lx_events TYPE slis_alv_event.

CONSTANTS: c_formname_subtotal_text TYPE slis_formname
VALUE ’F_SUBTOTAL_TEXT’.

CALL FUNCTION ’REUSE_ALV_EVENTS_GET’
EXPORTING
i_list_type = 0
IMPORTING
et_events    = t_events[]
EXCEPTIONS
list_type_wrong = 1
OTHERS         = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*       WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

LOOP AT t_events INTO lx_events.
CASE lx_events-name.
WHEN slis_ev_top_of_page.
MOVE ’F_TOP_OF_PAGE’ TO lx_events-form.

ENDCASE.
MODIFY t_events FROM lx_events.
ENDLOOP.

*Subtotal
CLEAR lx_events.
READ TABLE t_events INTO lx_events
WITH KEY name = slis_ev_subtotal_text.

if sy-subrc eq 0.
MOVE c_formname_subtotal_text to lx_events-form.
MODIFY t_events FROM lx_events INDEX sy-tabix.
ENDIF.

ENDFORM.β€œ F_BUILD_EVENTS
*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*
*& Form F_BUILD_PRINT_PARAMS
*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*
FORM f_build_print_params .

ENDFORM.β€œ F_BUILD_PRINT_PARAMS
*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*
*& Form F_DISPLAY_ALV_REPORT
*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*
FORM f_display_alv_report .

d_repid = sy-repid.
CALL FUNCTION ’REUSE_ALV_GRID_DISPLAY’
EXPORTING
* I_INTERFACE_CHECK        =’’
* I_BYPASSING_BUFFER                   =’’
* I_BUFFER_ACTIVE                   =’’
i_callback_program            = d_repid
i_callback_pf_status_set       = ’F_ALV_STATUS’
i_callback_user_command           = ’F_USER_COMMAND’
* I_CALLBACK_TOP_OF_PAGE                   =’’
* I_CALLBACK_HTML_TOP_OF_PAGE                  =’’
* I_CALLBACK_HTML_END_OF_LIST                =’’
* I_STRUCTURE_NAME                     =
* I_BACKGROUND_ID                     =’’
* I_GRID_TITLE                   =
* I_GRID_SETTINGS                   =
is_layout                = x_layout
it_fieldcat             = t_fieldcatalog[]
* IT_EXCLUDING                    =
* IT_SPECIAL_GROUPS                   =
IT_SORT                   = t_sort
* IT_FILTER                   =
* IS_SEL_HIDE                   =
i_default               = ’X’
i_save                 = ’A’
* IS_VARIANT                   =
it_events               = t_events
* IT_EVENT_EXIT                   =
is_print               = x_prntparams
* IS_REPREP_ID                   =
* I_SCREEN_START_COLUMN                   =0
* I_SCREEN_START_LINE                  =0
* I_SCREEN_END_COLUMN                    =0
* I_SCREEN_END_LINE                   =0
* I_HTML_HEIGHT_TOP                    =0
* I_HTML_HEIGHT_END                    =0
* IT_ALV_GRAPHICS                   =
* IT_HYPERLINK                    =
* IT_ADD_FIELDCAT                    =
* IT_EXCEPT_QINFO                    =
* IR_SALV_FULLSCREEN_ADAPTER                 =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER                  =
* ES_EXIT_CAUSED_BY_USER                  =
TABLES
t_outtab                = t_ekpo
EXCEPTIONS
PROGRAM_ERROR                     =1
OTHERS                     =2
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*      WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

ENDFORM.        ” F_DISPLAY_ALV_REPORT
*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*
*& Form F_SUB_FILL_ALV_FIELD_CATALOG
*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*

FORM f_sub_fill_alv_field_catalog USING

p_rowpos TYPE sycurow
p_colpos TYPE sycucol
p_fldnam TYPE fieldname
p_tabnam TYPE tabname
p_justif TYPE char1
p_seltext TYPE dd03p-scrtext_l
p_out TYPE char1
p_tech TYPE char1
p_qfield TYPE slis_fieldname
p_qtab TYPE slis_tabname.

DATA: lx_fcat TYPE slis_fieldcat_alv.

lx_fcat-row_pos = p_rowpos.
lx_fcat-col_pos = p_colpos.
lx_fcat-fieldname = p_fldnam.
lx_fcat-tabname = p_tabnam.
lx_fcat-just = p_justif.
lx_fcat-seltext_l = p_seltext.
lx_fcat-no_out = p_out.
lx_fcat-tech = p_tech.
lx_fcat-qfieldname = p_qfield.
lx_fcat-qtabname = p_qtab.

IF p_fldnam = ’NETPR’.
lx_fcat-do_sum = ’X’.
ENDIF.

APPEND lx_fcat TO t_fieldcatalog.
CLEAR lx_fcat.

ENDFORM.β€œ F_SUB_FILL_ALV_FIELD_CATALOG
*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*
*& Form F_TOP_OF_PAGE
*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*

FORM f_top_of_page.
*ALV Header Declarations
DATA: lt_header TYPE slis_t_listheader,
lx_header TYPE slis_listheader,
lt_line LIKE lx_header-info,
ld_lines TYPE i,
ld_linesc(10) TYPE c.

*Title
lx_header-typ = ’H’.
lx_header-info = ’EKPO Table Report’.
APPEND lx_header TO lt_header.
CLEAR lx_header.

*Date
lx_header-typ = ’S’.
lx_header-key = ’Date: ’.
CONCATENATE sy-datum+6(2) ’.’
sy-datum+4(2) ’.’
sy-datum(4) INTO lx_header-info.
APPEND lx_header TO lt_header.
CLEAR lx_header.

*Total No. of records Selected
DESCRIBE TABLE t_ekpo LINES ld_lines.
ld_linesc = ld_lines.
CONCATENATE ’Total No. of records Selected: ’ ld_linesc
INTO lt_line SEPARATED BY space.
lx_header-typ = ’A’.
lx_header-info = lt_line.
APPEND lx_header TO lt_header.
CLEAR: lx_header, lt_line.

CALL FUNCTION ’REUSE_ALV_COMMENTARY_WRITE’
EXPORTING
it_list_commentary = lt_header
* I_LOGO           = ’PHOTOTRI’
* I_END_OF_LIST_GRID       =
* I_ALV_FORM           =
.
ENDFORM. β€œF_TOP_OF_PAGE
*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*
*& Form F_ALV_STATUS
*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*

FORM f_alv_status USING fu_extab TYPE slis_t_extab.
REFRESH fu_extab.
SET PF-STATUS ’STANDARD’ EXCLUDING fu_extab.
ENDFORM. β€œF_ALV_STATUS

*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*
*& Form F_USER_COMMAND
*&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”*

FORM f_user_command USING ld_r_ucomm LIKE sy-ucomm
lx_rs_selfield TYPE slis_selfield.

CASE ld_r_ucomm.
WHEN ’&IC1β€².
IF lx_rs_selfield-fieldname = ’EBELN1β€².
READ TABLE t_ekpo INTO x_ekpo INDEX lx_rs_selfield-tabindex.
MESSAGE i003(aq) WITH ’Anda memilih Purchase order ’
x_ekpo-ebeln.
CLEAR x_ekpo.
ENDIF.

WHEN ’SHOW’.
LOOP AT t_ekpo INTO x_ekpo.
IF x_ekpo-cell EQ ’X’.
MESSAGE i003(aq) WITH ’Anda memilih Purchase order ’
x_ekpo-ebeln1.
ENDIF.
ENDLOOP.
CLEAR x_ekpo.
ENDCASE.
ENDFORM. β€œF_USER_COMMAND

FORM F_SUBTOTAL_TEXT CHANGING ld_total TYPE any
ld_subtot_text TYPE slis_subtot_text.

*Material level sub total
if ld_subtot_text-criteria = ’EBELN’.
ld_subtot_text-display_text_for_subtotal
= ’Subtotal’.
ENDIF.
ENDFORM.
Kemudianbuat GUI Status dengan status β€œSTANDARD”.

Kemudianpilih Template Status β€œList Viewer” (Extras>Adjust Template).

Activate semua, lalueksekusi.




Hasilnyaadalah β€œALV Grid”, untukmengubahmenjadiβ€œALV List”, masukke subroutine
β€œFORM f_display_alv_reportβ€œ, ubah ” ”
CALL FUNCTION ’REUSE_ALV_GRID_DISPLAYmenjadi ”
CALL FUNCTION ’REUSE_ALV_LIST_DISPLAY β€œ.
CMIIW

More Related Content

What's hot

List Processing in ABAP
List Processing in ABAPList Processing in ABAP
List Processing in ABAPsapdocs. info
Β 
Alvedit programs
Alvedit programsAlvedit programs
Alvedit programsmcclintick
Β 
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
Β 
To excel or not?
To excel or not?To excel or not?
To excel or not?Filippo Selden
Β 
Lecture 4 sql {basics keys and constraints}
Lecture 4 sql {basics  keys and constraints}Lecture 4 sql {basics  keys and constraints}
Lecture 4 sql {basics keys and constraints}Shubham Shukla
Β 
Lecture 3 sql {basics ddl commands}
Lecture 3 sql {basics  ddl commands}Lecture 3 sql {basics  ddl commands}
Lecture 3 sql {basics ddl commands}Shubham Shukla
Β 
Web Developer make the most out of your Database !
Web Developer make the most out of your Database !Web Developer make the most out of your Database !
Web Developer make the most out of your Database !Jean-Marc Desvaux
Β 
Oracle Training in Kochi | Trivandrum |Thrissur
Oracle Training in Kochi | Trivandrum |ThrissurOracle Training in Kochi | Trivandrum |Thrissur
Oracle Training in Kochi | Trivandrum |ThrissurIndiaOptions Softwares
Β 
Select To Order By
Select  To  Order BySelect  To  Order By
Select To Order ByKrizia Capacio
Β 
Common SQL Programming Mistakes
Common SQL Programming MistakesCommon SQL Programming Mistakes
Common SQL Programming MistakesPlamen Ratchev
Β 
RDBMS Lab02 creating tables (UIU)
RDBMS Lab02 creating tables (UIU)RDBMS Lab02 creating tables (UIU)
RDBMS Lab02 creating tables (UIU)Muhammad T Q Nafis
Β 
Nested Queries Lecture
Nested Queries LectureNested Queries Lecture
Nested Queries LectureFelipe Costa
Β 
[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
Β 

What's hot (19)

List Processing in ABAP
List Processing in ABAPList Processing in ABAP
List Processing in ABAP
Β 
Alvedit programs
Alvedit programsAlvedit programs
Alvedit programs
Β 
List Processing in ABAP
List Processing in ABAPList Processing in ABAP
List Processing in ABAP
Β 
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
Β 
To excel or not?
To excel or not?To excel or not?
To excel or not?
Β 
Lecture 4 sql {basics keys and constraints}
Lecture 4 sql {basics  keys and constraints}Lecture 4 sql {basics  keys and constraints}
Lecture 4 sql {basics keys and constraints}
Β 
Lecture 3 sql {basics ddl commands}
Lecture 3 sql {basics  ddl commands}Lecture 3 sql {basics  ddl commands}
Lecture 3 sql {basics ddl commands}
Β 
Web Developer make the most out of your Database !
Web Developer make the most out of your Database !Web Developer make the most out of your Database !
Web Developer make the most out of your Database !
Β 
Oracle Training in Kochi | Trivandrum |Thrissur
Oracle Training in Kochi | Trivandrum |ThrissurOracle Training in Kochi | Trivandrum |Thrissur
Oracle Training in Kochi | Trivandrum |Thrissur
Β 
Oracle: Functions
Oracle: FunctionsOracle: Functions
Oracle: Functions
Β 
Select To Order By
Select  To  Order BySelect  To  Order By
Select To Order By
Β 
Common SQL Programming Mistakes
Common SQL Programming MistakesCommon SQL Programming Mistakes
Common SQL Programming Mistakes
Β 
Les18
Les18Les18
Les18
Β 
Les17
Les17Les17
Les17
Β 
Oracle: DML
Oracle: DMLOracle: DML
Oracle: DML
Β 
Les10
Les10Les10
Les10
Β 
RDBMS Lab02 creating tables (UIU)
RDBMS Lab02 creating tables (UIU)RDBMS Lab02 creating tables (UIU)
RDBMS Lab02 creating tables (UIU)
Β 
Nested Queries Lecture
Nested Queries LectureNested Queries Lecture
Nested Queries Lecture
Β 
[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
Β 

Similar to Example syntax alv grid list

Zmalv output type_v1.1
Zmalv output type_v1.1Zmalv output type_v1.1
Zmalv output type_v1.1chandrashekarbh
Β 
Program For Parsing2
Program For Parsing2Program For Parsing2
Program For Parsing2Michelle Crapo
Β 
ABAP EVENTS EXAMPLE
ABAP EVENTS EXAMPLEABAP EVENTS EXAMPLE
ABAP EVENTS EXAMPLEvr1sap
Β 
SAP Batch data communication
SAP Batch data communicationSAP Batch data communication
SAP Batch data communicationJugul Crasta
Β 
Extbase and Beyond
Extbase and BeyondExtbase and Beyond
Extbase and BeyondJochen Rau
Β 
Module Prog
Module ProgModule Prog
Module Progmuralisrt
Β 
Alv Block
Alv BlockAlv Block
Alv Blockmuralisrt
Β 
project4-ast.DS_Storeproject4-astast.c#include symbolTa.docx
project4-ast.DS_Storeproject4-astast.c#include symbolTa.docxproject4-ast.DS_Storeproject4-astast.c#include symbolTa.docx
project4-ast.DS_Storeproject4-astast.c#include symbolTa.docxwkyra78
Β 
Report zalv
Report  zalvReport  zalv
Report zalvdineshk0105
Β 
Internal tables operations_chalapathi[1]
Internal tables operations_chalapathi[1]Internal tables operations_chalapathi[1]
Internal tables operations_chalapathi[1]Chalapathi Rao kornu
Β 
ZFINDALLZPROGAM
ZFINDALLZPROGAMZFINDALLZPROGAM
ZFINDALLZPROGAMJay Dalwadi
Β 
Notes for SQLite3 Usage
Notes for SQLite3 UsageNotes for SQLite3 Usage
Notes for SQLite3 UsageWilliam Lee
Β 
Get into the FLOW with Extbase
Get into the FLOW with ExtbaseGet into the FLOW with Extbase
Get into the FLOW with ExtbaseJochen Rau
Β 
07.advanced abap
07.advanced abap07.advanced abap
07.advanced abapPhong Ho
Β 
Db2 For I Parallel Data Load
Db2 For I Parallel Data LoadDb2 For I Parallel Data Load
Db2 For I Parallel Data LoadThomas Wolfe
Β 

Similar to Example syntax alv grid list (20)

Alv barra her
Alv barra herAlv barra her
Alv barra her
Β 
Alv a otro alv
Alv a otro alvAlv a otro alv
Alv a otro alv
Β 
Sap scripts
Sap scriptsSap scripts
Sap scripts
Β 
Zmalv output type_v1.1
Zmalv output type_v1.1Zmalv output type_v1.1
Zmalv output type_v1.1
Β 
Program For Parsing2
Program For Parsing2Program For Parsing2
Program For Parsing2
Β 
ABAP EVENTS EXAMPLE
ABAP EVENTS EXAMPLEABAP EVENTS EXAMPLE
ABAP EVENTS EXAMPLE
Β 
SAP Batch data communication
SAP Batch data communicationSAP Batch data communication
SAP Batch data communication
Β 
Extbase and Beyond
Extbase and BeyondExtbase and Beyond
Extbase and Beyond
Β 
Module Prog
Module ProgModule Prog
Module Prog
Β 
Alv Block
Alv BlockAlv Block
Alv Block
Β 
project4-ast.DS_Storeproject4-astast.c#include symbolTa.docx
project4-ast.DS_Storeproject4-astast.c#include symbolTa.docxproject4-ast.DS_Storeproject4-astast.c#include symbolTa.docx
project4-ast.DS_Storeproject4-astast.c#include symbolTa.docx
Β 
Report zalv
Report  zalvReport  zalv
Report zalv
Β 
Deber base
Deber baseDeber base
Deber base
Β 
Internal tables operations_chalapathi[1]
Internal tables operations_chalapathi[1]Internal tables operations_chalapathi[1]
Internal tables operations_chalapathi[1]
Β 
ZFINDALLZPROGAM
ZFINDALLZPROGAMZFINDALLZPROGAM
ZFINDALLZPROGAM
Β 
Notes for SQLite3 Usage
Notes for SQLite3 UsageNotes for SQLite3 Usage
Notes for SQLite3 Usage
Β 
Get into the FLOW with Extbase
Get into the FLOW with ExtbaseGet into the FLOW with Extbase
Get into the FLOW with Extbase
Β 
07.advanced abap
07.advanced abap07.advanced abap
07.advanced abap
Β 
Db2 For I Parallel Data Load
Db2 For I Parallel Data LoadDb2 For I Parallel Data Load
Db2 For I Parallel Data Load
Β 
Zmd Constant
Zmd ConstantZmd Constant
Zmd Constant
Β 

Recently uploaded

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel AraΓΊjo
Β 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
Β 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
Β 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
Β 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
Β 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
Β 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
Β 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
Β 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
Β 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
Β 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
Β 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
Β 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
Β 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
Β 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
Β 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
Β 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
Β 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
Β 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
Β 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
Β 

Recently uploaded (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Β 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
Β 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
Β 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
Β 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Β 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Β 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Β 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
Β 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
Β 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
Β 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
Β 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
Β 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
Β 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Β 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Β 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Β 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
Β 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Β 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
Β 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Β 

Example syntax alv grid list

  • 1. Contoh/Example Syntax ALV Grid / List (ALV Programming) 27/07/2010 β€” eryanta Untukkeperluan reporting, SAP menyediakan Function Module ALV (ABAP List Viewer/Apllication List Viewer).Berikutinicontoh syntax untukmembuat ALV Grid atau List. Syntax di Include TOP type-POOLs: slis, icon. TYPES : BEGIN OF ty_ekpo, cell, icon(5), ebeln TYPE ekpo-ebeln, ebeln1 TYPE ekpo-ebeln, ebelp TYPE ekpo-ebelp, statu TYPE ekpo-statu, aedat TYPE ekpo-aedat, matnr TYPE ekpo-matnr, menge TYPE ekpo-menge, meins TYPE ekpo-meins, netpr TYPE ekpo-netpr, peinh TYPE ekpo-peinh, line_color(4), END OF ty_ekpo. data: t_ekpo TYPE TABLE OF ty_ekpo, x_ekpo TYPE ty_ekpo. *ALV Data declaration data: t_fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE, d_tab_group TYPE slis_t_sp_group_alv, x_layout TYPE slis_layout_alv, d_repid like sy-repid, t_events TYPE slis_t_event, x_prntparams TYPE slis_print_alv, t_sort TYPE slis_t_sortinfo_alv, t_alv_isort TYPE slis_t_sortinfo_alv WITH HEADER LINE, t_alv_extab TYPE slis_t_extab WITH HEADER LINE. Syntax di Include F01 PERFORM f_get_data. PERFORM f_build_fieldcatalog.
  • 2. PERFORM f_build_layout. PERFORM f_build_events. PERFORM f_build_print_params. PERFORM f_display_alv_report. *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* *& Form F_GET_DATA *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* FORM f_get_data . DATA ld_color. SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh UP TO 10 ROWS FROM ekpo INTO CORRESPONDING FIELDS OF TABLE t_ekpo. *Populate field with color attributes LOOP AT t_ekpo INTO x_ekpo. x_ekpo-ebeln1 = x_ekpo-ebeln. * Populate color variable with colour properties * Char 1 = C (This is a color property) * Char 2 = 3 (Color codes: 1 - 7) * Char 3 = Intensified on/off ( 1 or 0 ) * Char 4 = Inverse display on/off ( 1 or 0 ) * i.e. wa_ekpo-line_color = ’C410β€² ld_color = ld_color + 1. * Only 7 colours so need to reset color value IF ld_color = 8. ld_color = 1. ENDIF. CONCATENATE ’C' ld_color ’10β€² INTO x_ekpo-line_color. * Show Icon IF ld_color = 1. x_ekpo-icon = ’@08@’. ELSEif ld_color = 2. x_ekpo-icon = ’@09@’. else. x_ekpo-icon = ’@0A@’. ENDIF. * wa_ekpo-line_color = ’C410β€². MODIFY t_ekpo FROM x_ekpo. ENDLOOP. ENDFORM.β€œ F_GET_DATA *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* *& Form F_BUILD_FIELDCATALOG
  • 3. *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* FORM f_build_fieldcatalog . PERFORM f_sub_fill_alv_field_catalog USING: ’01β€² ’01β€² ’ICON’ ’T_EKPO’ ’R' ’Light Status’ ” ” ” ”, ’01β€² ’02β€² ’EBELN1β€² ’T_EKPO’ ’L' ’Purchase Order’ ” ” ” ”, ’01β€² ’02β€² ’EBELN’ ’T_EKPO’ ’L' ’Purchase Order’ ’X' ’X' ” ”, ’01β€² ’03β€² ’EBELP’ ’T_EKPO’ ’L' ’PO Item’ ” ” ” ”, ’01β€² ’04β€² ’STATU’ ’T_EKPO’ ’L' ’Statu’ ” ” ” ”, ’01β€² ’05β€² ’AEDAT’ ’T_EKPO’ ’L' ’Item change date’ ” ” ” ”, ’01β€² ’06β€² ’MATNR’ ’T_EKPO’ ’L' ’Material Number’ ” ” ” ”, ’01β€² ’07β€² ’MENGE’ ’T_EKPO’ ’L' ’PO Quantity’ ” ” ” ”, ’01β€² ’08β€² ’MEINS’ ’T_EKPO’ ’L' ’Order Unit’ ” ” ” ”, ’01β€² ’09β€² ’NETPR’ ’T_EKPO’ ’R' ’Net Price’ ” ” ” ”, ’01β€² ’10β€² ’PEINH’ ’T_EKPO’ ’L' ’Price Unit’ ” ” ” ”. * DATA SORTING AND SUBTOTAL DATA: lx_sort TYPE slis_sortinfo_alv. CLEAR lx_sort. lx_sort-fieldname = ’EBELN’. lx_sort-spos = 1. lx_sort-up = ’X’. lx_sort-subtot = ’X’. APPEND lx_sort to t_sort. ENDFORM.β€œ F_BUILD_FIELDCATALOG *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* *& Form F_BUILD_LAYOUT *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* FORM f_build_layout . x_layout-colwidth_optimize = ’X’. x_layout-box_tabname = ’T_EKPO’. x_layout-zebra = ’X’. *x_layout-edit = ’X’. x_layout-info_fieldname = ’LINE_COLOR’. x_layout-box_fieldname = ’CELL’. ENDFORM.β€œ F_BUILD_LAYOUT *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* *& Form F_BUILD_EVENTS *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* FORM f_build_events . DATA: lx_events TYPE slis_alv_event. CONSTANTS: c_formname_subtotal_text TYPE slis_formname VALUE ’F_SUBTOTAL_TEXT’. CALL FUNCTION ’REUSE_ALV_EVENTS_GET’ EXPORTING
  • 4. i_list_type = 0 IMPORTING et_events = t_events[] EXCEPTIONS list_type_wrong = 1 OTHERS = 2. IF sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. LOOP AT t_events INTO lx_events. CASE lx_events-name. WHEN slis_ev_top_of_page. MOVE ’F_TOP_OF_PAGE’ TO lx_events-form. ENDCASE. MODIFY t_events FROM lx_events. ENDLOOP. *Subtotal CLEAR lx_events. READ TABLE t_events INTO lx_events WITH KEY name = slis_ev_subtotal_text. if sy-subrc eq 0. MOVE c_formname_subtotal_text to lx_events-form. MODIFY t_events FROM lx_events INDEX sy-tabix. ENDIF. ENDFORM.β€œ F_BUILD_EVENTS *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* *& Form F_BUILD_PRINT_PARAMS *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* FORM f_build_print_params . ENDFORM.β€œ F_BUILD_PRINT_PARAMS *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* *& Form F_DISPLAY_ALV_REPORT *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* FORM f_display_alv_report . d_repid = sy-repid. CALL FUNCTION ’REUSE_ALV_GRID_DISPLAY’ EXPORTING * I_INTERFACE_CHECK =’’
  • 5. * I_BYPASSING_BUFFER =’’ * I_BUFFER_ACTIVE =’’ i_callback_program = d_repid i_callback_pf_status_set = ’F_ALV_STATUS’ i_callback_user_command = ’F_USER_COMMAND’ * I_CALLBACK_TOP_OF_PAGE =’’ * I_CALLBACK_HTML_TOP_OF_PAGE =’’ * I_CALLBACK_HTML_END_OF_LIST =’’ * I_STRUCTURE_NAME = * I_BACKGROUND_ID =’’ * I_GRID_TITLE = * I_GRID_SETTINGS = is_layout = x_layout it_fieldcat = t_fieldcatalog[] * IT_EXCLUDING = * IT_SPECIAL_GROUPS = IT_SORT = t_sort * IT_FILTER = * IS_SEL_HIDE = i_default = ’X’ i_save = ’A’ * IS_VARIANT = it_events = t_events * IT_EVENT_EXIT = is_print = x_prntparams * IS_REPREP_ID = * I_SCREEN_START_COLUMN =0 * I_SCREEN_START_LINE =0 * I_SCREEN_END_COLUMN =0 * I_SCREEN_END_LINE =0 * I_HTML_HEIGHT_TOP =0 * I_HTML_HEIGHT_END =0 * IT_ALV_GRAPHICS = * IT_HYPERLINK = * IT_ADD_FIELDCAT = * IT_EXCEPT_QINFO = * IR_SALV_FULLSCREEN_ADAPTER = * IMPORTING * E_EXIT_CAUSED_BY_CALLER = * ES_EXIT_CAUSED_BY_USER = TABLES t_outtab = t_ekpo EXCEPTIONS PROGRAM_ERROR =1 OTHERS =2 .
  • 6. IF sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDFORM. ” F_DISPLAY_ALV_REPORT *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* *& Form F_SUB_FILL_ALV_FIELD_CATALOG *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* FORM f_sub_fill_alv_field_catalog USING p_rowpos TYPE sycurow p_colpos TYPE sycucol p_fldnam TYPE fieldname p_tabnam TYPE tabname p_justif TYPE char1 p_seltext TYPE dd03p-scrtext_l p_out TYPE char1 p_tech TYPE char1 p_qfield TYPE slis_fieldname p_qtab TYPE slis_tabname. DATA: lx_fcat TYPE slis_fieldcat_alv. lx_fcat-row_pos = p_rowpos. lx_fcat-col_pos = p_colpos. lx_fcat-fieldname = p_fldnam. lx_fcat-tabname = p_tabnam. lx_fcat-just = p_justif. lx_fcat-seltext_l = p_seltext. lx_fcat-no_out = p_out. lx_fcat-tech = p_tech. lx_fcat-qfieldname = p_qfield. lx_fcat-qtabname = p_qtab. IF p_fldnam = ’NETPR’. lx_fcat-do_sum = ’X’. ENDIF. APPEND lx_fcat TO t_fieldcatalog. CLEAR lx_fcat. ENDFORM.β€œ F_SUB_FILL_ALV_FIELD_CATALOG
  • 7. *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* *& Form F_TOP_OF_PAGE *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* FORM f_top_of_page. *ALV Header Declarations DATA: lt_header TYPE slis_t_listheader, lx_header TYPE slis_listheader, lt_line LIKE lx_header-info, ld_lines TYPE i, ld_linesc(10) TYPE c. *Title lx_header-typ = ’H’. lx_header-info = ’EKPO Table Report’. APPEND lx_header TO lt_header. CLEAR lx_header. *Date lx_header-typ = ’S’. lx_header-key = ’Date: ’. CONCATENATE sy-datum+6(2) ’.’ sy-datum+4(2) ’.’ sy-datum(4) INTO lx_header-info. APPEND lx_header TO lt_header. CLEAR lx_header. *Total No. of records Selected DESCRIBE TABLE t_ekpo LINES ld_lines. ld_linesc = ld_lines. CONCATENATE ’Total No. of records Selected: ’ ld_linesc INTO lt_line SEPARATED BY space. lx_header-typ = ’A’. lx_header-info = lt_line. APPEND lx_header TO lt_header. CLEAR: lx_header, lt_line. CALL FUNCTION ’REUSE_ALV_COMMENTARY_WRITE’ EXPORTING it_list_commentary = lt_header * I_LOGO = ’PHOTOTRI’ * I_END_OF_LIST_GRID = * I_ALV_FORM = . ENDFORM. β€œF_TOP_OF_PAGE
  • 8. *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* *& Form F_ALV_STATUS *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* FORM f_alv_status USING fu_extab TYPE slis_t_extab. REFRESH fu_extab. SET PF-STATUS ’STANDARD’ EXCLUDING fu_extab. ENDFORM. β€œF_ALV_STATUS *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* *& Form F_USER_COMMAND *&β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”* FORM f_user_command USING ld_r_ucomm LIKE sy-ucomm lx_rs_selfield TYPE slis_selfield. CASE ld_r_ucomm. WHEN ’&IC1β€². IF lx_rs_selfield-fieldname = ’EBELN1β€². READ TABLE t_ekpo INTO x_ekpo INDEX lx_rs_selfield-tabindex. MESSAGE i003(aq) WITH ’Anda memilih Purchase order ’ x_ekpo-ebeln. CLEAR x_ekpo. ENDIF. WHEN ’SHOW’. LOOP AT t_ekpo INTO x_ekpo. IF x_ekpo-cell EQ ’X’. MESSAGE i003(aq) WITH ’Anda memilih Purchase order ’ x_ekpo-ebeln1. ENDIF. ENDLOOP. CLEAR x_ekpo. ENDCASE. ENDFORM. β€œF_USER_COMMAND FORM F_SUBTOTAL_TEXT CHANGING ld_total TYPE any ld_subtot_text TYPE slis_subtot_text. *Material level sub total if ld_subtot_text-criteria = ’EBELN’. ld_subtot_text-display_text_for_subtotal = ’Subtotal’. ENDIF. ENDFORM.
  • 9. Kemudianbuat GUI Status dengan status β€œSTANDARD”. Kemudianpilih Template Status β€œList Viewer” (Extras>Adjust Template). Activate semua, lalueksekusi. Hasilnyaadalah β€œALV Grid”, untukmengubahmenjadiβ€œALV List”, masukke subroutine β€œFORM f_display_alv_reportβ€œ, ubah ” ” CALL FUNCTION ’REUSE_ALV_GRID_DISPLAYmenjadi ” CALL FUNCTION ’REUSE_ALV_LIST_DISPLAY β€œ.
  • 10. CMIIW