Eighty usage of SAP database operations (FOR ALL ENTRIES IN), more difficult to understand

A, as follows

Second, the query results are as follows

Third, we added two it_spfli in the table of contents

Fourth, the results are as follows, the query is that all JFK and SFO airport.

*&---------------------------------------------------------------------*
*& Report Z_TIANPAN_20190717_HELLO
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT z_tianpan_20190717_hello.

* 定义ty_spfli的内表
DATA: BEGIN OF ty_spfli,
        airpfrom LIKE spfli-airpfrom,
        airpto   LIKE spfli-airpto,
        fldate   LIKE sflight-fldate,
        deptime  LIKE spfli-deptime,
      END OF ty_spfli.
* 定义内表和工作区都为it_spfli的内表
DATA: it_spfli LIKE ty_spfli OCCURS 0 WITH HEADER LINE .

it_spfli-airpto = 'JFK'.
APPEND it_spfli .
it_spfli-airpto = 'SFO'.
APPEND it_spfli .

* 查询语句,
SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE  it_spfli
    FOR ALL ENTRIES IN it_spfli
    WHERE  spfli~airpto  = it_spfli-airpto  .

* 输出
LOOP AT it_spfli.
  WRITE: / '【from ', it_spfli-airpfrom, 'to = ',it_spfli-airpto, '】 航班日期:'
                      , it_spfli-fldate, ' 出发时间: ', it_spfli-deptime .
ENDLOOP.

* 字符串拼接
WRITE: / '青青子衿' & '悠悠我心'.

 

总结:

SAP里面的SQL语句奇葩的一米,常规的SQL的用法很多都用不了,ORDER BY不能加载最后,一加就报错,搞到半夜,气死我了。

学无止境,且行且珍惜。

 

Guess you like

Origin www.cnblogs.com/tianpan2019/p/11257551.html