SlideShare una empresa de Scribd logo
1 de 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

Más contenido relacionado

La actualidad más candente

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
 
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
 
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
 

La actualidad más candente (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 a Example syntax alv grid list

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
 
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
 
Internal tables operations_chalapathi[1]
Internal tables operations_chalapathi[1]Internal tables operations_chalapathi[1]
Internal tables operations_chalapathi[1]Chalapathi Rao kornu
 
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 a 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
 

Último

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 

Último (20)

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 

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