on 09-01-2013 3:35 AM
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.
hi,
Catch the even 'FPM_LEAVE_INITIAL_SCREEN' in the feeder class and check condition as per your requirement.
Regards,
Ragavendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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 5 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.
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.
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.
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.
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.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.