zoukankan      html  css  js  c++  java
  • 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种新姿势了

       下一个就看您了

      滴赏一下,立马上车

  • 相关阅读:
    Eclipse 安装插件
    java 之 Spring 框架(Java之负基础实战)
    tomcat 修改网站路径(Java之负基础实战)
    tomcat 修改编码(Java之负基础实战)
    tomcat 修改端口(Java之负基础实战)
    linux vi 操作
    解压文件--linux
    smarty用法
    thinkphp调试手段
    kindeditor上传文件的使用
  • 原文地址:https://www.cnblogs.com/rainysblog/p/12008972.html
Copyright © 2011-2022 走看看