cancel
Showing results for 
Search instead for 
Did you mean: 

Question in Validation

Former Member
0 Kudos

HI All,

I am developing a web dynpro application

I have a main view in which I have a view_Container element that calls a view lets say(Details_view).

I have a button row in the main view and in the details_view I have some fields and a table.

I need to validate the attributes of the second view when an action is triggered i.e (Button clicked in the main_view).

How do i get what action is triggered in initial view in the details_view?

Moreover I need to validate and display the message in the message area of the details_view?

Is it possible to get the view controller reference of the details_view in the main_view?

Can somebody help me out.

Thanks,

Krishna

Accepted Solutions (1)

Accepted Solutions (1)

anand_nidamanuru
Active Participant
0 Kudos

Hi Krishnakumar,

Do both views belong to same component?

If they are in the same component

1) Call a component controller (CC) method from the Main View

2) Raise an event from the CC method

3) Place an event handler in the detail View

4) Now that you have control in detail view, anything should be possible

If they are in different component

1) Create an interface method in Detail view component

2) Call this method from Main View

3) Again the interface controller method, will follow the same steps as mentioned above

4) raise an event and handle it in detail view

However you can use Context mapping and get the data as mentioned by others.

Its based on your requirement.

Thanks,

Anand

Answers (3)

Answers (3)

Former Member
0 Kudos
I need to validate the attributes of the second view when an action is triggered i.e
 (Button clicked in the main_view).

To validate fields in Detail View when you click a button in Main View Follow this apporach :

1. Make similara node as in Details View in your component Controlleer.

2. Map the Component controler node with the Nodes of Detail View.

3. Now you can access the component controller nodes in your Main View also by further mapping.

This way on the click of Button in Main view , you can access the values entered in Detail View and thus validate it.

How do i get what action is triggered in initial view in the details_view?

If you follow above approach then you wont require which action is triggered in Main View.

You can validate your fields in Main View only.

Former Member
0 Kudos

hi Krishna ,

u can use control wizard ( CONTROL +F7 ) to display the messages using message manager

eg report_error_message for errors and report_success_message for succeess message

u can go to code wizard and select the genrate message radio tab


* get message manager
DATA lo_api_controller     TYPE REF TO if_wd_controller.
DATA lo_message_manager    TYPE REF TO if_wd_message_manager.
 
lo_api_controller ?= wd_this->wd_get_api( ).
 
CALL METHOD lo_api_controller->get_message_manager
  RECEIVING
    message_manager = lo_message_manager
    .
 
* report message
CALL METHOD lo_message_manager->report_error_message
  EXPORTING
    message_text              =   'Error_Text' " Give your error text here.
ELSE.
// ur successful message using report_success_message method

I hope it helps

regards,

amit

Former Member
0 Kudos

hi Krishna ,

proceed like this :

1 make a attribute under ATTRIBUTE's tab in ur component controller say attr1 of type numc

2 in the initial view , set its value to '00'


wd_comp_controller->attr1 = '00'

I need to validate the attributes of the second view when an action is triggered i.e (Button clicked in the main_view).

3 make a action for ur button UI

4 in the onaction of ur button , ie OnAction method of it , set the attr1 to '01'


wd_comp_controller->attr1 = '01'

I need to validate and display the message in the message area of the details_view

5 now check for the attr1 in ur details_view and do ur validations and display the message accordingly


DATA : lv_var type NUMC .
lv_var = wd_comp_controller->attr1.
IF lv_var = '01'.
// ur validations
// message
ENDIF.

I hope it wud help

regards,

amit