메뉴 건너뛰기

SAP 한국 커뮤니티

How to read same field from D.Base into two fields of ITAB

sapjoy 2006.12.12 21:16 조회 수 : 3690 추천:44

How to read same field from D.Base into two fields of ITAB
Can any one help in how can we read data into 2 fields(like VBELN, VBELN1) in internal table from data base table(VBAK) of one field(VBELN)?

EX:
data: begin of itab occurs 0,
        vbeln like vbak-vbeln,
        vbeln1 like vbak-vbeln,
        end of itab.

For this how can we write select statement.

----------------------------------------------------------------------------------------

You can write select statment as follows,

select single vbeln vbeln from vbak
    into (itab-vbeln, itab-vbeln1 )
    where <condition>.

----------------------------------------------------------------------------------------

Try the following code:

tables vbak.
data: begin of itab occurs 0,
                vbeln like vbak-vbeln,
                vbeln1 like vbak-vbeln,
        end of itab.

select vbeln vbeln from vbak into (itab-vbeln,itab-vbeln1) .
     append itab.
endselect.

loop at itab.
      write : / itab-vbeln, itab-vbeln1.
endloop.

----------------------------------------------------------------------------------------

One of the possible way, try this:

data: begin of itab1,
             banfn1 like eban-banfn,
             banfn2 like eban-banfn,
             rest(800),
        end of itab1.

select * into itab1 from eban.
      itab1-banfn2 = itab1-banfn1.
      write:/ 'banfn 1', itab1-banfn1, ' banfn 2', itab1-banfn2.
endselect.

----------------------------------------------------------------------------------------

This should be better:

TABLES vbak.

DATA: BEGIN OF itab OCCURS 0,
                     vbeln LIKE vbak-vbeln,
                     vbeln1 LIKE vbak-vbeln,
             END OF itab.

SELECT vbeln vbeln FROM vbak INTO table itab.
  
LOOP AT itab.
       WRITE : / itab-vbeln, itab-vbeln1.
ENDLOOP.

번호 제목 글쓴이 날짜 조회 수
107 ALV 활용해 보기 [4] file 박진만 2007.06.28 3727
106 <b>[완료]</b>NW04 설치시 에러 몇가지 해결법 [3] file Abap consultant 2009.03.13 3715
105 OPEN SQL 사용법인데, 내용이 정리가 잘 되어 있네요 [21] file 노름마치 2008.06.09 3712
104 F1 도움말 존닭 2014.12.11 3696
» How to read same field from D.Base into two fields of ITAB [1] sapjoy 2006.12.12 3690
102 새로운 Print format 추가하기 [5] file 이명환 2007.10.18 3679
101 Overview transport requests for all systems and clients [3] file 노름마치 2009.11.05 3676
100 workflow - purchase order의 예 [2] file gauguin 2008.06.25 3675
99 사용자별 Upload & Download 기본값 [1] 홍성현 2007.08.09 3661
98 "GRAPH_HPGL" 수치데이터를 그래프로 표시해주는 펑션 [1] 홍성현 2007.08.08 3643
97 How to search a string in programs [3] 김대영 2007.04.24 3614
96 widget을 이용한 Job monitor 데모 [1] 해처리 2007.10.24 3603
95 OPEN SQL 메모리 OVERLOAD 덤프시.. [1] sapjoy 2007.04.04 3603
94 Progress Bar 표기 로직 [1] 양키(이경환) 2014.02.13 3598
93 SQL 추적 사용하기 [1] 푸른밤 2007.07.31 3580
92 Defining and Implementing Business Add-ins (BADI) (Step-by-step with screenshots) [3] file 노름마치 2009.07.10 3543
91 Number_Range_사용법 [13] file xcomedy 2008.07.19 3539
90 SAP Tuning-실무 [11] file 대전희망 2008.06.20 3537
89 SAP Table Reference(원본 연관관계) [5] file 죽돌이 2009.01.28 3481
88 To display icons on the Selection Screen [5] file 노름마치 2009.07.10 3453