ABAP语法篇1 DATA新用法
@DATA 按取数指定的字段定义内表结
定义工作区:
SELECT SINGLE *
FROM lfbk
INTO @DATA(is_lfbk)
WHERE lifnr EQ @gs_zmmtd049-lifnr.
CONCATENATE is_lfbk-bankn is_lfbk-bkref INTO gs_zmmtd049-bankn.
CONDENSE gs_zmmtd049-bankn.
SELECT * INTO TABLE @DATA(lt_plaf) FROM plaf WHERE plwrk EQ @p_werks AND psttr IN @s_budat AND plnum IN @s_plnum. IF lt_plaf[] IS INITIAL. MESSAGE e018 DISPLAY LIKE gc_e. LEAVE LIST-PROCESSING. ENDIF. IF lt_plaf[] IS NOT INITIAL. SELECT * FROM resb FOR ALL ENTRIES IN @lt_plaf WHERE plnum = @lt_plaf-plnum * AND posnr = @lt_caufv-b-posnr AND xloek EQ @space AND alpgr IS NOT INITIAL INTO TABLE @DATA(lt_resb). IF lt_resb[] IS INITIAL. MESSAGE e033 DISPLAY LIKE gc_e. LEAVE LIST-PROCESSING. ENDIF. SORT lt_resb BY aufnr posnr. gt_resbkeys = CORRESPONDING #( lt_resb ). SORT gt_resbkeys BY aufnr posnr. SELECT * INTO TABLE @DATA(lt_makt) FROM makt FOR ALL ENTRIES IN @lt_resb WHERE matnr = @lt_resb-matnr AND spras = @sy-langu. SORT lt_makt BY matnr. ENDIF. 定义工作区: SELECT SINGLE * FROM lfbk INTO @DATA(is_lfbk) WHERE lifnr EQ @gs_zmmtd049-lifnr. CONCATENATE is_lfbk-bankn is_lfbk-bkref INTO gs_zmmtd049-bankn. CONDENSE gs_zmmtd049-bankn.
语法说明:
Example
Inline declaration of an internal table as a target field of an assignment and inline declaration of an appropriate work area in a LOOP.
TYPES t_itab TYPE TABLE OF i
WITH NON-UNIQUE KEY table_line.
DATA(itab) = VALUE t_itab( ( 1 ) ( 2 ) ( 3 ) ).
LOOP AT itab INTO DATA(wa).
...
ENDLOOP.
Example
Inline declaration of an internal table as a target field of a SELECT statement and inline declaration of a variable for the table transformed to HTML. The data type of the variable is determined by the return value of the method.
SELECT *
FROM scarr
INTO TABLE @DATA(itab).
DATA(html) = cl_demo_output=>get( itab ).
Example
If a data object called data does not exist in the current context, the first statement is an inline declaration and the second statement executes a substring access.
-
DATA(data) = '1'.
DATA(data) = '2'. -
乐善好施,能学新知!!!
上一个打赏的兄dei已经解锁66种新姿势了下一个就看您了
滴赏一下,立马上车