首页 > 其他分享 >ABAP:财务的增强

ABAP:财务的增强

时间:2023-10-10 11:13:08浏览次数:40  
标签:hz 增强 财务 exits zbseg bseg param ABAP ENDIF

1.替代

T-CODE:OBBH 

配置公司代码下的调用点及替代步骤

 这里需要进入T-CODE:GCX2中进行配置,然后再出口程序中进行代码编写,下面详解

T-CODE:GCX2

维护应用区域的退出程序 复制RGGBS000到ZRGGBS000,更改GBLS的退出程序名

进入出口程序编写代码:首先把出口FORM添加到EXITS表中

FORM get_exit_titles TABLES etab.

  DATA: BEGIN OF exits OCCURS 50,
          name(5)   TYPE c,
          param     LIKE c_exit_param_none,
          title(60) TYPE c,
        END OF exits.

  exits-name  = 'U100'.
  exits-param = c_exit_param_none.
*  exits-param = c_exit_param_field.
  exits-title = TEXT-100.             "Cost center from CSKS
  APPEND exits.

  exits-name  = 'U101'.
  exits-param = c_exit_param_field.
  exits-title = TEXT-101.             "Cost center from CSKS
  APPEND exits.

  exits-name  = 'U401'.
  exits-param = c_exit_param_field.
  exits-title = TEXT-401.             "原因代码
  APPEND exits.

* begin of insertion                                          "wms092357
  exits-name  = 'U200'.
  exits-param = c_exit_param_field.
  exits-title = TEXT-200.             "Cons. transaction type
  APPEND exits.                       "from xref1/2
* end of insertion                                            "wms092357

  exits-name  = 'U500'.
  exits-param = c_exit_param_field.
  exits-title = TEXT-401.             "原因代码
  APPEND exits.

************************************************************************
* PLEASE DELETE THE FIRST '*' FORM THE BEGINING OF THE FOLLOWING LINES *
*        IF THE ACCOUNTING MODULE IS INSTALLED IN YOUR SYSTEM:         *
*  EXITS-NAME  = 'U102'.
*  EXITS-PARAM = C_EXIT_PARAM_CLASS.
*  EXITS-TITLE = TEXT-102.             "Sum is used for the reference.
*  APPEND EXITS.


***********************************************************************
** EXIT EXAMPLES FROM PUBLIC SECTOR INDUSTRY SOLUTION
**
** PLEASE DELETE THE FIRST '*' FORM THE BEGINING OF THE FOLLOWING LINE
** TO ENABLE PUBLIC SECTOR EXAMPLE SUBSTITUTION EXITS
***********************************************************************
  INCLUDE rggbs_ps_titles.

  REFRESH etab.
  LOOP AT exits.
    etab = exits.
    APPEND etab.
  ENDLOOP.

ENDFORM.   
FORM get_exit_titles TABLES etab.

  DATA: BEGIN OF exits OCCURS 50,
          name(5)   TYPE c,
          param     LIKE c_exit_param_none,
          title(60) TYPE c,
        END OF exits.

  exits-name  = 'U100'.
  exits-param = c_exit_param_none.
*  exits-param = c_exit_param_field.
  exits-title = TEXT-100.             "Cost center from CSKS
  APPEND exits.

  exits-name  = 'U101'.
  exits-param = c_exit_param_field.
  exits-title = TEXT-101.             "Cost center from CSKS
  APPEND exits.

  exits-name  = 'U401'.
  exits-param = c_exit_param_field.
  exits-title = TEXT-401.             "原因代码
  APPEND exits.

* begin of insertion                                          "wms092357
  exits-name  = 'U200'.
  exits-param = c_exit_param_field.
  exits-title = TEXT-200.             "Cons. transaction type
  APPEND exits.                       "from xref1/2
* end of insertion                                            "wms092357

  exits-name  = 'U500'.
  exits-param = c_exit_param_field.
  exits-title = TEXT-401.             "原因代码
  APPEND exits.

************************************************************************
* PLEASE DELETE THE FIRST '*' FORM THE BEGINING OF THE FOLLOWING LINES *
*        IF THE ACCOUNTING MODULE IS INSTALLED IN YOUR SYSTEM:         *
*  EXITS-NAME  = 'U102'.
*  EXITS-PARAM = C_EXIT_PARAM_CLASS.
*  EXITS-TITLE = TEXT-102.             "Sum is used for the reference.
*  APPEND EXITS.


***********************************************************************
** EXIT EXAMPLES FROM PUBLIC SECTOR INDUSTRY SOLUTION
**
** PLEASE DELETE THE FIRST '*' FORM THE BEGINING OF THE FOLLOWING LINE
** TO ENABLE PUBLIC SECTOR EXAMPLE SUBSTITUTION EXITS
***********************************************************************
  INCLUDE rggbs_ps_titles.

  REFRESH etab.
  LOOP AT exits.
    etab = exits.
    APPEND etab.
  ENDLOOP.

ENDFORM.   

 创建对应的Perform完成代码编写

*&---------------------------------------------------------------------*
*&      Form  u401
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM u401 USING rstgr.

  "add by jt-tansh 20210422
  "从配置表ZFIT008中获得原因代码
  BREAK jt-tansh.
  SELECT SINGLE rstgr INTO bseg-rstgr FROM zfit008 WHERE hkont = bseg-hkont.
  IF sy-subrc = 0.
    gv_rstgr = bseg-rstgr.
  ENDIF.

  IF bkpf-blart = 'ZP' OR bkpf-blart = 'DZ'.
    IF ( bseg-hkont+0(4) = '1001' OR bseg-hkont+0(4) = '1002').
      IF bseg-rstgr IS INITIAL.
        bseg-rstgr = gv_rstgr.
        CLEAR:gv_rstgr.
      ENDIF.

    ENDIF.
  ENDIF.


ENDFORM.

2.校验

TCODE:OB28

配置公司代码下的调用点及校验步骤

 这里可以修改消息类,一个组下面只能共用一个消息类,消息类要更改的话,只能选中组进行更改

 3.BTE增强

T-Code:FIBF

 点击执行

 

FUNCTION zsample_process_00001120.
*"----------------------------------------------------------------------
*"*"本地接口:
*"  IMPORTING
*"     VALUE(I_BKDF) TYPE  BKDF OPTIONAL
*"  TABLES
*"      T_BKPF STRUCTURE  BKPF
*"      T_BSEG STRUCTURE  BSEG
*"      T_BKPFSUB STRUCTURE  BKPF_SUBST
*"      T_BSEGSUB STRUCTURE  BSEG_SUBST
*"      T_BSEC STRUCTURE  BSEC OPTIONAL
*"  CHANGING
*"     REFERENCE(I_BKDFSUB) TYPE  BKDF_SUBST OPTIONAL
*"----------------------------------------------------------------------
  DATA:lv_bkpf TYPE bkpf.

  IF sy-tcode = 'F-44' OR sy-tcode = 'F-32' OR sy-tcode = 'F-53'.


    DATA zbseg TYPE TABLE OF bseg WITH HEADER LINE.
    DATA:hz TYPE bseg-wrbtr.

    zbseg[] = t_bseg[].
    LOOP AT t_bseg INTO DATA(ls_bseg).
      IF ls_bseg-koart = 'D'.
        CLEAR: hz,zbseg[],zbseg.
        LOOP AT zbseg WHERE koart = ls_bseg-koart
                        AND saknr = ls_bseg-saknr
                      AND kunnr = ls_bseg-kunnr .
          IF zbseg-shkzg = 'S'.
            hz = hz + zbseg-wrbtr.
          ELSE.
            hz = hz - zbseg-wrbtr.
          ENDIF.
        ENDLOOP.
        IF hz IS INITIAL.
          IF ls_bseg-shkzg = 'S'.

            READ TABLE t_bsegsub ASSIGNING FIELD-SYMBOL(<line>) WITH KEY tabix = sy-tabix.
            IF <line> IS ASSIGNED .
              <line>-xnegp = 'X'.
            ENDIF.
          ELSEIF ls_bseg-shkzg = 'H'..
            READ TABLE t_bsegsub ASSIGNING FIELD-SYMBOL(<line2>) WITH KEY tabix = sy-tabix.
            IF <line2> IS ASSIGNED .
              <line2>-xnegp = ''.
            ENDIF.
          ENDIF.
        ENDIF.



      ELSEIF ls_bseg-koart = 'K'.
        CLEAR: hz,zbseg.
        LOOP AT zbseg WHERE koart = ls_bseg-koart
                        AND saknr = ls_bseg-saknr
                      AND lifnr = ls_bseg-lifnr .
          IF zbseg-shkzg = 'S'.
            hz = hz + zbseg-wrbtr.
          ELSE.
            hz = hz - zbseg-wrbtr.
          ENDIF.
        ENDLOOP.
        IF hz IS INITIAL.
          IF ls_bseg-shkzg = 'S'.
            UNASSIGN <line>.
            READ TABLE t_bsegsub ASSIGNING <line> WITH KEY tabix = sy-tabix.
            IF <line> IS ASSIGNED .
              <line>-xnegp = 'X'.
            ENDIF.
          ELSEIF ls_bseg-shkzg = 'H'.
            UNASSIGN <line2>.
            READ TABLE t_bsegsub ASSIGNING <line2> WITH KEY tabix = sy-tabix.
            IF <line2> IS ASSIGNED .
              <line2>-xnegp = ''.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.

    ENDLOOP.

  ENDIF.


*  DATA:hz TYPE bseg-wrbtr.
*  DATA zbseg TYPE TABLE OF bseg WITH HEADER LINE.
*  CLEAR: hz,zbseg[],zbseg.
*
*  zbseg[] = t_bseg[].
*  " 客户    先对所有行项目
*  LOOP AT zbseg WHERE koart = 'D'.
*    IF zbseg-shkzg = 'S'.
*      hz = hz + zbseg-wrbtr.
*    ELSE.
*      hz = hz - zbseg-wrbtr.
*    ENDIF.
*  ENDLOOP.
*  IF sy-subrc = 0.
*    IF hz IS INITIAL.
*      LOOP AT  t_bseg WHERE koart = 'D'.
*        IF t_bseg-shkzg = 'S'.
*          READ TABLE t_bsegsub ASSIGNING FIELD-SYMBOL(<line>) WITH KEY tabix = sy-tabix.
*          IF <line> IS ASSIGNED .
*            <line>-xnegp = 'X'.
*          ENDIF.
*        ELSE.
*          IF t_bseg-shkzg = 'H' AND t_bseg-xnegp IS NOT INITIAL.
*            READ TABLE t_bsegsub ASSIGNING FIELD-SYMBOL(<line2>) WITH KEY tabix = sy-tabix.
*            IF <line2> IS ASSIGNED .
*              <line>-xnegp = ''.
*            ENDIF.
*          ENDIF.
*
*        ENDIF.
*
*      ENDLOOP.
*    ENDIF.
*  ENDIF.
*
*
*  " 供应商
*  CLEAR: hz,zbseg[],zbseg.
*  LOOP AT zbseg WHERE koart = 'K'.
*    IF zbseg-shkzg = 'S'.
*      hz = hz + zbseg-wrbtr.
*    ELSE.
*      hz = hz - zbseg-wrbtr.
*    ENDIF.
*  ENDLOOP.
*  IF sy-subrc = 0.
*    IF hz IS INITIAL.
*      LOOP AT  t_bseg WHERE koart = 'K'.
*        IF t_bseg-shkzg = 'S'.
*          UNASSIGN <line>.
*          READ TABLE t_bsegsub ASSIGNING <line> WITH KEY tabix = sy-tabix.
*          IF <line> IS ASSIGNED .
*            <line>-xnegp = 'X'.
*          ENDIF.
*        ELSE.
*          IF t_bseg-shkzg = 'H' AND t_bseg-xnegp IS NOT INITIAL.
*            UNASSIGN <line2>.
*            READ TABLE t_bsegsub ASSIGNING <line2> WITH KEY tabix = sy-tabix.
*            IF <line2> IS ASSIGNED .
*              <line>-xnegp = ''.
*            ENDIF.
*          ENDIF.
*
*        ENDIF.
*
*      ENDLOOP.
*    ENDIF.
*  ENDIF.




  READ TABLE t_bkpf INTO lv_bkpf INDEX 1.
  IF sy-subrc = 0.

    IF lv_bkpf-blart = 'RE' OR lv_bkpf-blart = 'RV'.
      LOOP AT t_bsegsub .
        t_bsegsub-sgtxt = lv_bkpf-bktxt.
        MODIFY t_bsegsub INDEX sy-tabix.
      ENDLOOP.
    ENDIF.
*    LOOP AT t_bseg ASSIGNING FIELD-SYMBOL(<fs_bg>).
*      <fs_bg>-sgtxt = lv_bkpf-bktxt.
*    ENDLOOP.
  ENDIF.

ENDFUNCTION.

返回FIBF界面.在设置中创建PRDUCT 然后配置对应的EVENT及函数模块

后面的A要打√,表示激活

 

 

标签:hz,增强,财务,exits,zbseg,bseg,param,ABAP,ENDIF
From: https://www.cnblogs.com/ap-ad-java-abap/p/17753814.html

相关文章

  • ABAP:年份+月份搜索帮助
    *&---------------------------------------------------------------------**&包含ZPPR011_S01*&---------------------------------------------------------------------*SELECTION-SCREENBEGINOFBLOCKblk1WITHFRAMETITLETEXT-001.......
  • 界面组件DevExpress WinForms v23.2新功能预览 - 增强MVVM相关功能
    本文主要描述了DevExpressWinForms即将在几个月之后发布的v23.2中包含的新功能,持续关注我们获取更多最新资讯哦~DevExpressWinForms有180+组件和UI库,能为WindowsForms平台创建具有影响力的业务解决方案。同时能完美构建流畅、美观且易于使用的应用程序,无论是Office风格的界面,......
  • SAP ABAP 关于SMARTFORMS编辑文本出现WORD样式
    SAPABAP关于SMARTFORMS编辑文本出现WORD样式问题描述:SAPABAP关于SMARTFORMS编辑时文本默认使用WORD在使用smartforms打开编辑文本的时候会出现word样式,这样就会出现无法拖拽字段和系统默认信息情况,导致部分功能无法使用解决方案:通过SE38打开程序RSCPSETEDITOR将SAPscript......
  • 【wabapp】jsp输出内容
    静态HTML内容:JSP页面中的所有静态HTML内容,例如标签、文本、图像等,会直接显示在生成的HTML页面中。这些内容不受JSP代码的影响,会原样输出。jspCopy<!DOCTYPEhtml><html><head><metacharset="UTF-8"><title>StaticHTMLContent</title></head><......
  • 增强现实抬头显示AR-HUD
        增强现实抬头显示(AR-HUD)可以将当前车身状态、障碍物提醒等信息3D投影在前挡风玻璃上,并通过自研的AR-Creator算法,融合实际道路场景进行导航,使驾驶员无需低头即可了解车辆实时行驶状况。结合DMS系统,可以实现眼动追踪功能。使驾驶更安全的同时,提高了产品的交互性。  ......
  • 网络代理技术:保障隐私与增强安全
    在当今高度互联的数字世界中,网络代理技术正逐渐崭露头角,为用户提供了保护隐私和增强网络安全的有力工具。本文将深入探讨Socks5代理、IP代理以及它们在网络安全、爬虫开发中的应用,助您更好地理解和利用这些技术。1.Socks5代理:多协议支持与高级功能Socks5代理是一种强大的代理协议,......
  • 什么是 TypeScript 的类型增强功能
    TypeScript的类型增强(TypeAugmentation)是一种功能,它允许您扩展现有类型的成员,以添加新的属性或方法,以及修改已有属性或方法的类型定义。这个功能让您可以更好地适应第三方库或原始代码,以便在不修改源代码的情况下添加自定义的类型信息。在本文中,我将详细介绍TypeScript的类型增......
  • 利用不可识别的人脸来增强人脸识别性能Harnessing Unrecognizable Faces for Improvin
    灰色标记:可以日后引用的观点红色标记:好的写法、语句、单词紫色标记:文章重点黄色标记:寻常突出文章评论::创新点::主要内容::gallery中的样本通常是人为采集并精心挑选的,它们具有较好的可识别性;然而,query通常来自于真实场景,它们受多种因素干扰如像素等等。......
  • Angular 里的 Module 增强
    Angular模块增强:扩展你的数据模型Angular是一个强大的前端框架,但在某些情况下,我们可能需要对其内置模型进行一些自定义。这时,Angular的模块增强(ModuleAugmentation)就派上了用场。在本文中,我们将深入研究Angular模块增强的细节,以及如何利用它来增强数据模型。什么是模块增......
  • 什么是 TypeScript 的类型增强功能
    TypeScript的类型增强(TypeAugmentation)是一种功能,它允许您扩展现有类型的成员,以添加新的属性或方法,以及修改已有属性或方法的类型定义。这个功能让您可以更好地适应第三方库或原始代码,以便在不修改源代码的情况下添加自定义的类型信息。在本文中,我将详细介绍TypeScript的类型......