cancel
Showing results for 
Search instead for 
Did you mean: 

Validation of reused component in Main component and Control the Navigation

naimkhans_babi
Active Participant
0 Kudos

Dear Friends

Good morning,

I have one question as I mention in the subject.

How to validate the data from re-used component in the main component and based on error or not the error fire the navigation plug ?

What I am doing is, I have two components

1. Main_comp --> V_CREATE (view).

2. Ora_comp-->V_CREATE_ACCOUNT (view).

In Ora_comp I have some fields that are mandatory. plus I have 2 password fields that have to be matched with each other like ( Password and Re-Enter password).

now in the MAIN_COMP

I have the view called v_create in this view I am using method "WDDOBEFOREACTION" to validate the things. but now I am stuck here dont know how to call the wd_api of v_create_account view of Ora_comp.

if lo_action is bound.
     case lo_action->name.
         when 'TO_REV'. <--this is the next button action who will fire the navigation plug.

         I need to write something like this. 

             data l_view_controller type ref to if_wd_view_controller.
             data lo_api_interfacecontroller TYPE REF TO if_wd_controller.
             *lo_api_interfacecontroller = lo_interfacecontroller->wd_get_api( ).*
             *l_view_controller = lo_api_interfacecontroller.*
             *cl_wd_dynamic_tool=>check_mandatory_attr_on_view( view_controller = l_view_controller ).*       
     "some other loginc to report the non-matching passwords error using report attribute blah blah, but its okey its not a problem.
    " The proble is this 
     
        _l_view_controller ="  ? "_  <-- what should | write here to check my view's mandatory attribute of re-used components.
        _cl_wd_dynamic_tool=>check_mandatory_attr_on_view( view_controller = l_view_controller )._

Endcase.
Endif.

please help me. How I can solve this. your any help will be appreciated.

Thank you

Regards

Naeem

Accepted Solutions (0)

Answers (2)

Answers (2)

naimkhans_babi
Active Participant
0 Kudos

save the action from the main controllers view and send it through method in re-used controller.. based on that I trigger the back navigation even though i havent filled any mandatory field.

Former Member
0 Kudos

HI,

What you are doing and how you are trying to do is not possible i guess. cl_wd_dynamic_tool=>check_mandatory_attr_on_view would work on the current view controller. If you wan to do a validation involving the data from the used component then i might consider checking it manually and use message manager to report the messages.

When the control is in the V_create, why would you want to control the mandatory attributes for the view V_CREATE_ACCOUNT. There is no navigation happened from v-create to v_create-action.

naimkhans_babi
Active Participant
0 Kudos

Hi!

Thank you so much for your reply, well you are right theres no navigation is taking place.. actually my view (V_CREATE) of a main component is navigating to either to review form for for review the inputs or to go back to action view to select the action like create ,,

why I wanted to use that dynamic_tool into main view and play with the reused view's attributes because when user presses the back button and try to go to the action view.. v_create view will not allow him to go unless he fills all the required fields..

I wanted to over -come that.. by flush out the message area in to_action navigation part.. so I thought may be if I can do this in main view. i can remove the messages and message areas as well but I was wrong.

well will it be possible for me to know. How can We suppress the messages and go back to action view without filling the required fields.

look the design

1 Serview view ( Oracle-Unix-Active Directory) --> user have selected the Oracle

2 Action view ( all the oracle related link2action (create, delete, rename password) --user have selected the create account

3 v_create view ( Oracle_comp , unix_comp , active_dir_comp) since user have selected the oracle I will use oracle components'view... here I have the form to create the account in oracle server. this has the mandatory fields I can use the dynamic_tool to put check on mandatory attributes.

4 review view- ( Oracle_comp , unix_comp , active_dir_comp) since user have selected the oracle I will use oracle components'view..in read only.

5 submit message view.

so problem is at 3rd view... I can check the attributes from componets ... fill it and correct and go to review.

but I cant go back to action-view without filling the correct informaiton. that I wanted to solve. Suggest me is there anyway to suppress the messages and message area on to_action or anyother place to trigger the back view navigation.

I hope this reply will you to understand what I am doing

Thank you so much and Regards

Edited by: Naim Khan S Babi on Mar 13, 2011 8:47 PM

Former Member
0 Kudos

Hi,

when i read your design i understand you choice !!

is it not working if you check the action name and skip the dynamic_tool check in case of backward navigation from v_create to action_view ?.

Other option might be replacing the dynamic_tool check with your own method which would check and report messages with or without navigation blocking.

naimkhans_babi
Active Participant
0 Kudos

Hi ! Good morning.

Well you re answer really help me a lot. I think in beforeaction method of create_view ( re-used components'view) I can catch the main components' actions ... so I can catch the 'TO_REV" action and write everything this way.

method WDDOBEFOREACTION .

DATA lo_api_interfacecontroller TYPE REF TO if_wd_controller.
DATA lo_interfacecontroller TYPE REF TO ziwci_bc_ams_main .
DATA lo_action type ref to if_wd_action.
DATA l_view_controller            type ref to if_wd_view_controller.

lo_interfacecontroller =   wd_this->wd_cpifc_main_comp( ).
lo_api_interfacecontroller = lo_interfacecontroller->wd_get_api( ).

lo_action = lo_api_interfacecontroller->get_action( ).
lo_action->name = 'TO_REV'.

  if lo_action is bound.
     case lo_action->name. <-- I have an error here 😞 
       when 'TO_REV'.
           l_view_controller = wd_this->wd_get_api( ).
           cl_wd_dynamic_tool=>check_mandatory_attr_on_view( view_controller = l_view_controller ).
      
      when others.
            
     endcase.
  endif.
endmethod.

The error at case lo_action->name is saying like this The obligatory parameter "NAME" had no values assigned to it.

can you please tell me am I making mistake here.. I think I should get the name of action in NAME ,,,

Please help me to correct my mistakes... I appreciate your help.

Regards

Naeem

naimkhans_babi
Active Participant
0 Kudos

Hi!

name = 'TO_REV'.

lo_action = lo_api_interfacecontroller->get_action( name ).

I add this code and it has removed the error. but I am not getting any name in lo_action->name attribute

because IF_WDR_CONTROLLER_DELEGATE~WD_ACTIONS <- this is empty... ACTION tab is empty here so I am not able to read any action here... what could be the possible reason behind it...? do you have any idea please tell me . mean while I am digging more

Thanks & Regards

Naeem

naimkhans_babi
Active Participant
0 Kudos

Well why it is empty because i m getting componentcontroller in the create_view ('which is reused_components view) . it should be the v_create where I am triggering the actions. Now I need to check how to get the v_create in create_views method beforeaction.

Thank you and Regards

Naeem

gill367
Active Contributor
0 Kudos

Where is the validation actually happening in your application.

right now you want to change it. but originally how it is happening.

where is the code written for checking the mandatroy parameters.

is it in the wddobeforeaction of the view v_create_view.

and it is without the case statement to check the action name.

is it the scenario.

if yes

go to the button which takes you to the review page.

what is the action name for the same.

check for this action and call the check for mandatory paramters only for this action.

data lo_api_controller type ref to if_wd_view_controller.
  data lo_action         type ref to if_wd_action.

  lo_api_controller = wd_this->wd_get_api( ).
  lo_action = lo_api_controller->get_current_action( ).

  if lo_action is bound.
    case lo_action->name.

thanks

sarbjeet singh