728x90
반응형
필드심볼로 구성된 다이나믹 테이블에서 특정 필드 값 계산식이 필요할때
FIELD-SYMBOLS <LT_DATA> TYPE TABLE.
DATA : TDREF TYPE REF TO DATA.
CREATE DATA TDREF LIKE <GT_DATA>.
ASSIGN TDREF->* TO <LT_DATA>.
SORT <LT_DATA> BY ('VERSI') ('PERIO') ('ARTNR') ('WERKS').
LOOP AT <GT_DATA> ASSIGNING <GS_DATA>.
ASSIGN COMPONENT 'VRGAR' OF STRUCTURE <GS_DATA> TO FIELD-SYMBOL(<VRGAR>).
IF <VRGAR> = 'F'.
ASSIGN COMPONENT 'VERSI' OF STRUCTURE <GS_DATA> TO FIELD-SYMBOL(<VERSI>).
ASSIGN COMPONENT 'PERIO' OF STRUCTURE <GS_DATA> TO FIELD-SYMBOL(<PERIO>).
ASSIGN COMPONENT 'ARTNR' OF STRUCTURE <GS_DATA> TO FIELD-SYMBOL(<ARTNR>).
ASSIGN COMPONENT 'WERKS' OF STRUCTURE <GS_DATA> TO FIELD-SYMBOL(<WERKS>).
ASSIGN COMPONENT 'VVQTY' OF STRUCTURE <GS_DATA> TO FIELD-SYMBOL(<VVQTY>).
ASSIGN COMPONENT 'MAT' OF STRUCTURE <GS_DATA> TO FIELD-SYMBOL(<MAT>).
READ TABLE <LT_DATA> ASSIGNING FIELD-SYMBOL(<LS_DATA>) WITH KEY ('VERSI') = <VERSI>
('PERIO') = <PERIO>
('ARTNR') = <ARTNR>
('WERKS') = <WERKS>
BINARY SEARCH.
IF SY-SUBRC = 0.
ASSIGN COMPONENT 'VERSI' OF STRUCTURE <LS_DATA> TO FIELD-SYMBOL(<VERSN>).
ASSIGN COMPONENT 'PERIO' OF STRUCTURE <LS_DATA> TO FIELD-SYMBOL(<ZPLANYYMM>).
ASSIGN COMPONENT 'ARTNR' OF STRUCTURE <LS_DATA> TO FIELD-SYMBOL(<MATNR>).
ASSIGN COMPONENT 'WERKS' OF STRUCTURE <LS_DATA> TO FIELD-SYMBOL(<MEINS>).
ASSIGN COMPONENT 'VVQTY' OF STRUCTURE <LS_DATA> TO FIELD-SYMBOL(<T_VVQTY>).
ASSIGN COMPONENT 'MAT' OF STRUCTURE <LS_DATA> TO FIELD-SYMBOL(<T_MAT>).
<MAT> = ( <T_MAT> / <T_VVQTY> ) * <VVQTY>.
ENDIF.
ELSE.
CONTINUE.
ENDIF.
ENDLOOP.
728x90
반응형
'ABAP' 카테고리의 다른 글
ALV Fieldcatalog Using Field-symbol (0) | 2023.02.21 |
---|---|
ALV 체크박스 클릭시 Cell edit (1) | 2023.02.21 |
RANGES 변수 (0) | 2023.02.21 |
ALV F4 (Possible entry) (0) | 2023.02.21 |
Maintenance View Call Function (0) | 2023.02.21 |
댓글