Application Development and Automation 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: 
Read only

Dynamic Data: Character Type Declaration

Former Member
0 Likes
1,080

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
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
768

Check my reply here

Read only

0 Likes
768

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

Read only

0 Likes
768

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

Read only

0 Likes
768

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

Read only

Former Member
0 Likes
768

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