Skip to Content
author's profile photo Former Member
Former Member

Dynamic Data: Character Type Declaration

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Dec 14, 2011 at 08:37 AM

    Check my reply here

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 14, 2011 at 08:39 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.