#PARAN SILVERLIGHT#
  • Tistory
    • 관리자
    • 글쓰기
Carousel 01
Carousel 02
Previous Next

Internal Table : READ, APPEND, MODIFY AND COLLECT

ERP/SAP/R/3 2011. 4. 6. 11:32
다음 프로그램을 디버깅하면서 이해할 수 있습니다.

  *&---------------------------------------------------------------------*
*& Report  ZTEST_it_01ERNAL_TABLE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZTEST_it_01ERNAL_TABLE.

tables : kna1.

* Header가 있는 internal Table 선언
DATA : BEGIN OF it_01 OCCURS 0,
  vbeln like vbak-vbeln,
  matnr type matnr,
  cnt type I,
  end of it_01.

* 특정 table과 같은 구조로 선언
data : it_02 like kna1 occurs 0 with header line.

* it_01 Table에 data를 append한다.
it_01-vbeln = 'A'.
it_01-matnr = 'AA'.
it_01-cnt = 1.
append it_01.

it_01-matnr = 'AB'.
it_01-cnt = 2.
append it_01.

it_01-vbeln = 'B'.
it_01-matnr = 'BB'.
it_01-cnt = 3.
append it_01.

it_01-vbeln = 'C'.
it_01-matnr = 'CC'.
it_01-cnt = 4.
append it_01.
clear it_01.


write : /'it_01에 값을 확인'.
LOOP AT it_01.
  write : / it_01-vbeln,it_01-matnr,it_01-cnt.
ENDLOOP.
write : /.

write : /'int-vbeln = A 값을 확인'.
LOOP AT it_01 where vbeln = 'A'.
  write : / it_01-vbeln,it_01-matnr,it_01-cnt.
ENDLOOP.
write : /.

write : /'Read commend(with key) 사용 : IF sy-subrc = 0.을 사용하여 data를  확인'.
read table it_01 with key vbeln = 'A'.
  IF sy-subrc = 0.
      write : / it_01-vbeln,it_01-matnr,it_01-cnt.
  ENDIF.
write : /.

write : /'Read commend(index) 사용 : IF sy-subrc = 0.을 사용하여 data를  확인'.
read table it_01 index 3.
  IF sy-subrc = 0.
      write : / it_01-vbeln,it_01-matnr,it_01-cnt.
  ENDIF.
write : /.


* index가 3인 it_01에 insert
write : /'insert후  값을 확인'.
it_01-vbeln = 'D'.
it_01-matnr = 'DD'.
it_01-cnt = 5.
insert it_01 index 3.
  clear it_01.
  LOOP AT it_01.
  write : / it_01-vbeln,it_01-matnr,it_01-cnt.
ENDLOOP.
write : /.

* 기본 적으로 append와 같이 마지막에 추가되는 것은 같으나 이미 저장된 record중에 character type의 field를 비교하여
* 같은 값으로 이미 저장되어 있는 record가 있으면 수자타입의 필드는 기존의 필드에 현재 header에 있는 값은 더한다.

write : /'collect후   값을 확인'.
it_01-vbeln = 'A'.
it_01-matnr = 'AB'.
it_01-cnt = 2.
collect it_01.
  clear it_01.
  LOOP AT it_01.
  write : / it_01-vbeln,it_01-matnr,it_01-cnt.
ENDLOOP.
write : /.


* it_01의 index가 3인 record를 수정한다.
write : /'modify후   값을 확인'.
LOOP AT it_01.
  it_01-vbeln = 'Z'.
*  modify it_01.
  modify it_01 index 3.
  clear it_01.

ENDLOOP.

  LOOP AT it_01.
  write : / it_01-vbeln,it_01-matnr,it_01-cnt.
ENDLOOP.
write : /.

* it_01의 contents를 비운다.
  write : /'refresh 후   값을 확인'.
refresh it_01.
  LOOP AT it_01.
  write : / it_01-vbeln,it_01-matnr,it_01-cnt.
ENDLOOP.
write : /.

write /'end Program'.
저작자표시 비영리 (새창열림)
블로그 이미지

파란실버라이트

To remember the time when I started learning Silver Light!

,

카테고리

  • Inforamtion Technology (281)
    • DESIGN PATTERN (33)
      • 실용주의 디자인패턴 (29)
    • SOFTWARE ENGINEERING (21)
      • Art Of Readable Code (12)
      • Object Oriented Programming (6)
      • TDD (2)
    • FRAMEWORK (22)
      • Spring.net (2)
      • LightSwitch (20)
    • PROGRAMING (58)
      • C# (20)
      • .NET (6)
      • HTML5 (7)
      • ASP.NET (9)
      • SILVERLIGHT (7)
      • Ruby On Rails (6)
    • PROJECT MANAGEMENT (10)
      • SW Version Management (7)
      • Schedulring Management (1)
    • BOOKS (18)
    • MOBILE APP (1)
      • SENCHA TOUCH (1)
    • SECURITY (5)
    • MES (1)
    • B2B (14)
      • WEBMETHODS (4)
    • ERP (53)
      • SAP/R/3 (51)
    • ABOUT TOOLS (2)
    • FUNDAMENT CONCEPT (21)
    • SOA BPM (22)
    • PORTFOLIO (0)

태그목록

  • 병렬
  • 프로그래밍
  • 동시성

최근에 받은 트랙백

글 보관함

링크

파란실버라이트

블로그 이미지

To remember the time when I started learning Silver Light!

LATEST FROM OUR BLOG

RSS 구독하기

LATEST COMMENTS

BLOG VISITORS

  • Total :
  • Today :
  • Yesterday :

Copyright © 2015 Socialdev. All Rights Reserved.

티스토리툴바