首页 > 数据库 >abap动态sql

abap动态sql

时间:2023-03-29 13:00:34浏览次数:39  
标签:layout wa list seltext abap fieldname sql 动态 ref

*&---------------------------------------------------------------------*
*& Report  ZPARMETERS3
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT zparmeters3.

TYPE-POOLS:slis.
TABLES vbak.

PARAMETERS p1 TYPE char10 DEFAULT '公海客户'.


START-OF-SELECTION.


  PERFORM getdata.

FORM getdata .


DATA tables TYPE TABLE OF ztcategory.     "数据字典分类表
DATA layout TYPE slis_layout_alv.         "Layout布局对象
DATA wa TYPE slis_fieldcat_alv.           "字段对象
DATA list TYPE TABLE OF slis_fieldcat_alv."字段集合

DATA lv_where type string VALUE ' zestatus = 1 '.

IF p1 is NOT INITIAL.
  CONCATENATE lv_where ' and ZECATNAME = p1 ' INTO lv_where SEPARATED BY space.
ENDIF.


CLEAR wa.


SELECT *
  INTO CORRESPONDING FIELDS OF TABLE tables
    FROM ztcategory where (lv_where) .


wa-key = 'x'."是否是主键
wa-fieldname = 'ZEID'."编号
wa-ref_fieldname = 'ZEID'. "参考字段编号
wa-ref_tabname = 'ZTCATEGORY'. "参考数据表
wa-seltext_m = '编号'.
wa-just = 'C'.
APPEND wa TO list.
CLEAR wa.

wa-fieldname = 'ZECREATEDATE'."创建日期
wa-ref_fieldname = 'ZECREATEDATE'. "参考字段
wa-ref_tabname = 'ZTCATEGORY'. "参考数据表
wa-seltext_m = '创建日期'.
APPEND wa TO list.

wa-fieldname = 'ZECREATETIME'."创建时间
wa-ref_fieldname = 'ZECREATETIME'.
wa-ref_tabname = 'ZTCATEGORY'.
wa-seltext_m = '创建时间'.
APPEND wa TO list.

wa-fieldname = 'ZECODE'.
wa-ref_fieldname = 'ZECODE'.
wa-ref_tabname = 'ZTCATEGORY'.
wa-seltext_m = '状态码'.
wa-just = 'C'.
APPEND wa TO list.


wa-fieldname = 'ZECATNAME'.
wa-ref_fieldname = 'ZECATNAME'.
wa-ref_tabname = 'ZTCATEGORY'.
wa-seltext_m = '分类名称'.
wa-just = 'L'.
APPEND wa TO list.

wa-fieldname = 'ZESORT'.
wa-ref_fieldname = 'ZESORT'.
wa-ref_tabname = 'ZTCATEGORY'.
wa-seltext_m = '数字排序'.
wa-just = 'C'.
APPEND wa TO list.

wa-fieldname = 'ZESTATUS'.
wa-ref_fieldname = 'ZESTATUS'.
wa-ref_tabname = 'ZTCATEGORY'.
wa-seltext_m = '当前状态'.
wa-just = 'L'.
APPEND wa TO list.

wa-fieldname = 'ZEREMARK'.
wa-ref_fieldname = 'ZEREMARK'.
wa-ref_tabname = 'ZTCATEGORY'.
wa-seltext_m = '描述说明'.
wa-just = 'L'.
APPEND wa TO list.

wa-fieldname = 'ZECONTENT'.
wa-ref_fieldname = 'ZECONTENT'.
wa-ref_tabname = 'ZTCATEGORY'.
wa-seltext_m = '状态描述'.
wa-just = 'L'.
APPEND wa TO list.



*===================================================================


layout-zebra = 'X'.
layout-colwidth_optimize = 'X'.
layout-detail_popup = 'X'.
layout-colwidth_optimize = 'X'.
layout-detail_titlebar = '客户状态分类详细'.
layout-f2code = '&ETA'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
 EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
   I_CALLBACK_PROGRAM                = sy-repid
*   I_CALLBACK_PF_STATUS_SET          = ' '
*   I_CALLBACK_USER_COMMAND           = ' '
*   I_CALLBACK_TOP_OF_PAGE            = ' '
*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*   I_CALLBACK_HTML_END_OF_LIST       = ' '
*   I_STRUCTURE_NAME                  =
*   I_BACKGROUND_ID                   = ' '
*   I_GRID_TITLE                      =
*   I_GRID_SETTINGS                   =
   IS_LAYOUT                         = layout
   IT_FIELDCAT                       = list
*   IT_EXCLUDING                      =
*   IT_SPECIAL_GROUPS                 =
*   IT_SORT                           =
*   IT_FILTER                         =
*   IS_SEL_HIDE                       =
*   I_DEFAULT                         = 'X'
*   I_SAVE                            = ' '
*   IS_VARIANT                        =
*   IT_EVENTS                         =
*   IT_EVENT_EXIT                     =
*   IS_PRINT                          =
*   IS_REPREP_ID                      =
*   I_SCREEN_START_COLUMN             = 0
*   I_SCREEN_START_LINE               = 0
*   I_SCREEN_END_COLUMN               = 0
*   I_SCREEN_END_LINE                 = 0
*   I_HTML_HEIGHT_TOP                 = 0
*   I_HTML_HEIGHT_END                 = 0
*   IT_ALV_GRAPHICS                   =
*   IT_HYPERLINK                      =
*   IT_ADD_FIELDCAT                   =
*   IT_EXCEPT_QINFO                   =
*   IR_SALV_FULLSCREEN_ADAPTER        =
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           =
*   ES_EXIT_CAUSED_BY_USER            =
  TABLES
    t_outtab                          = tables
* EXCEPTIONS
*   PROGRAM_ERROR                     = 1
*   OTHERS                            = 2
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.


ENDFORM.

 

标签:layout,wa,list,seltext,abap,fieldname,sql,动态,ref
From: https://www.cnblogs.com/hua900822/p/17268527.html

相关文章

  • 经典动态规划题(python)
    python动态规划性质最优子结构性质。如果问题的最优解所包含的子问题的解也是最优的,我们就称该问题具有最优子结构性质(即满足最优化原理)。最优子结构性质为动态规划算......
  • Mysql主从同步
    一、主从复制的重要性   日常系统业务流量的增长,一台MySQL数据库服务器已经满足不了需求了,会负载过重,容易出现查询效率慢、宕机的情况,导致用户体验差、数据的丢失。......
  • MySQL查询数据时间戳和日期的转换
    在数据库的使用中,经常需要按指定日期来查询记录,以便于统计,而在数据库中,有很多存储的是时间戳,也有的直接存日期,查询的时候可能不是那么好弄。mysql提供了两个函数:from_un......
  • Mysql问题处理分享:SQLSTATE[HY000]: General error: 126 Incorrect
    今天网站访问内容页突然报错:SQLSTATE[HY000]:Generalerror:126Incorrectkeyfilefortable'.\数据库名\qb_cms_content1.MYI';trytorepairit当mysql的临时......
  • vue动态切换组件
    多个组件挂在到同一个组件上,通过参数进行动态切换一、实现方式<component:is="componentName"></component> 二、示例importPage1from'./Page1'importPage2......
  • sqlserver获取逗号分隔的字段值中是否包含某一个值
    数据如图: 获取RBuilding字段值中有‘一号楼的数据’select*fromTB_BLSRunConfigwhereRBuildinglikeCONCAT('%','1号楼','%')结果: 根据时间排序取最新的一......
  • SQLServer查询执行过的SQL记录
    说明:仅支持sqlserver2008及以上版本通过下面的SQL语句可以查看Sqlserver执行的SQL记录,常用于SQL优化及辅助查找数据更新相关功能bug。1SELECTTOP10002ST......
  • 2012第29周官方应用市场Top Grossing动态
    本周官方市场的动态:最近几周在收入榜单排名上,三个官方市场的新进榜应用在数量基本相当,没有太大的出入,而且在收入榜单榜首的也一直都是几款收费游戏(由于GooglePlay在中国区......
  • MySQL字段去除空格的简单方法
    //替换所有空格 td_water_zoning_str为表名,device_name为字段名,注意,这里只要是空格自动替换为无。  UPDATEtd_water_zoning_strSETdevice_name=replace(dev......
  • MySqL Invalid GIS data provided to function st_geometryfromtext. 解决方法
     最近需要通过geoserver显示多边形,首先需要先将数据库的数据转换为地理数据存储类型,但由于原本的信息是按text存储的,将text类型转换为geometry就需要用到ST_GeomFromText......