MI04 盘点单数据录入
*&---------------------------------------------------------------------*
*& Report ZRHSSD002
*&
*&---------------------------------------------------------------------*
*&create by ly 20170123
*&for Inventory count input MI04
*&
*& DEVK940966 2017.01.23 16:59:32 LIYUAN
*&---------------------------------------------------------------------* REPORT ZRHSSD002 MESSAGE-ID ZCRM. "INVENTROY HEAD DATA TABLE
TABLES:IKPF. TYPE-POOLS:SLIS. TYPES:BEGIN OF TY_ITAB,
SEL(),
ICON(),
MESSAGE(),
MATNR TYPE ISEG-MATNR,
CHARG TYPE ISEG-CHARG,
ERFMG TYPE ISEG-ERFMG,
ERFME TYPE ISEG-ERFME,
END OF TY_ITAB. "Inventory item data itab
DATA:GT_ITEM TYPE TABLE OF BAPI_PHYSINV_ITEM,
GW_ITEM LIKE LINE OF GT_ITEM,
GW_HEAD TYPE BAPI_PHYSINV_HEAD,
GT_RETURN TYPE TABLE OF BAPIRET2,
GW_RETURN LIKE LINE OF GT_RETURN,
GT_ITEM_INPUT TYPE TABLE OF BAPI_PHYSINV_COUNT_ITEMS,
GW_ITEM_INPUT LIKE LINE OF GT_ITEM_INPUT.
DATA:GT_EXCEL_T TYPE ALSMEX_TABLINE OCCURS WITH HEADER LINE,
GS_EXCEL_T LIKE LINE OF GT_EXCEL_T.
DATA:GT_FIELDCAT TYPE LVC_T_FCAT.
DATA GS_FIELDCAT LIKE LINE OF GT_FIELDCAT.
DATA LS_LAYOUT TYPE LVC_S_LAYO.
DATA:GT_ITAB TYPE TABLE OF TY_ITAB,
GW_ITAB LIKE LINE OF GT_ITAB.
DATA:LV_S TYPE STRING,
LV_N TYPE STRING VALUE '0123456789.-'.
DATA:GV_FM TYPE C."GL VALUE FOR DIFF FM. DEFINE APPEND_FIELDCAT .
CLEAR GS_FIELDCAT.
GS_FIELDCAT-FIELDNAME = &.
GS_FIELDCAT-SCRTEXT_L = &.
GS_FIELDCAT-OUTPUTLEN = &.
GS_FIELDCAT-NO_ZERO = &.
APPEND GS_FIELDCAT TO GT_FIELDCAT.
END-OF-DEFINITION. SELECTION-SCREEN BEGIN OF BLOCK BLK01 WITH FRAME TITLE TEXT-.
PARAMETERS:P_IBLNR TYPE IKPF-IBLNR OBLIGATORY MEMORY ID IBN,
P_GJAHR TYPE IKPF-GJAHR OBLIGATORY DEFAULT SY-DATUM+(),
P_DATE TYPE IIKPF-ZLDAT OBLIGATORY DEFAULT SY-DATUM,
P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN END OF BLOCK BLK01. AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
PERFORM FRM_GET_FILEPATH. START-OF-SELECTION.
CLEAR:GV_FM.
PERFORM PRM_DATA_CHECK.
PERFORM PRM_UPLOAD.
PERFORM PRM_SET_FIELD.
PERFORM PRM_SHOW. *&---------------------------------------------------------------------*
*& Form FRM_GET_FILEPATH
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FRM_GET_FILEPATH .
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
MASK = ',Excel(*.xls),*.XLS,*.XLSX,'
TITLE = text-
IMPORTING
FILENAME = P_FILE
EXCEPTIONS
INV_WINSYS =
NO_BATCH =
SELECTION_CANCEL =
SELECTION_ERROR =
OTHERS = .
IF SY-SUBRC <> .
MESSAGE S000 DISPLAY LIKE 'E'."(ZCRM) TYPE 'S' DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. "FRM_GET_FILEPATH
*&---------------------------------------------------------------------*
*& Form PRM_DATA_CHECK
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM PRM_DATA_CHECK . CALL FUNCTION 'BAPI_MATPHYSINV_GETDETAIL'
EXPORTING
PHYSINVENTORY = P_IBLNR
FISCALYEAR = P_GJAHR
IMPORTING
HEAD = GW_HEAD
TABLES
ITEMS = GT_ITEM
RETURN = GT_RETURN. READ TABLE GT_RETURN INTO GW_RETURN WITH KEY TYPE = 'E'.
IF SY-SUBRC = .
MESSAGE GW_RETURN-MESSAGE TYPE 'S' DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
ENDIF. IF GW_HEAD-DELETE_STATUS = 'X'.
MESSAGE S001 DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
ENDIF. IF GW_HEAD-FREEZEBOOKINV = 'X'.
MESSAGE S002 DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
ENDIF. SORT GT_ITEM[] BY MATERIAL. ENDFORM. "PRM_DATA_CHECK
*&---------------------------------------------------------------------*
*& Form PRM_UPLOAD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM PRM_UPLOAD .
IF P_FILE IS NOT INITIAL.
*将excel数据传入内表
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FILE
I_BEGIN_COL = ''
I_BEGIN_ROW = ''
I_END_COL = ''
I_END_ROW = ''
TABLES
INTERN = GT_EXCEL_T.
ENDIF.
IF GT_EXCEL_T[] IS INITIAL.
MESSAGE S003 DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
ENDIF. LOOP AT GT_EXCEL_T INTO GS_EXCEL_T.
AT NEW ROW.
CLEAR:GW_ITAB.
ENDAT. CASE GS_EXCEL_T-COL.
WHEN ."MATNR
GW_ITAB-MATNR = GS_EXCEL_T-VALUE.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = GW_ITAB-MATNR
IMPORTING
OUTPUT = GW_ITAB-MATNR. READ TABLE GT_ITEM INTO GW_ITEM WITH KEY MATERIAL = GW_ITAB-MATNR BINARY SEARCH.
IF SY-SUBRC = .
IF GW_ITEM-QUANTITY <> .
GV_FM = ''."CHANGE MODE
* GW_ITAB-MESSAGE = text-008.
* GW_ITAB-ICON = '@0A@'.
ENDIF.
ELSE.
GW_ITAB-MESSAGE = text-.
GW_ITAB-ICON = '@0A@'.
ENDIF.
WHEN ."ERFMG
CLEAR:LV_S.
LV_S = GS_EXCEL_T-VALUE.
IF LV_S CO LV_N.
GW_ITAB-ERFMG = GS_EXCEL_T-VALUE.
ELSE.
GW_ITAB-MESSAGE = text-.
GW_ITAB-ICON = '@0A@'.
ENDIF.
WHEN ."CHARG
GW_ITAB-CHARG = GS_EXCEL_T-VALUE.
WHEN OTHERS.
ENDCASE. AT END OF ROW.
APPEND GW_ITAB TO GT_ITAB.
ENDAT.
ENDLOOP.
ENDFORM. "PRM_UPLOAD
*&---------------------------------------------------------------------*
*& Form PRM_SET_FIELD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM PRM_SET_FIELD .
REFRESH GT_FIELDCAT.
LS_LAYOUT-CWIDTH_OPT = 'X'. "优化列宽选项是否设置
LS_LAYOUT-ZEBRA = 'X'.
LS_LAYOUT-BOX_FNAME = 'SEL'.
APPEND_FIELDCAT:'ICON' TEXT- '',
'MESSAGE' TEXT- '',
'MATNR' TEXT- 'X',
'ERFMG' TEXT- 'X'.
* 'CHARG' TEXT-006 17 'X'.
ENDFORM. "PRM_SET_FIELD
*&---------------------------------------------------------------------*
*& Form PRM_SHOW
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM PRM_SHOW .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT_LVC = LS_LAYOUT
IT_FIELDCAT_LVC = GT_FIELDCAT[]
I_CALLBACK_PF_STATUS_SET = 'PRM_SET_STATUS'
I_CALLBACK_USER_COMMAND = 'PRM_USER_COMMAND'
* i_grid_title = lv_title
I_DEFAULT = 'X'
I_SAVE = 'A'
TABLES
T_OUTTAB = GT_ITAB
EXCEPTIONS
PROGRAM_ERROR =
OTHERS = .
IF SY-SUBRC <> .
ENDIF.
ENDFORM. "PRM_SHOW
*&---------------------------------------------------------------------*
*& Form PRM_SET_STATUS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->RT_EXTAB text
*----------------------------------------------------------------------*
FORM PRM_SET_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB..
SET PF-STATUS 'ZSTAT'.
ENDFORM. "PRM_SET_STATUS
*&---------------------------------------------------------------------*
*& Form PRM_USER_COMMAND
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_UCOMM text
* -->P_SELFIELD text
*----------------------------------------------------------------------*
FORM PRM_USER_COMMAND USING P_UCOMM LIKE SY-UCOMM
P_SELFIELD TYPE SLIS_SELFIELD.
DATA:LR_GRID TYPE REF TO CL_GUI_ALV_GRID.
CHECK P_UCOMM EQ 'EXCU'. CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = LR_GRID. CLEAR:GT_ITEM_INPUT[],GW_ITEM_INPUT,GT_RETURN[],GW_RETURN. LOOP AT GT_ITAB INTO GW_ITAB WHERE SEL = 'X' AND ICON = ''.
READ TABLE GT_ITEM INTO GW_ITEM WITH KEY MATERIAL = GW_ITAB-MATNR BINARY SEARCH.
IF SY-SUBRC = .
GW_ITEM_INPUT-ITEM = GW_ITEM-ITEM.
GW_ITEM_INPUT-MATERIAL = GW_ITEM-MATERIAL.
GW_ITEM_INPUT-BATCH = GW_ITEM-BATCH.
GW_ITEM_INPUT-ENTRY_QNT = GW_ITAB-ERFMG.
IF GW_ITEM_INPUT-ENTRY_QNT = .
GW_ITEM_INPUT-ZERO_COUNT = 'X'.
ENDIF.
GW_ITEM_INPUT-ENTRY_UOM = GW_ITEM-ENTRY_UOM.
APPEND GW_ITEM_INPUT TO GT_ITEM_INPUT.
CLEAR:GW_ITEM_INPUT.
ENDIF.
ENDLOOP. IF GT_ITEM_INPUT[] IS INITIAL.
MESSAGE text- TYPE 'S' DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
ELSE.
IF GV_FM IS INITIAL.
CALL FUNCTION 'BAPI_MATPHYSINV_COUNT'
EXPORTING
PHYSINVENTORY = P_IBLNR
FISCALYEAR = P_GJAHR
COUNT_DATE = P_DATE
TABLES
ITEMS = GT_ITEM_INPUT
RETURN = GT_RETURN.
ELSE.
CALL FUNCTION 'BAPI_MATPHYSINV_CHANGECOUNT'
EXPORTING
PHYSINVENTORY = P_IBLNR
FISCALYEAR = P_GJAHR
TABLES
ITEMS = GT_ITEM_INPUT
RETURN = GT_RETURN.
ENDIF. READ TABLE GT_RETURN INTO GW_RETURN WITH KEY TYPE = 'E'.
IF SY-SUBRC <> .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'. LOOP AT GT_ITAB INTO GW_ITAB WHERE SEL = 'X' AND ICON = ''.
GW_ITAB-ICON = '@08@'.
GW_ITAB-MESSAGE = text-.
MODIFY GT_ITAB FROM GW_ITAB.
ENDLOOP.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
READ TABLE GT_RETURN INTO GW_RETURN WITH KEY TYPE = 'E'.
IF SY-SUBRC = .
* MESSAGE GW_RETURN-MESSAGE TYPE 'S' DISPLAY LIKE 'E'.
LOOP AT GT_ITAB INTO GW_ITAB WHERE SEL = 'X' AND ICON = ''.
GW_ITAB-ICON = '@0A@'.
GW_ITAB-MESSAGE = GW_RETURN-MESSAGE.
MODIFY GT_ITAB FROM GW_ITAB.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF. CALL METHOD LR_GRID->REFRESH_TABLE_DISPLAY.
ENDFORM. "PRM_USER_COMMAND
MI04 盘点单数据录入的更多相关文章
- 汉码盘点机PDA无缝对接思迅思迅盘点机思迅条码数据采集器批号商品盘点的方法
1.1. 盘点批号 如果某些商品进行了批号管理,我们不仅仅要清点什么商品总数有多少个,我们还要区分该商品的某个批号有多少个数量,因此以前批号盘点工作量是非常大的. 我们的盘点机PDA支持批号盘点 ...
- haohantechsoft-PDA软件,PDA管理软件,PDA管理系统,仓库PDA销售开单盘点软件
为了更好服务于广大服装客户群体进行销售.盘点.调拨配送等.推出基于无线网络版移动PDA销售开单盘点软件系统.该系统支持无线3G.WIFI.GPRS系统,用户可以手持PDA在无线网络连接状态下进行销售. ...
- OCEANIAERP对接-code盘点机并存储实时库存计划和方案的使用,实时库存,云清查方案
1. PDA手持设备按键说明 [Tab]键:使输入焦点在控件上切换. [ESC]键:弹出是否退出确认对话框,退出操作界面或程序. [OK]键:确认输入或选择,进入下一步操作. [C]键:删除键 ...
- 金蝶盘点机PDA条码数据采集器WMS系统具体有哪些功能
1. 使用汉码盘点机PDA实现仓库条码管理的好处 (1) 传统电脑管理软件出入库需要来回电脑跑人工手工电脑录单效率低,通过人眼识别商品品种和清点商品数量,容易造成录单错误.从而造成电脑管理软件库存 ...
- 金蝶盘点机PDA仓库条码管理:仓库如何盘点
1.1. 仓库盘点 传统的仓库盘点,需要人工手工抄写盘点单,时候再去电脑上一行行的录入盘点单,操作非常耗时费力,往往需要盘点好几天,最终盘点效果还不好,在抄写过程中容易出现错误,从而造成盘点结果不准确 ...
- 【MM系列】SAP MM模块-库存盘点BAPI的使用及注意点
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[MM系列]SAP MM模块-库存盘点BAPI的 ...
- 【系统设计】WMS系统中 库存、盘点、移库、拆库功能的设计(库内管理)
最近负责WMS系统 盘点 移库 两个功能模块的功能及数据库设计. 物流仓储系统的搭建,要基于仓库的实际情况,整理内部员工需求,再参考其他WMS系统,经过长时间的讨论和研究,最终转化为产品需求. 这里先 ...
- 金蝶K3表
系统ID 表ID 表名 表中文名 表说明 FType FSefDefSign0 0 t_VoucherGroup 凭证字表 ...
- 大家都在用PDA条码扫描枪管理企业仓库 PDA无线数据采集程序
PDA数据采集器又称之为手持终端,这些都是用于扫描货物条码统计数据用的,PDA扫描枪有效提高企业仓库管理,在仓库管理中引入条码技术,对仓库的到货检验.入库.出库.调拨.移库移位.库存盘点等各个作业环节 ...
随机推荐
- 软件开发架构、网络基础知识、osi七层模型
一.软件开发的架构 涉及到两个程序之间通讯的应用大致可以分为两种: 第一种是应用类:qq.微信.网盘.优酷这一类是属于需要安装的桌面应用 第二种是web类:比如百度.知乎.博客园等使用浏览器访问就可以 ...
- 3、Python函数详解(0601)
回顾: re search,findall,finditer.sub,subn function () 调用函数 def func_name(arg1,....) 生成函数对象 func_s ...
- Lintcode455-StudentID-Easy
Implement a class Class with the following attributes and methods: A public attribute students which ...
- python3 session cookie
session是保存在服务器中的,而cookies是保存在客户端中的.服务器通过session id来跟踪客户,而对于客户端而言,session id是保存在cookies中的,所以只要把cookie ...
- python循环语句与其他编程语言不同之处
1.局部变量 for i in range(5): print i, print i, 运行结果: 0 1 2 3 4 4 i是for语句里面的局部变量.但在python里面,在同一方法体内,定义了一 ...
- SyncDictionary
using System; using System.Collections; using System.Collections.Generic; using System.Threading; us ...
- 封装fetch的使用(包含超时处理)
// 1: 传统fetch操作 fetch('http://facebook.github.io/react-native/movies.json') .then((response) => r ...
- Linux硬盘分区满,但没有找到占用文件
原因查找: 此服务器上有写日志的操作,在写的同时我把要写入的文件删除了..因为在写操作不能创建文件的时候会写硬盘的block,这样会使硬盘利用率越来越低,可以使用lsof -n |grep delet ...
- SqlParameter的两种用法【二】
private void Loadprovince() { string sql = "select * from Tables where ArealdPid=@pid"; /第 ...
- Qt5.QString传参数
1.函数传参,如果是 QString&类型 的话,不能直接 传入 char* 类型的参数,若是声明成 const QString&类型 的话,就可以 解释:应该是 函数调用的时候 编译 ...