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(1),
        ICON(4),
        MESSAGE(100),
        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 0 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.-‘.

DEFINE APPEND_FIELDCAT .
  CLEAR GS_FIELDCAT.
  GS_FIELDCAT-FIELDNAME = &1.
  GS_FIELDCAT-SCRTEXT_L = &2.
  GS_FIELDCAT-OUTPUTLEN = &3.
  GS_FIELDCAT-NO_ZERO = &4.
  APPEND GS_FIELDCAT TO GT_FIELDCAT.
END-OF-DEFINITION.

SELECTION-SCREEN BEGIN OF BLOCK BLK01 WITH FRAME TITLE TEXT-001.
PARAMETERS:P_IBLNR TYPE IKPF-IBLNR OBLIGATORY MEMORY ID IBN,
           P_GJAHR TYPE IKPF-GJAHR OBLIGATORY DEFAULT SY-DATUM+0(4),
           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.

  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-012
    IMPORTING
      FILENAME         = P_FILE
    EXCEPTIONS
      INV_WINSYS       = 1
      NO_BATCH         = 2
      SELECTION_CANCEL = 3
      SELECTION_ERROR  = 4
      OTHERS           = 5.
  IF SY-SUBRC <> 0.
    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 = 0.
    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 = ‘1‘
        I_BEGIN_ROW = ‘2‘
        I_END_COL   = ‘20‘
        I_END_ROW   = ‘5000‘
      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 1."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 = 0.
          IF GW_ITEM-QUANTITY <> 0.
            GW_ITAB-MESSAGE = text-008.
            GW_ITAB-ICON = ‘@[email protected]‘.
          ENDIF.
        ELSE.
          GW_ITAB-MESSAGE = text-009.
          GW_ITAB-ICON = ‘@[email protected]‘.
        ENDIF.
      WHEN 2."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-010.
          GW_ITAB-ICON = ‘@[email protected]‘.
        ENDIF.
      WHEN 3."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-002                  1    ‘‘,
                  ‘MESSAGE‘           TEXT-003                  100    ‘‘,
                  ‘MATNR‘             TEXT-004                  18    ‘X‘,
                  ‘ERFMG‘             TEXT-005                  17    ‘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            = 1
      OTHERS                   = 2.
  IF SY-SUBRC <> 0.
  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 = 0.
      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.
      GW_ITEM_INPUT-ENTRY_UOM = GW_ITEM-ENTRY_UOM.
      APPEND GW_ITEM_INPUT TO GT_ITEM_INPUT.
    ENDIF.
  ENDLOOP.

  IF GT_ITEM_INPUT[] IS INITIAL.
    MESSAGE text-011 TYPE ‘S‘ DISPLAY LIKE ‘E‘.
    LEAVE LIST-PROCESSING.
  ELSE.
    CALL FUNCTION ‘BAPI_MATPHYSINV_COUNT‘
      EXPORTING
        PHYSINVENTORY = P_IBLNR
        FISCALYEAR    = P_GJAHR
        COUNT_DATE    = P_DATE
      TABLES
        ITEMS         = GT_ITEM_INPUT
        RETURN        = GT_RETURN.

    READ TABLE GT_RETURN INTO GW_RETURN WITH KEY TYPE = ‘E‘.
    IF SY-SUBRC <> 0.
      CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT‘
        EXPORTING
          WAIT = ‘X‘.

      LOOP AT GT_ITAB INTO GW_ITAB WHERE SEL = ‘X‘ AND ICON = ‘‘.
        GW_ITAB-ICON = ‘@[email protected]‘.
        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 = 0.
        MESSAGE GW_RETURN-MESSAGE TYPE ‘S‘ DISPLAY LIKE ‘E‘.
      ENDIF.
    ENDIF.
  ENDIF.

  CALL METHOD LR_GRID->REFRESH_TABLE_DISPLAY.
ENDFORM.                    "PRM_USER_COMMAND
时间: 2025-01-03 15:29:41

MI04 盘点单数据录入的相关文章

传统手工盘点与盘点机盘点方案对比,盘点机的用途,盘点机的价值,汉码科技实时盘点方案

传统的盘点方案: 1.盘点前的准备工作:信息部一般会规划处盘点哪些店铺或者哪些区域,制订好盘点计划,打印好盘点单,下发到相关工作人员. 2.盘点中的盘点工作:盘点工作员拿到盘点单,分组,分区域进行盘点,并将商品数量登记在盘点单上.盘点时一般是一个人点数,一个人查找盘点单并记录数量.由于商品品种上千上万,在这么多的商品中查找到一个商品记录是非常痛苦的一件事情,头晕眼花.有的使用按仓位进行盘点,这种方式查找稍微没那么困难,但是手工记录,手工抄写难免出现误差,并且商品品种多,工作量巨大.传统的手工盘点

图书盘点机,图书条码数据采集器,高效的仓库管理书籍条码解决方案

图书库存扮演书中仓库管理运营的一个重要的关键业务数据.发展在任何年龄,现在现在促进血液循环的书籍,图书类型和更新速度是一样的迅速崛起. 为了确保立足于图书业,要保证正确的进货和库存控制以及发货.从而避免货物积压.管理费用的添加.然而.传统简单.静态的仓库管理已无法保证企业资源的高效利用.现在的图书行业对数据信息的准确性.实时性要求越来越高.仅靠人工记忆和手工录入.不但费时费力,并且easy出错,给企业带来巨大损失. 图书行业仓储管理中运用汉码盘点机进行仓储管理,扫描条码.录入数量即完毕各种单据的

图书盘点机,图书条码数据采集器,高效图书仓储管理条码解决方案

图书的盘点在图书企业的仓储管理运作中起着至关重要的作用.随时时代的发展,现如今图书的发行量越来越大,图书的种类以及更新速度也同样的飞速上涨.要保证在图书业立足,首先要保证正确的进货和库存控制以及发货,从而避免货物积压.管理费用的增加.然而,传统简单.静态的仓库管理已无法保证企业资源的高效利用.如今的图书行业对数据信息的准确性.实时性要求越来越高,仅靠人工记忆和手工录入,不但费时费力,而且容易出错,给企业带来巨大损失. 图书行业仓储管理中运用汉码盘点机进行仓储管理,扫描条码,录入数量即完成各种单据

药店药品管理方案,药店药品的盘点方案,如果进行药店药品的高效盘点?药品盘点步骤是?

传统的盘点方案: 1.盘点前的准备工作:信息部一般会规划处盘点哪些店铺或者哪些区域,制订好盘点计划,打印好盘点单,下发到相关工作人员. 2.盘点中的盘点登记:盘点工作员拿到盘点单,分组,分区域进行盘点,并将商品数量登记在盘点单上.盘点时一般是一个人点数,一个人查找盘点单并记录数量.由于商品品种上千上万,在这么多的商品中查找到一个商品记录是非常痛苦的一件事情,头晕眼花.有的使用按仓位进行盘点,这种方式查找稍微没那么困难,但是手工记录,手工抄写难免出现误差,并且商品品种多,工作量巨大.传统的手工盘点

海典ERP与汉码盘点机对接门店实时盘点计划及程序使用方法,实时盘点,云盘点方案

1.     PDA手持设备按键说明 [Tab]键:使输入焦点在控件上切换. [ESC]键:弹出是否退出确认对话框,退出操作界面或程序. [OK]键:确认输入或选择,进入下一步操作. [C]键:删除键,或者回退上一步操作. [#]键:快速切换和隐藏/显示输入法对.通过[#]号键可以在各种输入法之间进行切换. 2.     门店盘点前准备工作 2.1.  登记帐存并生成盘点单号和盘点页码(在ERP管理软件中) 1.       在ERP医药管理软件上进行盘点登记:注:每次盘点之前首先要对将要盘点的

超市仓库商品盘点作业流程,仓库如何进行盘点,仓库盘点流程?仓库盘点好方法?

盘点的结果可以说是一份商场经营绩效的成绩单.通过盘点作业可以计算出商场真实的存货.费用率.毛利率.货损率等经营指标. 1.盘点目的. 盘点目的主要有两个:一是控制存货,以指导日常经营业务:二是掌握损益,以便真实地把握经营绩效,并尽早采取防漏措施. 2.盘点原则. 一般是每月对商品盘点一次,并由连锁总部所设的盘点小组负责各商场的盘点工作.为了确保商品盘点的效率,应坚持三个原则: (1)售价盘点原则,即以商品的零售价作为盘点的基础,库存商品以零售价金额控制,通过盘点确定一定时期内的商品溢损和零售差错

如何选购盘点机,条码数据采集器?需要注意哪些事项?比如:金蝶盘点机,药品盘点机,超市盘点机,图书盘点机,服装盘点机等

如何选择盘点机?条码数据采集器? 盘点机也叫移动智能终端,条码数据采集器,盘点枪,PDA等. 随着条码技术的普遍推广,仓储管理信息化技术的发展,越来越多的企业均会上一套进销存管理软件来进行仓储管理.我们只需要在进销存ERP中录入各种单据就能记录商品的入库,出库,以及调拨,就能知道当前该商品的库存还有多少,什么时候该要补货了,还能知道商品的供应商等等信息.但是随着商品的越来越多,库存流转越来越复杂,我们录入各种单据的工作量也越来越大,由于人工录入大量数据,导致人工误差也大,因此我们经常会遇到ERP

SAP ABAP 库存盘点注意点及BAPI的使用

欢迎看到文章的朋友加入SAP技术交流QQ群:160061507 关于盘点的一点介绍: 盘赢:帐面库存小于实际库存.盘亏:帐面库存大于实际库存 盘点在系统中的步骤: 1.创建盘点凭证MI01 告知系统在需要盘点的:工厂,库存地,物料,是否批次,是否特殊库存. 2.冻结上述物料的库存移动 如果在盘点凭证中的Posting Block打勾,那么在盘点凭证中登记的物料就自动block了. 当然在实际操作中,最好就是把仓库大门一关,送货进来的供应商敲破大门就是不开,^_^,玩笑. 3.库存盘点MI04 盘

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

1.     PDA手持设备按键说明 [Tab]键:使输入焦点在控件上切换. [ESC]键:弹出是否退出确认对话框,退出操作界面或程序. [OK]键:确认输入或选择,进入下一步操作. [C]键:删除键.或者回退上一步操作. [#]键:高速切换和隐藏/显示输入法对.通过[#]号键能够在各种输入法之间进行切换. 2.     门店盘点前准备工作 2.1.  登记帐存并生成盘点单号和盘点页码(在ERP管理软件中) 1.       在ERP医药管理软件上进行盘点登记:注:每次盘点之前首先要对将要盘点的