abap动态内表

This Tutorial details about creation of dynamic internal table with different scenarios

Internal Tables are local tables within a program containing a series of lines having same data type. ABAPTM Open SQL allows single field, range of fields, entire database table or view into an internal table.  

In technical terms Internal table is a dynamic sequential dataset in which all records have the same data structure and a key.  

A static internal table can be declared in an ABAPTM program initially, when the structure of the internal table is fixed and known to the user. 

Dynamic internal table is an extension to internal table concept, used when the number of fields is not known at the design time or until the compile time.

Scenario 1:

Display the table of contents in grid format using the dynamic internal table. 

Creating Dynamic internal table 

  PARAMETERS : p_table(10) TYPE C.

  DATA: w_tabname TYPE w_tabname,            

        w_dref TYPE REF TO data,             

        w_grid TYPE REF TO cl_gui_alv_grid. 

  FIELD-SYMBOLS: <t_itab> TYPE ANY TABLE. 

  w_tabname = p_table. 

  CREATE DATA w_dref TYPE TABLE OF (w_tabname).

  ASSIGN w_dref->* TO <t_itab>.

 Populating Dynamic internal table 

  SELECT *

    FROM (w_tabname) UP TO 20 ROWS

    INTO TABLE <t_itab>.

 Displaying dynamic internal table using Grid. 

  CREATE OBJECT w_grid

    EXPORTING i_parent = cl_gui_container=>screen0. 

  CALL METHOD w_grid->set_table_for_first_display

    EXPORTING

      i_structure_name = w_tabname

    CHANGING

      it_outtab        = <t_itab>. 

  CALL SCREEN 100.

 Scenario 2: 

Create a dynamic internal table with the specified number of columns. 

 Creating Dynamic internal table

TYPE-POOLS: slis.

 FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,  “ Dynamic internal table name

               <fs_dyntable>,                     “ Field symbol to create work area

               <fs_fldval> type any.              “ Field symbol to assign values 

PARAMETERS: p_cols(5) TYPE c.                     “ Input number of columns

DATA:   t_newtable TYPE REF TO data,

        t_newline  TYPE REF TO data,

        t_fldcat   TYPE slis_t_fldcat_alv,

        t_fldcat   TYPE lvc_t_fcat,

        wa_it_fldcat TYPE lvc_s_fcat,

        wa_colno(2) TYPE n,

        wa_flname(5) TYPE c. 

* Create fields .

  DO p_cols TIMES.

    CLEAR wa_it_fldcat.

    move sy-index to wa_colno.

    concatenate 'COL'

                wa_colno

           into wa_flname.

    wa_it_fldcat-fieldname = wa_flname.

    wa_it_fldcat-datatype = 'CHAR'.

    wa_it_fldcat-intlen = 10.

    APPEND wa_it_fldcat TO t_fldcat.

  ENDDO. 

* Create dynamic internal table and assign to FS

  CALL METHOD cl_alv_table_create=>create_dynamic_table

    EXPORTING

      it_fieldcatalog = t_fldcat

    IMPORTING

      ep_table        = t_newtable. 

  ASSIGN t_newtable->* TO <t_dyntable>. 

* Create dynamic work area and assign to FS

  CREATE DATA t_newline LIKE LINE OF <t_dyntable>.

  ASSIGN t_newline->* TO <fs_dyntable>.

Populating Dynamic internal table 

  DATA: fieldname(20) TYPE c.

  DATA: fieldvalue(10) TYPE c.

  DATA: index(3) TYPE c. 

  DO p_cols TIMES. 

    index = sy-index.

    MOVE sy-index TO wa_colno.

    CONCATENATE 'COL'

                wa_colno

           INTO wa_flname. 

* Set up fieldvalue

    CONCATENATE 'VALUE' index INTO

                fieldvalue.

    CONDENSE    fieldvalue NO-GAPS. 

    ASSIGN COMPONENT  wa_flname

        OF STRUCTURE <fs_dyntable> TO <fs_fldval>.

    <fs_fldval> =  fieldvalue. 

  ENDDO. 

* Append to the dynamic internal table

  APPEND <fs_dyntable> TO <t_dyntable>.

 Displaying dynamic internal table using Grid. 

DATA: wa_cat LIKE LINE OF fs_fldcat. 

  DO p_cols TIMES.

    CLEAR wa_cat.

    MOVE sy-index TO wa_colno.

    CONCATENATE 'COL'

                wa_colno

           INTO wa_flname. 

    wa_cat-fieldname = wa_flname.

    wa_cat-seltext_s = wa_flname.

    wa_cat-outputlen = '10'.

    APPEND wa_cat TO fs_fldcat.

  ENDDO. 

* Call ABAP List Viewer (ALV)

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

      it_fieldcat = fs_fldcat

    TABLES

      t_outtab    = <t_dyntable>.

ABAP动态内表使用的例子 主要是关于ABAP动态内表使用详细方法以及示例的详解 立即下载

相关推荐

保姆级教程:在Ubuntu 20.04上搞定PX4飞控与T265的视觉定位(附避坑指南)

本文提供在Ubuntu 20.04上配置PX4飞控与T265视觉定位系统的详细教程,涵盖驱动安装、ROS与MAVROS桥接、PX4参数调优及故障排查。通过实测验证的步骤和避坑指南,帮助开发者实现厘米级精度的视觉定位,特别适合室内无人机应用。

weixin_29038155的博客 248

ABAP动态内表

一、应用场景 当创建报表遇到行转列,或根据查询到的数据,确定显示ALV列时,可以使用动态内表,在运行是确定列数。 本实例,当查询的采购订单时,根据每个采购订单最大的行数,作为要显示的最大列,将每个采购订单的行,一列一列的显示,而不是一行行显示。 二、代码详解 1、查询数据 获取采购订单,获取采购订单最多有多少行,将来就要展示多少列 "-----------------------------@...

BinGeneral的博客 4101

详解电路设计中的RC电路

​ 一、什么是RC电路 RC电路是指由电阻R和电容C组成的电路,它是脉冲产生和整形电路中常用到 的电路。 常见的RC充、放电电路、RC积分电路合RC微分电路接下来详细讲解。 二、RC充、放电电路 RC充、放电电路如下图所示,下面通过充电和放电两个过程来分析此电路。 ​RC充、放电电路图 (1)RC充电电路 RC充电电路图如下图(a)所示 RC充电电路图及充电曲线图 ​由上图分析: 将上图a中开关S置于“1”处,电源E开始通过电阻R对电容C充电,由于刚开始充电时电容两端没有..

IT xiaobai 4万+

ABAP动态内表总结

实现动态内表功能需调用静态方法 :CREATE_DYNAMIC_TABLE 其功能为根据输入的fieldcat自动生成一个相应的内表,所以与常规的ALV编写顺序相反,在使用动态内表时一般先根据需求静态或动态的写好fieldcat数据,之后再以fieldcat为参数调用CREATE_DYNAMIC_TABLE方法来生成动态内表   1.填写FIELDCAT " ADD FIELDCATDAT...

Nathan的博客 7542

电源完整性之Cadence Sigrity Power SI_AC阻抗仿真

之前和大家分享过电源完整性之仿真设计原理链接: [link](https://blog.youkuaiyun.com/weixin_41808082/article/details/117065140?spm=1001.2014.3001.5501).今天接着上一篇文章总结一下电源AC阻抗的的仿真操作流程及一些simulation中的设置参数,用到的时候Cadence Sigrity 中的Power SI组件,下面开始享受仿真的快乐吧: 1.仿真模式选择与文件导入 选择Cadence Sigrity下的Power SI

刘小同学的博客 1万+

别再硬编码了!WinCC子画面动态加载的5种C脚本写法对比

本文深入解析WinCC子画面动态加载的5种C脚本实现方案,包括基础加载、路径动态解析、多语言切换、窗口自适应布局和混合架构交互。通过代码示例和场景分析,帮助开发者避免硬编码问题,提升工业自动化系统的交互效率和可维护性。特别推荐路径动态解析方案,有效解决项目路径管理的痛点。

weixin_29008691的博客 476

ABAP动态生成内表的三种方法

动态内表的创建和使用主要有以下几点: 动态内表的创建,首先要定义动态结构,然后再根据定义的动态结构利用系统一个标准的method:”cl_ALV_table_create=>create_dynamic_table“生成动态内表。 动态内表的赋值,遍历动态结构,获取指定的字段,然后给指定的字段赋值。 动态内表的读取显示,与赋值相似,遍历动态结构,获取指定的字段,然后读取对应字段的值。 其中...

ChampaignWolf的专栏 2636

分布式推理服务(策略:数据并行、张量并行、流水线并行、专家并行)技术分析

摘要:分布式推理突破单GPU内存和算力限制,支持大模型部署。四种核心策略包括: 数据并行:复制模型拆分数据,提升吞吐但内存效率低; 流水线并行:模型分阶段执行,支持超大模型但存在计算气泡; 张量并行:拆分层内矩阵运算,延迟低但通信开销大; 专家并行:动态激活MoE模型专家,计算高效但路由复杂。实际应用中常组合策略(如3D并行),需权衡模型规模、硬件条件与性能目标。

技术引领业务创新 943

ABAP开发学习记录——动态内表

income需要以waers字段作为参考单位。只输出所选月份的数据。

m0_64077397的博客 724

Agent本地部署教程详细步骤

在开始之前,你需要明确你要部署的Agent是什么。如果你需要部署其他Agent,请参考其官方文档调整步骤。

weixin_39673931的博客 2495

硬件测试之—纹波测试为什么不要使用接地夹子

示波器为什么不推荐使用接地夹

qq_19294353的博客 2988

ABAP动态内标的实现和常见使用方法,问题。

待定

ABAP成长之路 2250

基于QEMU的openEuler aarch64虚拟机快速部署与漏洞验证指南

本文提供了一份基于QEMU在个人电脑上快速部署openEuler aarch64虚拟机的详细指南。内容涵盖从软件准备、目录规划、QEMU安装、虚拟磁盘创建到系统安装与SSH配置的全过程,并以CVE-2024-1086内核漏洞为例,演示了如何在该虚拟环境中进行安全漏洞的验证与补丁测试,为安全研究和运维测试提供了一个低成本、高效率的ARM架构沙箱环境。

earth的博客 438

ABAP 动态内表,操作动态内表

ABAP 动态内表,删除,更新,增加

指尖溯光的博客 1439

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

ABAP创建动态内表

ABAP创建动态内表

woniu_maggie的博客 484

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

ABAP生成動態內表

創建步驟: 先定义动态结构體,然後用系統標準的方法:cl_alv_table_create=>create_dynamic_table,生成動態內表 赋值。遍歷动态结构,获取指定的字段,然后给指定的字段赋值。 顯示。遍歷动态结构,获取指定的字段,然后读取对应字段的值。 TABLES: ekbe. SELECT-OPTIONS: ebeln FOR ekbe-ebeln NO INTERVALS, matnr FOR ekbe-matnr NO INTERVALS,

JamesG's Blog 456

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

ABAP 创建动态内表的三种方法(转)

第一种: 如果我们需要的动态内表字段或者动态工作区和数据字典中的类型一致,可以直接使用CREATE DATA生成,当然也可以是自定义类型。 比如要产生和数据表MARA结构一致的动态内表: DATA : DY_TABLE TYPE REF TO DATA, WA_LINE TYPE REF TO DATA. FIELD-SYMBOLS: <DYN_TABLE> TYPE STANDARD TABLE . CREATE DATA DY_TABLE TYPE TABLE OF MARA. .

yiyuzz的博客 1765

ABAP内表动态排序

背景 内表的排序是ABAP最常见的操作,但是遇到动态内表时,无法静态指定内表组件,因此需要动态实现 解决方案 变量+小括号() 系统标准类cl_abap_itab_utilities=>virtual_sort() 常见的时第一种方式,但是排序组件较多时,需要定义的变量也相对较多,复杂且不美观 示例代码 types: begin of line, col1 type i, ...

u012232542的博客 3109

ABAP 动态创建变量,构造,表

1. A.动态创建变量 创建不同的基本类型,引用不同的get_*(),具体查看类cl_abap_elemdescr, DATA: dref_i TYPE REF TO data, elem_type TYPE REF TO cl_abap_elemdescr. "创建基本类型 elem_type ?= cl_abap_elemdescr=&gt;get_i( ). 创建变量对象...

weixin_42396921的博客 4188

动态ABAP内表

REPORT  ZLEIY_ABAP_TEST. FIELD-SYMBOLS:  TYPE STANDARD TABLE,                ,                . DATA: dy_table TYPE REF TO data,       dy_line  TYPE REF TO data,       it_structure TYPE lvc_t_

Bruce_yin的专栏 2003

ABAP 动态内表排序

动态内表要排序时,因为不知道内表中的字段名字,所以不能直接用SORT table BY field1 field2...可以使用下面的方法来实现:SORT table BY (sorttable)表类型: ABAP_SORTORDER_TAB结构类型: ABAP_SORTORDER代码示例:  DATA:  W_IT_FIELD       TYPE ABAP_SORTORDER_TAB,  W_...

weixin_41464064的博客 2609

ABAP 创建动态内表之一

REPORT ZLC_TEST09 . TYPE-POOLS:abap. PARAMETERS p_name TYPE tabname. DATA: d_ref TYPE REF TO data, lt_alv_cat TYPE TABLE OF lvc_s_fcat, ls_alv_cat LIKE LINE OF lt_alv_cat.   DATA: lt_table LIKE...

王小磊 3807

SAP ABAP 动态生成内表的几种做法

动态内表的创建,首先要定义动态结构,然后再根据定义的动态结构利用系统一个标准的method:”cl_ALV_table_create=>create_dynamic_table“生成动态内表。动态内表的读取显示,与赋值相似,遍历动态结构,获取指定的字段,然后读取对应字段的值。动态内表的赋值,遍历动态结构,获取指定的字段,然后给指定的字段赋值。

matinal 當冬夜漸暖 。公众号:matinal 1799

ABAP 内表排序 动态字段排序

SAP ABAP 内表动态排序

lnu2471的博客 466
上一篇: DYNP_VALUES_UPDATE 實時更新 Selection Screen
下一篇: 将SmartForms转换为PDF保存到本地
java_smalltalk
博客等级 码龄20年 8粉丝 43原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值