SAP PM:获取设备资产基本信息

在SAP工厂维护模块中,给设备贴二维码标签是现在越来越流行的做法。因此通过扫描二维码获取设备资产信息是个非常基本的需求。

以下实例简单实现了,给SAP RFC传入设备编码获取设备资产基本信息的需求。

首先建立RFC Function module,传入参数:

 

 SAP PM:获取设备资产基本信息

 

 

 传出参数:

SAP PM:获取设备资产基本信息

 

 实现代码:

FUNCTION ZDEMO_PM001.
*"----------------------------------------------------------------------
*"*"本地接口:
*"  IMPORTING
*"     VALUE(IV_EQUNR) TYPE  EQUNR
*"  EXPORTING
*"     VALUE(EV_EQUNR) TYPE  EQUNR
*"     VALUE(EV_EQKTX) TYPE  KTX01
*"     VALUE(EV_HERST) TYPE  HERST
*"     VALUE(EV_TYPBZ) TYPE  TYPBZ
*"     VALUE(EV_FING) TYPE  FING
*"     VALUE(EV_PLTXT) TYPE  PLTXT
*"     VALUE(EV_ANLNR) TYPE  ANLN1
*"     VALUE(EV_INBDT) TYPE  ILOM_DATAB
*"----------------------------------------------------------------------
  DATA: BEGIN OF LS_EQUI,
          EQUNR TYPE EQUI-EQUNR,
          HERST TYPE EQUI-HERST,
          TYPBZ TYPE EQUI-TYPBZ,
          INBDT TYPE EQUI-INBDT,
          EQKTX TYPE EQKT-EQKTX,
          SWERK TYPE ILOA-SWERK,
          BEBER TYPE ILOA-BEBER,
          TPLNR TYPE ILOA-TPLNR,
          ANLNR TYPE ILOA-ANLNR,
          PLTXT TYPE IFLOTX-PLTXT,
          FING  TYPE T357-BEBER,
        END OF LS_EQUI.

  CLEAR LS_EQUI.
  SELECT SINGLE
    EQUNR
    HERST
    TYPBZ
    INBDT
    EQKTX
    SWERK
    BEBER
    TPLNR
    ANLNR
    FROM V_EQUI
    INTO LS_EQUI
    WHERE EQUNR = IV_EQUNR
    AND DATBI = '99991231'.

  IF SY-SUBRC = 0.
    IF LS_EQUI-TPLNR IS NOT INITIAL.
      SELECT SINGLE PLTXT  FROM  IFLOTX  INTO  LS_EQUI-PLTXT  WHERE  TPLNR = LS_EQUI-TPLNR  AND SPRAS = SY-LANGU.
    ENDIF.

    IF LS_EQUI-BEBER IS NOT INITIAL.
      SELECT SINGLE FING FROM T357 INTO LS_EQUI-FING WHERE WERKS = LS_EQUI-SWERK AND BEBER = LS_EQUI-BEBER.
    ENDIF.

    EV_EQUNR = LS_EQUI-EQUNR.
    EV_EQKTX = LS_EQUI-EQKTX.
    EV_HERST = LS_EQUI-HERST.
    EV_TYPBZ = LS_EQUI-TYPBZ.
    EV_FING = LS_EQUI-FING.
    EV_PLTXT = LS_EQUI-PLTXT.
    EV_ANLNR = LS_EQUI-ANLNR.
    EV_INBDT = LS_EQUI-INBDT.
  ENDIF.




ENDFUNCTION.

 

 

 

<style></style>
上一篇:Vue的一些基础语法


下一篇:JavaScript:自定义滚动条