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

field symbol issue.

Hi,

i want to get the name of the field of table and check if this is key or not when i use this i get the value of the component.

how can i get the the component name.

ASSIGN COMPONENT  sy-index
         OF STRUCTURE <wa_table> TO <dyn_field>.

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Aug 12, 2008 at 09:42 AM

    try using the RTTI classes to get the information...sample code is as below...

    lt_components will contain the field names.

    data lo_structdescr type ref to cl_abap_structdescr.

    data lt_components type CL_ABAP_STRUCTDESCR=>component_table.

    LO_STRUCTDESCR ?= CL_ABAP_structDESCR=>DESCRIBE_BY_DATA( P_DATA = <WA_TABLE> ).

    lt_components = lo_structdescr->get_components( ).

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 12, 2008 at 09:42 AM
    data: lv_key            type c length 1.
    
    select keyflag 
    from   dd03l
    into    lv_key
    where tabname = "tablename
    and    fieldname = <dyn_field>.
    
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 12, 2008 at 09:58 AM

    Hi,

    If you know the internal tablename and program name in which it is declared you can try

    REUSE_ALV_FIELDCATALOG_MERGE.

    https://www.sdn.sap.com/irj/sdn/profile?editmode=true&userid=3495537

    Regards,

    Mohaiyuddin

    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.