惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
T
Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
Intezer
C
Cyber Attacks, Cyber Crime and Cyber Security
The Register - Security
The Register - Security
量子位
Security Latest
Security Latest
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
C
CXSECURITY Database RSS Feed - CXSecurity.com
MyScale Blog
MyScale Blog
J
Java Code Geeks
Apple Machine Learning Research
Apple Machine Learning Research
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Spread Privacy
Spread Privacy
Jina AI
Jina AI
博客园 - 【当耐特】
P
Palo Alto Networks Blog
Last Week in AI
Last Week in AI
SecWiki News
SecWiki News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
G
GRAHAM CLULEY
宝玉的分享
宝玉的分享
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
有赞技术团队
有赞技术团队
T
Tor Project blog
H
Hacker News: Front Page
A
Arctic Wolf
NISL@THU
NISL@THU
A
About on SuperTechFans
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
V
V2EX
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
Know Your Adversary
Know Your Adversary
P
Privacy International News Feed
I
InfoQ
D
Docker
L
LINUX DO - 最新话题
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
U
Unit 42

博客园 - zhumk

Kindle DX/2最低程度中文化 ABAP:更新供应商Email地址 How to search for BAdIs IP41 - 维护计划中的日期和周期 如何升级Mac Mini(二代)内存 Kindle Collection编辑器 Kindle 汉化终结版 ABAP:密码输入框 SAP相关下载链接 ABAP:在Dynpro屏幕中使用Selection Screen BAPI:KBPP_EXTERN_UPDATE_CO, TCODE:CJ30/CJ40 第四部分 ALV popup based on classic style REUSE_ALV_POPUP_TO_SELECT function module ABAP: 如何让ALV Tree的注册事件在屏幕PAI之后触发 ABAP: Search Help for Date ABAP:运行中修改Table Control控件状态 BAPI:KBPP_EXTERN_UPDATE_CO, TCODE:CJ30/CJ40 第三部分 BAPI:KBPP_EXTERN_UPDATE_CO, TCODE:CJ30/CJ40 第二部分 BAPI:KBPP_EXTERN_UPDATE_CO, TCODE:CJ30/CJ40 第一部分 DynDNS免费动态域名解析
ABAP:WBS Element下层预算向上层汇总
zhumk · 2011-02-18 · via 博客园 - zhumk

看到标题立马会想到用递归实现,但是递归不好调试,容易出现错误,下面给出一种简单实现方法。

 typesbegin of ty_prhi,
          posnr like prhi-posnr,
          up   like prhi-up,
          down  like prhi-down.
   include type ty_wbs.
   typesend of ty_prhi.

   datalt_prhi type standard table of ty_prhi,
         ls_prhi type ty_prhi.
   field-symbols:<fs_prhi> like ls_prhi,
                  <fs_wbs> like gs_wbs.

   "1.0 需要将下层WBS上的预算上上层汇总
   " GT_WBS中只保存了本层的需求单预算,未包含下层的需求单预算
   lt_wbs[] gt_wbs[].
   sort lt_wbs by pspnr.

   select into corresponding fields of table lt_prhi
     from prhi
     for all entries in lt_wbs
     where posnr lt_wbs-pspnr.

   sort lt_wbs by pspnr.
   loop at lt_prhi assigning <fs_prhi>.
     read table lt_wbs into ls_wbs
        with key pspnr <fs_prhi>-posnr binary search.
     if sy-subrc 0.
       move-corresponding ls_wbs to <fs_prhi>.
     endif.
   endloop.

   "按层次倒序排列,将上层相同的排列在一起
   sort lt_prhi by stufe descending up ascending.
   "从底层往上层累加
   loop at lt_prhi into ls_prhi.
     read table lt_wbs assigning <fs_wbs>
        with key pspnr ls_prhi-up
        binary search.
     if sy-subrc eq 0.
       read table lt_wbs into ls_wbs
       with key pspnr ls_prhi-posnr
       binary search.

       "将当前层加到上层
       <fs_wbs>-zgssum <fs_wbs>-zgssum + ls_wbs-zgssum.
     endif.
   endloop.