RTTS 로 구조체의 필드를 가져와서 필드이름, 필드타입, 길이, 소숫점의 정보를 가져올 수 있다.
1. GS_MENU라는 구조체의 정보를 가져올 수 있다.
go_structdescr ?= cl_abap_typedescr=>describe_by_data( gs_menu ).
2. components Attribute로 각 컴포넌트(필드)들의 정보 조회 가능.
Internal table이기 때문에, abap_compdescr TYPE의 변수를 만들어서 Loop을 돌아서 확인 가능.
LOOP AT go_structdescr->components INTO gs_component.
ps_fcat-fieldname = gs_component-name.
ps_fcat-datatype = gs_component-type_kind.
ps_fcat-inttype = gs_component-type_kind.
ps_fcat-intlen = gs_component-length / cl_abap_char_utilities=>charsize.
ENDLOOP.
※ 문제는 length가 기존 필드 길이 값의 2배로 나온다
- 유니코드를 사용하기 때문에 그렇다. 그래서 CL_ABAP_CHAR_UTILITIES=>CHARSIZE를 사용하여(나누 어 서) 기존 필드 값이 나오로독 한다.
https://answers.sap.com/questions/1310867/unicode-vs-non-unicode.htm
- CL_ABAP_CHAR_UTILITIES=>CHARSIZE 의 값은 해당 시스템의 Character Size(bite) 를 리턴한다. 현재 우리 가 사용하는 SAP 시스템에서는 유니코드를 사용하기 대문에 2가 리턴되므로 그 값을 나누어 실제 길이 값을 찾을 수 있다.
unicode vs non-unicode | SAP Community
Hi All, Can anyone please tell me what is the differenece between unicode and non-unicode SAP systems. I heard that all the new versions are unicode. What is the difference, purpose and significance of these? Thanks Cyrus
answers.sap.com
'SAP > ABAP 기초' 카테고리의 다른 글
(ABAP) Business Exception(SEGW) (0) | 2022.01.06 |
---|---|
(ABAP 기초) Long Text 사용 (0) | 2021.10.21 |
(ABAP 기초) GET_CURRENT_CELL & Layout Method (0) | 2021.10.11 |
(ABAP 기초) 자주 사용 되는 타입, 클래스 모음 (ABAP/ALV) (0) | 2021.10.11 |
(ABAP 기초) Standard Application Toolbar 리스트 (0) | 2021.10.10 |