cancel
Showing results for 
Search instead for 
Did you mean: 

Validate a Field in the Initial Screen of UI in FPM

Venkat_Sesha
Advisor
Advisor
0 Kudos

  Hi Gurus,

I would like to validate this field in the Material Change initial Screen.

When the user Selects the particular Change Request Type. Then I need to Validate the Above entered plant against the Material Entered.

Where can I write the Code Logic for this validation from MARC table. Please help.

Accepted Solutions (1)

Accepted Solutions (1)

former_member215610
Active Participant
0 Kudos

hi,

Catch the even 'FPM_LEAVE_INITIAL_SCREEN' in the feeder class and check condition as per your requirement.

Regards,

Ragavendra

Venkat_Sesha
Advisor
Advisor
0 Kudos

Hi Ragavendra,

I am CRM Tech guy. I am bit fresh to FPM. Please shown me where can I find the feeder class and explain in detail what should I do there.

thanks

former_member215610
Active Participant
0 Kudos

Hi,

Goto Form UIBB configuration and you can find the feeder class under Floorplan setting.

and catch the event in get_data method.

Regards,

Ragavendra

Venkat_Sesha
Advisor
Advisor
0 Kudos

ok whats next.. after catching the event. I will validate plant against material there and throws an Abundant message. but still goes to next screen.

former_member215610
Active Participant
0 Kudos

Have you appended error message into ET_MESSAGES?

Venkat_Sesha
Advisor
Advisor
0 Kudos

yes ofcourse. There is a Strucute like ucms_messge or something I dont remember and I appended with msgty, msgid, msg1, blah blah blah.. The abandoned message is thrown on the screen but when I click on EDIT again with same data it goes to next screen.

former_member215610
Active Participant
0 Kudos

Hi

I Think it is raising LEAVE_INITIAL_SCREEN event try to check where this event is raising.

and based on your condition do not raise this event.

LEAVE_INITIAL_SCREEN-is use to leave initial screen.

code will be link this:

data: lo_fpm type ref to if_fpm

lo_fpm = cl_fpm_factory=>get_instance( )

lo_fpm->raise_event_by_id(IF_FPM_CONSTANTS=>GC_EVENT-LEAVE_INITIAL_SCREEN).

Regards,

Ragavendra

Venkat_Sesha
Advisor
Advisor
0 Kudos

Hi Check what I have written and see what I got.

Please tell me how to fix this.

When I press Continue and the Error is Displayed on the Screen but It is going to the next screen where in my requirement is it should not go to next screen.

Though the error message it displayed on the screen it continues to the Next Screen which should not happen. Also Please find the below code what I have written in the GET_DATA Method.

Method     IF_FPM_GUIBB_FORM~GET_DATA in the Class CL_MDG_BS_MAT_FEEDER_FORM_SET

ENHANCEMENT ZCL_FEEDER_FROM_SET.    "active version

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(3) Class /PLMU/CL_FRW_G_FEEDER_FORM, Interface IF_FPM_GUIBB_FORM, Method GET_DATA, End, Enhancement ZCL_FEEDER_FROM_SET, Start                       A

*

  Data : LV_RS_INITIAL_SCREEN_VALUES Type MDG_BS_MAT_S_MP_SETTINGS_DATA.

  Data : lt_marc Type STANDARD TABLE OF MARC,

         LV_FLAG Type Flag,

         ls_usmd_message Like Line of ET_MESSAGEs.

      DATA : DREF TYPE REF TO CL_FPM_EVENT.



  CALL METHOD CL_MDG_BS_MAT_SETTINGS=>GET_INITIAL_SCREEN_VALUES

    RECEIVING

      RS_INITIAL_SCREEN_VALUES = LV_RS_INITIAL_SCREEN_VALUES.

    If Not LV_RS_INITIAL_SCREEN_VALUES-CREQUEST_TYPE IS INITIAL.

* Validate the Material and Plant againt MARC Table

    Select * from marc into table lt_marc

                            WHERE matnr = LV_RS_INITIAL_SCREEN_VALUES-MATNR

                              And werks = LV_RS_INITIAL_SCREEN_VALUES-WERKS.

* If there is an Entry then mark a Flag

    If Sy-Subrc = 0.

      LV_FLAG = 'X'.

    Else.

      lv_flag = SPACE.

    Endif.

* Check What Change Request is Selected

    Case LV_RS_INITIAL_SCREEN_VALUES-CREQUEST_TYPE.



     When 'MAT02'.

      If Not LV_FLAG Is Initial.

* Error Message for the Wrong Plant

      ls_usmd_message-msgid = '00'.

      ls_usmd_message-SEVERITY = 'E'.

      ls_usmd_message-msgno = 001.

      ls_usmd_message-parameter_1 = 'Plant  '.

      ls_usmd_message-parameter_2 = LV_RS_INITIAL_SCREEN_VALUES-WERKS.

      ls_usmd_message-parameter_3 = ' already exists for the Material  '.

      ls_usmd_message-parameter_4 = LV_RS_INITIAL_SCREEN_VALUES-MATNR.

      APPEND ls_usmd_message TO Et_messages.

*      gv_werks = 'X'.

      endif.

    When 'MAT04'.

      " Do Nothing

    When others.

     If LV_FLAG Is Initial.

* Error Message for the Wrong Plant

      ls_usmd_message-msgid = '00'.

      ls_usmd_message-SEVERITY = 'E'.

      ls_usmd_message-msgno = 001.

      ls_usmd_message-parameter_1 = 'Plant '.

      ls_usmd_message-parameter_2 = LV_RS_INITIAL_SCREEN_VALUES-WERKS.

      ls_usmd_message-parameter_3 = ' does not exists for the Material '.

      ls_usmd_message-parameter_4 = LV_RS_INITIAL_SCREEN_VALUES-MATNR.

      APPEND ls_usmd_message TO Et_messages.

*      gv_werks = 'X'.

     endif.

    ENDCASE.

    READ TABLE ET_MESSAGES Into LS_USMD_MESSAGE With Key SEVERITY = 'E'.

    If Sy-Subrc = 0.

*       CLEAR ev_skip_default.

*        mo_controller->after_failed_event(

*          EXPORTING io_event            = io_event

*                    iv_raised_by_own_ui = iv_raised_by_own_ui ).

*     io_event = cl_fpm_event=>create_by_id( cl_fpm_event=>GC_EVENT_CANCEL ).

    Endif.

  ENDIF.

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(4) Class /PLMU/CL_FRW_G_FEEDER_FORM, Interface IF_FPM_GUIBB_FORM, Method GET_DATA, End, Enhancement ZCL_FEEDER_FROM_SET, End                         A

ENDENHANCEMENT.

former_member215610
Active Participant
0 Kudos

Hi,

when you click on continue event LEAVE_INITIAL_SCREEN is raise so it is displaying message and navigating to next page.

Create a action validate and assign to continue button and write you logic in get_data method. if it is validated then raise event LEAVE_INITIAL_SCREEN other wise do nothing.

Venkat_Sesha
Advisor
Advisor
0 Kudos

I got it what you are trying to say. But I don't know how to do this part. Create a ACTION VALIDATE and Assign it to CONTINUE Button. How do I do this part.

Please explain in code or something that how to do this

Venkat_Sesha
Advisor
Advisor
0 Kudos

This is what I have written if there is a error message under GET_DATA Method

    READ TABLE ET_MESSAGES Into LS_USMD_MESSAGE With Key SEVERITY = 'E'.

    If Sy-Subrc = 0.

      lo_fpm = cl_fpm_factory=>get_instance( ).

      lo_fpm->raise_event_by_id( IF_FPM_CONSTANTS=>GC_EVENT-LEAVE_INITIAL_SCREEN ).

    Endif.

former_member215610
Active Participant
0 Kudos

you can create a action using get_defination method by adding line item into et_action_defination.

and write the code to validate and append error message.

Read the et_message if severity = 'E' and if sy-subrc <> 0 then raise event LEAVE_INITIAL_SCREEN.

refer this code :

READ TABLE ET_MESSAGES Into LS_USMD_MESSAGEWith Key SEVERITY = 'E'.

    If Sy-Subrc <> 0.

      lo_fpm = cl_fpm_factory=>get_instance( ).

      lo_fpm->raise_event_by_id(IF_FPM_CONSTANTS=>GC_EVENT-LEAVE_INITIAL_SCREEN ).

    Endif.


Aliaksandr
Active Participant
0 Kudos

Hello,

Most appropriate method of feeder class to terminate FPM event is PROCESS_EVENT. You must add message in ET_MESSAGES table and set EV_RESULT parameter in IF_FPM_CONSTANTS=>GC_EVENT_RESULT-FAILED for this.

Unfortunately this method does not contain UI data but for this purpose you can use FLUSH method of feeder class which is triggered before PROCESS_EVENT. Store value of IS_DATA parameter in your global variable in feeder class and use it for your checks in PROCESS_EVENT method.

Kind regards, Aliaksandr.

Venkat_Sesha
Advisor
Advisor
0 Kudos

Hi AZ,

Thanks for the info. But still the same error remains.

In the GET Data I am checking some data validation and populating the error messages to a custom attribute in the class CL_MDG_BS_MAT_FEEDER_FORM_SET.

In the PROVESS_EVENT Method I am doing this.

oref type ref to CL_MDG_BS_MAT_FEEDER_FORM_SET.

and read oref->gt_message into WA with key severity = 'E'.

if sy-subrc = 0.

  Append lines of oref->gt_message to et_messages.

EV_RESULT = IF_FPM_CONSTANTS=>GC_EVENT_RESULT-FAILED

endif.

still the same problem remains. I get the error message when I click on continue and the screen moves to next screen with the error message on the top.

Aliaksandr
Active Participant
0 Kudos

Hello,

GET_DATA method is triggered later then PROCESS_EVENT. Move your checks in PROCESS_EVENT method.

Kind regards, Aliaksandr.

Venkat_Sesha
Advisor
Advisor
0 Kudos

Hi AZ,

However after GET_DATA, process Event is also triggered. I wan to stop there, after GET_DATA.

bcox I need to capture the screen data that has been changed.

Though I wrote the same logic in Flush , when user presses continue, error messages are shown and the next screen is called.

Aliaksandr
Active Participant
0 Kudos

Hello,

Could you post your implementations of FLUSH and PROCESS_EVENT methods?

Kind regards, Aliaksandr.

Venkat_Sesha
Advisor
Advisor
0 Kudos

Solved with some WD Post Implementation Method. Thanks everybody

Answers (0)