Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to specify Internal table field length at run-time

Former Member
0 Kudos
170

I need to create an internal table where the field length is specified at run-time by the user. Syntax checks because q_pcleng is not a constant. Suggestions for work-around?

parameters: q_pcleng type i default 1024.

data: begin of file_buffer occurs 100,

record(q_pcleng),

end of file_buffer.

TIA,

Kirsten

4 REPLIES 4

suresh_datti
Active Contributor
0 Kudos
67

did you try to use

record type string ?

~Suresh

former_member181962
Active Contributor
0 Kudos
67

HI Kirsten,

Why not declare it as a string?

data: begin of file_buffer occurs 100,

record type string,

end of file_buffer.

Former Member
0 Kudos
67

Hello,

You can't do that. You must create the internal table dynamically at runtime, you can not change the attributes of the internal table once it is created.

/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap

Depending on your requirement, you may be able to use TYPE STRING for that field. Doing so, makes the field variable length. Again, I don't know what your requirement is.

Vasanth

0 Kudos
67

No, can't use type string. It needs to be a fixed length record but length will not be specified until run-time, could be length 100 this run, 1024 next run, 450 next, etc. I'm reading thru that blog to see if it can help. Thanks, Kirsten