DATA : it_t001l LIKE t001l OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF itab OCCURS 0,
werks TYPE werks_d,
lgort TYPE lgort_d,
lgobe TYPE lgobe,
matnr TYPE matnr,
END OF itab.
** 전, 늘 이렇게 써 왔는데요 ==> 이렇게 쓰지 말고.............................................
** LOOP AT it_t001l.
** itab-lgobe = it_t001l-lgobe.
** MODIFY itab TRANSPORTING lgobe WHERE werks = it_t001l-werks
** AND lgort = it_t001l-lgort.
** ENDLOOP.
** 이렇게 써야해요..............................................
CLEAR itab[].
SELECT * FROM mard INTO CORRESPONDING FIELDS OF TABLE itab
CLEAR it_t001l[].
SELECT * INTO TABLE it_t001l FROM t001l CLIENT SPECIFIED
WHERE mandt = sy-mandt.
SORT itab BY werks lgort.
SORT it_t001l BY werks lgort.
LOOP AT it_t001l.
READ TABLE itab WITH KEY werks = it_t001l-werks
lgort = it_t001l-lgort
BINARY SEARCH.
CHECK sy-subrc IS INITIAL.
LOOP AT itab FROM sy-tabix.
IF itab-werks <> it_t001l-werks OR
itab-lgort <> it_t001l-lgort.
EXIT.
ENDIF.
itab-lgobe = it_t001l-lgobe.
MODIFY itab.
ENDLOOP.
ENDLOOP.
* BINARY SEARCH 하실땐 반드시 SORT 부터 하시구요....
댓글 6
-
김창훈
2007.08.29 23:35
-
鵬의 날개
2007.09.19 23:39
한가지 추가한다면...
전체 Loop 안의 Read 할때 Binary Search 할때 Transporting No Fields 를 추가해 주시면 작은 차이지만 더 낫습니다...^^
-
노름마치
2007.09.21 23:58
* 이케요?
** 이렇게 쓰지 말고.............................................
** LOOP AT it_t001l.
** itab-lgobe = it_t001l-lgobe.
** MODIFY itab TRANSPORTING lgobe WHERE werks = it_t001l-werks
** AND lgort = it_t001l-lgort.
** ENDLOOP.
** 이렇게 써야해요..............................................
*" 자재명
DATA it_makt LIKE makt OCCURS 0 WITH HEADER LINE.
IF NOT ITAB[] IS INITIAL.
CLEAR it_makt[].
SELECT matnr maktx
INTO CORRESPONDING FIELDS OF TABLE it_makt
FROM makt
FOR ALL ENTRIES IN itab
WHERE matnr EQ itab-matnr
AND spras EQ sy-langu.
SORT it_makt BY matnr.
DELETE ADJACENT DUPLICATES FROM it_makt COMPARING matnr.
SORT itab BY matnr.
LOOP AT it_makt.
READ TABLE itab WITH KEY matnr = it_makt-matnr
BINARY SEARCH
TRANSPORTING NO FIELDS.
CHECK sy-subrc IS INITIAL.
LOOP AT itab FROM sy-tabix.
IF itab-matnr <> it_makt-matnr.
EXIT.
ENDIF.
itab-maktx = it_makt-maktx.
MODIFY itab.
ENDLOOP.
ENDLOOP.
ENDIF.
*" 플랜트명
DATA it_t001w LIKE t001w OCCURS 0 WITH HEADER LINE.
CLEAR it_t001w[].
SELECT * INTO TABLE it_t001w FROM t001w CLIENT SPECIFIED
WHERE mandt = sy-mandt.
SORT it_t001w BY werks.
SORT itab BY werks.
LOOP AT it_t001w.
READ TABLE itab WITH KEY werks = it_t001w-werks
BINARY SEARCH
TRANSPORTING NO FIELDS.
CHECK sy-subrc IS INITIAL.
LOOP AT itab FROM sy-tabix.
IF itab-werks <> it_t001w-werks.
EXIT.
ENDIF.
itab-name1 = it_t001w-name1.
MODIFY itab.
ENDLOOP.
ENDLOOP.
*" 저장위치명
DATA it_t001l LIKE t001l OCCURS 0 WITH HEADER LINE.
CLEAR it_t001l[].
SELECT * INTO TABLE it_t001l FROM t001l CLIENT SPECIFIED
WHERE mandt = sy-mandt.
SORT it_t001l BY werks lgort.
SORT itab BY werks lgort.
LOOP AT it_t001l.
READ TABLE itab WITH KEY werks = it_t001l-werks
lgort = it_t001l-lgort
BINARY SEARCH
TRANSPORTING NO FIELDS.
CHECK sy-subrc IS INITIAL.
LOOP AT itab FROM sy-tabix.
IF itab-werks <> it_t001l-werks OR
itab-lgort <> it_t001l-lgort.
EXIT.
ENDIF.
itab-lgobe = it_t001l-lgobe.
MODIFY itab.
ENDLOOP.
ENDLOOP.
*" 자재유형명
DATA it_t134t LIKE t134t OCCURS 0 WITH HEADER LINE.
CLEAR it_t134t[].
SELECT * INTO TABLE it_t134t FROM t134t CLIENT SPECIFIED
WHERE mandt = sy-mandt
AND spras = sy-langu.
SORT it_t134t BY mtart.
SORT itab BY mtart.
LOOP AT it_t134t.
READ TABLE itab WITH KEY mtart = it_t134t-mtart
BINARY SEARCH
TRANSPORTING NO FIELDS.
CHECK sy-subrc IS INITIAL.
LOOP AT itab FROM sy-tabix.
IF itab-mtart <> it_t134t-mtart.
EXIT.
ENDIF.
itab-mtbez = it_t134t-mtbez.
MODIFY itab.
ENDLOOP.
ENDLOOP.
* 회사명
CLEAR : it_t001[].
SELECT * INTO TABLE it_t001 FROM t001 CLIENT SPECIFIED
WHERE mandt = sy-mandt.
SORT it_t001 BY bukrs.
SORT gt_display BY bukrs.
LOOP AT it_t001.
READ TABLE gt_display WITH KEY bukrs = it_t001-bukrs
BINARY SEARCH
TRANSPORTING NO FIELDS.
CHECK sy-subrc IS INITIAL.
LOOP AT gt_display FROM sy-tabix.
IF gt_display-bukrs <> it_t001-bukrs.
EXIT.
ENDIF.
gt_display-butxt = it_t001-butxt.
MODIFY gt_display.
ENDLOOP.
ENDLOOP.
* 평가클래스명
CLEAR : it_t025t[].
SELECT * INTO TABLE it_t025t FROM t025t CLIENT SPECIFIED
WHERE mandt = sy-mandt
AND spras = sy-langu.
SORT it_t025t BY bklas.
SORT gt_display BY bklas.
LOOP AT it_t025t.
READ TABLE gt_display WITH KEY bklas = it_t025t-bklas
BINARY SEARCH
TRANSPORTING NO FIELDS.
CHECK sy-subrc IS INITIAL.
LOOP AT gt_display FROM sy-tabix.
IF gt_display-bklas <> it_t025t-bklas.
EXIT.
ENDIF.
gt_display-bkbez = it_t025t-bkbez.
MODIFY gt_display.
ENDLOOP.
ENDLOOP.
* 자재그룹
CLEAR : it_t023t[].
SELECT * INTO TABLE it_t023t FROM t023t CLIENT SPECIFIED
WHERE mandt = sy-mandt
AND spras = sy-langu.
SORT it_t023t BY matkl.
SORT gt_display BY matkl.
LOOP AT it_t023t.
READ TABLE gt_display WITH KEY matkl = it_t023t-matkl
BINARY SEARCH
TRANSPORTING NO FIELDS.
CHECK sy-subrc IS INITIAL.
LOOP AT gt_display FROM sy-tabix.
IF gt_display-matkl <> it_t023t-matkl.
EXIT.
ENDIF.
gt_display-wgbez = it_t023t-wgbez.
MODIFY gt_display.
ENDLOOP.
ENDLOOP.
* 외부자재그룹
CLEAR : it_twewt[].
SELECT * INTO TABLE it_twewt FROM twewt CLIENT SPECIFIED
WHERE mandt = sy-mandt
AND spras = sy-langu.
SORT it_twewt BY extwg.
SORT gt_display BY extwg.
LOOP AT it_twewt.
READ TABLE gt_display WITH KEY extwg = it_twewt-extwg
BINARY SEARCH
TRANSPORTING NO FIELDS.
CHECK sy-subrc IS INITIAL.
LOOP AT gt_display FROM sy-tabix.
IF gt_display-extwg <> it_twewt-extwg.
EXIT.
ENDIF.
gt_display-ewbez = it_twewt-ewbez.
MODIFY gt_display.
ENDLOOP.
ENDLOOP.
* 제품계층구조
CLEAR : it_t179t[].
SELECT * INTO TABLE it_t179t FROM t179t CLIENT SPECIFIED
WHERE mandt = sy-mandt
AND spras = sy-langu.
SORT it_t179t BY prodh.
SORT gt_display BY prodh.
LOOP AT it_t179t.
READ TABLE gt_display WITH KEY prodh = it_t179t-prodh
BINARY SEARCH
TRANSPORTING NO FIELDS.
CHECK sy-subrc IS INITIAL.
LOOP AT gt_display FROM sy-tabix.
IF gt_display-prodh <> it_t179t-prodh.
EXIT.
ENDIF.
gt_display-vtext = it_t179t-vtext.
MODIFY gt_display.
ENDLOOP.
ENDLOOP.
-
체인지
2007.11.20 20:31
좋은 자료 감사합니다 -
가을바람
2008.12.19 02:39
감사합니다.
-
이삭
2009.03.06 23:59
JOIN 사용하세요.
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
168 | ICON ascii code [3] | sapjoy | 2007.10.05 | 5035 |
167 | ABAP TIP [4] | 둘리67 | 2007.10.03 | 5996 |
166 | 너무도 당연해서 가끔 잊곤하는 공기와 같은 존재 'F1' key [5] | 백혜정 | 2007.09.19 | 4079 |
165 | AT 구문에 대한 설명입니다. [6] | 김창훈 | 2007.08.16 | 5791 |
164 | 제가 모은 팁들입니다. [62] | 풍운사랑 | 2007.09.08 | 5597 |
163 | OK Code Values... 흠,,, [1] | 김창훈 | 2007.08.31 | 4696 |
162 | Image를 화면에 보여주는 방법 [1] | 정두영 | 2007.08.31 | 6254 |
161 | 테이블 update 프로그램 [4] | sapjoy | 2007.08.30 | 4808 |
160 | System field 정리한 내용이에요 [4] | 김창훈 | 2007.08.22 | 5539 |
159 | 조회조건 동적으로 보이기 [5] | 신종철™ | 2007.08.21 | 4837 |
158 | 스페이스를 2자리로 먹을때 1자리로 먹게 바꾸기 [1] | 신종철™ | 2007.08.21 | 3998 |
157 | ABAP 문법 2nd [8] | 아일락 | 2007.08.20 | 3956 |
156 | ABAP 문법 1st [13] | 아일락 | 2007.08.20 | 4595 |
155 | 엑셀 65000 라인초과시 사용 유틸 [5] | GG | 2007.08.20 | 5336 |
154 | 플랜트로 회사코드와 기준통화 찾기 [8] | 김창훈 | 2007.08.17 | 5655 |
153 | 속도개선하기....INDEX를 이렇게도 쓰네용~~ [9] | 김창훈 | 2007.08.15 | 5426 |
» | 텍스트반영시(자재명,저장위치명 기타등등) 속도개선 방법 [6] | 김창훈 | 2007.08.15 | 6051 |
151 | ALV 중간 집계 하기 [3] | 신종철 | 2007.08.10 | 4828 |
150 | 4.6에서 ALV 필드 변경 안될때 버퍼 지우는 방법 | 신종철 | 2007.08.10 | 4803 |
149 | ABAP System Fields | 홍성현 | 2007.08.10 | 3935 |
보너스~~~
*" 자재명
DATA it_makt LIKE makt OCCURS 0 WITH HEADER LINE.
CLEAR it_makt[].
SELECT matnr maktx
INTO CORRESPONDING FIELDS OF TABLE it_makt
FROM makt
FOR ALL ENTRIES IN itab
WHERE matnr EQ itab-matnr
AND spras EQ sy-langu.
SORT it_makt BY matnr.
DELETE ADJACENT DUPLICATES FROM it_makt COMPARING matnr.
SORT itab BY matnr.
LOOP AT it_makt.
READ TABLE itab WITH KEY matnr = it_makt-matnr
BINARY SEARCH.
CHECK sy-subrc IS INITIAL.
LOOP AT itab FROM sy-tabix.
IF itab-matnr <> it_makt-matnr.
EXIT.
ENDIF.
itab-maktx = it_makt-maktx.
MODIFY itab.
ENDLOOP.
ENDLOOP.
*" 플랜트명
DATA it_t001w LIKE t001w OCCURS 0 WITH HEADER LINE.
CLEAR it_t001w[].
SELECT * INTO TABLE it_t001w FROM t001w CLIENT SPECIFIED
WHERE mandt = sy-mandt.
SORT it_t001w BY werks.
SORT itab BY werks.
LOOP AT it_t001w.
READ TABLE itab WITH KEY werks = it_t001w-werks
BINARY SEARCH.
CHECK sy-subrc IS INITIAL.
LOOP AT itab FROM sy-tabix.
IF itab-werks <> it_t001w-werks.
EXIT.
ENDIF.
itab-name1 = it_t001w-name1.
MODIFY itab.
ENDLOOP.
ENDLOOP.
*" 저장위치명
DATA it_t001l LIKE t001l OCCURS 0 WITH HEADER LINE.
CLEAR it_t001l[].
SELECT * INTO TABLE it_t001l FROM t001l CLIENT SPECIFIED
WHERE mandt = sy-mandt.
SORT it_t001l BY werks lgort.
SORT itab BY werks lgort.
LOOP AT it_t001l.
READ TABLE itab WITH KEY werks = it_t001l-werks
lgort = it_t001l-lgort
BINARY SEARCH.
CHECK sy-subrc IS INITIAL.
LOOP AT itab FROM sy-tabix.
IF itab-werks <> it_t001l-werks OR
itab-lgort <> it_t001l-lgort.
EXIT.
ENDIF.
itab-lgobe = it_t001l-lgobe.
MODIFY itab.
ENDLOOP.
ENDLOOP.
*" 자재유형명
DATA it_t134t LIKE t134t OCCURS 0 WITH HEADER LINE.
CLEAR it_t134t[].
SELECT * INTO TABLE it_t134t FROM t134t CLIENT SPECIFIED
WHERE mandt = sy-mandt
AND spras = sy-langu.
SORT it_t134t BY mtart.
SORT itab BY mtart.
LOOP AT it_t134t.
READ TABLE itab WITH KEY mtart = it_t134t-mtart
BINARY SEARCH.
CHECK sy-subrc IS INITIAL.
LOOP AT itab FROM sy-tabix.
IF itab-mtart <> it_t134t-mtart.
EXIT.
ENDIF.
itab-mtbez = it_t134t-mtbez.
MODIFY itab.
ENDLOOP.
ENDLOOP.