简体   繁体   English

以字节为单位计算itab结构的长度

[英]Calculate the length of itab structure in bytes

The internal table size (eg for a DSO) is limited to 4030 bytes.内部表大小(例如对于 DSO)限制为 4030 字节。 I have a list of infoobjects and would like to calculate if their amount will exceed this limit.我有一个 infoobject 列表,想计算它们的数量是否会超过这个限制。 How can I convert their data type in bytes?如何以字节为单位转换它们的数据类型?

Example:例子:

CHAR 4 -> xxx bytes
DATS   -> xxx bytes
FLTP   -> xxx bytes
...

Thanks a lot!非常感谢!

You have to replace the ls_bkpf with the actual structure (line of internal table) you use in your program, oherwise I hope it helps.您必须将ls_bkpf替换为您在ls_bkpf使用的实际结构(内部表行),否则我希望它会有所帮助。 lv_length will contain the total size of the fields in bytes. lv_length 将包含字段的总大小(以字节为单位)。

  DATA: ls_bkpf TYPE bkpf.
  FIELD-SYMBOLS: <lv_field> TYPE any.
  DATA: lo_typedesc TYPE REF TO cl_abap_typedescr.
  DATA: lv_length TYPE i.

  DO.
    ASSIGN COMPONENT sy-index
           OF STRUCTURE ls_bkpf
           TO <lv_field>.
    IF sy-subrc EQ 0.
      lo_typedesc = cl_abap_elemdescr=>describe_by_data( <lv_field> ).
      ADD lo_typedesc->length TO lv_length.
    ELSE.
      EXIT.
    ENDIF.
  ENDDO.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MySQL:为什么索引长度为0.0字节? - MySQL: Why is my index length 0.0 bytes? 程序内的MySQL函数LENGTH()不会以字节为单位返回字符串长度 - MySQL function LENGTH() inside a Prodedure doesnt return string length as bytes ABAP - 内部连接 ​​itab 与 db 表 - ABAP - Inner Join itab with db table 如何在MySQL中预测/计算数值(INT)的字段长度? - How to predict/calculate field length of numeric values (INT) in MySQL? MySQL ERROR 1071 (42000):指定的密钥太长; 最大密钥长度为 1000 字节 - MySQL ERROR 1071 (42000): Specified key was too long; max key length is 1000 bytes 无法将数据库复制到远程主机。 指定的密钥太长; 最大密钥长度为767字节 - Cannot copy database to remote host. Specified key was too long; max key length is 767 bytes 如何在mysql中解决“指定密钥太长,最大密钥长度为255字节”? - How to resolve “specified key was too long max key length is 255 bytes” in mysql? oracle wmconcat,listagg函数报告字符串长度超过4000字节错误 - oracle wmconcat,listagg function report string length exceed 4000 bytes error django.db.utils.OperationalError: (1071, '指定的密钥太长;最大密钥长度为 767 字节') - django.db.utils.OperationalError: (1071, 'Specified key was too long; max key length is 767 bytes') Lumen 5.6 迁移错误指定的密钥太长最大密钥长度为 767 字节 - Lumen 5.6 Migrate Error Specified key was too long max key length is 767 bytes
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM