본문 바로가기

ABAP

ABAP : IS BOUND 와 IS INITIAL의 차이

먼저 Reference문서를 보면 IS BOUND와 IS INITIAL의 기능을 설명 하고 있다.

 

IS BOUND 

참조 값이 유효할 경우 그 값을 를 참조 한다 -> 스택에 없거나 삭제된 경우 존재 하지 않는 값이냐? 고 묻는데 사용할 수 도 있다.

IS INITIAL

피연산자가 초기값인지 확인한다

 

또 다른 Reference에는 

IS BOUND는 개체(object reference)을 구체적화할때 쓰고

IS INITIAL은 더 큰 개념으로 사용한다 변수, ITAB, 개체 등 더 큰 범주에서 사용된다

개체를 참조할경우 IS BOUND를 사용하기를 권하고 있다.

 

Well, the only thing that I would say is, that the IS BOUND syntax is specific to object references, so when you see this in your code, you automatically know that you are talking about an object, if you use IS INITIAL, it becomes ambiguous as to what you are talking about, since it could be a variable, internal table, or object reference. I believe that the IS BOUND syntax should always be used when referring to object references, this provides for better readibility and maintance.