-------------------------------------2007-6-26--------------------

-------------------------------------2007-6-26--------------------

 

国内进口是指:公司购买国内厂商的东西

国外进口是指:公司购买国外厂商的东西

 

创建含表头的<itab>….不含表头的<itab>…..<wa>

Defining an Internal Table

根据其它的结构构造新的itab

向内表加入数据:

内表排序

使用行组的级别控制.

逐个组件的从db中读取数据

 

 

创建含表头的<itab>….不含表头的<itab>…..<wa>

data: itab_marc like marc occurs 5 with header line,

      itab_marc1 like marc occurs 1,

      line_marc like marc.

 

Defining an Internal Table

DATA itab TYPE itabtype [WITH HEADER LINE].

DATA itab LIKE itab [WITH HEADER LINE].

DATA itab [TYPE linetype|LIKE lineobj] OCCURS n
          [WITH HEADER LINE].

 

根据其它的结构构造新的itab

data: begin of stb occurs 0.

        include structure stpox.

data: smatnr like mseg-matnr,

      flag.

data: end of stb.

 

向内表加入数据:

APPEND LINES OF <itab1> [FROM <n1>] [TO <n2>] TO <itab2>.

APPEND [<wa> TO|INITIAL LINE TO] <itab>.

INSERT [<wa> INTO|INITIAL LINE INTO] <itab> [INDEX <idx>].

INSERT LINES OF <itab1> [FROM <n1>] [TO <n2>]

                        INTO <itab2> [INDEX <idx>].

 

内表排序

SORT <itab> [<order>] [AS TEXT]

   [BY <f1> [<order>] [AS TEXT] ... <fn> [<order>] [AS TEXT]].

 

Eg. SORT ITAB DESCENDING BY LAND WEIGHT ASCENDING.

   上句话首先根据其标准关键字进行排序,然后根据定义的LANDWEIGHT关键字进行排序

 

使用行组的级别控制.

<line>

                            

FIRST           内表的第一行

LAST             内表的最后一行

NEW <F>      行组的开头,与字段<f><f>剩余字段中的内容相同.

 

Eg.

DATA: BEGIN OF LINE,

         COL1 TYPE C,

         COL2 TYPE I,

         COL3 TYPE I,

      END OF LINE.

DATA ITAB LIKE LINE OCCURS 10.

LINE-COL1 = 'A'.

DO 3 TIMES.

   LINE-COL2 = SY-INDEX.

   LINE-COL3 = SY-INDEX ** 2.

   APPEND LINE TO ITAB.

ENDDO.

LINE-COL1 = 'B'.

DO 3 TIMES.

   LINE-COL2 = 2 * SY-INDEX.

   LINE-COL3 = ( 2 * SY-INDEX ) ** 2.

   APPEND LINE TO ITAB.

ENDDO.

 

loop at itab into line.

  write: / line-col1, line-col2, line-col3.

endloop.

clear line.

uline.

skip.

 

LOOP AT ITAB INTO LINE.

WRITE: / LINE-COL1, LINE-COL2, LINE-COL3.

   AT END OF COL1.

      SUM.

      ULINE.

      WRITE: / LINE-COL1, LINE-COL2, LINE-COL3.

      SKIP.

   ENDAT.

 

   AT LAST.

      SUM.

      ULINE.

      WRITE: / LINE-COL1, LINE-COL2, LINE-COL3.

   ENDAT.

ENDLOOP.

 

逐个组件的从db中读取数据

l         To <wa>

SELECT ... INTO CORRESPONDING FIELDS OF <wa> ........

l         To <itab>

SELECT ... INTO CORRESPONDING FIELDS OF TABLE <itab> ........

l         Add <itab>

SELECT ... APPENDING CORRESPONDING FIELDS OF TABLE <itab> ........

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值