*결론은 큰 차이가 없으나, OO 개념에서는 LIK만 지원된다.
예를 들어 ALV에서 인터널 테이블을 TYPE으로 선언하면
필드 카탈로그가 작동하지 않는다.
For all practical purposes there are the same. The only additional advantage with types is that you can define your own types(including complex ones) in the data dictionary and reuse them accross various programs.
But within a program if two variables are defined one using LIKE and another using TYPE, both referring to the same field, then there is no difference.
If I include a type pool within a program, then I can define my variables only using TYPE to refer to any type defined in that pool. I cannot use LIKE in this scenario. Also, if I want to use native types like C, N, etc, I cannot use LIKE there either. I can use LIKE ABC only if ABC is in the database or if ABC is defined previously in the same program.
I can use TYPE ABC, if ABC is defined in database as a TYPE and included in the program with the statement TYPE-POOLS. I can use it, if it is the native types. I can use it, if it is already defined in the dictionary as a structure/table or structure/table field, or even if it is defined as a data element or a domain. So I can declare a variable V_BUKRS TYPE BUKRS, but I cannot define a variable V_BUKRS LIKE BUKRS.
But if I intend to use V_BUKRS to store company code, I will prefer to declare it as V_BUKRS LIKE T001-BUKRS, only because if tomorrow for some reason, the definition of T001-BUKRS changes to a data element for example, BUKRS_N(say DEC 4) instead of the data element BUKRS(CHAR 4) that it refers to now, I don't have to change my programs because I am referring to the table field and inhereting its properties. Whereas, had I declared my V_BUKRS TYPE BUKRS and the table now changed to BUKRS_N, I will be forced to change my program as there will be a type incompatability.
예를 들어 ALV에서 인터널 테이블을 TYPE으로 선언하면
필드 카탈로그가 작동하지 않는다.
For all practical purposes there are the same. The only additional advantage with types is that you can define your own types(including complex ones) in the data dictionary and reuse them accross various programs.
But within a program if two variables are defined one using LIKE and another using TYPE, both referring to the same field, then there is no difference.
If I include a type pool within a program, then I can define my variables only using TYPE to refer to any type defined in that pool. I cannot use LIKE in this scenario. Also, if I want to use native types like C, N, etc, I cannot use LIKE there either. I can use LIKE ABC only if ABC is in the database or if ABC is defined previously in the same program.
I can use TYPE ABC, if ABC is defined in database as a TYPE and included in the program with the statement TYPE-POOLS. I can use it, if it is the native types. I can use it, if it is already defined in the dictionary as a structure/table or structure/table field, or even if it is defined as a data element or a domain. So I can declare a variable V_BUKRS TYPE BUKRS, but I cannot define a variable V_BUKRS LIKE BUKRS.
But if I intend to use V_BUKRS to store company code, I will prefer to declare it as V_BUKRS LIKE T001-BUKRS, only because if tomorrow for some reason, the definition of T001-BUKRS changes to a data element for example, BUKRS_N(say DEC 4) instead of the data element BUKRS(CHAR 4) that it refers to now, I don't have to change my programs because I am referring to the table field and inhereting its properties. Whereas, had I declared my V_BUKRS TYPE BUKRS and the table now changed to BUKRS_N, I will be forced to change my program as there will be a type incompatability.
댓글 13
-
kyeinho
2007.06.04 18:51
-
체인지
2007.11.20 20:28
좋은 자료 감사합니다 -
eclipse
2007.12.03 07:19
진짜 ALV FIELD CATALOG MERGE FUNC.에서 TYPE으로 선언된 것은 안 들어오드라구요.
진작에 이 글을 참고했으면 좋았을 껄..며칠 고생했어요...ㅠ.ㅠ.
-
삐러
2008.01.08 18:10
명확하군용.ㅎ
-
사니아
2008.01.29 06:21
이걸 어제만 봤어도 ㅜㅜ...
밤새도록.. 삽질했는데~~~
-
달식이
2008.02.27 02:15
우와 감사합니다. -
아bap
2008.03.06 20:44
안되길래 이것저것 해보고 걍 여기선 이거네 하고 넘어간건데... 감사드려요
-
pcj
2008.03.30 06:16
좋은 정보네요~~ -
천군
2008.07.11 23:17
감사합니다 -
내밥은 아밥
2012.02.17 00:43
좋은 자료 감사합니다 -
네잎클로버
2013.09.24 20:27
좋은 정보 감사합니다 ^^
-
neoclassic
2013.11.13 00:42
감사합니다~
-
초록매실
2014.01.02 10:52
좋은정보 감사합니다.
궁금했던 내용이었는데...