2019.03.30 Dialog demo 一个标准使用的dialog程序
PROGRAM zdemo_dialog. INCLUDE zdemo_dialogtop.
INCLUDE zdemo_dialogo01.
INCLUDE zdemo_dialogi01.
INCLUDE zdemo_dialogf01.
INCLUDE zdemo_dialoghelp.
*&---------------------------------------------------------------------*
*& 包含 ZDEMO_DIALOGTOP
*&---------------------------------------------------------------------* "屏幕元素定义
DATA: "ok_code TYPE sy-ucomm,
input_one TYPE char10,
input_two TYPE char10,
output_three TYPE char10,
cb_descri TYPE char1.
DATA subinput_one TYPE char10.
TABLES:t001w,t001l,makt,marc. *&SPWIZARD: FUNCTION CODES FOR TABSTRIP 'TABSTRIP_01'
CONSTANTS: BEGIN OF c_tabstrip_01,
tab1 LIKE sy-ucomm VALUE 'TABSTRIP_01_FC1', "功能代码
tab2 LIKE sy-ucomm VALUE 'TABSTRIP_01_FC2',
tab3 LIKE sy-ucomm VALUE 'TABSTRIP_01_FC3',
END OF c_tabstrip_01.
*&SPWIZARD: DATA FOR TABSTRIP 'TABSTRIP_01'
CONTROLS: tabstrip_01 TYPE TABSTRIP.
DATA: BEGIN OF g_tabstrip_01,
subscreen LIKE sy-dynnr, "子屏幕
prog LIKE sy-repid VALUE 'ZDEMO_DIALOG', "程序名
pressed_tab LIKE sy-ucomm VALUE c_tabstrip_01-tab1, "按下去得按钮
END OF g_tabstrip_01.
DATA: ok_code LIKE sy-ucomm. *排除按钮 EXCLUDING BUTTON
DATA :gt_status TYPE TABLE OF sy-ucomm, "EXCLUDING GT_STATUS
gs_status TYPE sy-ucomm. " *标题 TITLE
DATA gv_title TYPE c LENGTH . "标识 SIGN DATA gv_sign_01 TYPE c. *内表 TABLE CTRL 显示 表
TYPES:BEGIN OF ty_tab,
id TYPE id,
matnr TYPE mard-matnr,
werks TYPE mard-werks,
lgort TYPE mard-lgort,
END OF ty_tab.
DATA: lt_tab TYPE TABLE OF ty_tab,
ls_tab TYPE ty_tab. *table control 控制表
TYPES:BEGIN OF ty_tab_crl,
cbox TYPE checkbox,
id TYPE id,
matnr TYPE mard-matnr,
werks TYPE mard-werks,
lgort TYPE mard-lgort,
END OF ty_tab_crl.
DATA:gt_tab TYPE TABLE OF ty_tab_crl,
gs_tab TYPE ty_tab_crl. *TABLE CONTROL 控制表2
DATA :gt_tab_1 TYPE TABLE OF ty_tab_crl,
gs_tab_1 TYPE ty_tab_crl.
*&SPWIZARD: DECLARATION OF TABLECONTROL 'TC_CTRL' ITSELF
CONTROLS: tc_ctrl TYPE TABLEVIEW USING SCREEN . "table control 的控制器 *&SPWIZARD: LINES OF TABLECONTROL 'TC_CTRL'
DATA: g_tc_ctrl_lines LIKE sy-loopc."行数 *DATA: OK_CODE LIKE SY-UCOMM. *&SPWIZARD: DECLARATION OF TABLECONTROL 'TC_CTRL_TAB' ITSELF
CONTROLS: tc_ctrl_tab TYPE TABLEVIEW USING SCREEN . *&SPWIZARD: LINES OF TABLECONTROL 'TC_CTRL_TAB'
DATA: g_tc_ctrl_tab_lines LIKE sy-loopc. DATA gv_field TYPE lvc_s_fcat-fieldname.
DATA gv_lines TYPE i.
*DATA: OK_CODE LIKE SY-UCOMM. *创建选择界面
SELECTION-SCREEN BEGIN OF SCREEN AS SUBSCREEN.
SELECT-OPTIONS s_werks FOR marc-werks.
SELECTION-SCREEN END OF SCREEN . *&SPWIZARD: DECLARATION OF TABLECONTROL 'TC_CTRL_TAB_1' ITSELF
CONTROLS: tc_ctrl_tab_1 TYPE TABLEVIEW USING SCREEN . *&SPWIZARD: LINES OF TABLECONTROL 'TC_CTRL_TAB_1'
DATA: g_tc_ctrl_tab_1_lines LIKE sy-loopc. *DATA: OK_CODE LIKE SY-UCOMM.
*&---------------------------------------------------------------------*
*& 包含 ZDEMO_DIALOGO01
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100' EXCLUDING gt_status.
SET TITLEBAR 'TITLE_0100' WITH gv_title.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module PBO_0100 OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE pbo_0100 OUTPUT.
IF input_one IS NOT INITIAL.
output_three = input_one.
ELSE.
output_three = 'NONE'.
ENDIF. IF gv_sign_01 = abap_off.
cb_descri = 'X'.
ENDIF. IF cb_descri EQ abap_on.
LOOP AT SCREEN .
IF screen-group1 = 'GP1'.
screen-active = ''.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSE.
LOOP AT SCREEN .
IF screen-group1 = 'GP1'.
screen-active = ''.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF. ENDMODULE. *&SPWIZARD: OUTPUT MODULE FOR TS 'TABSTRIP_01'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: SETS ACTIVE TAB
MODULE tabstrip_01_active_tab_set OUTPUT.
tabstrip_01-activetab = g_tabstrip_01-pressed_tab.
CASE g_tabstrip_01-pressed_tab."根据 按下得页签 来 获取 子屏幕
WHEN c_tabstrip_01-tab1.
g_tabstrip_01-subscreen = ''.
gv_title = '-Create'.
WHEN c_tabstrip_01-tab2.
g_tabstrip_01-subscreen = ''.
gv_title = '-Modify'.
WHEN c_tabstrip_01-tab3.
g_tabstrip_01-subscreen = ''.
gv_title = '-Display'.
WHEN OTHERS.
*&SPWIZARD: DO NOTHING
ENDCASE.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module STATUS_0110 OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE status_0110 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
subinput_one = input_two. ENDMODULE. *&SPWIZARD: OUTPUT MODULE FOR TC 'TC_CTRL'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: UPDATE LINES FOR EQUIVALENT SCROLLBAR
MODULE tc_ctrl_change_tc_attr OUTPUT.
DESCRIBE TABLE lt_tab LINES tc_ctrl-lines."获取行数
* DESCRIBE TABLE LT_TAB OCCURS LV_LINES."初始化大小
DESCRIBE TABLE lt_tab OCCURS DATA(lv_lines)."初始化大小
DESCRIBE TABLE lt_tab KIND DATA(lv_type)."表类型 ENDMODULE. *&SPWIZARD: OUTPUT MODULE FOR TC 'TC_CTRL'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: GET LINES OF TABLECONTROL
MODULE tc_ctrl_get_lines OUTPUT.
g_tc_ctrl_lines = sy-loopc.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
EXPORTING
input = ls_tab-matnr
IMPORTING
output = ls_tab-matnr. * CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
* EXPORTING
* input = ls_tab-id
* IMPORTING
* output = ls_tab-id.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module GET_TABLE_DATA OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE get_table_data OUTPUT. IF lt_tab[] IS INITIAL.
SELECT matnr werks lgort FROM mard INTO CORRESPONDING FIELDS OF TABLE lt_tab
UP TO ROWS
ORDER BY werks lgort.
LOOP AT lt_tab ASSIGNING FIELD-SYMBOL(<fs>).
<fs>-id = sy-tabix.
ENDLOOP.
ENDIF. ENDMODULE. *&SPWIZARD: OUTPUT MODULE FOR TC 'TC_CTRL_TAB'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: UPDATE LINES FOR EQUIVALENT SCROLLBAR
MODULE tc_ctrl_tab_change_tc_attr OUTPUT.
DESCRIBE TABLE gt_tab LINES tc_ctrl_tab-lines.
ENDMODULE. *&SPWIZARD: OUTPUT MODULE FOR TC 'TC_CTRL_TAB'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: GET LINES OF TABLECONTROL
MODULE tc_ctrl_tab_get_lines OUTPUT.
g_tc_ctrl_tab_lines = sy-loopc.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
EXPORTING
input = gs_tab-matnr
IMPORTING
output = gs_tab-matnr. * CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
* EXPORTING
* input = gs_tab-id
* IMPORTING
* output = gs_tab-id.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module GET_TABLE_DATA_130 OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE get_table_data_130 OUTPUT.
IF gt_tab[] IS INITIAL.
SELECT matnr werks lgort FROM mard INTO CORRESPONDING FIELDS OF TABLE gt_tab
UP TO ROWS
ORDER BY werks lgort.
LOOP AT gt_tab ASSIGNING FIELD-SYMBOL(<fs1>).
<fs1>-id = sy-tabix.
ENDLOOP.
ENDIF.
ENDMODULE. *&SPWIZARD: OUTPUT MODULE FOR TC 'TC_CTRL_TAB_1'. DO NOT CHANGE THIS LIN
*&SPWIZARD: UPDATE LINES FOR EQUIVALENT SCROLLBAR
MODULE tc_ctrl_tab_1_change_tc_attr OUTPUT.
DESCRIBE TABLE gt_tab_1 LINES tc_ctrl_tab_1-lines.
ENDMODULE. *&SPWIZARD: OUTPUT MODULE FOR TC 'TC_CTRL_TAB_1'. DO NOT CHANGE THIS LIN
*&SPWIZARD: GET LINES OF TABLECONTROL
MODULE tc_ctrl_tab_1_get_lines OUTPUT.
g_tc_ctrl_tab_1_lines = sy-loopc.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module GET_TABLE_DATA_110 OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE get_table_data_110 OUTPUT.
IF gt_tab_1[] IS INITIAL.
APPEND INITIAL LINE TO gt_tab_1.
ENDIF.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module TC_CTRL_TAB_CHANGE_FIELD_ATTR OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE tc_ctrl_tab_change_field_attr OUTPUT.
* IF gs_tab-cbox = 'X'.
* LOOP AT SCREEN."控制摸个单元格可输入 可输出
* IF screen-name = 'GS_TAB-ID'.
* screen-input = '1'.
* MODIFY SCREEN.
* ENDIF.
* ENDLOOP.
* ENDIF.
"光标处回车 可编辑
IF tc_ctrl_tab-current_line = gv_lines + tc_ctrl_tab-top_line - .
LOOP AT SCREEN.
IF screen-name = gv_field.
screen-input = ''.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDMODULE.
*&---------------------------------------------------------------------*
*& 包含 ZDEMO_DIALOGI01
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT. ok_code = sy-ucomm. CASE ok_code.
WHEN 'BACK' OR 'CANC'.
LEAVE TO SCREEN .
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BT_BACK'.
LEAVE TO SCREEN .
* WHEN 'BT_EXIT'.
* LEAVE PROGRAM.
ENDCASE. "滚轮和回车都会触发 PBO 和 PAI 所以需要在function code 使用过后清空
CLEAR ok_code.
CLEAR sy-ucomm.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module EXIT_COMMAND INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE exit_command INPUT.
ok_code = sy-ucomm.
CASE ok_code.
* WHEN 'BACK' OR 'CANC'.
* LEAVE TO SCREEN 0.
* WHEN 'EXIT'.
* LEAVE PROGRAM.
* WHEN 'BT_BACK'.
* LEAVE TO SCREEN 0.
WHEN 'BT_EXIT'.
LEAVE PROGRAM.
ENDCASE. CLEAR ok_code.
CLEAR sy-ucomm.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module CHECK_PLANT INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE check_plant INPUT. SELECT SINGLE name1 INTO t001w-name1 FROM t001w
WHERE werks = t001w-werks.
IF sy-subrc NE .
CLEAR :t001w-werks,t001w-name1.
ENDIF. ENDMODULE.
*&---------------------------------------------------------------------*
*& Module CHECK_WAREHOUSE INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE check_warehouse INPUT. IF t001w-werks IS NOT INITIAL.
SELECT SINGLE lgobe INTO t001l-lgobe FROM t001l
WHERE werks = t001w-werks AND lgort = t001l-lgort.
IF sy-subrc NE .
CLEAR: t001l-lgort,t001l-lgobe.
ENDIF.
ELSE.
CLEAR: t001l-lgort,t001l-lgobe.
ENDIF.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module CHECK_MATERIAL INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE check_material INPUT.
IF t001w-werks IS NOT INITIAL
AND t001l-lgort IS NOT INITIAL.
SELECT SINGLE maktx INTO makt-maktx FROM makt
WHERE matnr = makt-matnr AND spras = sy-langu.
ELSE.
CLEAR:makt-matnr,makt-maktx.
ENDIF.
ENDMODULE. *&SPWIZARD: INPUT MODULE FOR TS 'TABSTRIP_01'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: GETS ACTIVE TAB
MODULE tabstrip_01_active_tab_get INPUT.
ok_code = sy-ucomm.
CASE ok_code.
WHEN c_tabstrip_01-tab1.
g_tabstrip_01-pressed_tab = c_tabstrip_01-tab1.
REFRESH gt_status.
* gs_status = 'SAVE'."隐藏按钮
* APPEND gs_status TO gt_status.
* CLEAR gs_status.
WHEN c_tabstrip_01-tab2.
g_tabstrip_01-pressed_tab = c_tabstrip_01-tab2.
REFRESH gt_status.
WHEN c_tabstrip_01-tab3.
g_tabstrip_01-pressed_tab = c_tabstrip_01-tab3.
REFRESH gt_status.
gs_status = 'SAVE'."隐藏按钮
APPEND gs_status TO gt_status.
CLEAR gs_status.
WHEN OTHERS.
*&SPWIZARD: DO NOTHING
ENDCASE.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module SET_SIGNAL INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE set_signal INPUT.
gv_sign_01 = 'X'.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0110 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0110 INPUT. ok_code = sy-ucomm. CASE ok_code.
WHEN 'SUBCK'.
IF subinput_one = input_one.
MESSAGE 'Data is right' TYPE 'I' DISPLAY LIKE 'S'.
g_tabstrip_01-pressed_tab = c_tabstrip_01-tab2.
REFRESH gt_status.
ELSE.
MESSAGE 'No match' TYPE 'I' DISPLAY LIKE 'E'.
RETURN.
ENDIF.
ENDCASE. ENDMODULE. *&SPWIZARD: INPUT MODULE FOR TC 'TC_CTRL'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: PROCESS USER COMMAND
MODULE tc_ctrl_user_command INPUT.
ok_code = sy-ucomm.
PERFORM user_ok_tc USING 'TC_CTRL'
'LT_TAB'
' '
CHANGING ok_code.
sy-ucomm = ok_code.
ENDMODULE. *&SPWIZARD: INPUT MODULE FOR TC 'TC_CTRL_TAB'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: MODIFY TABLE
MODULE tc_ctrl_tab_modify INPUT.
MODIFY gt_tab
FROM gs_tab
INDEX tc_ctrl_tab-current_line."只能修改不能新增
ENDMODULE. *&SPWIZARD: INPUT MODUL FOR TC 'TC_CTRL_TAB'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: MARK TABLE
MODULE tc_ctrl_tab_mark INPUT.
DATA: g_tc_ctrl_tab_wa2 LIKE LINE OF gt_tab.
IF tc_ctrl_tab-line_sel_mode =
AND gs_tab-cbox = 'X'.
LOOP AT gt_tab INTO g_tc_ctrl_tab_wa2
WHERE cbox = 'X'.
g_tc_ctrl_tab_wa2-cbox = ''.
MODIFY gt_tab
FROM g_tc_ctrl_tab_wa2
TRANSPORTING cbox.
ENDLOOP.
ENDIF.
MODIFY gt_tab
FROM gs_tab
INDEX tc_ctrl_tab-current_line
TRANSPORTING cbox."修改选中的行
ENDMODULE. *&SPWIZARD: INPUT MODULE FOR TC 'TC_CTRL_TAB'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: PROCESS USER COMMAND
MODULE tc_ctrl_tab_user_command INPUT.
ok_code = sy-ucomm.
PERFORM user_ok_tc USING 'TC_CTRL_TAB'
'GT_TAB'
'CBOX'
CHANGING ok_code.
sy-ucomm = ok_code.
ENDMODULE. *&SPWIZARD: INPUT MODULE FOR TC 'TC_CTRL_TAB_1'. DO NOT CHANGE THIS LINE
*&SPWIZARD: MODIFY TABLE
MODULE tc_ctrl_tab_1_modify INPUT.
MODIFY gt_tab_1
FROM gs_tab_1
INDEX tc_ctrl_tab_1-current_line.
ENDMODULE. *&SPWIZARD: INPUT MODUL FOR TC 'TC_CTRL_TAB_1'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: MARK TABLE
MODULE tc_ctrl_tab_1_mark INPUT.
DATA: g_tc_ctrl_tab_1_wa2 LIKE LINE OF gt_tab_1.
IF tc_ctrl_tab_1-line_sel_mode =
AND gs_tab_1-cbox = 'X'.
LOOP AT gt_tab_1 INTO g_tc_ctrl_tab_1_wa2
WHERE cbox = 'X'.
g_tc_ctrl_tab_1_wa2-cbox = ''.
MODIFY gt_tab_1
FROM g_tc_ctrl_tab_1_wa2
TRANSPORTING cbox.
ENDLOOP.
ENDIF.
MODIFY gt_tab_1
FROM gs_tab_1
INDEX tc_ctrl_tab_1-current_line
TRANSPORTING cbox.
ENDMODULE. *&SPWIZARD: INPUT MODULE FOR TC 'TC_CTRL_TAB_1'. DO NOT CHANGE THIS LINE
*&SPWIZARD: PROCESS USER COMMAND
MODULE tc_ctrl_tab_1_user_command INPUT.
ok_code = sy-ucomm.
PERFORM user_ok_tc USING 'TC_CTRL_TAB_1'
'GT_TAB_1'
'CBOX'
CHANGING ok_code.
sy-ucomm = ok_code.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0130 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0130 INPUT.
ok_code = sy-ucomm. CASE ok_code.
WHEN 'ID_BT'."modify table control lines
PERFORM frm_modify_lines.
WHEN OTHERS.
ENDCASE. CLEAR ok_code.
CLEAR sy-ucomm.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module GET_CURSOR INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE get_cursor INPUT.
GET CURSOR FIELD gv_field LINE gv_lines.
ENDMODULE.
*&---------------------------------------------------------------------*
*& 包含 ZDEMO_DIALOGF01
*&---------------------------------------------------------------------* *----------------------------------------------------------------------*
* INCLUDE TABLECONTROL_FORMS *
*----------------------------------------------------------------------* *&---------------------------------------------------------------------*
*& Form USER_OK_TC
*& 标准FORM 标准按钮 引导自动创建 *
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
FORM user_ok_tc USING p_tc_name TYPE dynfnam
p_table_name
p_mark_name
CHANGING p_ok LIKE sy-ucomm. *&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
DATA: l_ok TYPE sy-ucomm,
l_offset TYPE i.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------* *&SPWIZARD: Table control specific operations *
*&SPWIZARD: evaluate TC name and operations *
SEARCH p_ok FOR p_tc_name.
IF sy-subrc <> .
EXIT.
ENDIF.
l_offset = strlen( p_tc_name ) + .
l_ok = p_ok+l_offset.
*&SPWIZARD: execute general and TC specific operations *
CASE l_ok.
WHEN 'INSR'. "insert row
PERFORM fcode_insert_row USING p_tc_name
p_table_name.
CLEAR p_ok. WHEN 'DELE'. "delete row
PERFORM fcode_delete_row USING p_tc_name
p_table_name
p_mark_name.
CLEAR p_ok. WHEN 'P--' OR "top of list
'P-' OR "previous page
'P+' OR "next page
'P++'. "bottom of list
PERFORM compute_scrolling_in_tc USING p_tc_name
l_ok.
CLEAR p_ok.
* WHEN 'L--'. "total left
* PERFORM FCODE_TOTAL_LEFT USING P_TC_NAME.
*
* WHEN 'L-'. "column left
* PERFORM FCODE_COLUMN_LEFT USING P_TC_NAME.
*
* WHEN 'R+'. "column right
* PERFORM FCODE_COLUMN_RIGHT USING P_TC_NAME.
*
* WHEN 'R++'. "total right
* PERFORM FCODE_TOTAL_RIGHT USING P_TC_NAME.
*
WHEN 'MARK'. "mark all filled lines
PERFORM fcode_tc_mark_lines USING p_tc_name
p_table_name
p_mark_name .
CLEAR p_ok. WHEN 'DMRK'. "demark all filled lines
PERFORM fcode_tc_demark_lines USING p_tc_name
p_table_name
p_mark_name .
CLEAR p_ok. * WHEN 'SASCEND' OR
* 'SDESCEND'. "sort column
* PERFORM FCODE_SORT_TC USING P_TC_NAME
* l_ok. ENDCASE. ENDFORM. " USER_OK_TC *&---------------------------------------------------------------------*
*& Form FCODE_INSERT_ROW *
*&---------------------------------------------------------------------*
FORM fcode_insert_row
USING p_tc_name TYPE dynfnam
p_table_name . *&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
DATA l_lines_name LIKE feld-name.
DATA l_selline LIKE sy-stepl.
DATA l_lastline TYPE i.
DATA l_line TYPE i.
DATA l_table_name LIKE feld-name.
FIELD-SYMBOLS <tc> TYPE cxtab_control.
FIELD-SYMBOLS <table> TYPE STANDARD TABLE.
FIELD-SYMBOLS <lines> TYPE i.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------* ASSIGN (p_tc_name) TO <tc>. *&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE p_table_name '[]' INTO l_table_name. "table body
ASSIGN (l_table_name) TO <table>. "not headerline *&SPWIZARD: get looplines of TableControl *
CONCATENATE 'G_' p_tc_name '_LINES' INTO l_lines_name.
ASSIGN (l_lines_name) TO <lines>. *&SPWIZARD: get current line *
GET CURSOR LINE l_selline.
IF sy-subrc <> . " append line to table
l_selline = <tc>-lines + .
*&SPWIZARD: set top line *
IF l_selline > <lines>.
<tc>-top_line = l_selline - <lines> + .
ELSE.
<tc>-top_line = .
ENDIF.
ELSE. " insert line into table
l_selline = <tc>-top_line + l_selline - .
l_lastline = <tc>-top_line + <lines> - .
ENDIF.
*&SPWIZARD: set new cursor line *
l_line = l_selline - <tc>-top_line + . *&SPWIZARD: insert initial line *
INSERT INITIAL LINE INTO <table> INDEX l_selline.
<tc>-lines = <tc>-lines + .
*&SPWIZARD: set cursor *
SET CURSOR LINE l_line. ENDFORM. " FCODE_INSERT_ROW *&---------------------------------------------------------------------*
*& Form FCODE_DELETE_ROW *
*&---------------------------------------------------------------------*
FORM fcode_delete_row
USING p_tc_name TYPE dynfnam
p_table_name
p_mark_name . *&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
DATA l_table_name LIKE feld-name. FIELD-SYMBOLS <tc> TYPE cxtab_control.
FIELD-SYMBOLS <table> TYPE STANDARD TABLE.
FIELD-SYMBOLS <wa>.
FIELD-SYMBOLS <mark_field>.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------* ASSIGN (p_tc_name) TO <tc>. *&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE p_table_name '[]' INTO l_table_name. "table body
ASSIGN (l_table_name) TO <table>. "not headerline *&SPWIZARD: delete marked lines *
DESCRIBE TABLE <table> LINES <tc>-lines. LOOP AT <table> ASSIGNING <wa>. *&SPWIZARD: access to the component 'FLAG' of the table header *
ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>. IF <mark_field> = 'X'.
DELETE <table> INDEX syst-tabix.
IF sy-subrc = .
<tc>-lines = <tc>-lines - .
ENDIF.
ENDIF.
ENDLOOP. ENDFORM. " FCODE_DELETE_ROW *&---------------------------------------------------------------------*
*& Form COMPUTE_SCROLLING_IN_TC
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_TC_NAME name of tablecontrol
* -->P_OK ok code
*----------------------------------------------------------------------*
FORM compute_scrolling_in_tc USING p_tc_name
p_ok.
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
DATA l_tc_new_top_line TYPE i.
DATA l_tc_name LIKE feld-name.
DATA l_tc_lines_name LIKE feld-name.
DATA l_tc_field_name LIKE feld-name. FIELD-SYMBOLS <tc> TYPE cxtab_control.
FIELD-SYMBOLS <lines> TYPE i.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------* ASSIGN (p_tc_name) TO <tc>.
*&SPWIZARD: get looplines of TableControl *
CONCATENATE 'G_' p_tc_name '_LINES' INTO l_tc_lines_name.
ASSIGN (l_tc_lines_name) TO <lines>. *&SPWIZARD: is no line filled? *
IF <tc>-lines = .
*&SPWIZARD: yes, ... *
l_tc_new_top_line = .
ELSE.
*&SPWIZARD: no, ... *
CALL FUNCTION 'SCROLLING_IN_TABLE'
EXPORTING
entry_act = <tc>-top_line
entry_from =
entry_to = <tc>-lines
last_page_full = 'X'
loops = <lines>
ok_code = p_ok
overlapping = 'X'
IMPORTING
entry_new = l_tc_new_top_line
EXCEPTIONS
* NO_ENTRY_OR_PAGE_ACT = 01
* NO_ENTRY_TO = 02
* NO_OK_CODE_OR_PAGE_GO = 03
OTHERS = .
ENDIF. *&SPWIZARD: get actual tc and column *
GET CURSOR FIELD l_tc_field_name
AREA l_tc_name. IF syst-subrc = .
IF l_tc_name = p_tc_name.
*&SPWIZARD: et actual column *
SET CURSOR FIELD l_tc_field_name LINE .
ENDIF.
ENDIF. *&SPWIZARD: set the new top line *
<tc>-top_line = l_tc_new_top_line. ENDFORM. " COMPUTE_SCROLLING_IN_TC *&---------------------------------------------------------------------*
*& Form FCODE_TC_MARK_LINES
*&---------------------------------------------------------------------*
* marks all TableControl lines
*----------------------------------------------------------------------*
* -->P_TC_NAME name of tablecontrol
*----------------------------------------------------------------------*
FORM fcode_tc_mark_lines USING p_tc_name
p_table_name
p_mark_name.
*&SPWIZARD: EGIN OF LOCAL DATA-----------------------------------------*
DATA l_table_name LIKE feld-name. FIELD-SYMBOLS <tc> TYPE cxtab_control.
FIELD-SYMBOLS <table> TYPE STANDARD TABLE.
FIELD-SYMBOLS <wa>.
FIELD-SYMBOLS <mark_field>.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------* ASSIGN (p_tc_name) TO <tc>. *&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE p_table_name '[]' INTO l_table_name. "table body
ASSIGN (l_table_name) TO <table>. "not headerline *&SPWIZARD: mark all filled lines *
LOOP AT <table> ASSIGNING <wa>. *&SPWIZARD: access to the component 'FLAG' of the table header *
ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>. <mark_field> = 'X'.
ENDLOOP.
ENDFORM. "fcode_tc_mark_lines *&---------------------------------------------------------------------*
*& Form FCODE_TC_DEMARK_LINES
*&---------------------------------------------------------------------*
* demarks all TableControl lines
*----------------------------------------------------------------------*
* -->P_TC_NAME name of tablecontrol
*----------------------------------------------------------------------*
FORM fcode_tc_demark_lines USING p_tc_name
p_table_name
p_mark_name .
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
DATA l_table_name LIKE feld-name. FIELD-SYMBOLS <tc> TYPE cxtab_control.
FIELD-SYMBOLS <table> TYPE STANDARD TABLE.
FIELD-SYMBOLS <wa>.
FIELD-SYMBOLS <mark_field>.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------* ASSIGN (p_tc_name) TO <tc>. *&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE p_table_name '[]' INTO l_table_name. "table body
ASSIGN (l_table_name) TO <table>. "not headerline *&SPWIZARD: demark all filled lines *
LOOP AT <table> ASSIGNING <wa>. *&SPWIZARD: access to the component 'FLAG' of the table header *
ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>. <mark_field> = space.
ENDLOOP.
ENDFORM. "fcode_tc_mark_lines
*&---------------------------------------------------------------------*
*& Form FRM_MODIFY_LINES
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM frm_modify_lines .
DATA ls_cols LIKE LINE OF tc_ctrl_tab-cols. LOOP AT tc_ctrl_tab-cols INTO ls_cols.
IF ls_cols-index = ''.
IF ls_cols-screen-input = ''.
ls_cols-screen-input = ''.
ELSE.
ls_cols-screen-input = ''.
ENDIF.
MODIFY tc_ctrl_tab-cols FROM ls_cols.
ENDIF.
ENDLOOP .
ENDFORM.
*----------------------------------------------------------------------*
***INCLUDE ZDEMO_DIALOGHELP.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module F4_HELP_WAREHOUSE INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE f4_help_warehouse INPUT.
TYPES:BEGIN OF lty_lgort,
werks TYPE t001l-werks,
lgort TYPE t001l-lgort,
lgobe TYPE t001l-lgobe,
END OF lty_lgort. DATA:lt_lgort TYPE TABLE OF lty_lgort. IF t001w-werks IS NOT INITIAL.
SELECT werks lgort lgobe INTO TABLE lt_lgort FROM t001l WHERE werks = t001w-werks. CHECK sy-subrc EQ .
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
retfield = 'LGORT'
* PVALKEY = ' '
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'T001L-LGORT'
* STEPL = 0
window_title = 'WAREHOUSE SELECTION'
* VALUE = ' '
value_org = 'S'
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* CALLBACK_METHOD =
* MARK_TAB =
* IMPORTING
* USER_RESET =
TABLES
value_tab = lt_lgort
* FIELD_TAB =
* RETURN_TAB =
* DYNPFLD_MAPPING =
* EXCEPTIONS
* PARAMETER_ERROR = 1
* NO_VALUES_FOUND = 2
* OTHERS = 3
.
IF sy-subrc <> .
* Implement suitable error handling here
ENDIF. ELSE.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname = 'T001L'
fieldname = 'LGORT'
* SEARCHHELP = ' '
* SHLPPARAM = ' '
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'T001L-LGORT'
* STEPL = 0
* VALUE = ' '
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* SUPPRESS_RECORDLIST = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* CALLBACK_METHOD =
* SELECTION_SCREEN = ' '
* IMPORTING
* USER_RESET =
* TABLES
* RETURN_TAB =
* EXCEPTIONS
* FIELD_NOT_FOUND = 1
* NO_HELP_FOR_FIELD = 2
* INCONSISTENT_HELP = 3
* NO_VALUES_FOUND = 4
* OTHERS = 5
.
IF sy-subrc <> .
* Implement suitable error handling here
ENDIF. ENDIF.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module F4_HELP_MATERIAL INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE f4_help_material INPUT.
TYPES:BEGIN OF lty_matnr,
werks TYPE mard-werks,
lgort TYPE mard-lgort,
matnr TYPE mard-matnr,
maktx TYPE makt-maktx,
END OF lty_matnr. DATA:lt_matnr TYPE TABLE OF lty_matnr. IF t001w-werks IS NOT INITIAL
AND t001l-lgort IS NOT INITIAL.
SELECT a~werks a~lgort a~matnr b~maktx
INTO TABLE lt_matnr
FROM mard AS a
INNER JOIN makt AS b ON b~matnr = a~matnr AND b~spras = sy-langu
WHERE a~werks = t001w-werks
AND a~lgort = t001l-lgort. CHECK sy-subrc EQ .
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
retfield = 'MATNR'
* PVALKEY = ' '
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'MAKT-MATNR'
* STEPL = 0
window_title = 'MATERIAL SELECTION'
* VALUE = ' '
value_org = 'S'
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* CALLBACK_METHOD =
* MARK_TAB =
* IMPORTING
* USER_RESET =
TABLES
value_tab = lt_matnr
* FIELD_TAB =
* RETURN_TAB =
* DYNPFLD_MAPPING =
* EXCEPTIONS
* PARAMETER_ERROR = 1
* NO_VALUES_FOUND = 2
* OTHERS = 3
.
IF sy-subrc <> .
* Implement suitable error handling here
ENDIF. ELSE.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname = 'MAKT'
fieldname = 'MATNR'
* SEARCHHELP = ' '
* SHLPPARAM = ' '
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'MAKT-MATNR'
* STEPL = 0
* VALUE = ' '
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* SUPPRESS_RECORDLIST = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* CALLBACK_METHOD =
* SELECTION_SCREEN = ' '
* IMPORTING
* USER_RESET =
* TABLES
* RETURN_TAB =
* EXCEPTIONS
* FIELD_NOT_FOUND = 1
* NO_HELP_FOR_FIELD = 2
* INCONSISTENT_HELP = 3
* NO_VALUES_FOUND = 4
* OTHERS = 5
.
IF sy-subrc <> .
* Implement suitable error handling here
ENDIF. ENDIF.
ENDMODULE.
DEMO 得效果图如下,屏幕就自己画下哈, TABLE Control he tablstrip 都是用引导功能画得
2019.03.30 Dialog demo 一个标准使用的dialog程序的更多相关文章
- 2019.03.30 图解HTTP
文章来源<图解HTTP> 第一章 了解Web及网络基础 你有想过当你在浏览器(web browser)的地址栏上输入URL时,Web页面是如何实现的吗? 嗯,好像也没想过 web使用一种名 ...
- 2019.03.30 Head first
第一节 认识python python.exe -V python 会进入解释器 quit()命令会退出解释器 IDEL,一个python的集成开发环境,能够利用颜色突出语法的编辑器,一个调试工具,P ...
- [2019.03.25]Linux中的查找
TMUX天下第一 全世界所有用CLI Linux的人都应该用TMUX,我爱它! ======================== 以下是正文 ======================== Linu ...
- 2019.03.03 - Linux搭建go语言交叉环境
编译GO 1.6版本以上的需要依赖GO 1.4版本的二进制,并且需要把GOROOT_BOOTSTRAP的路径设置为1.4版本GO的根目录,这样它的bin目录就可以直接使用到1.4版本的GO 搭建go语 ...
- 一个标准的,兼容性很好的div仿框架的基础模型!
<!DOCTYPE html> <html > <head> <meta http-equiv="Content-Type" conten ...
- NPOI-Excel系列-1000.创建一个标准的Excel文件
using NPOI.HSSF.UserModel; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.IO; name ...
- JS~Boxy和JS模版实现一个标准的消息提示框
面向对象的封装 面向对象一个入最重要的特性就是“封装”,将一些没有必要公开的方法和属性以特定的方式进行组装,使它对外只公开一个接口,外界在调用它时,不需要关注它实现的细节,而只要关注它的方法签名即可, ...
- 【转】C# 串口操作系列(1) -- 入门篇,一个标准的,简陋的串口例子。
C# 串口操作系列(1) -- 入门篇,一个标准的,简陋的串口例子. 标签: c#objectnewlineexceptionbytestring 2010-05-17 01:10 117109人阅读 ...
- 如何创建一个标准的Windows服务
出处:http://www.cnblogs.com/wuhuacong/archive/2009/02/11/1381428.html 如何创建一个标准的Windows服务 在很多时候,我们需要一个定 ...
随机推荐
- javascript模板字符串(反引号)
模板字面量 是允许嵌入表达式的字符串字面量. 你可以使用多行字符串和字符串插值功能.它们在ES2015规范的先前版本中被称为“模板字符串”. 语法 `string text``string text ...
- 紫书 例题 10-11 UVa 11181(概率计算)
这道题不能凭感觉做了.要套公式 r个人买了东西叫事件E, 第i个人买东西的概率叫做事件Ei 求得是P(E|Ei), 则P(E|Ei)= P(E|Ei)/ P(E) 那么P(E)可以枚举求得, 用递归求 ...
- windows调试之命令行窗口问题
CProProcess::InitProProcess(_T("safeProcessDemo")); cout << "Enter 'q' to exit: ...
- 如何获取到app的包名
相信很多朋友在刚开始接触测试app的时候都不清楚app的包名是什么,接下来给大家介绍几种方法去获取. 一.手机设备已连接到电脑,点击进入app中,前提是电脑上装备了android-SDK,tools文 ...
- window下,nodejs安装http-server,并开启HTTP服务器
1.下载nodejs 官方下载地址:https://nodejs.org/en/ 2.在cmd命令中,输入node -v 输入出版本号,代表安装成功. 3.输入 npm install http-s ...
- npoi 导入
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CusImport.aspx ...
- CSS 分类 (Classification)
★★CSS 分类属性 (Classification)★★ ⑴CSS 分类属性允许你控制如何显示元素,设置图像显示于另一元素中的何处,相对于其正常位置来定位元素,使用绝对值来定位元素,以及元素的可见度 ...
- TTTTTTTTTTTTTTTTTTT CF 银行转账 图论 智商题
C. Money Transfers time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- 3.决策树ID3算法原理
1.决策树的作用 主要用于解决分类问题的一种算法 2.建立决策树的3中常用算法 1).ID3--->信息增益 2).c4.5--> 信息增益率 4).CART Gini系数 3.提出问题: ...
- unittest详解(四) 批量执行用例(discover)
前面我们说了,对于不同文件用例,我们可以通过addTest()把用例加载到一个测试套件(TestSuite)来统一执行,对于少量的文件这样做没问题,但是如果有几十上百个用例文件,这样做就太浪费时间了. ...