tablecontrol中modify cell
creat object tree1(TYPE REF TO CL_GUI_ALV_TREE)时
传入参数 NO_HTML_HEADER 传入‘ ’时 输出效果如同top of page。(需要在CALL METHOD TREE1->SET_TABLE_FOR_FIRST_DISPLAY 中传入参数
IT_LIST_COMMENTARY
I_LOGO
I_BACKGROUND_ID 来达到效果 )
BCALV_TREE_DEMO中的
INCLUDE BCALV_TOOLBAR_EVENT_RECEIVER.
INCLUDE BCALV_TREE_EVENT_RECEIVER.
下图上为node,下为item。Method中逻辑完全一致。
只在item中写逻辑:
这个时候只在右键item时才出现逻辑中的菜单:
而对整条数据右键时不会出现菜单。(选中整条数据即点击最前方小图标)
只在node中写逻辑:将node中逻辑放出,将item中逻辑隐掉时,情况相反。
右键item无效果。
右键整条数据出现逻辑中的菜单。
数据引用/动态内表
LCL_ALV_GRID=>MC_STYLE_DISABLED 盖不过LS_FIELDCAT-EDIT (只在edit= x的情况成立)
tabcontrol中设置可编辑,系统原本的属性优先级(1)>程序中修改的代码优先级(2)>layout中output only优先级(3)
(就是2不能改1,但是2能改3)
图中BUKRS-SGTXT字段在layout中设置了可编辑:
在PBO中设置不可编辑时,在3区域能起作用;但若用同样的思路想将1区域中单元格设置为不可编辑,则不起作用(效果见下图)
excel upload 上传路径取最后四位‘XLSX’OR‘.XLS’ *DATA: BEGIN OF GT_GET OCCURS 0, * NAME TYPE C LENGTH 10, * SEX TYPE C LENGTH 1, * AGE TYPE C LENGTH 2,"??? * END OF GT_GET. *DATA GS_GET LIKE LINE OF GT_GET. * *DATA: LV_EXTEN TYPE STRING, * LV_FILTER TYPE STRING, * LV_DIREC TYPE STRING, * LV_RC TYPE I VALUE 1, * LT_TAB TYPE FILETABLE. *DATA LS_TAB LIKE LINE OF LT_TAB. *DATA: LV_TRD TYPE TRUXS_T_TEXT_DATA, * LV_FNAME LIKE RLGRAP-FILENAME. * *PARAMETERS:P_FILE LIKE RLGRAP-FILENAME. * *AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE. * * CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG * EXPORTING * DEFAULT_EXTENSION = LV_EXTEN * FILE_FILTER = LV_FILTER * INITIAL_DIRECTORY = LV_DIREC * CHANGING * FILE_TABLE = LT_TAB * RC = LV_RC. * * READ TABLE LT_TAB INTO LS_TAB INDEX 1. * P_FILE = LS_TAB. * *START-OF-SELECTION. * DATA LV_L TYPE I . * DATA LV_NEW(4) TYPE C . * LV_L = STRLEN( P_FILE ). * LV_L = LV_L - 4 . * LV_NEW = P_FILE+LV_L(4). * TRANSLATE LV_NEW TO UPPER CASE. * IF LV_NEW NE 'XLSX' AND LV_NEW NE '.XLS' . * MESSAGE 'wrong with file type !' TYPE 'E'. * ELSE. * WRITE P_FILE. * ENDIF. ******************************************************************* ************************************************************ DATA:BEGIN OF GT_GET OCCURS 0, CONT(1024) TYPE C, END OF GT_GET. DATA GS_GET LIKE LINE OF GT_GET. DATA: LV_EXTEN TYPE STRING, LV_FILTER TYPE STRING, LV_DIREC TYPE STRING, LV_RC TYPE I VALUE 1, LT_TAB TYPE FILETABLE, LV_FNAME TYPE STRING, LV_PATH TYPE STRING, LV_FP TYPE STRING, LV_BIN TYPE I. DATA: LS_TAB LIKE LINE OF LT_TAB. DATA: LV_TRD TYPE TRUXS_T_TEXT_DATA. PARAMETERS:P_FILE TYPE STRING. AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE. CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG EXPORTING DEFAULT_EXTENSION = LV_EXTEN FILE_FILTER = LV_FILTER INITIAL_DIRECTORY = LV_DIREC CHANGING FILE_TABLE = LT_TAB RC = LV_RC. READ TABLE LT_TAB INTO LS_TAB INDEX 1. P_FILE = LS_TAB. CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD EXPORTING FILENAME = P_FILE * FILETYPE = 'ASC' FILETYPE = 'BIN' * CODEPAGE = '8400' CHANGING DATA_TAB = GT_GET[] EXCEPTIONS FILE_OPEN_ERROR = 1 FILE_READ_ERROR = 2 NO_BATCH = 3 GUI_REFUSE_FILETRANSFER = 4 NO_AUTHORITY = 6 UNKNOWN_ERROR = 7 BAD_DATA_FORMAT = 8 UNKNOWN_DP_ERROR = 12 ACCESS_DENIED = 13 OTHERS = 17. CHECK GT_GET[] IS NOT INITIAL. *************************************************upload *************************************************upload CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG EXPORTING * DEFAULT_FILE_NAME = '*.xls' "vip:set deflult file type DEFAULT_EXTENSION = LV_EXTEN FILE_FILTER = LV_FILTER INITIAL_DIRECTORY = LV_DIREC CHANGING FILENAME = LV_FNAME PATH = LV_PATH FULLPATH = LV_FP. P_FILE = LV_FNAME. START-OF-SELECTION. IF P_FILE IS INITIAL. MESSAGE S000 WITH 'P_file Is Initial !' DISPLAY LIKE 'E'. EXIT. ENDIF. CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD EXPORTING FILENAME = LV_FP * FILETYPE = 'ASC' FILETYPE = 'BIN' * WRITE_FIELD_SEPARATOR = 'X'"vip: text and excel CHANGING DATA_TAB = GT_GET[]. IF SY-SUBRC <> 0. MESSAGE E000 WITH SPACE. ELSE. MESSAGE S000 WITH 'successful!'. ENDIF. ***************************************************download ***************************************************download ***************************************************download&upload ********************************************************************* ** *TABLES:BKPF,YTA0CMZ00010. *DATA GT_ITEM TYPE TABLE OF YTESTTAB WITH HEADER LINE. *DATA: BEGIN OF GS_HEADER, * BUKRS LIKE BKPF-BUKRS , * BELNR LIKE BKPF-BELNR , * GJAHR LIKE BKPF-GJAHR , * END OF GS_HEADER. ** *SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-T01. *SELECT-OPTIONS : *S_BUKRS FOR BKPF-BUKRS DEFAULT '0654', *S_BELNR FOR BKPF-BELNR DEFAULT '0600000002', *S_GJAHR FOR BKPF-GJAHR DEFAULT '2009'. *SELECTION-SCREEN END OF BLOCK B1 . * *SELECT SINGLE BUKRS BELNR GJAHR * FROM BKPF * INTO CORRESPONDING FIELDS OF GS_HEADER * WHERE BUKRS IN S_BUKRS * AND BELNR IN S_BELNR * AND GJAHR IN S_GJAHR. * *SELECT BUKRS BELNR GJAHR ** BUZEI SGTXT SHKZG * FROM BSEG * INTO CORRESPONDING FIELDS OF TABLE GT_ITEM * WHERE BUKRS IN S_BUKRS * AND BELNR IN S_BELNR * AND GJAHR IN S_GJAHR. * * MODIFY YTESTTAB FROM TABLE GT_ITEM. * **DELETE FROM YTA0CMZ00010 WHERE BUKRS IS NOT NULL. * *IF SY-SUBRC EQ 0. * WRITE: 'S'. * COMMIT WORK. *ELSE. * WRITE: 'F'. * ROLLBACK WORK . *ENDIF. *************************************************************modify *DELETE FROM YTESTTAB WHERE BUDAT IS NOT NULL. *IF SY-SUBRC EQ 0. *WRITE: 'S'. *ENDIF. **************************************************************delete * *UPDATE ytciz10010 SET ZMODULE = 'BW' WHERE DLVUNIT = 'WEBCUIF'. * *IF SY-SUBRC EQ 0. * WRITE: 'S'. * commit WORK. * else. * WRITE: 'F'. * ROLLBACK WORK . *ENDIF. ***********************************************************update *******截取lv后四位 DATA LV_1 TYPE C LENGTH 10 VALUE 'ABCDEFG'. DATA LV_2 TYPE C LENGTH 10 . DATA LV_N1 TYPE I. DATA LV_N2 TYPE I. LV_N1 = STRLEN( LV_1 ). LV_N2 = LV_N1 - 4. LV_2 = LV_1+LV_N2(4). WRITE LV_2. ***********************************************************