FAGLL03H 新增自定义字段

1、SGLPOS_N_GL_CT、SGLPOS_N_CT两个结构新增自定义字段

2、执行t-code:HDBVIEWS

 

 3、实施增强 FAGL_LIB

 

 4、使用select data方法

 

5、代码示例:

 

method IF_FAGL_LIB~SELECT_DATA.FIELD-SYMBOLS: <fs> TYPE any.FIELD-SYMBOLS <ls_data>                 TYPE any.FIELD-SYMBOLS <ld_data>                 TYPE any.DATA: ls_component LIKE LINE OF it_component.DATA lr_data                  TYPE REF TO data.DATA lo_descr                 TYPE REF TO cl_abap_typedescr.DATA lo_str_descr_in          TYPE REF TO cl_abap_structdescr.DATA ls_abap_comp_descr       TYPE abap_compdescr.DATA: lv_id    TYPE c LENGTH 50,lv_name TYPE c LENGTH 200.CREATE DATA lr_data LIKE LINE OF ct_data.ASSIGN lr_data->* TO <ls_data>.* Get structure description of data tableCALL METHOD cl_abap_structdescr=>describe_by_dataEXPORTINGp_data      = <ls_data>RECEIVINGp_descr_ref = lo_descr.lo_str_descr_in ?= lo_descr.LOOP AT ct_data ASSIGNING <ls_data>.* Go over the components of the structureLOOP AT lo_str_descr_in->componentsINTO ls_abap_comp_descr."贷款银行CLEAR:lv_id,lv_name.IF ls_abap_comp_descr-name = 'ZZBAK'."贷款银行代码ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.lv_id = <ld_data>.SELECT SINGLE txt50 INTO lv_name FROM ztfi_zbak_helpt WHERE banka = lv_id AND spras = sy-langu.IF sy-subrc = 0.ls_abap_comp_descr-name = 'ZZEBANK'."贷款银行名称ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.<ld_data> = lv_name.ENDIF.ENDIF."政府补助CLEAR:lv_id,lv_name.IF ls_abap_comp_descr-name = 'ZZBZTYPE'."政府补助项目ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.lv_id = <ld_data>.SELECT SINGLE txt50 INTO lv_name FROM ztfi_zbztyp_helt WHERE zzbztype = lv_id AND spras = sy-langu.IF sy-subrc = 0.ls_abap_comp_descr-name = 'ZZBZNAME'."政府补助项目名称ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.<ld_data> = lv_name.ENDIF.ENDIF."现金流量码CLEAR:lv_id,lv_name.IF ls_abap_comp_descr-name = 'ZZCASHFLOW'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.lv_id = <ld_data>.SELECT SINGLE txt50 INTO lv_name FROM ztficashflowt WHERE zzcashflow = lv_id AND spras = sy-langu.IF sy-subrc = 0.ls_abap_comp_descr-name = 'ZZCASHNAME'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.<ld_data> = lv_name.ENDIF.ENDIF."在建工程公告项目CLEAR:lv_id,lv_name.IF ls_abap_comp_descr-name = 'ZZDWGGXM'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.lv_id = <ld_data>.SELECT SINGLE txt50 INTO lv_name FROM ztfi0076t WHERE zzdwggxm = lv_id AND spras = sy-langu.IF sy-subrc = 0.ls_abap_comp_descr-name = 'ZZGGXMNAME'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.<ld_data> = lv_name.ENDIF.ENDIF."费用类型CLEAR:lv_id,lv_name.IF ls_abap_comp_descr-name = 'ZZEXPTYPE'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.lv_id = <ld_data>.SELECT SINGLE txt50 INTO lv_name FROM ztfi0078t WHERE zzexptype = lv_id AND spras = sy-langu.IF sy-subrc = 0.ls_abap_comp_descr-name = 'ZZFYLXNAME'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.<ld_data> = lv_name.ENDIF.ENDIF."附加成本中心CLEAR:lv_id,lv_name.IF ls_abap_comp_descr-name = 'ZZKOSTL'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.lv_id = <ld_data>.SELECT SINGLE ltext INTO lv_name FROM cskt WHERE kostl = lv_id AND spras = sy-langu.IF sy-subrc = 0.ls_abap_comp_descr-name = 'ZZKOSTLNAME'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.<ld_data> = lv_name.ENDIF.ENDIF."附加客户CLEAR:lv_id,lv_name.IF ls_abap_comp_descr-name = 'ZZKUNNR'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.lv_id = <ld_data>.SELECT SINGLE name1,name2 INTO (@DATA(lv_name1),@DATA(lv_name2)) FROM kna1 WHERE kunnr = @lv_id.IF sy-subrc = 0.ls_abap_comp_descr-name = 'ZZKUNNRNAME'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.<ld_data> = lv_name1 && lv_name2.ENDIF.ENDIF."附加供应商CLEAR:lv_id,lv_name.IF ls_abap_comp_descr-name = 'ZZLIFNR'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.lv_id = <ld_data>.SELECT SINGLE name1,name2 INTO (@DATA(lv_name3),@DATA(lv_name4)) FROM lfa1 WHERE lifnr = @lv_id.IF sy-subrc = 0.ls_abap_comp_descr-name = 'ZZLIFNRNAME'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.<ld_data> = lv_name3 && lv_name4.ENDIF.ENDIF."摊销费用类型文本CLEAR:lv_id,lv_name.IF ls_abap_comp_descr-name = 'ZZSHARE'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.lv_id = <ld_data>.SELECT SINGLE txt50 INTO lv_name  FROM ztfi0001t WHERE zzshare = lv_id AND spras = sy-langu.IF sy-subrc = 0.ls_abap_comp_descr-name = 'ZZEFYLXNAME'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.<ld_data> = lv_name.ENDIF.ENDIF."投资文号CLEAR:lv_id,lv_name.IF ls_abap_comp_descr-name = 'ZZTZWH'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.lv_id = <ld_data>.SELECT SINGLE zzktext INTO lv_name  FROM ztfi_aux_tzwh WHERE zzplantcp = lv_id.IF sy-subrc = 0.ls_abap_comp_descr-name = 'ZZKTEXT'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.<ld_data> = lv_name.ENDIF.ENDIF."国家专项CLEAR:lv_id,lv_name.IF ls_abap_comp_descr-name = 'ZZXMBH'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.lv_id = <ld_data>.SELECT SINGLE xmmc INTO lv_name  FROM ztfi0010 WHERE xmbh = lv_id.IF sy-subrc = 0.ls_abap_comp_descr-name = 'XMMC'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.<ld_data> = lv_name.ENDIF.ENDIF."变动原因CLEAR:lv_id,lv_name.IF ls_abap_comp_descr-name = 'ZZYWLX'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.lv_id = <ld_data>.SELECT SINGLE txt50 INTO lv_name FROM ztfi0077t WHERE zzywlx = lv_id.IF sy-subrc = 0.ls_abap_comp_descr-name = 'ZZBDYZNAME'.ASSIGN COMPONENT ls_abap_comp_descr-name OF STRUCTURE <ls_data> TO <ld_data>.IF sy-subrc NE 0.EXIT.ENDIF.<ld_data> = lv_name.ENDIF.ENDIF.ENDLOOP.ENDLOOP.endmethod.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/625224.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【javaWeb 第七篇】后端-Spring

Spring SpringspringBoot请求简单参数实体参数数组集合参数日期参数JSON参数路径参数 响应数据分层解耦三层架构解耦操作Bean的声明Bean组件扫描问题DI详解 Spring 详细介绍结合官网查看&#xff1a;https://spring.io/why-spring Spring发展到今天已经形成一种开发生态圈&…

计算机组成原理-->真值,机器数,定点数,浮点数,原反补

1.真值和机器数 真值&#xff1a;正、负号加某进制数绝对值的形式&#xff0c;即机器数所代表的实际值。如-1100 机器数&#xff1a;一个数值数据的机内编码&#xff0c;即符号和数值都数码化的数。常用的有原码和补码表示法。如11100. 2.定点数和浮点数的定义 在计算机中&…

redis五种类型介绍

Redis是一种内存数据存储系统&#xff0c;它支持五种不同的数据类型&#xff1a; 1. String String是Redis中最基本的数据类型&#xff0c;它可以存储任何形式的字符串数据&#xff0c;例如普通的文本字符串&#xff0c;二进制数据或JSON格式的数据。除此之外&#xff0c;还可以…

STM32有什么高速接口吗?

STM32系列微控制器在高速接口方面也提供了一些强大的功能&#xff0c;虽然没有像Zynq那样的可编程逻辑部分&#xff0c;但有一些特性值得注意。我这里有一套嵌入式入门教程&#xff0c;不仅包含了详细的视频 讲解&#xff0c;项目实战。如果你渴望学习嵌入式&#xff0c;不妨点…

python创建word文档并向word中写数据

一、docx库的安装方法 python创建word文档需要用到docx库&#xff0c;安装命令如下&#xff1a; pip install python-docx 注意&#xff0c;安装的是python-docx。 二、使用方法 使用方法有很多&#xff0c;这里只介绍创建文档并向文档中写入数据。 import docxmydocdocx.Do…

LabVIEW变速箱自动测试系统

LabVIEW变速箱自动测试系统 在农业生产中&#xff0c;采棉机作为重要的农用机械&#xff0c;其高效稳定的运行对提高采棉效率具有重要意义。然而&#xff0c;传统的采棉机变速箱测试方法存在测试效率低、成本高、对设备可能产生损害等问题。为了解决这些问题&#xff0c;开发了…

Python赋能AI数据分析开启人工智能新时代

文章目录 一、Python是办公自动化的重要工具二、Python是提升职场竞争力的利器三、Python是企业数字化的重要平台四、Python是AI发展的重要通道之一《编程菜鸟学Python数据分析》编辑推荐内容简介作者简介目录前言为什么要写这本书读者对象如何阅读本书 随着我国企业数字化和信…

蓝桥杯 — — 完全日期

完全日期 友情链接&#xff1a;完全日期 题目&#xff1a; 思路&#xff1a; 直接从20010101枚举到20211231&#xff0c;然后再判断每一个数是否是一个合法的日期&#xff0c;如果这个日期是合法的&#xff0c;接着判断这个日期的每一个位置上的数字之和是否是一个完全平方数…

图片转表格怎么显示两位小数字?

图片转表格的核心机制在于利用OCR技术&#xff0c;将图片上的表格文字精准转化为计算机能够理解的表格数据。然而&#xff0c;在进行这一转换过程中&#xff0c;为了防止出现科学计数法等复杂显示方式&#xff0c;程序默认会将所有单元格设置为字符串格式。这虽然保证了转换的准…

【C++学习】C++IO流

这里写目录标题 &#x1f680;C语言的输入与输出&#x1f680;什么是流&#x1f680;CIO流&#x1f680;C标准IO流&#x1f680;C文件IO流 &#x1f680;C语言的输入与输出 C语言中我们用到的最频繁的输入输出方式就是scanf ()与printf()。 scanf(): 从标准输入设备(键盘)读取…

智谱AI通用大模型:官方开放API开发基础

目录 一、模型介绍 1.1主要模型 1.2 计费单价 二、前置条件 2.1 申请API Key 三、基于SDK开发 3.1 Maven引入SDK 3.2 代码实现 3.3 运行代码 一、模型介绍 GLM-4是智谱AI发布的新一代基座大模型&#xff0c;整体性能相比GLM3提升60%&#xff0c;支持128K上下文&#x…

pandas基本用法

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 前言一、pandas的数据结构1、一维数组pd.Series1.1 pd.Series&#xff08;data,index,dtype&#xff09;示例1&#xff1a;不定义index示例2&#xff1a;自定义inde…