登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

原来为了你

我的人生就是要一次次的超越

 
 
 

日志

 
 
 
 

Ranges  

2011-01-07 14:58:50|  分类: ABAP基础知识 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

ranges有四个字段:sign,option,low,high.

**********************************************************************ranges取数时,它的最大长度是9998,举例:
form frm_get_vbap_01 .

  
rangesl_r_vgbel      for lips-vgbel,                  "用于从vbak(vbap)取数
          l_r_vgbel_temp 
for lips-vgbel.                  "l_r_vgbel的每9998

  
data:   lt_vbak_temp   type table of typ_vbak,
          l_len          
type i value 0,
          l_count        
type i value 0,                  "统计loop l_r_vgbel,每次清空
          l_tabix        
type i value 0.                  "统计loop l_r_vgbel,每次不清空

*---汇总交货单中的订单号
  
loop at gt_lips into gw_lips.
    l_r_vgbel
-sign    'I'.
    l_r_vgbel
-option  'EQ'.
    l_r_vgbel
-low     gw_lips-vgbel.
    
append l_r_vgbel.
  
endloop.
  
sort l_r_vgbel by low.
  
delete adjacent duplicates from l_r_vgbel.
  l_len 
linesl_r_vgbel ).

  
if l_len > 9998.
    
loop at l_r_vgbel.
      
move-corresponding l_r_vgbel to l_r_vgbel_temp.
      
append l_r_vgbel_temp.

      l_count 
l_count + 1.
      l_tabix 
l_tabix + 1.

      
if  l_count 9998 or l_tabix l_len.
        
clear lt_vbak_temp.
        
select  vbeln
                vkorg
           
into corresponding fields of table lt_vbak_temp          "先选数到暂存表lt_lips_temp
           
from vbak
           
where vbeln in s_vbe_va
             
and vkorg in s_vkorg
             
and vbeln in l_r_vgbel_temp.                           "range9998
        
append lines of lt_vbak_temp to gt_vbak.                    "append to gt_vbak
*---append之后要清空
        
clear lt_vbak_temp.
        
clear l_r_vgbel_temp[].
        
clear l_count.
      
endif.
    
endloop.

  
else.
    
select vbeln
           vkorg
      
into corresponding fields of table gt_vbak                    "gt_vbak
      
from vbak
      
where vbeln in s_vbe_va
        
and vkorg in s_vkorg
        
and vbeln in l_r_vgbel.                                     "l_r_vgbel
  
endif.
endform.                    " FRM_GET_VBAP_01  
**********************************************************************内表用range删除
databegin of gt_01 occurs 0,
        sno 
type i,
        sname
(20),
      
end of gt_01.

do 59999 times.
  gt_01
-sno sy-index.
  gt_01
-sname sy-index.
  
append gt_01.
enddo.

do 59998 times.
  
rangesr_sno for gt_01-sno.
  r_sno
-sign    'I'.
  r_sno
-option  'EQ'.
  r_sno
-low     sy-index.
  
append r_sno.
enddo.

delete gt_01 where sno in r_sno."r_sno的数量没限制,至少对59998没限制

loop at gt_01.
  
write gt_01-sno.
endloop.

**********************************************************************range的合并
rangesr_sno for gt_01-sno.
rangesr_sno1 for gt_01-sno.
append lines of r_sno1 to r_sno.

  评论这张
 
阅读(434)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018