zoukankan      html  css  js  c++  java
  • ABAP如何在join查询中使用动态表名(其实这样是没有必要的)

    最近有人问如何写在join查询中使用动态表名的方法,现在我给出一个样例,供大家参考:

    REPORT demo_class_counter_event.

    DATA: BEGIN OF wa,
            carrid TYPE spfli-carrid,
            connid TYPE spfli-connid,
            fldate TYPE sflight-fldate,
            bookid TYPE sbook-bookid,
          END OF wa,
          itab LIKE SORTED TABLE OF wa
                    WITH UNIQUE KEY carrid connid fldate bookid.

    DATA name(300) TYPE c VALUE 'spfli AS p '&
          ' INNER JOIN sflight AS f ' &
          ' ON p~carrid = f~carrid AND p~connid = f~connid '&
          ' INNER JOIN sbook   AS b '&
          ' ON b~carrid = f~carrid AND b~connid = f~connid AND b~fldate = f~fldate '.

    SELECT  p~carrid p~connid f~fldate b~bookid
      INTO  CORRESPONDING FIELDS OF TABLE itab
      FROM  (name)
      WHERE p~cityfrom = 'FRANKFURT' AND
            p~cityto   = 'NEW YORK'  AND
            f~seatsmax > f~seatsocc.

    LOOP AT itab INTO wa.
      AT NEW fldate.
        WRITE: / wa-carrid, wa-connid, wa-fldate.
      ENDAT.
      WRITE / wa-bookid.
    ENDLOOP. 

  • 相关阅读:
    [51nod1299]监狱逃离
    [51nod1206]Picture
    noi 2016 游记
    [Codeforces 696D] Legen...
    [bzoj2574] [Poi1999]Store-Keeper
    [bzoj1227] [SDOI2009]虔诚的墓主人
    [bzoj3979] [WF2012]infiltration
    Docker
    SpringBoot实现登录
    SpringBoot第一次案例
  • 原文地址:https://www.cnblogs.com/xiaomaohai/p/6157314.html
Copyright © 2011-2022 走看看