近期开发程序,要点归纳
此文档编辑不按照开发时间排序,按照查询出来的结果排序
程序
1、ZFC_FIJSD_CONFIRM 结算确认单 审核
a 设置程序名
SET TITLEBAR '1000' WITH '结算确认单复审'.
b 取当前用户的有权限操作的门店
DATA: gt_jsmd TYPE TABLE OF zsrt_ghcl WITH HEADER LINE.
CALL FUNCTION 'Z_GET_USER_JSMD'
EXPORTING
usnam = sy-uname
TABLES
jsmd = gt_jsmd[].
c 设置按钮是否显示
DATA: gl_fcode TYPE TABLE OF sy-ucomm.
APPEND '&PRINT' TO gl_fcode .
SET PF-STATUS 'LIST_TOTAL' EXCLUDING gl_fcode.
d 针对抬头的显示设置屏幕接口内容
wenben-text = '审核'.
wenben-icon_id = icon_release.
wenben-icon_text = '审核'.
wenben-quickinfo = '审核'.
APPEND wenben.
e 刷新alv
FORM frm_refresh_alv .
DATA: alv_grid TYPE REF TO cl_gui_alv_grid.
DATA: stbl TYPE lvc_s_stbl.
stbl-row = 'X'.
stbl-col = 'X'.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = alv_grid.
CALL METHOD alv_grid->check_changed_data.
CALL METHOD alv_grid->refresh_table_display
EXPORTING
is_stable = stbl.
ENDFORM.
" FRM_REFRESH_ALV
f 消息报错
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
2 维护产品层次 ZFC_MM002_A
3、ZFC_MM002_D1
a 程序处理过程中的提示
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
TEXT = '数据处理中,请等待.... '.
b excel上传
FORM FRM_GET_FILENAME USING P_P_FILE.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
DEFAULT_FILENAME = P_FILE
CHANGING
RC = RC
FILE_TABLE = FILETAB[]
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
OTHERS = 5.
READ TABLE FILETAB INDEX 1.
IF SY-SUBRC EQ 0.
P_FILE = FILETAB-FILENAME.
MESSAGE S004(ZFC_MM002_00).
ENDIF.
IF SY-SUBRC <> 0.
MESSAGE E003(ZFC_MM002_00).
ENDIF.
ENDFORM. " FRM_GET_FILENAME
FORM FRM_GET_UPLOAD_DATA .
G_FILE = P_FILE. "注意两个文件用于不同的函数,所以类型不同
DATA: IT_A LIKE TABLE OF ITAB WITH HEADER LINE.
DATA: IT_C LIKE TABLE OF ITAB WITH HEADER LINE.
FIELD-SYMBOLS:<F>.
FIELD-SYMBOLS:<WA>.
* 读取EXCEL内容到指定的内表中
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = G_FILE
I_BEGIN_COL = 1
I_BEGIN_ROW = 1
I_END_COL = 255
I_END_ROW = 65536
TABLES
INTERN = ITAB[].
FIELD-SYMBOLS: <FS>.
DELETE ITAB WHERE ROW = 1. "删除字段名行
LOOP AT ITAB.
ON CHANGE OF ITAB-ROW.
IF SY-TABIX NE 1.
APPEND GT_DETAIL.
CLEAR GT_DETAIL.
ENDIF.
ENDON.
ASSIGN COMPONENT ITAB-COL OF STRUCTURE GT_DETAIL TO <FS>. " 动态方法将值传到相应的内表
<FS> = ITAB-VALUE.
ENDLOOP.
C 取固定值描述
DATA: txt_zhelfmt LIKE txt_attyp OCCURS 0 WITH HEADER LINE.
DATA: lt_zhelfmt LIKE TABLE OF txt_attyp WITH HEADER LINE."
DATA: hs_zhelfmt LIKE HASHED TABLE OF txt_attyp WITH UNIQUE KEY domvalue_l WITH HEADER LINE.
SELECT VALPOS DDTEXT DOMVALUE_L INTO CORRESPONDING FIELDS OF TABLE LT_ZHELFMT
FROM DD07T
FOR ALL ENTRIES IN TXT_ZHELFMT
WHERE DOMVALUE_L = TXT_ZHELFMT-DOMVALUE_L AND
AS4LOCAL = 'A' AND DDLANGUAGE = '1' AND DOMNAME = 'ZD_ZHELFM' .".DOMVALUE_L = ZSAT001W-YFJSF .
SORT LT_ZHELFMT BY DOMVALUE_L.
HS_ZHELFMT[] = LT_ZHELFMT[].
d 查看内表条目数
L_LINE = LINES( GT_LINE[] ).
E 更改物料数据bapi CMOD ZMAT01 增强接口
CALL FUNCTION 'BAPI_MATERIAL_MAINTAINDATA_RT'
EXPORTING
HEADDATA = LS_HEADER
IMPORTING
RETURN = RETURN
TABLES
CLIENTDATA = CLIENTDATA
CLIENTDATAX = CLIENTDATAX
CLIENTEXT = CLIENTEXT
CLIENTEXTX = CLIENTEXTX.
F 确认询问
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = '是否保存退出'
TEXT_QUESTION = '你还有没有保存的数据,确定退出不保存?'
TEXT_BUTTON_1 = '是'
TEXT_BUTTON_2 = '否'
DEFAULT_BUTTON = '1'
DISPLAY_CANCEL_BUTTON = 'X'
IMPORTING
ANSWER = L_ANSWER
EXCEPTIONS
TEXT_NOT_FOUND = 1
OTHERS = 2.
IF L_ANSWER = '1'.
SET SCREEN 0.
ENDIF.
4 、ZFC_MM004 辅料基准价创建
A 、 选择屏字段不可编辑
INITIALIZATION.
LOOP AT SCREEN.
IF screen-name = 'P_KSCHL' .
screen-input = '0'. "灰掉,只输出
ENDIF.
MODIFY SCREEN.
ENDLOOP.
B、 设置下拉框
SELECT bsart batxt FROM t161t INTO CORRESPONDING FIELDS OF list_t161t
WHERE spras = sy-langu AND bstyp = 'F'.
value-key = list_t161t-bsart.
value-text = list_t161t-batxt.
APPEND value TO list.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE 'NOT FOUND BSART' TYPE 'I' DISPLAY LIKE 'E'.
LEAVE TO SCREEN 100.
ENDIF.
SORT list BY key.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'FIELD01'
values = list.
C 获取 文本信息
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'F01'
language = '1'
name = cebeln2
object = 'EKPO'
TABLES
lines = it_tline[]
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
D 获取长文本输入框的内容
* 获取长文本输入框的内容
CALL METHOD editor->get_text_as_r3table
* EXPORTING
* ONLY_WHEN_MODIFIED = FALSE
IMPORTING
table = lt_table
is_modified = l_modi
EXCEPTIONS
error_dp = 1
error_cntl_call_method = 2
error_dp_create = 3
OTHERS = 4
.
* IF sy-subrc <> 0.
* * MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* * WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* ELSEIF l_modi = 1.
LOOP AT lt_table INTO lt_tlines-tdline.
* CHECK lt_tlines-tdline <> ''."删掉空行
APPEND lt_tlines.
ENDLOOP.
E 创建文本信息
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
fid = 'B01'
flanguage = '1'
fname = l_banfn
fobject = 'EBAN'
* SAVE_DIRECT = 'X'
* FFORMAT = '*'
TABLES
flines = lt_tlines
EXCEPTIONS
no_init = 1
no_save = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
F 获取流水号
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01'
object = 'ZCONR'
* QUANTITY = '1'
* SUBOBJECT = ' '
* TOYEAR = '0000'
* IGNORE_BUFFER = ' '
IMPORTING
number = lv_knumh
* QUANTITY =
* RETURNCODE =
EXCEPTIONS
interval_not_found = 1
number_range_not_intern = 2
object_not_found = 3
quantity_is_0 = 4
quantity_is_not_1 = 5
interval_overflow = 6
buffer_overflow = 7
OTHERS = 8.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
`5 ZFC_MM006_A 供应商合同付款管理功能
a 使用 oo alv 如何隐藏标准按钮
LOOP AT pt_result INTO ls_result.
IF ls_result-shbz = 'X'.
CLEAR ls_stylerow.
ls_stylerow-fieldname = 'DJRQ'.
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
* APPEND ls_stylerow TO ls_result-cellstyles .
APPEND ls_stylerow TO lt_styletab .
CLEAR ls_stylerow.
ls_stylerow-fieldname = 'JE'.
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
* APPEND ls_stylerow TO ls_result-cellstyles .
APPEND ls_stylerow TO lt_styletab .
CLEAR ls_stylerow.
ls_stylerow-fieldname = 'YWLX'.
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
* APPEND ls_stylerow TO ls_result-cellstyles .
APPEND ls_stylerow TO lt_styletab .
ENDIF.
ls_result-cellstyles[] = lt_styletab[].
REFRESH lt_styletab[].
* INSERT lines of lt_styletab INTO ls_result-cellstyles .
MODIFY pt_result FROM ls_result .
ENDLOOP.
6 ZRP_MM032 新品检验量查询报表
A RANGES: ra_lfart FOR likp-lfart.
LOOP AT lt_lfart.
CLEAR ra_lfart .
ra_lfart-sign = 'I' .
ra_lfart-option = 'EQ' .
ra_lfart-low = lt_lfart-lfart.
APPEND ra_lfart .
ENDLOOP.
7 ZFS_MM043 商品串规格调整
CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY' "检查商品可用量
EXPORTING
PLANT = P_WERKS
MATERIAL = IT_DATA-MATNR_O
UNIT = LT_MEINS
BATCH = IT_DATA-CHARG_O
CHECK_RULE = 'B'
STGE_LOC = P_LGORT
TABLES
WMDVSX = WMDVSX
WMDVEX = WMDVEX
.
READ TABLE WMDVEX INDEX 1 .
IF sy-subrc = 0.
IF WMDVEX-COM_QTY < IT_DATA-MENGE .
IT = IT_DATA-MENGE - WMDVEX-COM_QTY.
MESSAGE E043(ZTMESSAGE) WITH IT.
ENDIF.
ELSE.
READ TABLE LT_TEMP INDEX 1.
IF LT_TEMP-LABST < IT_DATA-MENGE.
IT = IT_DATA-MENGE - LT_TEMP-LABST.
MESSAGE E043(ZTMESSAGE) WITH IT.
ENDIF.
ENDIF.
ENDIF.
posted on 2014-09-27 09:32 TorranceZhao 阅读(454) 评论(0) 编辑 收藏 举报