首页 > 其他分享 >BKPF会计凭证查询-ALV表

BKPF会计凭证查询-ALV表

时间:2022-12-08 20:35:20浏览次数:40  
标签:index layout 会计凭证 BKPF fieldcat lt ls ALV TYPE

*&---------------------------------------------------------------------*
*& Report  Z14
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT z14.

TYPE-POOLS:slis.

"1.声明变量
DATA:lt_fieldcat TYPE   slis_t_fieldcat_alv,
     ls_fieldcat TYPE   slis_fieldcat_alv,
     ls_layout   TYPE   slis_layout_alv.


"2.定义内表
TYPES:BEGIN OF ty_alvshow,

    bukrs TYPE bkpf-bukrs,"公司代码
    belnr TYPE bkpf-belnr,"会计凭证编号
    gjahr TYPE bkpf-gjahr,"会计年度
    blart TYPE bkpf-blart,"凭证类型
    bktxt TYPE bkpf-bktxt,"凭证抬头文本
  END OF ty_alvshow.

DATA: lt_ty_alvshow TYPE TABLE OF ty_alvshow,
      ls_ty_alvshow TYPE ty_alvshow.

"3-读取数据
SELECT
    a~bukrs
    a~belnr
    a~gjahr
    a~blart
    a~bktxt

FROM bkpf AS a INTO TABLE lt_ty_alvshow .


ls_layout-zebra = 'X'.
ls_layout-detail_popup = 'X'.
ls_layout-f2code = '&ETA'.
ls_layout-colwidth_optimize = 'X'.
ls_layout-detail_titlebar = '详细信息'.

DATA index TYPE int2.
index = 1.
ls_fieldcat-col_pos = index.
ls_fieldcat-fieldname = 'bukrs'.
ls_fieldcat-key = 'X'.
ls_fieldcat-datatype = 'char'.
ls_fieldcat-outputlen = '4'.
ls_fieldcat-seltext_m = '公司代码'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR ls_fieldcat.

index = index + 1.
ls_fieldcat-col_pos = index.
ls_fieldcat-fieldname = 'belnr'.
ls_fieldcat-key = 'X'.
ls_fieldcat-datatype = 'char'.
ls_fieldcat-outputlen = '10'.
ls_fieldcat-seltext_m = '会计凭证编号'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR ls_fieldcat.

index = index + 1.
ls_fieldcat-col_pos = index.
ls_fieldcat-fieldname = 'gjahr'.
ls_fieldcat-datatype = 'NUMC'.
ls_fieldcat-outputlen = '4'.
ls_fieldcat-seltext_m = '会计年度'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR ls_fieldcat.

index = index + 1.
ls_fieldcat-col_pos = index.
ls_fieldcat-fieldname = 'blart'.
ls_fieldcat-datatype = 'CHAR'.
ls_fieldcat-outputlen = '2'.
ls_fieldcat-seltext_m = '凭证类型'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR ls_fieldcat.

index = index + 1.
ls_fieldcat-col_pos = index.
ls_fieldcat-fieldname = 'bktxt'.
ls_fieldcat-datatype = 'CHAR'.
ls_fieldcat-outputlen = '25'.
ls_fieldcat-seltext_m = '凭证抬头文本'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR ls_fieldcat.


"显示ALV
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
*   I_CALLBACK_PROGRAM                = ' '
*   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   = ls_layout
    it_fieldcat = lt_fieldcat
*   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    = lt_ty_alvshow
* EXCEPTIONS
*   PROGRAM_ERROR                     = 1
*   OTHERS      = 2
  .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

 

标签:index,layout,会计凭证,BKPF,fieldcat,lt,ls,ALV,TYPE
From: https://www.cnblogs.com/hua900822/p/16967201.html

相关文章

  • 对graalvm、springboot3.0一些新特性的探究
    环境:系统:IntelcoreMacVentura13.0.1工具: Idea:2022.2.3 gradle:7.4(idea自带的)  openjdk:version"17.0.5"2022-10-18 graalvm: CE22.3.0 ......
  • jdk自带的javaVisualVM检测tomcat
    背景:在项目运行的过程中想了解一下tomcat的执行性能情况,下面以jdk自带的javaVisualVm为例进行配置检测1.在我本地(windows系统)找到jdk中的bin目录,找到jvisualvm.exe双击......
  • org.apache.catalina.core.StandardWrapperValve.invoke 在路径为/xxx的上下文中,Servl
    举个例子,后端向jsp中传递了一个参数是一个对象当jsp进行引用${bean.xxx}时bean中没有xxx属性,那么就会报这个错看看是不是jsp更新了对应的类没有更新解决方式很简单,要么j......
  • 这回终于把Java类中Serialversionuid 作用讲的明明白白了
    实现Serializable接口的目的是为类可持久化,比如在网络传输或本地存储,为系统的分布和异构部署提供先决条件。若没有序列化,现在我们所熟悉的远程调用,对象数据库都不可能存在,......
  • Dalvik opcodes
    DalvikopcodesAuthor: ​​GaborPaller​​VxvaluesinthetabledenoteaDalvikregister.Dependingontheinstruction,16,256or64kregisterscanbeacces......
  • SAP ALV 数据导出被截断的bug
    也不知道是从哪个sapgui版本开始的,很多年前开发的报表,慢慢的都出现一个问题,就是导出的时候数据会被截断了。目前也没有好的办法统一解决,只能碰到了调整相应代码。在构造......
  • jvisualvm安装Visual GC插件
    转载自:http://t.zoukankan.com/seamy-p-15649609.html ===================== 目录一、javajvisualvm介绍1、jvisualvm用途2、jvisualvm安装二、VisualGC......
  • idea中serialVersionUID怎么自动生成
    首先我看了一些博客说要下载插件,我去插件里没有找到,后来是直接设置的点击file->setting点击Inspection在搜索框里输入seria就会看到Serializableclasswithout'seri......
  • Leetcode第1704题:判断字符串的两半是否相似(Determine is string halves are alike)
    解题思路直接模拟。将字符串分为两半,分别遍历统计各元音出现的次数,最后比较是否相等即可。核心代码如下:boolhalvesAreAlike(strings){stringa=s.substr(......
  • ALV报表——动态内表
    运行效果:  代码:*************************************************************************程序名:xxx*程序描述:动态内表*事务代码:xxx***************......