cl_gui_alv_grid
DESCRIPTION
CL_GUI_ALV_GRID IN CHIENESETRANSCRIPT
2.ALV
2.ALV GRID CONTROL (ALV)
2.ALV GRID CONTROL
3ALV GRID
31. [Field catalog]
52.[layout]
63.,
6.ALV.
7ALV.
7:SCREEN,,CONTAINER..
7: ALV.
10,.
11,
11,
12:
12:,.
12:
13:()
13:
14:
16:
17:
18
19.
20
21ALV GRID
221.()
222.
233.
254..
255.
276.
.ALV
The ALV Grid Control (ALV = SAP List Viewer),,,.
SAP: SAP,ALV GRID,,,.
ALV GRID:
3,,,..
ALV3ALV:,ALV,ALV.
.ALV GRID CONTROL (ALV)
ALV GRID CONTROL,ALV GRID CONTROL,.
ABAP,ALV(INSTANCE),ABAP.
.ALV GRID CONTROL ALV GRID,CL_GUI_ALV_GRID
dataALV_GRID1 type ref to cl_gui_alv_grid.
ALV GRID:
ALV GRID1. [Field catalog]ALV,,,,,.
:(,STRUCTURE LVC_S_FCAT)
2ROW_POSALV : ()
3COL_POSALV : ,,1,2,..
4FIELDNAMEALV :
5TABNAMELVC 1
6CURRENCYALV :
7CFIELDNAMEALV :
8QUANTITYALV :
9QFIELDNAMEALV :
10IFIELDNAMEALV :
11ROUNDALV : ROUND
12EXPONENTALV
13KEYALV : ,
14KEY_SELALV :
15ICONALV :
16SYMBOLALV :
17CHECKBOXALV :
18JUSTALV : :
'R': right justified
'L': left justified
'C': centered
19LZEROALV : X'
20NO_SIGNALV X',
21NO_ZEROALV : X',0
22NO_CONVEXTALV :
23EDIT_MASKALV :
24EMPHASIZEALV :
25FIX_COLUMNALV :
26DO_SUMALV : X',
27NO_SUMALV : X' ,
28NO_OUTALV : X' ,
29TECHALV : X'.
30OUTPUTLENALV :
31CONVEXIT
32SELTEXTALV :
33TOOLTIPALV :
34ROLLNAMEALV : F1
35DATATYPEABAP ABAP
36INTTYPEABAP (C,D,N,...)ABAP (C,D,N,...)
37INTLEN
38LOWERCASE/X'
39REPTEXT
40HIER_LEVELALV :
41REPREPALV : /
42DOMNAME
43SP_GROUP
44HOTSPOTALV : X',,
45DFIELDNAMEALV :
46COL_IDALV : ID
47F4AVAILABLX'.
48AUTO_VALUEALV :
49CHECKTABLE
50VALEXI
51WEB_FIELDALV :
52HREF_HNDL
53STYLEALV : ,PUSHBUTTION
54STYLE2ALV :
55STYLE3ALV :
56STYLE4ALV :
57DRDN_HNDL
58DRDN_FIELDALV :
59NO_MERGING 1
60H_FTYPEALV : (,,., ...)
61COL_OPT
62NO_INIT_CH 1
63DRDN_ALIAS 1
64REF_FIELDALV :
65REF_TABLEALV :
66TXT_FIELDALV :
67ROUNDFIELDALV : ROUND
68DECIMALS_OALV :
69DECMLFIELDALV : DECIMALS
70DD_OUTLENALV :
71DECIMALS
72COLTEXTALV :
73SCRTEXT_L
74SCRTEXT_M
75SCRTEXT_S
76COLDDICTXTALV : DDIC
77SELDDICTXTALV : DDIC
78TIPDDICTXTALV : DDIC
79EDITALV : .'X'
80TECH_COLALV :
81TECH_FORMALV :
82TECH_COMPALV :
83HIER_CPOSALV :
84H_COL_KEY: /
85H_SELECT
86DD_ROLL ()
87DRAGDROPIDALV : &
88MAC 1
89INDX_FIELD
90INDX_CFIEL
91INDX_QFIEL
92INDX_IFIEL
93INDX_ROUND
94INDX_DECML
95GET_STYLE 1
96MARK 1
2.[layout]
ALVALV,,,.
ALV[LVC_S_LAYO],.
Value range
CWIDTH_OPTSPACE, 'X'
SMALLTITLE,SPACE, 'X'
GRID_TITLE,70
NO_HEADERS,SPACE, 'X'
NO_HGRIDLNSPACE, 'X'
NO_MERGINGSPACE, 'X'
NO_ROWMARK,SPACE, 'X'
DA
NO_TOOLBARSPACE, 'X'
NO_VGRIDLNSPACE, 'X'
SEL_MODESPACE, 'A', 'B', 'C', 'D'
EXCP_CONDSSPACE, 'X'
EXCP_FNAME30
EXCP_LED LEDSPACE, 'X'
EXCP_ROLLNSPACE, 'X'
CTAB_FNAME30
INFO_FNAME30
ZEBRA,SPACE, 'X'
NO_TOTLINESPACE, 'X'
NUMC_TOTALNUMCSPACE, 'X'
TOTALS_BEF,SPACE, 'X'
STYLEFNAME,PUSHBUTTON30
3.,
[LVC_S_PRNT]
[LVC_S_SORT]
[LVC_S_FILT]
,,,.
.ALV.
DIALOG.
OOALV GRID,FUNCTIONALV,,CL_GUI_ALV_GRID.
ALV.
1,,,,,I_STRUCTURE_NAME.
2.,,,,..
2,,,.
:SCREEN,,CONTAINER..
DATA:wcl_containerTYPEREFTOcl_gui_custom_container,wcl_alvTYPEREFTOcl_gui_alv_grid.*---DATAgt_fieldcatTYPElvc_t_fcat.*---DATAgs_layoutTYPElvc_s_layo.*----(SFLIGHT)DATABEGINOFgt_listOCCURS0.INCLUDESTRUCTUREsflight.DATAENDOFgt_list.
: ALV.
PBO:PROCESSBEFOREOUTPUT.MODULEdisplay_alv. DISPLAY_ALVMODULE,:
MODULEdisplay_alvOUTPUT.PERFORMdisplay_alv.ENDMODULE."display_alvOUTPUT FORM DISPLAY_ALV,ALV,,:
FORMdisplay_alv.IFwcl_alvISINITIAL.CREATEOBJECT:wcl_containerEXPORTINGcontainer_name='ALV_CON'.CREATEOBJECTwcl_alvEXPORTINGi_parent=wcl_container.
*-----PERFORMprepare_field_catalogCHANGINGgt_fieldcat.*-----PERFORMprepare_layoutCHANGINGgs_layout.*-----alvCALLMETHODgr_alvgrid->set_table_for_first_displayEXPORTING*I_BUFFER_ACTIVE=*I_CONSISTENCY_CHECK=*I_STRUCTURE_NAME=*IS_VARIANT=*I_SAVE=*I_DEFAULT='X'is_layout=gs_layout*IS_PRINT=*IT_SPECIAL_GROUPS=*IT_TOOLBAR_EXCLUDING=*IT_HYPERLINK=CHANGINGit_outtab=gt_list[]it_fieldcatalog=gt_fieldcat*IT_SORT=*IT_FILTER=EXCEPTIONSinvalid_parameter_combination=1program_error=2too_many_lines=3OTHERS=4.ELSE.*----alvCALLMETHODgr_alvgrid->refresh_table_display*EXPORTING*IS_STABLE=*I_SOFT_REFRESH=EXCEPTIONSfinished=1OTHERS=2.IFsy-subrc0.*--ENDIF.ENDIF.ENDFORM."display_alv "set_table_for_first_display"
I_BUFFER_ACTIVE,,,ALV
.,
ALV
I_STRUCTURE_NAME,'SFLIGHT'.,
,IT_FIELDCATALOG.
IS_VARIANT
I_SAVE:
'X'
'U'
'A'
SPACE
I_DEFAULT:
'X' ,
SPACE
IS_LAYOUT,
IS_PRINT
IT_SPECIAL_GROUPSSP_GROUP.
IT_TOOLBAR_EXCLUDING
IT_HYPERLINK,LVC_S_HYPEHREF,
HANDLE,GRID
IT_ALV_GRAPHICS,ALV.
IT_OUTTAB,
IT_FIELDCATALOG
IT_SORT
IT_FILTER
"REFRESH_TABLE_DISPLAY"
IS_STABLE2.,
,.
I_SOFT_REFRESH,,,
,.
.:ALV,
.
,..1. FORMprepare_field_catalogCHANGINGpt_fieldcatTYPElvc_t_fcat.DATAls_fcattypelvc_s_fcat.ls_fcat-fieldname='CARRID'.ls_fcat-inttype='C'.ls_fcat-outputlen='3'.ls_fcat-coltext='CarrierID'.ls_fcat-seltext='CarrierID'.APPENDls_fcattopt_fieldcat.CLEARls_fcat.ls_fcat-fieldname='CONNID'.ls_fcat-ref_table='SFLIGHT'.ls_fcat-ref_table='CONNID'.ls_fcat-outputlen='3'.ls_fcat-coltext='ConnectionID'.ls_fcat-seltext='ConnectionID'.APPENDls_fcattopt_fieldcat.ENDFORM.2. FORMprepare_field_catalogCHANGINGpt_fieldcatTYPElvc_t_fcat.DATAls_fcattypelvc_s_fcat.CALLFUNCTION'LVC_FIELDCATALOG_MERGE'EXPORTINGi_structure_name='SFLIGHT'CHANGINGct_fieldcat=pt_fieldcat[]EXCEPTIONSinconsistent_interface=1program_error=2OTHERS=3.IFsy-subrc0.*--ExceptionhandlingENDIF.LOOPATpt_fieldcatINTOls_fcat.CASEpt_fieldcat-fieldname.WHEN'CARRID'.ls_fcat-outpulen='10'.ls_fcat-coltext='AirlineCarrierID'.MODIFYpt_fieldcatFROMls_fcat.WHEN'PAYMENTSUM'.ls_fcat-no_out='X'.MODIFYpt_fieldcatFROMls_fcat.ENDCASE.ENDLOOP.ENDFORM."prepare_field_catalog,
FORMprepare_layoutCHANGINGps_layoutTYPElvc_s_layo.ps_layout-zebra='X'.ps_layout-grid_title='Flights'.ps_layout-smalltitle='X'.ENDFORM."prepare_layout
,(,,) ALV,UI_FUNCTIONS,set_table_for_first_display"IT_TOOLBAR_EXCLUDING".cl_gui_alv_grid,after_user_command.
,layoutno_toolbar"X".
FORMexclude_tb_functionsCHANGINGpt_excludeTYPEui_functions.DATAls_excludeTYPEui_func.ls_exclude=cl_gui_alv_grid=>mc_fc_maximum.APPENDls_excludeTOpt_exclude.ls_exclude=cl_gui_alv_grid=>mc_fc_minimum.APPENDls_excludeTOpt_exclude.ls_exclude=cl_gui_alv_grid=>mc_fc_subtot.APPENDls_excludeTOpt_exclude.ls_exclude=cl_gui_alv_grid=>mc_fc_sum.APPENDls_excludeTOpt_exclude.ls_exclude=cl_gui_alv_grid=>mc_fc_average.APPENDls_excludeTOpt_exclude.ls_exclude=cl_gui_alv_grid=>mc_mb_sum.APPENDls_excludeTOpt_exclude.ls_exclude=cl_gui_alv_grid=>mc_mb_subtot.ENDFORM.:,ALVDEMO..
:,.
,,..
: get_frontend_fieldcatalog set_frontend_fieldcatalog : get_frontend_layout set_frontend_layout
,,,.
DATAls_fcatTYPElvc_s_fcat.DATAlt_fcatTYPElvc_t_fcat.DATAls_layoutTYPElvc_s_layo.CALLMETHODgr_alvgrid->get_frontend_fieldcatalogIMPORTINGet_fieldcatalog=lt_fcat[].LOOPATlt_fcatINTOls_fcat.IFls_fcat-fieldname='PAYMENTSUM'.ls_fcat-no_out=space.MODIFYlt_fcatFROMls_fcat.ENDIF.ENDLOOP.CALLMETHODgr_alvgrid->set_frontend_fieldcatalogEXPORTINGit_fieldcatalog=lt_fcat[].
CALLMETHODgr_alvgrid->get_frontend_layoutIMPORTINGes_layout=ls_layout.ls_layout-grid_title='Flights(withPaymentSums)'.CALLMETHODgr_alvgrid->set_frontend_layoutEXPORTINGis_layout=ls_layout.:
.LVC_T_SORT.set_table_for_first_displayIT_SORT.
FORMprepare_sort_tableCHANGINGpt_sortTYPElvc_t_sort.DATAls_sortTYPElvc_s_sort.ls_sort-spos='1'.ls_sort-fieldname='CARRID'.ls_sort-up='X'."AtoZls_sort-down=space.APPENDls_sortTOpt_sort.ls_sort-spos='2'.ls_sort-fieldname='SEATSOCC'.ls_sort-up=space.ls_sort-down='X'."ZtoAAPPENDls_sortTOpt_sort.ENDFORM."prepare_sort_table
2:
1.DUMP. 2.,,,"no_merging""X" .
get_sort_criteria set_sort_criteria.:()
ALV,."LVC_T_FILT".RANGES."SET_TABLE_FOR_FIRST_DISPLAY""IT_FILTER"
FORMprepare_filter_tableCHANGINGpt_filtTYPElvc_t_filt.DATAls_filtTYPElvc_s_filt.ls_filt-fieldname='FLDATE'.ls_filt-sign='E'.ls_filt-option='BT'.ls_filt-low='20030101'.ls_filt-high='20031231'.APPENDls_filtTOpt_filt.ENDFORM."preparefiltertable
"get_filter_criteria" "set_filter_criteria".:
,,"SEL_MODE"...
SPACEBB
'A',
'B',,
'C',,
'D',
:
1.ALV,. 2.,."GET_SELECTED_CELLS", "GET_SELECTED_CELLS_ID", "GET_SELECTED_ROWS","GET_SELECTED_COLUMNS" 3.PAI,,.PBO,SET.:
,ALV.,.
,,.
ALV.,4CHAR.
Cx y z------------------------------------------ Color | | | | 1/0: / 1/0: /
C,(17),,,,,.
:
x
1Gray-blueheaders
2Light grayList bodies
3yellowtotals
4Blue-greenKey columns
5greenPositive threshold value
6redNegative threshold value
7orangeControl levels
A). "emphasize".4CHAR,.:
LS_FCAT-EMPHASIZE='C701'. , LS_FCAT-KEY='X' ,.,KEY.
B) ,,,.,4CHAR,.:
DATABEGINOFgt_listOCCURS0.INCLUDESTRUCTURESFLIGHT.DATArowcolor(4)TYPEc.DATAENDOFgt_list.
,ALV,"INFO_FNAME",ALV,. ps_layout-info_fname = 'ROWCOLOR'. ,,,.,,,.
C) ,,2.DEEP,ALV..
"LVC_T_SCOL".
3:
FNAME,COLOR,.,.
COLOR. NOKEYCOL.,.,.,ALV"CTAB_FNAME",.
DATABEGINOFgt_listOCCURS0.INCLUDESTRUCTURESFLIGHT.DATArowcolor(4)TYPEc.DATAcellcolorsTYPElvc_t_scol.DATAENDOFgt_list.DATAls_cellcolorTYPElvc_s_scol....READTABLEgt_listINDEX5.ls_cellcolor-fname='SEATSOCC'.ls_cellcolor-color-col='7'.ls_cellcolor-color-int='1'.APPENDls_cellcolorTOgt_list-cellcolors.MODIFYgt_listINDEX5.
: ,--->--->.:
."LVC_T_HYPE" ,INT4,ALV,,.,WEB_FIELD.
,CARRID,CONNID:
,2:
DATABEGINOFgt_listOCCURS0.INCLUDESTRUCTURESFLIGHT.DATArowcolor(4)TYPEc.DATAcellcolorsTYPElvc_t_scol.DATAcarrid_handleTYPEint4.DATAconnid_handleTYPEint4.DATAENDOFgt_list.
: ,.,,"LVC_T_HYPE".
FORMprepare_hyperlinks_tableCHANGINGpt_hypeTYPElvc_t_hype.DATAls_hypeTYPElvc_s_hype.ls_hype-handle='1'.ls_hype-href='http://www.company.com/carrids/car1'.APPENDls_hypeTOpt_hype.ls_hype-handle='2'.ls_hype-href='http://www.company.com/carrids/car1'.APPENDls_hypeTOpt_hype.ls_hype-handle='3'.ls_hype-href='http://www.company.com/carrids/car1'.APPENDls_hypeTOpt_hype.ls_hype-handle='4'.ls_hype-href='http://www.company.com/connids/con11'.APPENDls_hypeTOpt_hype.ls_hype-handle='5'.ls_hype-href='http://www.company.com/connids/con12'APPENDls_hypeTOpt_hype.....ENDFORM.
.FIELDCATLOG.
CARRIDfield catalog
Ls_fieldcat-web_field='CARRID_HANDLE'. CONNIDfield catalog
Ls_fieldcat-web_field='CONNID_HANDLE.
"SET_TABLE_FOR_FIRST_DISPLAY"it_hyperlink
::
LOOPATgt_list.IFgt_list-carrid=XX.Gt_list-carrid_handle=1.IFgt_list-connid=01.Gt_list-connid_handle=4.ENDIF.ENDIF.ENDLOOP.:
,,,.
,,,"LVC_T_DROP".ALV."SET_TABLE_FOR_FIRST_DISPLAY","SET_DROP_DOWN_TABLE".
,"DRDN_HNDL".:
ps_fcat-drdn_hndl='1'.
(,),"DRDN_FIELD".:
ps_fcat-drdn_field='PTYP_DD_HNDL'.
:
DATABEGINOFgt_listOCCURS0.INCLUDESTRUCTURESFLIGHT.DATArowcolor(4)TYPEc.DATAcellcolorsTYPElvc_t_scol.DATAcarrid_handleTYPEint4.DATAconnid_handleTYPEint4.DATAptype_dd_hndlTYPEint4.DATAENDOFgt_list.
:
FORMprepare_drilldown_values.DATAlt_ddvalTYPElvc_t_drop.DATAls_ddvalTYPElvc_s_drop.ls_ddval-handle='1'.ls_ddval-value='JFK-12'.APPENDls_ddvalTOlt_ddval.ls_ddval-handle='1'.ls_ddval-value='JSF-44'.APPENDls_ddvalTOlt_ddval.ls_ddval-handle='1'.ls_ddval-value='KMDA-53'.APPENDls_ddvalTOlt_ddval.ls_ddval-handle='1'.ls_ddval-value='SS3O/N'.APPENDls_ddvalTOlt_ddval.CALLMETHODgr_alvgrid->set_drop_down_tableEXPORTINGit_drop_down=lt_ddval.ENDFORM."prepare_drilldown_values
,set_drop_down_tableALV.:
,ALV GRID..ALV GRID.
ALV GRID,HTMLHTMLSAP GUI.
:
EventApplicationHTML
Print_end_of_listDefine output text to be printed at the end of the entire list
Print_top_of_listDefine output text to be printed at begin of the entire list
Print_top_of_pageDefine output text to be printed at begin of each page
Print_end_of_pageDefine output text to be printed at the end of each page
Subtotal_textDefine self-defined subtotal texts
ALV GRID
EventApplicationHTML
Button_clickQuery click on a push button in the ALV GRID control
Double_clickQuery a double click on a cell of the ALV GRID
Hotspot_clickQuery a hotspot click on columns defined for this purpose in advance
OndragCollect information when elements of the ALV GRID Control are dragged
OndropProcess information when elements of the ALV GRID Control are dropped
ondropCompletePerform final actions after successful drag&drop
ondropGetFlavorDistinguish between options for drag&drop behavior
EventApplicationHTML
Before_user_commandQuery self-defined and standard functions
User_commandQuery self-defined function codes
After_user_commandQuery self-defined and standard functions codes
(,)
EventApplicationHTML
Tool barChange,delete or add gui elements on alv grid
Menu_buttonDefine menus for menu buttons in the toolbar
Context_menu_requestChange context menu
Onf1Define self-defined f1 help
.
CLASSlcl_event_handlerDEFINITION.PUBLICSECTION.METHODS:*--ALVHandle_toolbarFOREVENTtoolbarOFcl_gui_alv_gridIMPORTINGe_objecte_interactive,*--Handle_user_commandFOREVENTuser_commandOFcl_gui_alv_gridIMPORTINGe_ucomm.*--Handle_hotspot_clickFOREVENThotspot_clickOFcl_gui_alv_gridIMPORTINGe_row_ide_column_ides_row_no.*--Handle_before_user_commandFOREVENTbefore_user_commandOFcl_gui_alv_gridIMPORTINGe_ucomm.*--Handle_after_user_commandFOREVENTafter_user_commandOFcl_gui_alv_gridIMPORTINGe_ucomm.*--ALV,Handle_data_changedFOREVENTdata_changedOFcl_gui_alv_gridIMPORTINGer_data_changed.*--Handle_data_changed_finishedFOREVENTdata_changed_finishedOFcl_gui_alv_gridIMPORTINGe_modified.*--Handle_menu_buttonFOREVENTmenu_buttonOFcl_gui_alv_gridIMPORTINGe_objecte_ucomm.*--Handle_button_clickFOREVENTbutton_clickOFcl_gui_alv_gridIMPORTINGe_objece_ucomm.PRIVATESECTION.ENDCLASS."
ALV:
CLASSlcl_event_handlerIMPLEMENTATION.*--HandletoolbarMETHODhandle_toolbar.PERFORMhandle_toolbarusigne_objecte_interactive.ENDMETHOD."lcl_event_handler*--HandlehotspotclickMETHODhandle_hotspot_click.PERFORMhandle_hotspot_clickUSINGe_row_ide_column_ides_row_no.ENDMETHOD."lcl_event_handler*--HandledoubleclickMETHODhandle_double_click.PERFORMhandle_double_clickUSINGe_rowe_columnes_row_no.ENDMETHOD."lcl_event_handler*--HandleafterusercommandMETHODhandle_after_user_command.PERFORMhandle_after_user_commandUSINGe_object.ENDFORM."lcl_event_handler*--HandlebeforeusercommandMETHODhandle_before_user_command.PERFORMhandle_before_user_command.ENDMETHOD."lcl_event_handler*--HandledatachangedMETHODhandle_data_changed.PERFORMhandle_data_changedUSINGer_data_changed.ENDMETHOD.
METHODhandle_data_changed_finished.PERFORMhandle_data_chagedUSINGe_modified.ENDMETHOD."handle_data_changed_finished
METHODhandle_menu_button.PERFORMhandle_menu_buttonUSINGe_objecte_ucomm.ENDMETHOD.
METHOD handle_button_click.PERFORMhandle_button_clickUSINGe_objcete_ucomm.ENDMETHOD."handle_menu_buttonENDCLASS."lcl_event_handlerIMPLEMENTATIONALV GRID
,ALV GRID.
DATAgr_event_handlerTYPEREFTOlcl_event_handler.....*--CreatinganinstancefortheeventhandlerCREATEOBJECTgr_event_handler.*--RegisteringhandlermethodstohandleALVGrideventsSETHANDLERgr_event_handler->handle_user_commandFORgr_alvgrid.SETHANDLERgr_event_handler->handle_toolbarFORgr_alvgrid.SETHANDLERgr_event_handler->handle_menu_buttonFORgr_alvgrid.SETHANDLERgr_event_handler->handle_double_clickFORgr_alvgrid.SETHANDLERgr_event_handler->handle_hotspot_clickFORgr_alvgrid.SETHANDLERgr_event_handler->handle_button_clickFORgr_alvgrid.SETHANDLERgr_event_handler->handle_before_user_command FORgr_alvgrid.SETHANDLERgr_event_handler->handle_context_menu_request FORgr_alvgrid.SETHANDLERgr_event_handler->handle_data_changedFORgr_alvgrid.SETHANDLERgr_event_handler->handle_data_changed_finished FORgr_alvgrid.1.()
,,"HOTSPOT""X",HOTSPOT_CLICK.HOTSPOT_CLICK,"E_ROW_ID",2:LVC_S_COL"E_COLUMN_ID",E_COLUMN_ID-FIELDNAME. LVC_S_ROID"ES_ROW_NO",ES_ROW_NO-ROW_ID,.
:
FORMhandle_hotspot_clickUSINGi_row_idTYPElvc_s_rowi_column_idTYPElvc_s_colis_row_noTYPElvc_s_roid.READTABLEgt_listINDEXis_row_no-rowid.IFsy-subrc=0ANDi_column_id-fieldname=seatsocc.CALLSCREEN200.ENDIF.ENDFORM."handle_hotspot_click
SEATSOCC,200.
2.
,3..
:
FORMhandle_double_clickUSINGi_rowTYPElvc_s_rowi_columnTYPElvc_s_colis_row_noTYPElvc_s_rowid.READTABLEgt_listINDEXis_row_no-row_id.IFsy-subrc=0ANDi_column-fieldname=seatsocc.CALLSCREEN200.ENDIF.ENDFORM."handle_double_click
SEATSOCC200.
3.
ALV,GUI,2.
toolbar,user_command.
TOOLBAR,"e_object""mt_toolbar".:
FORMhandle_toolbarUSINGi_objectTYPEREFTOcl_alv_event_toolbar_set.DATA:ls_toolbarTYPEstb_button.CLEARls_toolbar.MOVE3TOls_toolbar-butn_type.APPENDls_toolbarTOi_object->mt_toolbar.
CLEARls_toolbar.MOVE'PER'TOls_toolbar-function.MOVEicon_display_textTOls_toolbar-icon.MOVE'PassengerInfo'(201)TOls_toolbar-quickinfo.MOVE'PassengerInfo'(201)TOls_toolbar-text.MOVE''TOls_toolbar-disabled.APPENDls_toolbarTOi_object->mt_toolbar.
CLEARls_toolbar.MOVE'EXCH'TOls_toolbar-function.MOVE2TOls_toolbar-butn_type.MOVEicon_calculationTOls_toolbar-icon.MOVE'PaymentinotherCurencies'(202)TOls_toolbar-quickinfo.MOVE''TOls_toolbar-text.MOVE''TOls_toolbar-disapbled.APPENDls_toolbarTOi_object->mt_toolbar.ENDFORM."handle_toolbar
:FieldDescription
FUNCTION
BUTN_TYPE
:
0 Button(normal)
1 Menu and default button
2 Menu
3
4 Radio button
5 Checkbox
6 Menu entry
ICON()
TEXT()
QUICKINFO()
DISABLED
.12,,menu_button:
FORMhandle_menu_buttonUSINGi_objectTYPEREFTOcl_ctmenui_ucommTYPEsyucomm..CASEi_ucomm.WHENexch.CALLMETHODi_object->add_functionEXPORTINGfcode=eutext=euro.CALLMETHODi_object->add_functionEXPORTINGfcode=trltext=turkishlira.ENDCASE.ENDFORM."handle_menu_button
,USER_COMMAND.
FORMhandle_user_commandUSINGi_ucommTYPEsy-ucomm.DATAlt_selected_rowsTYPElvc_t_rowid.DATAls_selected_rowTYPElvc_s_roid.
CALLMETHODgr_alvgrid->get_selected_rowsIMPORTINGet_row_no=lt_selected_rows.READTABLElt_selected_rowsINTOls_selected_rowINDEX1.IFsy-subrcNE0.MESSAGEs000(su)WITH'Selectarow'(203).ENDIF.CASEi_ucomm.WHEN'CAR'.READTABLEgt_listINDEXls_selected_row-row_id.IFsy-subrc=0.CALLFUNCTION'ZDISPLAY_CARRIER_INFO'EXPORTINGcarrid=gt_list-carridEXCEPTIONScarrier_not_found=1oters=2.ENDIF.WHEN'EU'.READTABLEgt_listINDEXls_selected_row-row_id.IFsy-subrc=0.CALLFUNCTION'ZPOPUP_CONV_CURR_ADD_DISPLAY'EXPORTINGmonun='EU'quant=gt_list-paymentsum.ENDIF.ENDCASE.ENDFORM."handle_user_commandget_selected_rows.EXCH2,.ALV,ALVset_toolbar_interactive.CALLMETHODgr_alv_grid->set_toolbar_interactive.4..
ALV.,"before_user_command","set_user_command",.
:
FORMhandle_before_user_commandUSINGi_ucommTYPEsyucomm.CASEe_ucomm.WHEN'&INFO'.CALLFUNCTION'ZSFLIGHT_PROG_INFO'.CALLMETHODgr_alvgrid->set_user_commandEXPORTINGi_ucomm=space.ENDCASE.ENDFORM."handle_before_user_command
5.(style,styleCL_GUI_ALV_GRID,MC_STYLE4_LINK,MC_STYLE4_LINK_NO,MC_STYLE_BUTTON,MC_STYLE_DISABLED,....),/,F4,,,......
5.1 PUSHBUTTON
,"LVC_T_STYL". :
DATA:BEGINOFgt_listOCCURS0.INCLUDESTRUCTUREsflight.DATArowcolor(4)TYPEc.DATAcellcolorsTYPElvc_t_scol.DATAcarrid_handleTYPEint4.DATAconnid_handleTYPEint4.DATAcellstylesTYPElvc_t_styl.DATAENDOFgt_list.
:7SEATSMAX.
DATAls_styleTYPElvc_s_styl.READTABLEgt_listINDEX7.ls_style-fieldname='SEATSMAX'.ls_style-style=cl_gui_alv_grid=>mc_style_button.APPENDls_styleTOgt_list-cellstyles.MODIFYgt_listINDEX7.
STYLE,:gs_layout-stylefname='CELLSTYLES'.
,2.
5.2 ,SAP.,,A,,B,.
,EDIT"X".,ALV,,,.,.
5.1,,"LVC_T_STYL".styleCL_GUI_ALV_GRID=>MC_STYLE_ENABLEDCL_GUI_ALV_GRID=>MC_STYLE_DISABLED..CL_GUI_ALV_GRID=>MC_STYLE_ENABLED,CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.:
FORMadjust_edittablesUSINGpt_listLIKEgt_list[].DATAls_listrowLIKELINEOFpt_list.DATAls_stylerowTYPElvc_s_styl.DATAlt_styletabTYPElvc_t_styl.
LOOPATpt_listINTOls_listrow.IFls_listrow-carrid='XY'.ls_stylerow-fieldname='SEATSMAX'.ls_stylerow-style=cl_alv_grid=>mc_style_disabled.APPENDls_stylerowTOlt_styletab.ENDIF.IFls_listrow-connid='02'.ls_stylerow-fieldname='PLANETYPE'LS_STYLEROW-STYLE=CL_ALV_GRID=>MC_STYLE_ENABLED.APPENDls_pstylerowTOlt_styletab.ENDIF.INSERTLINESOFlt_styletabINTOls_listrow-cellstyles.MODIFYpt_listFROMls_listrow.ENDLOOP.ENDFORM."adjust_edittables
ALVSTYLE.gs_layout-stylefname='CELLSTYLES'.
,STYLE.set_ready_for_inputi_ready_for_input = 1ALVALVi_ready_for_input0,6.
alvALVAlv grid:data_changeddata_changed_finished.REGISTER_EDIT_EVENT,.2:
1.: i_event_id = cl_gui_alv_grid=>mc_event_enter 2.: i_event_id = cl_gui_alv_grid=>mc_event_modifies
,.
ALV,DATA_CHANGEDCL_ALV_CHANGED_DATA_PROTOCOLER_DATA_CHANGEDALV..CL_ALV_CHANGED_DATA_PROTOCOL:
Get_cell_value
Modify_cell
Add_protocol_entry
Protocol_is_visible
Refresh_protocol
:
MT_MOD_CELLSContains address of modified cells with rowed and field name
MT_MOD_ROWSContain modified rows Its type is genric
MT_GOOD_CELLSContain cells have proper values
MT_DELETED_ROWSContain rows deleted from the list
MT_INSERTED_ROWSContain rows deleted from the list
,.
:
FORMhandle_data_changedUSINGir_data_changedTYPEREFTOcl_alv_changed_data_protocol.DATA:ls_mod_cellTYPElvc_s_modi,lv_valueTYPElvc_value.
SORTir_data_changed->mt_mod_cellsBYrow_id.LOOPATir_data_changed->mt_mod_cellsINTOls_mod_cellWHEREfieldname='SEATSMAX'.CALLMETHODir_data_changed->get_cell_valueEXPORTINGi_row_id=ls_mod_cell-row_idi_fieldname='CARRID'IMPORTINGe_value=lv_value.IFlv_value='THY'ANDls_mod_cell-value>'500'.CALLMETHODir_data_changed->add_protocol_entryEXPORTINGi_msgid='SU'i_msgno='000'i_msgty='E'i_msgv1='Thisnumbercannotexceed500for'i_msgv2=lv_valuei_msgv3='Thevalueisetto''500'''i_fieldname=ls_mod_cell-fieldnamei_row_id=ls_mod_cell-rowid.CALLMETHODir_data_changed->modify_cellEXPORTINGi_row_id=ls_mod_cell-row_idi_fieldname=ls_mod_cell-fieldnamei_value='500'.ENDIF.ENDLOOP.ENDFORM."handle_data_changed7.ClassALV
Control Framework: Fatal error - GUI cannot be reached
Docking_container
DATA: cont_docking TYPE REF TO cl_gui_docking_container .
PBOALVALV GRID
IF cl_gui_alv_grid=>offline( ) IS INITIAL. CREATE OBJECT g_custom_container EXPORTING container_name = g_container. CREATE OBJECT grid1 EXPORTING i_parent = g_custom_container. ELSE. CREATE OBJECT grid1 EXPORTING i_parent = cont_docking . ENDIF.