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: 

Dynamic Data: Character Type Declaration

Former Member
0 Kudos

Hello Experts,

I would like to get your feedback regarding declaration of a character type field with dynamic length?

For example, I would like to declare data like: char(size) type c, where size is dynamic.

How can I do this? Thanks in advance.

Regards,

Jerome

5 REPLIES 5

kesavadas_thekkillath
Active Contributor
0 Kudos

Check my reply here

0 Kudos

Hello Keshav,

THanks for your reply. What I actually need is to create a table like:

data: begin of table occurs 0,

field(size here) type c, --> dynamic length field

end of table.

Can you help me in how to implement this?

Regards,

Jerome

0 Kudos

Please be more clear while asking the question. Now you question is how to create a dynamic internal table. This question is a FAQ and can be easily searched in forums.

Kesav

0 Kudos

Hello,

Normally the dynamic table creation I saw requires reference tables, in this case I need a dynamic length as a field in the internal table.

Regards,

Jerome

Former Member
0 Kudos

Hi,

DATA r_elemdescr TYPE REF TO cl_abap_elemdescr.

r_elemdescr ?= cl_abap_elemdescr=>describe_by_name( 'DATA_ELEMENT_HERE' ).

DATA r_field TYPE REF TO data.

FIELD-SYMBOLS <field> TYPE ANY.

CREATE DATA r_field TYPE HANDLE r_elemdescr.

ASSIGN r_field->* TO <field>.

<field> = .....

now <field> is your dynamic field value

Regards,

Ravi