*&---------------------------------------------------------------------*
*& Report Z_SALAH_EDIT_CELLS
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT Z_SALAH_EDIT_CELLS.
**********************************************************************
*REPORT DESCRIBE:單元格可編輯
*DEVELOPER:SALAH
*DEVELOP DATE:20191014
*MODIFY DATE:
*FUNCTION SPEC:
*KEY USER:
**********************************************************************
TYPE-POOLS:SLIS.
TYPES:BEGIN OF TYP_01,
PER_KEY(20) TYPE C,
PER_NOR(20) TYPE C,
SEL_STY TYPE LVC_T_STYL,
CBOX TYPE C,
END OF TYP_01.
DATA IS_SEL_STY TYPE LVC_S_STYL.
DATA GT_01 TYPE TABLE OF TYP_01.
DATA GS_01 TYPE TYP_01.
DATA IT_FIELDCAT TYPE LVC_T_FCAT .
DATA IS_FIELDCAT TYPE LVC_S_FCAT .
DATA IS_LAYOUT TYPE LVC_S_LAYO.
DATA IS_GRID_SET TYPE LVC_S_GLAY.
GS_01-PER_KEY = 'test key one'.
GS_01-PER_NOR = 'test normal one'.
APPEND GS_01 TO GT_01.
GS_01-PER_KEY = 'test key two'.
GS_01-PER_NOR = 'test normal two'.
APPEND GS_01 TO GT_01.
IS_FIELDCAT-FIELDNAME = 'per_key'.
"is_fieldcat-edit = 'X'.
IS_FIELDCAT-SCRTEXT_L = '鍵值數據'.
APPEND IS_FIELDCAT TO IT_FIELDCAT.
IS_FIELDCAT-FIELDNAME = 'per_nor'.
"is_fieldcat-edit = 'X'.
IS_FIELDCAT-SCRTEXT_L = '非鍵值數據'.
APPEND IS_FIELDCAT TO IT_FIELDCAT.
PERFORM FRM_SET_LINE_NOEDIT.
IS_GRID_SET-EDT_CLL_CB = 'X'.
IS_LAYOUT-CWIDTH_OPT = 'X'.
IS_LAYOUT-EDIT = 'X'.
IS_LAYOUT-STYLEFNAME = 'SEL_STY'.
IS_LAYOUT-BOX_FNAME = 'CBOX'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'FRM_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'FRM_USERCOMM'
* 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_GRID_SET
IS_LAYOUT_LVC = IS_LAYOUT
IT_FIELDCAT_LVC = IT_FIELDCAT
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS_LVC =
* IT_SORT_LVC =
* IT_FILTER_LVC =
* IT_HYPERLINK =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
" I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT_LVC =
* IS_REPREP_ID_LVC =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP =
* I_HTML_HEIGHT_END =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO_LVC =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = GT_01
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
FORM FRM_PF_STATUS USING EXTAB.
SET PF-STATUS 'MENU'.
ENDFORM.
FORM FRM_USERCOMM USING P_UCOMM TYPE SYUCOMM
CHANGING P_SEL TYPE SLIS_SELFIELD.
DATA: LR_GRID TYPE REF TO CL_GUI_ALV_GRID,
MYINDEX TYPE SY-TABIX.
* Ë¢ÐÂÆÁÄ»
CASE P_UCOMM.
WHEN 'INS'.
APPEND INITIAL LINE TO GT_01.
LOOP AT GT_01 INTO GS_01.
IF GS_01-PER_KEY IS INITIAL.
CLEAR GS_01-SEL_STY.
MODIFY GT_01 FROM GS_01 INDEX SY-TABIX.
ENDIF.