cancel
Showing results for 
Search instead for 
Did you mean: 

raising error messages on click of Next Button in GAF

Former Member
0 Kudos

Hi ,

I have created OIF application for my WD component using FPM_GAF_COMPONENT.

I am able to generated the roadmap and on the second step of the roadmap , I have certain input fields. Now based on some validations, I want to generate the error message.

I have made a button and in the onaction of that , I am successfully able to validate the fields using report T100 message.


  DATA: valid_characters         TYPE string .

    CONCATENATE '0123456789' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ '
  'abcdefghijklmnopqrstuvwxyz&' INTO valid_characters RESPECTING BLANKS.


  DATA lo_nd_node_vname TYPE REF TO if_wd_context_node.
  DATA lo_el_node_vname TYPE REF TO if_wd_context_element.
  DATA ls_node_vname TYPE wd_this->element_node_vname.
  DATA lv_vname LIKE ls_node_vname-vname.
* navigate from <CONTEXT> to <NODE_VNAME> via lead selection
  lo_nd_node_vname = wd_context->get_child_node( name = wd_this->wdctx_node_vname ).

* get element via lead selection
  lo_el_node_vname = lo_nd_node_vname->get_element(  ).

* get single attribute
  lo_el_node_vname->get_attribute(
    EXPORTING
      name =  `VNAME`
    IMPORTING
      value = lv_vname ).

  IF NOT lv_vname CO valid_characters.

    CALL METHOD wd_this->mr_message_manager->report_t100_message
      EXPORTING
        iv_msgid          = 'ZVM_MESSAGE_CLASS'
        iv_msgno          = 000
        io_component      = wd_this
        iv_severity       = if_fpm_message_manager=>gc_severity_error
        iv_lifetime       = if_fpm_message_manager=>gc_life_visibility_automatic
        io_element        = lo_el_node_vname
        iv_attribute_name = `VNAME`.

  ENDIF.

But my requirement is to validate the input fields on click of the Next button of the roadmap

How can I do it?

Thanks,

Amit

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Amit,

As i understood, If there is any error on the view than you should not be able to go to the next step in the roadmap right?

if so...

than yes it is possible.

See i tried it and found that, i could not calcel any standard eventAs in your case canceling the next event).

But yes they is way around.

For example say you have 3 steps and on the second step you got the error, so you want to stay at the second step.

now in the PROCESS_EVENT of 2 step write the following code.

DATA lo_fpm TYPE REF TO if_fpm.

lo_fpm = cl_fpm_factory=>get_instance( ).

CASE io_event->mv_event_id.

WHEN io_event->gc_event_next_step.

CALL METHOD lo_fpm->raise_event_by_id( io_event->gc_event_next_step ).

WHEN OTHERS.

ENDCASE.

and in the PROCESS_EVENT of 3 step write the following code.

DATA lo_fpm TYPE REF TO if_fpm.

lo_fpm = cl_fpm_factory=>get_instance( ).

CASE io_event->mv_event_id.

WHEN io_event->gc_event_next_step.

CALL METHOD lo_fpm->raise_event_by_id( io_event->gc_event_previous_step ).

WHEN OTHERS.

ENDCASE.

This is because when the line CALL METHOD lo_fpm->raise_event_by_id( io_event->gc_event_next_step ).

will get executed it will carry NEXT event to the 3 step and on the NEXT event of the 3 step you are firing event

CALL METHOD lo_fpm->raise_event_by_id( io_event->gc_event_previous_step ).

which will again get back you to 2 step.

Modify the code accordingly, means before raising

CALL METHOD lo_fpm->raise_event_by_id( io_event->gc_event_next_step ).

check whether error ocurred in this step by using simple IF ELSE.

similarly before raising event

CALL METHOD lo_fpm->raise_event_by_id( io_event->gc_event_previous_step ).

in the 3 step,

check whether there is any error in step 2.

I hope there yor are using IF_FPM_SHARED_DATA to share the data b/w components if there are more than one component,

otherwise in 3 step you won't be able to now the errors of 2 step.

Hope this will help you.

Regards,

Arvind

Former Member
0 Kudos

Yes Arvind ,

perfect .. u have understood correctly . I do not want to navigate to the third step if there is a problem in the second step.

thanks for your code , but I am a beginner in FPM , so do not really know how to implement it

for all my steps , I am using the same WD component . I am able to see a single method PROCESS_EVENT inside the component controller of my WD component .

but what do u exactly mean by the PROCESS_EVENT of 2nd and 3rd step ? I am not able to see the different methods for different roadmap steps .Please help me in this regard.

Also another thing , which I wanted is to generate the error message on the screen , as soon as I click on the Next button to navigate to the other step.

eg here is my scenario.. in the second step , I have only one input field and NEXT & PREVIOUS buttons . When I click on NEXT button ( which shud navigate me to the third step) , I shud not be allowed to navigate and the error message shud come ..

as of now , I am also maintaining a BUTTON in the second step of roadmap and am generating error message against any validation of INPUT FIELD on click of tht BUTTON. Also I am not able to restrict user to this step when erro comes.

Regards,

Amit

Former Member
0 Kudos

Hi Amit,

1. For validating on click next button, create a method in component controller and call this method on th click of next button.

2. For restricting the navigation to the next step.

DATA lo_fpm TYPE REF TO if_fpm.

DATA lv_error TYPE wdy_boolean.

lo_fpm = cl_fpm_factory=>get_instance( ).

CASE io_event->mv_event_id.

WHEN io_event->gc_event_next_step.

IF lv_error = 'X'.

CALL METHOD lo_fpm->raise_event_by_id( io_event->gc_event_previous_step ).

ENDIF.

WHEN OTHERS.

ENDCASE.

Write this code in the PROCESS_EVENT method which u could identify in the component controller.

where lv_error is true if there is any error in the step.

Hope this will work.

Regards,

Arvind

Former Member
0 Kudos

Hi Arvind/Amit,

I read your thread and I would like to know if you have consindered using the export parameter EV_RESULT of the PROCESS_EVENT method?

When the parameter EV_RESULT is given a value of "FAILED" (GC_EVENT_RESULTS-FAILED), the event is cancelled (i.e. navigation to the next tab is cancelled).

You can do your data validation and based on your condition, pass "FAILED" to EV_RESULT when required.

ev_result = if_fpm_constants=>gc_event_result-failed.

Regards,

Saleem

Former Member
0 Kudos

Hi,

Also, if you raise an FPM error message defined in the method PROCESS_EVENT(), it will automatically cancel the navigation in the GAF application.

Regards,

Saleem

Answers (0)