`

MIRO

    博客分类:
  • ABAP
 
阅读更多
from: http://help-sap.blogspot.com/2011/01/miro.html,
      http://space.itpub.net/9859323/viewspace-684596

If you want to mimic the quantity shown in MIRO (transaction) while posting incoming invoice, you need to use the following function module


CALL FUNCTION 'MRM_ASSIGNMENT'
EXPORTING
i_display = v_display
ti_drseg_old = i_drseg
TABLES
t_drseg = ti_drseg
t_rbselbest = ti_rbselbest
t_rbsellifs = ti_rbsellifs
t_rbselfrbr = ti_rbselfrbr
t_rbselwerk = ti_rbselwerk
t_rbselerfb = ti_rbselerfb
t_errprot = ti_errprot
t_ebelntab = ti_ebelntab
CHANGING
c_rbkpv = w_rbkpv
t_limit = w_limit.
IF sy-subrc = 0.
IF ti_errprot[] IS INITIAL AND ti_drseg[] IS NOT INITIAL.

LOOP AT ti_drseg ASSIGNING w_drseg WHERE koart = c_koart_initial.
w_drseg-tbtkz = w_rbkpv-tbtkz.
CALL FUNCTION 'MRM_AMOUNT_QUANTITY_PROPOSE_N'
EXPORTING
i_rbkpv = w_rbkpv
CHANGING
c_drseg = w_drseg .
ENDLOOP. "
ENDIF. "
ENDIF. "


FUNCTION Z_MME_CALLSAP_GETPOITEMS.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     VALUE(IVORGANG) LIKE  RM08M-VORGANG
*"     VALUE(IREFERENZBELEGTYP) LIKE  RM08M-REFERENZBELEGTYP
*"     VALUE(IEBELN) LIKE  RM08M-EBELN OPTIONAL
*"     VALUE(IXWARE_BNK) LIKE  RM08M-XWARE_BNK
*"     VALUE(IEBELP) LIKE  RM08M-EBELP OPTIONAL
*"     VALUE(IBLDAT) LIKE  INVFO-BLDAT OPTIONAL
*"     VALUE(IBUDAT) LIKE  INVFO-BUDAT
*"     VALUE(IBUKRS) LIKE  BKPF-BUKRS
*"     VALUE(ISUPERFIELD) LIKE  RM08M-SUPERFIELD OPTIONAL
*"     VALUE(IXZUORDLIDELIVERY) LIKE  RBKPB-XZUORDLI OPTIONAL
*"     VALUE(IXZUORDLIRETURN) LIKE  RBKPB-XZUORDLI OPTIONAL
*"     VALUE(IDELIVERYBEGIN) LIKE  RBKPB-LFDATABLI OPTIONAL
*"     VALUE(IDELIVERYEND) LIKE  RBKPB-LFDATBISLI OPTIONAL
*"     VALUE(IRETURNBEGIN) LIKE  RBKPB-LFDATABLI OPTIONAL
*"     VALUE(IRETURNEND) LIKE  RBKPB-LFDATBISLI OPTIONAL
*"  EXPORTING
*"     VALUE(RETURNMSG) LIKE  ZRETURNMSG STRUCTURE  ZRETURNMSG
*"  TABLES
*"      IDRSEG STRUCTURE  DRSEG OPTIONAL
*"----------------------------------------------------------------------
  TYPES: BEGIN OF MRM_RBVS.
          INCLUDE STRUCTURE RBVS.
  TYPES: SELKZ(1) TYPE C,
         END OF MRM_RBVS.

  TYPES: BEGIN OF MRM_RBKPV.
          INCLUDE STRUCTURE RBKP_V.
  TYPES: RBTX LIKE RBTX OCCURS 0,
         THEAD  TYPE THEAD,              " Note header
         TNOTE  TYPE TLINE    OCCURS 0,  " Note lines
         H_RBVS TYPE MRM_RBVS OCCURS 0,  " vendor split
         H_RBWS LIKE RBWS     OCCURS 0,  " extended withholding tax
*       bupla  LIKE accit-bupla,        " Business place Korea
         WWERT  LIKE ACCIT-WWERT,        "  Umrechnungsdatum f黵 Kufix
         MRM_ZLSPR TYPE MRM_ZLSPR,       "  Log. Zahlsperre
         XCPDD TYPE XCPDD,               " CPD Dialog bearbeitet
         ADRNR TYPE ADRNR,               " CPD Adresse
         PENRC TYPE PENRC,               " Cause for late Payment
                                         "(PS/USA)
         BAPI_EXTBLNR TYPE RE_BELNR,
         " External doc. no. for BAPI when
         BAPI_PROCESS TYPE C,         " changing fiscal year / flag
                                         " that doc. comes from BAPI
         END OF MRM_RBKPV.

  TYPES: BEGIN OF MMCR_DRSEG_CO.
          INCLUDE STRUCTURE COBL_MRM_D.
  TYPES: CR LIKE DRSEG_CR    OCCURS 0,
         UNPL_REFWR TYPE REFWR,
         END OF MMCR_DRSEG_CO.

  TYPES: BEGIN OF MMCR_DRSEG.
          INCLUDE STRUCTURE DRSEG.
  TYPES: CR LIKE DRSEG_CR OCCURS 0,
         CO TYPE MMCR_DRSEG_CO OCCURS 0,
         SM LIKE DRSEG_SM OCCURS 0,
         CHARACT TYPE RBCHARACT_INSTANCE OCCURS 3,
                                         "instances of characteristics
         UEBGMAT  TYPE MATNR,
         UEBRBLGP TYPE RBLGP,
         SELKZ_DB TYPE SELKZ,
         RBLGP_OLD TYPE RBLGP,           "rblgp before aggregation
         END OF MMCR_DRSEG.

  TYPES: MMCR_LIMIT  LIKE RELIMIT.
*  TYPES: MMCR_TLIMIT TYPE SORTED TABLE OF MMCR_LIMIT
*                     WITH UNIQUE KEY EBELN EBELP.
*
  DATA: BEGIN OF MM_ERRPROT OCCURS 0,
         MSGTY       LIKE SY-MSGTY,
         MSGID       LIKE SY-MSGID,
         MSGNO       LIKE SY-MSGNO,
         MSGV1       LIKE SY-MSGV1,
         MSGV2       LIKE SY-MSGV2,
         MSGV3       LIKE SY-MSGV3,
         MSGV4       LIKE SY-MSGV4,
         SOURCE      TYPE C,
         RBLGP       LIKE DRSEG-RBLGP,
         SHOWN       LIKE BOOLE-BOOLE,
        END OF MM_ERRPROT.

  DATA: LIN TYPE P,
        TEXT(30), "返回消息文本
        MM_RBKPV TYPE MRM_RBKPV,
        I_RBSELBEST LIKE RBSELBEST OCCURS 0 WITH HEADER LINE,
        I_RBSELLIFS LIKE RBSELLIFS OCCURS 0 WITH HEADER LINE,
        I_RBSELFRBR LIKE RBSELFRBR OCCURS 0 WITH HEADER LINE,
        I_RBSELWERK LIKE RBSELWERK OCCURS 0 WITH HEADER LINE,
        I_RBSELERFB LIKE RBSELERFB OCCURS 0 WITH HEADER LINE,
        MM_TLIMIT TYPE SORTED TABLE OF MMCR_LIMIT
                     WITH UNIQUE KEY EBELN EBELP,
        MM_DRSEG TYPE MMCR_DRSEG OCCURS 0 WITH HEADER LINE.

  CLEAR I_RBSELBEST.
  I_RBSELBEST-EBELN = IEBELN.
  I_RBSELBEST-EBELP = IEBELP.
  APPEND I_RBSELBEST.

  MM_RBKPV-BLDAT = IBLDAT.
  MM_RBKPV-BUDAT = IBUDAT.
  MM_RBKPV-BUKRS = IBUKRS.

*请货款
  IF IVORGANG = '1' AND IREFERENZBELEGTYP = '1' AND IXWARE_BNK = '1'.
    MM_RBKPV-XRECH = 'X'.       "标识: 记帐发票
    MM_RBKPV-XZUORDLI = 'X'.    "显示交货项目分配
    MM_RBKPV-XZUORDRT = 'X'.  "显示退货分配
    MM_RBKPV-XBNK = ''.         "计划交货成本标识
    MM_RBKPV-XWARE = 'X'.       "货物发票/服务标识符
    MM_RBKPV-TBTKZ = ''.        "标识: 后续借/贷
    MM_RBKPV-XBEST = 'X'.       "复选框: 分配
    MM_RBKPV-XRECHL = 'S'.      "交货项目的过帐逻辑(发票/贷项清单)
    MM_RBKPV-XRECHR = 'H'.      "交货项目的过帐逻辑(发票/贷项清单)
    TEXT = '没有需要请的货款'.
*请已计划费用
 ELSEIF IVORGANG = '1' AND IREFERENZBELEGTYP = '1' AND IXWARE_BNK = '2'.
    MM_RBKPV-XRECH = 'X'.
    MM_RBKPV-XZUORDLI = 'X'.
    MM_RBKPV-XZUORDRT = 'X'.
    MM_RBKPV-XBNK = 'X'.
    MM_RBKPV-XWARE = ''.
    MM_RBKPV-TBTKZ = ''.
    MM_RBKPV-XBEST = 'X'.
    MM_RBKPV-XRECHL = 'S'.
    MM_RBKPV-XRECHR = 'H'.
    TEXT = '没有需要请的已计划费用'.
*请未计划费用
 ELSEIF IVORGANG = '3' AND IREFERENZBELEGTYP = '1' AND IXWARE_BNK = '1'.
    MM_RBKPV-XRECH = 'X'.
    MM_RBKPV-XZUORDLI = 'X'.
    MM_RBKPV-XZUORDRT = 'X'.
    MM_RBKPV-XBNK = ''.
    MM_RBKPV-XWARE = 'X'.
    MM_RBKPV-TBTKZ = 'X'.
    MM_RBKPV-XBEST = 'X'.
    MM_RBKPV-XRECHL = 'S'.
    MM_RBKPV-XRECHR = 'H'.
    TEXT = '没有需要请未计划费用'.
*货款、已计划费用和未计划费用同时请款
 ELSEIF IVORGANG = '1' AND IREFERENZBELEGTYP = '1' AND IXWARE_BNK = '3'.
    MM_RBKPV-XRECH = 'X'.
    MM_RBKPV-XZUORDLI = 'X'.
    MM_RBKPV-XZUORDRT = 'X'.
    MM_RBKPV-XBNK = 'X'.
    MM_RBKPV-XWARE = 'X'.
    MM_RBKPV-TBTKZ = ''.
    MM_RBKPV-XBEST = 'X'.
    MM_RBKPV-XRECHL = 'S'.
    MM_RBKPV-XRECHR = 'H'.
    TEXT = '没有需要请的货款、已计划费用和未计划费用'.
*退货订单请款
 ELSEIF IVORGANG = '2' AND IREFERENZBELEGTYP = '1' AND IXWARE_BNK = '1'.
    MM_RBKPV-XRECH = ''.
    MM_RBKPV-XZUORDLI = 'X'.
    MM_RBKPV-XZUORDRT = 'X'.
    MM_RBKPV-XBNK = ''.
    MM_RBKPV-XWARE = 'X'.
    MM_RBKPV-TBTKZ = ''.
    MM_RBKPV-XBEST = 'X'.
    MM_RBKPV-XRECHL = 'H'.
    MM_RBKPV-XRECHR = 'H'.
    TEXT = '没有需要请的退货货款'.
*批次请款
 ELSEIF IVORGANG = '1' AND IREFERENZBELEGTYP = '5' AND IXWARE_BNK = '3'.
    TEXT = '此供应商没有需要请的货款及费用'.
    IF IXZUORDLIDELIVERY = 'X' AND IXZUORDLIRETURN = 'X'. "交货和退货
      MM_RBKPV-LFDATABLI = IDELIVERYBEGIN.
      MM_RBKPV-LFDATBISLI = IDELIVERYEND.
      MM_RBKPV-LFDATABRT = IRETURNBEGIN.
      MM_RBKPV-LFDATBISRT = IRETURNEND.
      MM_RBKPV-XZUORDLI = 'X'.
      MM_RBKPV-XZUORDRT = 'X'.
      MM_RBKPV-XBNK = 'X'.
      MM_RBKPV-XWARE = 'X'.
      MM_RBKPV-TBTKZ = ''.
      MM_RBKPV-XBEST = ''.
      MM_RBKPV-SELIF = ISUPERFIELD.
      MM_RBKPV-XRECHL = 'S'.
      MM_RBKPV-XRECHR = 'H'.
    ELSEIF IXZUORDLIDELIVERY = 'X' AND IXZUORDLIRETURN = ''. "交货
      MM_RBKPV-LFDATABLI = IDELIVERYBEGIN.
      MM_RBKPV-LFDATBISLI = IDELIVERYEND.
      MM_RBKPV-LFDATABRT = IRETURNBEGIN.
      MM_RBKPV-LFDATBISRT = IRETURNEND.
      MM_RBKPV-XZUORDLI = ''.
      MM_RBKPV-XZUORDRT = 'X'.
      MM_RBKPV-XBNK = 'X'.
      MM_RBKPV-XWARE = 'X'.
      MM_RBKPV-TBTKZ = ''.
      MM_RBKPV-XBEST = ''.
      MM_RBKPV-SELIF = ISUPERFIELD.
      MM_RBKPV-XRECHL = 'S'.
      MM_RBKPV-XRECHR = 'H'.
    ELSEIF IXZUORDLIDELIVERY = '' AND IXZUORDLIRETURN = 'X'. "退货
    ENDIF.
  ENDIF.

  CALL FUNCTION 'MRM_ASSIGNMENT'
    EXPORTING
      I_DISPLAY          = 'X'
*   TI_DRSEG_OLD       =
* IMPORTING
*   E_CANCEL           =
    TABLES
      T_DRSEG            = MM_DRSEG
      T_RBSELBEST        = I_RBSELBEST
      T_RBSELLIFS        = I_RBSELLIFS
      T_RBSELFRBR        = I_RBSELFRBR
      T_RBSELWERK        = I_RBSELWERK
      T_RBSELERFB        = I_RBSELERFB
      T_ERRPROT          = MM_ERRPROT
*   T_EBELNTAB         =
*   T_RBSELTRAN        =
    CHANGING
      C_RBKPV            = MM_RBKPV
      T_LIMIT            = MM_TLIMIT
      .
 LOOP AT MM_DRSEG WHERE KOART = ''.
   MOVE MM_RBKPV-TBTKZ TO MM_DRSEG-TBTKZ.
   CALL FUNCTION 'MRM_AMOUNT_QUANTITY_PROPOSE_N'
     EXPORTING
       I_RBKPV = MM_RBKPV
     CHANGING
       C_DRSEG = MM_DRSEG.
   MODIFY MM_DRSEG.
 ENDLOOP.
 LOOP AT MM_DRSEG.
    MOVE-CORRESPONDING MM_DRSEG TO IDRSEG.
    APPEND IDRSEG.
    CLEAR MM_DRSEG.
  ENDLOOP.

  DESCRIBE TABLE MM_DRSEG LINES LIN.
  IF LIN = 0.
    RETURNMSG-MTYPE = 'W'.
    RETURNMSG-MTEXT = TEXT.
  ENDIF.

ENDFUNCTION
分享到:
评论

相关推荐

    sap miro 变式问题

    在SAP系统中,MIRO(Invoice Verification)是一个用于处理和过账供应商发票的事务代码。用户在执行此任务时可能会遇到变式问题,导致某些必输项被限制,从而影响业务流程。本文将深入探讨这个问题及其解决方案。 ...

    SAP 发票校验(Tcode MIRO) 税额容差分析

    ### SAP发票校验(Tcode MIRO)税额容差分析 #### 一、发票校验与税码分析 发票校验是SAP系统中的一个重要环节,它主要用于验证供应商发票是否与采购订单或合同相符,并计算税额。发票校验过程中会涉及到税码的设置...

    Miro(开源影音播放器) v6.0中文版.zip

    由Participatory Culture基金会开发的Miro,目的是让在线视频“和看电视一样简单”,让每一个人都能轻松接触互联网新媒体,它支持开放性标准。 Miro(开源影音播放器)功能介绍 - 播放大部分的流行格式的视频文件比如...

    MIRO LUA 2 (PSP开发软件)

    MIRO LUA 2 (PSP开发软件) 开发PSP软件的工具 <br>收集来的。

    如何定制发票校验MIRO格式

    如何定制发票校验MIRO格式

    psp开发工具miro lua

    【PSP开发工具Miro Lua】是一款专为PSP(PlayStation Portable)平台设计的lua脚本开发环境,它为LUA爱好者提供了在PSP上编写、测试和运行lua程序的便利工具。LUA是一种轻量级的脚本语言,因其简洁的语法和强大的...

    SAP公司间采购EDI配置-如何触发自动MIRO.docx

    ### SAP公司间采购EDI配置-如何触发自动MIRO 在SAP系统中,企业间交易(尤其是跨国或跨法人实体的交易)往往涉及到复杂的流程管理与数据交换。本文将详细介绍如何通过SAP系统的EDI(Electronic Data Interchange)...

    SAP_MIRO_Free-Tutorial-on-Invoice-Verification

    ### SAP MIRO:发票验证免费教程详解 #### 一、SAP MIRO 概述 在SAP系统中,MIRO(Invoice Verification)是用于处理供应商发票的核心事务代码。通过MIRO事务,用户可以录入、审核及过账发票,同时进行必要的调整...

    unity3d MovieTexture ogg ogv 格式转换器-Miro Video Converter

    Miro Video Converter是一款免费视频转换小软件。支持Windows及Mac OS X平台。支持的视频格式包括:AVI、H.264、MOV、WMV、XVID、Theora、MKV、FLV,可以将上述格式的视频转换到 Android、iPod/iPhone及Theora设备上...

    犹尼康 M91 Miro-OPLC 信号模块英文说明.zip

    《犹尼康M91 Miro-OPLC信号模块详解》 在自动化和控制系统领域,犹尼康(Yokogawa)是全球知名的工业自动化解决方案提供商之一。M91 Miro-OPLC信号模块是其产品线中的一个重要组成部分,这款模块专为实现高效、可靠...

    Miro:MIRO-合并机器人!

    MIRO-合并机器人! Miro旨在帮助合并来自Github Pull Requests的代码。 部署中 Miro是一个用.NET Core编写的完全开放源代码的项目。 要在您的org / team / projects中使用Miro,您需要做的就是pull + run miro ...

    miro-latex:基于Mathjax的Miro的LateX Web插件

    **miro-latex: 基于MathJax的Miro LaTeX Web插件** Miro是一款流行的在线协作白板工具,允许用户进行无限制的视觉思维、协作和项目管理。而"miro-latex"是一个专门针对Miro设计的Web插件,它引入了LaTeX支持,使得...

    miro:我的终端模拟器

    **miro:我的终端模拟器** miro是一款创新的终端模拟器,它的独特之处在于它采用了Rust编程语言进行开发,并且利用了GPU的加速能力,以提供更流畅、更高效的终端体验。Rust是一种系统级语言,以其内存安全性和高...

    Miro for Google Calendar-crx插件

    在会议和研讨会之前附加和共享Miro董事会 Miro Google日历扩展程序使组织者不必为会议设置烦恼,并为与会人员提供了提高会议效率所需的访问权限。 轻松将Miro面板直接添加到Google日历活动中,并确保会议参与者可以...

    miro-team-topologies:Miro.com的团队拓扑Web插件

    Miro的团队拓扑Web插件使用此插件,用户可以构建团队拓扑。此插件是出于培训目的而创建的,尚未准备好投入生产[尚未]。功能如何运作去做如何建造您将需要使用npm ENV VAR集在全局安装Webpack-cli。运行npm install...

    miro:用于逼真图像的简单的基于光线追踪的渲染系统

    **miro:逼真的图像渲染系统** Miro是一款基于光线追踪技术的简单渲染系统,它使用C++编程语言实现,旨在提供高效的图像渲染能力,创造出接近真实的视觉效果。光线追踪是一种计算机图形学技术,通过模拟光线在场景...

    Miro Web Clipper-crx插件

    使用Miro Google Chrome扩展程序,添加文件和屏幕截图变得非常容易。 使用此扩展程序,您可以将文件从桌面或文件管理器直接拖放到板上。 您还可以在浏览器中拍摄网站的屏幕截图,并将其立即保存到Miro库中。 第一种...

Global site tag (gtag.js) - Google Analytics