메뉴 건너뛰기

SAP 한국 커뮤니티

텍스트반영시(자재명,저장위치명 기타등등) 속도개선 방법

김창훈 2007.08.15 03:40 조회 수 : 6051 추천:20

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 부터 하시구요....