*&---------------------------------------------------------------------*
*& 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 盘点单数据录入的更多相关文章

  1. 汉码盘点机PDA无缝对接思迅思迅盘点机思迅条码数据采集器批号商品盘点的方法

    1.1.    盘点批号 如果某些商品进行了批号管理,我们不仅仅要清点什么商品总数有多少个,我们还要区分该商品的某个批号有多少个数量,因此以前批号盘点工作量是非常大的. 我们的盘点机PDA支持批号盘点 ...

  2. haohantechsoft-PDA软件,PDA管理软件,PDA管理系统,仓库PDA销售开单盘点软件

    为了更好服务于广大服装客户群体进行销售.盘点.调拨配送等.推出基于无线网络版移动PDA销售开单盘点软件系统.该系统支持无线3G.WIFI.GPRS系统,用户可以手持PDA在无线网络连接状态下进行销售. ...

  3. OCEANIAERP对接-code盘点机并存储实时库存计划和方案的使用,实时库存,云清查方案

    1.     PDA手持设备按键说明 [Tab]键:使输入焦点在控件上切换. [ESC]键:弹出是否退出确认对话框,退出操作界面或程序. [OK]键:确认输入或选择,进入下一步操作. [C]键:删除键 ...

  4. 金蝶盘点机PDA条码数据采集器WMS系统具体有哪些功能

    1.  使用汉码盘点机PDA实现仓库条码管理的好处 (1)  传统电脑管理软件出入库需要来回电脑跑人工手工电脑录单效率低,通过人眼识别商品品种和清点商品数量,容易造成录单错误.从而造成电脑管理软件库存 ...

  5. 金蝶盘点机PDA仓库条码管理:仓库如何盘点

    1.1. 仓库盘点 传统的仓库盘点,需要人工手工抄写盘点单,时候再去电脑上一行行的录入盘点单,操作非常耗时费力,往往需要盘点好几天,最终盘点效果还不好,在抄写过程中容易出现错误,从而造成盘点结果不准确 ...

  6. 【MM系列】SAP MM模块-库存盘点BAPI的使用及注意点

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[MM系列]SAP MM模块-库存盘点BAPI的 ...

  7. 【系统设计】WMS系统中 库存、盘点、移库、拆库功能的设计(库内管理)

    最近负责WMS系统 盘点 移库 两个功能模块的功能及数据库设计. 物流仓储系统的搭建,要基于仓库的实际情况,整理内部员工需求,再参考其他WMS系统,经过长时间的讨论和研究,最终转化为产品需求. 这里先 ...

  8. 金蝶K3表

    系统ID     表ID     表名     表中文名     表说明     FType     FSefDefSign0     0     t_VoucherGroup     凭证字表    ...

  9. 大家都在用PDA条码扫描枪管理企业仓库 PDA无线数据采集程序

    PDA数据采集器又称之为手持终端,这些都是用于扫描货物条码统计数据用的,PDA扫描枪有效提高企业仓库管理,在仓库管理中引入条码技术,对仓库的到货检验.入库.出库.调拨.移库移位.库存盘点等各个作业环节 ...

随机推荐

  1. 并发学习一、MPI初步认识

    学习参考地址:https://www.jianshu.com/p/2fd31665e816 编程使用的vs2015 社区版本(个人感觉比Vc6.0的丑界面看起来舒服多了) MPI基本函数 MPI调用借 ...

  2. Nuget 打包 for .Net Standart project

    Create .NET Standard packages with Visual Studio 2015 Publishing packages nuge.exe 放在项目目录中 nuget spe ...

  3. 51nod1057-N的阶乘(大数乘法巧解)

    这道大数乘法开始我是想套板子模拟的..然后就发现2/3的例子都wa了.(惊了).然后在思考后发现n2的板子的确过不了这么多的大数.(不看题的下场).所以,我在网上发现了分块求大数的方法.%%% 思路来 ...

  4. POJ 2718 Smallest Difference(最小差)

     Smallest Difference(最小差) Time Limit: 1000MS    Memory Limit: 65536K Description - 题目描述 Given a numb ...

  5. FB01与F-02的区别(转载)

    FB01与F-02的区别(转载) FB01 : a) ''Post Document'' b) No doc type as SA automatically comes. c) No automat ...

  6. SD--批量删除订单

    SD--批量删除订单 在sap应用中常常会需要批量删除一些错误录入的单据,为此开发了一个小程序.该程序为了安全,程序做了一下控制 1.限制用户只能删除自己的订单,不能删除别人输入的订单,如果需要修改一 ...

  7. Jquery loading 效果

    function showLoad(tipInfo) { var eTip = document.createElement('div'); eTip.setAttribute('id', 'tipD ...

  8. display: none; 与 jq show方法之间的联系

    1. 定义四种常用隐藏元素的方式,然后调用  jq 的 show 方法显示,观察各原先隐藏元素的   display   表现,结合 jq 源码,show 方法设置 元素 display  属性值为 ...

  9. 学习笔记50—多重假设检验与Bonferroni校正、FDR校正

    总结起来就三句话: (1)当同一个数据集有n次(n>=2)假设检验时,要做多重假设检验校正 (2)对于Bonferroni校正,是将p-value的cutoff除以n做校正,这样差异基因筛选的p ...

  10. Mybatis中resultType理解