cancel
Showing results for 
Search instead for 
Did you mean: 

Adding customer validation to standard viewset in enhanced component

former_member182421
Active Contributor
0 Kudos

Hi,

I'm trying to validate a field, for example first Name in BP (component IUICMD) , but I don't know wich method I should use to read the specific attributes of the context node on the event EH_ONSAVE, somebody knows how to get the value?

Thanks n' Best regards,

Luis

Edited by: Luis pérez on Apr 29, 2008 9:16 AM

Accepted Solutions (1)

Accepted Solutions (1)

PeCo
Advisor
Advisor
0 Kudos

Hi Luis,

you access the data from the UI layer via the context nodes. So you need to identify which context node of your view the relevant attribute belongs to, most likely something like Detail, BuilHeader or so. Attrbute should be FIRST_NAME for the first name field.

Tip: At runtime, put the cursor into the field and press the F2 key. A popup will show up with component name, view name, context node and attribute.

To access the attribute value in the coding you need to go access the the context node via the TYPED_CONTEXT attribute of the view. From the context node you could either access the attribute value via a getter (you may need to generate a specific one) or by accessing the current entity and go from there.

So e.g.

me->typed_context-><your_context_node_name>->get_<your_attribute>( ) for the getter access

or

lr_ent = me->typed_context--><your_context_node_name>->collection_wrapper->get_current( ). lv_val = lr_ent->get_property( '<your_attribute>').

Best regards

Peter

Former Member
0 Kudos

Hi,

Actually I am facing Problem regarding my current object. When this line of code runs

current = collectio_wrapper->get_current(). of my defined ATTRIBUTE, it shows null so my field property does not get set. So i am not able to save it..

What can be the issue like.................!

Could you please help me out.............!

Harkesh Dang

former_member182421
Active Contributor
0 Kudos

Hi, I think you should open a new threat with you're question coz it looks a little offtopic

Best Regards,

Luis

Answers (1)

Answers (1)

former_member182421
Active Contributor
0 Kudos

Hi, I finally found the method to get te value of the attribute in the context node,

Example:

L_PERSON is the instance of the one node context.

L_back is a string.

CALL METHOD L_PERSON->IF_BSP_MODEL_BINDING~GET_ATTRIBUTE

EXPORTING

  • ATTRIBUTE_REF =

ATTRIBUTE_PATH = 'STRUCT.LASTNAME' "<- For example

  • INDEX =

  • COMPONENT =

  • NO_CONVERSION_EXIT = 0

RECEIVING

VALUE = l_back.

I hope this will help!

Thanks N' Best Regards.

Luí