首页 > 其他分享 >FICO 资产负债表案例

FICO 资产负债表案例

时间:2024-01-22 15:57:32浏览次数:29  
标签:p1 &--------------------------------------------------------------------- Fo

*&---------------------------------------------------------------------*
*& 包含               ZRFI0058_FRM
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form FRM_GET_DATA
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_get_data .

  "获取本位币
  SELECT bukrs waers butxt FROM t001 INTO CORRESPONDING FIELDS OF TABLE gt_t001 WHERE bukrs = p_bukrs.

  "获取起初金额
  SELECT ryear,  rbukrs,racct,
    SUM( hslvt ) AS hslvt,
    SUM( hsl01 ) AS hsl01,
    SUM( hsl02 ) AS hsl02,
    SUM( hsl03 ) AS hsl03,
    SUM( hsl04 ) AS hsl04,
    SUM( hsl05 ) AS hsl05,
    SUM( hsl06 ) AS hsl06,
    SUM( hsl07 ) AS hsl07,
    SUM( hsl08 ) AS hsl08,
    SUM( hsl09 ) AS hsl09,
    SUM( hsl10 ) AS hsl10,
    SUM( hsl11 ) AS hsl11,
    SUM( hsl12 ) AS hsl12,
    SUM( hsl13 ) AS hsl13,
    SUM( hsl14 ) AS hsl14,
    SUM( hsl15 ) AS hsl15,
    SUM( hsl16 ) AS hsl16
     FROM faglflext
    INTO CORRESPONDING FIELDS OF TABLE @gt_faglflext
    WHERE rbukrs = @p_bukrs
    AND   ryear  = @p_gjahr
    AND   rldnr  = '0L'
   AND   racct  IN @s_racct
    GROUP BY ryear,rbukrs,racct.

  "计算期初汇总
  PERFORM frm_get_hslvt.

  CLEAR:lv_waers,lv_rate,lv_kurst.
  LOOP AT lt_fagsum INTO ls_fagsum.


    "勾选本位币
    READ TABLE gt_t001 INTO gs_t001  WITH KEY bukrs = ls_fagsum-rbukrs.
    IF sy-subrc = 0.
      lv_waers = gs_t001-waers.
      lv_kurst = ''.
      lv_rate  = ''.
    ENDIF.


    "勾选集团货币
    IF p_tcurr IS NOT INITIAL.
**********选择 001货币资金  004其他非流动资产取标准汇率
      IF p_001 IS NOT INITIAL OR p_004 IS NOT INITIAL.
        PERFORM frm_get_exch_rate.
      ELSE.
**********其他项目从汇率自建表取数
        PERFORM frm_get_zf0i058_rate.
      ENDIF.
      ls_fagsum-hslvt = ls_fagsum-hslvt * lv_rate.
    ENDIF.
  ENDLOOP.
**********计算公式



*********汇总数据到输出表
  LOOP AT gt_acc INTO gs_acc .
    READ TABLE lt_fagsum INTO ls_fagsum WITH KEY racct = gs_acc-saknr  rbukrs = gs_acc-bukrs.
    IF sy-subrc = 0.
      gs_acc-hslvt  = ls_fagsum-hslvt.
    ENDIF.

    MODIFY gt_acc FROM gs_acc.
    CLEAR gs_acc.
  ENDLOOP.

  "按报表名称和项目汇总
  LOOP AT gt_acc INTO gs_acc.
    CLEAR:gs_acc-saknr,gs_acc-txt50.
    COLLECT gs_acc INTO lt_acc.
  ENDLOOP.

  "整理输出ALV
  LOOP AT gt_zfi0058 INTO gs_zfi0058.
    gs_out-zreport = ls_acc-zreport.
    gs_out-zname = gs_zfi0058-zname.
    gs_out-zrow    = gs_zfi0058-zrow.
    gs_out-zformula = gs_zfi0058-zformula.
    READ TABLE  lt_acc INTO ls_acc WITH  KEY  zreport = gs_zfi0058-zreport
                                              zname   = gs_zfi0058-zname.
    IF sy-subrc = 0.
      gs_out-zamount = ls_acc-hslvt.
    ENDIF.

    APPEND gs_out TO gt_out.
    CLEAR gs_out.
  ENDLOOP.

  "弹框更新数据
  PERFORM frm_popup_data.


ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_DISPLAY
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_display .

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
      i_callback_program     = sy-repid
*     i_callback_pf_status_set = 'FRM_PF_STATUS'
*     i_callback_user_command  = 'FRM_USER_COMMAND'
      i_callback_top_of_page = 'FRM_TOP_OF_PAGE'
      is_layout_lvc          = gs_layout
      it_fieldcat_lvc        = gt_fieldcat
*     I_DEFAULT              = 'X'
      i_save                 = 'A'
    TABLES
      t_outtab               = gt_out[].
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.
ENDFORM.

*&---------------------------------------------------------------------*
*& Form FRM_FIELDCAT
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_fieldcat .
  DEFINE fieldcat.
    gs_fieldcat-key       = &1.
    gs_fieldcat-fieldname = &2.
    gs_fieldcat-scrtext_l = &3.
*    gs_fieldcat-edit      = &4.
*    gs_fieldcat-no_zero   = &5.
*    gs_fieldcat-ref_tabname = &6.
*    gs_fieldcat-ref_fieldname = &7.
  APPEND gs_fieldcat TO gt_fieldcat.
  END-OF-DEFINITION.

  fieldcat  ''  'ZNAME'   '项目'     .
  fieldcat  ''  'ZAMOUNT'   '金额'     .
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_LAYOUT
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_layout .
  gs_layout-cwidth_opt = 'X'.
  gs_layout-zebra        = 'X' .
ENDFORM.

*&---------------------------------------------------------------------*
*& Form frm_init_data
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_init_data .
*获取报表行
  SELECT *
    FROM zzt_zfi0058
    INTO CORRESPONDING FIELDS OF TABLE gt_zfi0058
    WHERE zreport IN s_zreport.

*获取报表科目信息
  SELECT *
    FROM zzt_zfi0058_acc
    INTO CORRESPONDING FIELDS OF TABLE gt_acc
    WHERE bukrs = p_bukrs
    AND  zreport IN s_zreport.


  LOOP AT gt_acc INTO gs_acc.
    s_racct-sign = 'I'.
    s_racct-option = 'EQ'.
    s_racct-low = gs_acc-saknr.
    APPEND s_racct.
  ENDLOOP.


ENDFORM.
*&---------------------------------------------------------------------*
*& Form frm_get_display
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_get_display .
  SELECT *
    FROM zzt_zfi0058_log
    INTO CORRESPONDING FIELDS OF TABLE gt_out
    WHERE bukrs = p_bukrs
    AND   gjahr = p_gjahr
    AND   monat = p_monat
    AND   zreport IN s_zreport.



ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_GET_exch_rate
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_get_exch_rate .
  DATA lv_datum TYPE sy-datum.


  CLEAR: lv_datum.

  lv_datum = p_gjahr && p_monat && 01.
  CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
    EXPORTING
      i_date = lv_datum
    IMPORTING
      e_date = lv_datum.



  "获取汇率
  CALL FUNCTION 'BAPI_EXCHANGERATE_GETDETAIL'
    EXPORTING
      rate_type  = 'P'
      from_curr  = lv_waers
      to_currncy = 'CNY'
      date       = lv_datum
    IMPORTING
      exch_rate  = ls_exch.
*        return     = ls_return.

  IF ls_exch IS INITIAL.
    MESSAGE '请维护' && p_bukrs && p_gjahr && p_monat && lv_waers && '对应的汇率 'TYPE 'S' DISPLAY LIKE 'E'.
    LEAVE LIST-PROCESSING.

  ENDIF.

  lv_rate = ls_exch-exch_rate.
  lv_kurst = '04'.
  lv_waers = 'CNY'.
ENDFORM.
*----------------------------------------------------------------------*
*       FORM FRM_TOP_OF_PAGE
*----------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM  frm_top_of_page.
  DATA lt_listheader TYPE slis_t_listheader. "抬头标题
  DATA ls_listheader TYPE slis_listheader.

  DATA lv_waers TYPE t001-waers.
  DATA lv_ktext TYPE tcurt-ktext.


  READ TABLE gt_t001 INTO gs_t001 INDEX 1.
  IF p_fcurr IS NOT INITIAL.  "本位币
    lv_waers = gs_t001-waers.
  ELSE.                       "集团货币默认CNY
    lv_waers = 'CNY'.
  ENDIF.

  SELECT SINGLE ktext INTO lv_ktext FROM tcurt WHERE spras = 1 AND waers = lv_waers.


  CLEAR ls_listheader.
  ls_listheader-typ = 'H'.    "抬头信息类别  H为标题 S为内容
  ls_listheader-info = gs_t001-butxt && p_gjahr && '年'  && p_monat &&  '月' && lv_ktext.
  APPEND ls_listheader TO lt_listheader.

  CLEAR ls_listheader.
  ls_listheader-typ = 'S'.
  ls_listheader-key = lv_report.
*  ls_listheader-info =
  APPEND ls_listheader TO lt_listheader.


  CLEAR ls_listheader.
  ls_listheader-typ = 'S'.
  ls_listheader-key = lv_waers.
  APPEND ls_listheader TO lt_listheader.



  "调用显示页头函数
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary = lt_listheader
      i_logo             = 'UNICHARM'.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form frm_get_zf0i058_rate
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_get_zf0i058_rate .
  SELECT  *
    FROM zzt_zfi0058_rate
    INTO CORRESPONDING FIELDS OF TABLE gt_rate
    WHERE gjahr = p_gjahr
    AND   monat = p_monat
    AND   fcurr = lv_waers.


  IF gt_rate IS INITIAL.
    MESSAGE '请维护' && p_bukrs && p_gjahr && p_monat && lv_waers && '对应的汇率 'TYPE 'S' DISPLAY LIKE 'E'.
    LEAVE LIST-PROCESSING.

  ENDIF.


  READ TABLE gt_rate INTO gs_rate  INDEX 1.


  IF p_s IS NOT INITIAL.
    lv_rate = gs_rate-ukurs_s.
    lv_kurst = '01'.
  ELSEIF p_hy IS NOT INITIAL.
    lv_rate = gs_rate-ukurs_hy.
    lv_kurst = '02'.
  ELSE.
    lv_rate = gs_rate-ukurs_y.
    lv_kurst = '03'.
  ENDIF.

  lv_waers = 'CNY'.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_CHECK_DATA
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_check_data .
  IF p_gjahr <= 2021.
    MESSAGE '仅可查看2022年后的报表数据!' TYPE 'S'DISPLAY LIKE 'E'.
    STOP.
  ENDIF.


  IF p_monat > 12.
    MESSAGE  '禁止输入大于12的期间!' TYPE 'S' DISPLAY LIKE 'E'.
    STOP.
  ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form frm_get_hslvt
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_get_hslvt .
  DATA: lv_hslvt TYPE faglflext-hslvt,
        gv_monat TYPE char2.


  gv_monat  = p_monat.

  CLEAR:lv_hslvt.
  LOOP AT gt_faglflext INTO gs_faglflext.
    CLEAR:lv_hslvt,ls_fagsum.
    DATA(ls_sum) = gs_faglflext.
    MOVE-CORRESPONDING:gs_faglflext TO ls_fagsum.
    CLEAR ls_fagsum-hslvt.
    DO gv_monat +  1 TIMES VARYING lv_hslvt FROM ls_sum-hslvt NEXT ls_sum-hsl01.
      ls_fagsum-hslvt  = ls_fagsum-hslvt + lv_hslvt.
    ENDDO.

    APPEND ls_fagsum TO lt_fagsum.

  ENDLOOP.
  "得到根据期间汇总后计算的金额
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_POPUP_DATA
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_popup_data .
  lv_msg =  p_gjahr && p_monat && p_bukrs && lv_waers  &&'数据已存在,是否更新!'.
  CALL FUNCTION 'POPUP_TO_CONFIRM'
    EXPORTING
      text_question         = lv_msg
      icon_button_1         = '是 '
      icon_button_2         = '否 '
      default_button        = '2'
      display_cancel_button = 'X'
      start_column          = 25
      start_row             = 6
    IMPORTING
      answer                = lv_answer
    EXCEPTIONS
      text_not_found        = 1
      OTHERS                = 2.
  IF lv_answer = 1.

    LOOP AT gt_out INTO gs_out.
      gs_update-bukrs = p_bukrs.
      gs_update-gjahr = p_gjahr.
      gs_update-monat = p_monat.
      gs_update-monat = p_monat.
      gs_update-zreport = gs_out-zreport.
      gs_update-zrow     = gs_out-zrow.
      gs_update-zname   = gs_out-zname.
      gs_update-zamount = gs_out-zamount.
      gs_update-zwaers  = lv_waers.
      gs_update-zkurst  = lv_kurst..
      gs_update-zukurs  = lv_rate.
      APPEND gs_update TO gt_update.
      CLEAR gs_update.
    ENDLOOP.

    SORT gt_update BY zreport zname zrow.
    IF gt_update[] IS NOT INITIAL.
      MODIFY  zzt_zfi0058_log FROM TABLE gt_update.
      COMMIT WORK AND WAIT.
    ENDIF.
  ELSE.

*    CLEAR gt_out[].
*    PERFORM frm_get_display.
  ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_GET_SCREEN
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_get_screen .


  LOOP AT SCREEN.
    IF p_fcurr IS NOT INITIAL.
      IF screen-group1 = 'M3' .
        screen-active = '0'.
      ELSE.
        screen-active = '1'.
      ENDIF.
    ENDIF.

    IF ( p_001 IS NOT INITIAL OR p_004 IS NOT INITIAL  ) AND p_tcurr IS NOT INITIAL.
      IF screen-group1 = 'M3' .
        screen-active = '0'.
      ELSE.
        screen-active = '1'.
      ENDIF.
    ENDIF.


    MODIFY SCREEN.
  ENDLOOP.
ENDFORM.

 

标签:p1,&---------------------------------------------------------------------,Fo
From: https://www.cnblogs.com/Anyohh233/p/17980197

相关文章

  • FICO清账程序
    *&---------------------------------------------------------------------**&ReportZFIP001*&*&---------------------------------------------------------------------**&*&*&---------------------------------------------------......
  • FICO 资产负债表
    *&---------------------------------------------------------------------**&ReportZFIR_004*&---------------------------------------------------------------------**&*&-----------------------------------------------------------------......
  • FICO 三大报表运算维护表计算规则(表里维护行次的)
    1+2+3"内表整理科目报表项目汇总后计算公式1+2+3DATA:lv_strTYPEstring,lv_str1TYPEstring,lt_numTYPETABLEOFstring,lt_signTYPETABLEOFstring,lv_indexTYPECHAR4,lv_iTYPEi,lv_sumTYPEpDECIMALS3.......
  • 巴拉巴拉 HANA CLOUD 版本的ODATE 接口案例
    今天分享一个S4HC的ODATA接口这是一个维护PM中设备的的扣子 REPORT  YTEST029.DATA: LO_HTTP_CLIENT TYPE REF TO IF_HTTP_CLIENT.DATA: LO_HTTP_CLIENT2 TYPE REF TO IF_HTTP_CLIENT.DATA: RESPONSE TYPE STRING.DATA:IV_URL TYPE STRING.根据SM59中配置......
  • 案例:常用组件与布局
    介绍HarmonyOSArkUI提供了丰富多样的UI组件,您可以使用这些组件轻松地编写出更加丰富、漂亮的界面。在本篇Codelab中,您将通过一个简单的购物社交应用示例,学习如何使用常用的基础组件和容器组件。本示例主要包含:“登录”、“首页”、“我的”三个页面。相关概念Text:显......
  • 中断机制之中断协商案例深度解析 上
    说明具体来说,当一个线程调用interrupt()时:如果线程处于正常活动状态,那么会将该线程的中断标志设置为true,仅此而已。被设置中断标志的线程将继续正常运行,不受影响。所以,innerupt()并不能真正的中断线程,需要被调用的线程自己进行配合才行。如果线程处于被阻塞状态(例如处于sl......
  • springboot整合springSecurity入门案例(实现登录,记住我等常用标签使用)
    一,整合进依赖每个依赖都标了注释,大家可以按照自己需要的来添加,置于配置问件啥的,大家可以参考springboot+mybatisplus+redis整合(附上脚手架完整代码)<!--主要就是加了这个依赖--><dependency><groupId>org.springframework.security</groupId><artifact......
  • mybatis一对多,多对一经典案例及优缺点分析
    准备数据新建俩张表(student表,clalss表)sql语句如下:createtablestudent(sIdintprimarykeyauto_increment,sNamevarchar(20)notnull,cIdintnotnull,constraintf_sid_cidforeignkey(cId)referencesclass(cId))engine=innodb,charset=utf8;createtableclass......
  • 云计算-代码开发流水线及CCE容器集群使用案例
    总结自己在使用华为云商业CI/CD代码流水和CCE容器集群部署案例学无止尽啊新项目构建镜像使用华为codearts代码流水线,详细见官方文档https://support.huaweicloud.com/productdesc-devcloud/devcloud_pdtd_00000.html以部署report-service构建测试镜像为例dockerfile文件前端FRO......
  • 小程序开发实战案例五 | 小程序如何嵌入H5页面
    在接入小程序过程中会遇到需要将H5页面集成到小程序中情况,今天我们就来聊一聊怎么把H5页面塞到小程序中。 本篇文章将会从下面这几个方面来介绍:小程序承载页面的前期准备小程序如何承载H5小程序和H5页面如何通讯小程序和H5页面的相互跳转 小程序承载页面的......