sap abap屏幕编程中使用的table 和call子程序的

简介: 今天下午顾问在和用户谈需求呢,趁这个时间写了个屏幕中使用table 和如何call 子程序的例子,放在这里,有人看也好,没有人看也罢,权当自己练连手.*&------------------------------------------------------...
今天下午顾问在和用户谈需求呢,趁这个时间写了个屏幕中使用table 和如何call 子程序的例子,放在这里,有人看也好,没有人看也罢,权当自己练连手.

*&---------------------------------------------------------------------*
*& Module pool ZCHOUER1 *
*& this program is test for chouer
*&---------------------------------------------------------------------*
PROGRAM ZCHOUER1.

**---tables
TABLES ZEKKP.

**---workaera
DATA BEGIN OF WA_ZEKKP.
INCLUDE STRUCTURE ZEKKP.
DATA END OF WA_ZEKKP.
DATA WA_ZEKK LIKE WA_ZEKKP.

**---Initial table
DATA IT_ZEKKP LIKE TABLE OF WA_ZEKKP.

**---data define
DATA OK_CODE LIKE SY-UCOMM.

**---tables controls
CONTROLS MY_TABLE_CONTROL TYPE TABLEVIEW USING SCREEN '0201'.
DATA WA_COLS LIKE LINE OF MY_TABLE_CONTROL-COLS.

**---start-of-selection
START-OF-SELECTION.
CALL SCREEN 100.

*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
SET TITLEBAR 'TITLE_0100'.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
CASE OK_CODE.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BOOK'.
PERFORM GET_DATA.
SORT IT_ZEKKP BY EBELN.
DESCRIBE TABLE IT_ZEKKP LINES MY_TABLE_CONTROL-LINES.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Module CLEAR_OK_CODE OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE CLEAR_OK_CODE OUTPUT.
CLEAR OK_CODE.
ENDMODULE. " CLEAR_OK_CODE OUTPUT
*&---------------------------------------------------------------------*
*& Module STATUS_0200 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_0200 OUTPUT.
SET PF-STATUS 'STATUS_0200'.
SET TITLEBAR 'TITLE_0200'.

ENDMODULE. " STATUS_0200 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0200 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0200 INPUT.
CASE OK_CODE.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
WHEN 'BACK'.
SET SCREEN 100.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'SRTD'.
READ TABLE MY_TABLE_CONTROL-COLS WITH KEY SELECTED = 'X' INTO
WA_COLS.
IF SY-SUBRC = 0.
SORT IT_ZEKKP BY (WA_COLS-SCREEN-NAME+6) DESCENDING.
ENDIF.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT

*&---------------------------------------------------------------------*
*& Form get_Data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* *----------------------------------------------------------------------*
FORM GET_DATA .
SELECT * FROM EKKO
INTO CORRESPONDING FIELDS OF TABLE IT_ZEKKP
WHERE BUKRS = WA_ZEKKP-BUKRS.
ENDFORM. " get_Data
*&---------------------------------------------------------------------*
*& Module trans_to_0200 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE TRANS_TO_0200 OUTPUT.
MOVE-CORRESPONDING WA_ZEKKP TO ZEKKP.
ENDMODULE. " trans_to_0200 OUTPUT
*&---------------------------------------------------------------------*
*& Module trans_from_tc_fields INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE TRANS_FROM_TC_FIELDS INPUT.
MOVE ZEKKP-MARK TO WA_ZEKKP-MARK.
MODIFY IT_ZEKKP INDEX MY_TABLE_CONTROL-CURRENT_LINE FROM WA_ZEKKP.
ENDMODULE. " trans_from_tc_fields INPUT
*&---------------------------------------------------------------------*
*& Module trans_to_tc_fields OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE TRANS_TO_TC_FIELDS OUTPUT.
MOVE-CORRESPONDING WA_ZEKKP TO ZEKKP.
ENDMODULE. " trans_to_tc_fields OUTPUT
*&---------------------------------------------------------------------*
*& Module check_zekkp INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE CHECK_ZEKKP INPUT.
SELECT SINGLE * FROM EKKO
INTO CORRESPONDING FIELDS OF WA_ZEKKP
WHERE EBELN = ZEKKP-EBELN
AND BUKRS = ZEKKP-BUKRS.
ENDMODULE. " check_zekkp INPUT

目录
相关文章
|
SQL
SAP ABAP-OPENSQL-数值函数简介
S4中针对OPENSQL新提供一些函数
139 0
|
SQL
SAP ABAP-OPENSQL-字符串函数介绍
S4中SQL新语法字符串函数
204 0
|
SQL
SAP ABAP-OPENSQL-日期/时间戳函数
S4提供针对OPENSQL一些新的SQL函数调用,本文展示相关函数的使用
636 0
SAP ABAP-删除工序示例代码
ABAP-删除工序示例代码
169 0
SAP MM/FI_运费处理方式
常见的采购运费处理方式
SAP MM 途损处理方式
通常客户采购业务需求提到货物运输有损耗,需要针对此业务给出合理方案输出,下面笔者针对此类业务分析下各种实现方案的可行性!
SAP MM初阶之事务代码MIGO界面批次拆分最多输入15行?
SAP MM初阶之事务代码MIGO界面批次拆分最多输入15行?
SAP MM初阶之事务代码MIGO界面批次拆分最多输入15行?
SAP MM不常用移动类型之325
SAP MM不常用移动类型之325
SAP MM不常用移动类型之325
SAP MM初阶之采购信息记录里的Prior Supplier栏位
SAP MM初阶之采购信息记录里的Prior Supplier栏位
SAP MM初阶之采购信息记录里的Prior Supplier栏位