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

How to read the NAME of the attribute?

Hi Experts,

I am doing an application of WD Abap, and i have a scenario where in I have to read the 'Name' of the attribute. Can you please help if there is any method which gives me the name? Please help with the code if any.

eg:

i have 1 node - A

under node A, i have 1 attribute - PERNR

now, on screen, when i enter some value in input field "PERNR", i want to read the name of attribute i.e. 'PERNR' along with the value of it. I do not want to hardcode this name in method GET_ATTRIBUTE...

hope i am clear with my question. please help.

thanks

prateek

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Jul 25, 2012 at 03:57 PM

    Hi Parteek,

    If you are in an event handler method, e.g., for the onEnter event of an InputField, you can read the name of the field's bound context attribute by reading WDEVENT's PARAMETERS table. The record where NAME=ID shows you the field's bound context attribute.

    lv_the_attribute_name = wdevent->get_string( name = 'ID' ).

    Cheers,

    Amy

    Add a comment
    10|10000 characters needed characters exceeded

    • Hello Parteek,

      You can get the path to the context attribute and the element reference by calling method BOUND_VALUE of the input field. The last part of the path is the attribute name. Each UI element classe has methods BOUND_* for all bindable properties.

      Write the code in WDDOMODIFYVIEW

      DATA lo_element type REF TO CL_WD_INPUT_FIELD.
      DATA lv_path TYPE string.
      lo_element ?= view->get_element( 'ROOTUIELEMENTCONTAINER_USERID' ).
      CALL METHOD LO_ELEMENT->BOUND_VALUE
      * EXPORTING
      * CONTEXT_ELEMENT =
      * CONTEXT_NODE_PATH_NAME =
      RECEIVING
      PATH = lv_path

      Thanks & Regards,

      Chandani


      .

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.