‎2008 Jun 13 11:05 AM
Hello All,
For my Report I've a SSCRN.
This SSCRN has Input Fields and RadioButtons and Input Fields for RadioButtons.
Now I've to perform some screen modifications when one of the Radiobuttons is pressed.
That part I did it successfully on AT SSCRN OUTPUT Event.
But when it comes to the valiadation part then I'm facing some problems.
When I'm displaying an Error Message in the Event AT SSCRN Output
I'm getting a Pop-up of the Error Message and when I click on OK the screen is leaving to the SCREEN 0.
and when I'm raising a message in the startof-selection the screen the ERROR MSG is displayed on an empty screen where as I need it on the SSCRN.
So basically the problem is :
I want to raise Error messages when something is wrong w.r.t the Input Field values.
You guys can say that I can do that in the EVENT :AT SSCRN on FIELD .
But I need screen modifications also at the same time.
WHen I'm doing the validation in the above event my screen modifications are wrongly done.
for Eg. When i raise an error message at SSCN on Field event the error msg is raised but that field is not enabled.
SO i again modified the screen in the same event but some sync is missing and so I'm not getting the desired output.
and one more thing ........It's not about displaying ERROR LIKE Messages.
I want to display only ERROR message not DISPLAY LIKE ERROR Messages.
That means my control shid not go to the next step when this error message is triggered.
SO,how shud i raise Error Messages in the
1. AT SSCRN OUTPUT Event
2. START of SELECTION EVENT
3. AT SSCRN EVENT
4. AT SSCRN on FIELD EVENT
I'm attaching my code ...but I guess it's difficult for u guys to chk it as it involves lot of coding But still I appreciate if u guys can tell me the concept ...........
at selection-screen output.
perform screen_modify.
* At Selection-Screen
at selection-screen.
perform chk_boxes_init_chk. "001
* F4 help for layout field
at selection-screen on value-request for p_vari.
perform variant_f4.
* Begin of 001
* Storage location - Low F4 Help
at selection-screen on value-request for s_strloc-low.
clear gv_lgort.
perform search_help_strlocation changing gv_lgort.
s_strloc-low = gv_lgort.
* Storage location - High - F4 Help
at selection-screen on value-request for s_strloc-high.
perform search_help_strlocation changing gv_lgort.
s_strloc-high = gv_lgort.
* MRP Controller - Low - F4 Help
at selection-screen on value-request for s_mprct-low.
clear gv_dispo.
perform search_help_mrpcntrlr changing gv_dispo.
s_mprct-low = gv_dispo.
* MRP Controller - High - F4 Help
at selection-screen on value-request for s_mprct-high.
clear gv_dispo.
perform search_help_mrpcntrlr changing gv_dispo.
s_mprct-high = gv_dispo.
* End of 001
* F4 help for local file download
at selection-screen on value-request for p_path.
* Get file name
call function 'F4_FILENAME'
importing
file_name = gv_file.
if sy-subrc = 0.
p_path = gv_file.
endif.
******************************************************************************
* Selection-Screen Validations " 001
******************************************************************************
* Begin of 001
* Plant Validation
at selection-screen on p_plant.
perform plant_chk.
* Storage location Validation
at selection-screen on s_strloc.
if s_strloc-low is not initial and s_strloc-high is initial.
perform lgort_chk using s_strloc-low.
endif.
* Vendor Validation
at selection-screen on p_suppl.
if p_suppl is not initial.
perform vendor_chk.
endif.
* MRP Controller Validation
at selection-screen on s_mprct.
if s_mprct-low is not initial and s_mprct-high is initial.
perform mrp_controller_chk using s_mprct-low.
endif.
* Material Validation
at selection-screen on s_matnr.
if s_matnr-low is not initial and s_matnr-high is initial.
perform material_chk.
endif.
* Special Stock Indicator Validation
at selection-screen on s_sobkz.
if s_sobkz-low is not initial and s_sobkz-high is initial.
perform special_stock_chk.
endif.
* Movement Type Validation
at selection-screen on s_mvtpe.
if s_mvtpe-low is not initial and s_mvtpe-high is initial.
perform movt_type_chk.
endif.
* For Check Box of DIALOG
at selection-screen on p_disp.
if p_disp = 'X'.
* Check authority for the TCODE Access
* PERFORM tcode_auth_chk. " Test Purpose
* Check Authority for the Data Display
perform process_dialog_auth_chk.
endif.
* For Check Box of File Transfer
at selection-screen on p_trans.
if p_trans = 'X'.
* Check authority for the TCODE Access
* PERFORM tcode_auth_chk. " Test Purpose
* Check Authority for the Data Display and File Transfer
perform process_file_transfer_auth_chk.
endif.
* Chk the Path and FIle Name
at selection-screen on p_path.
perform chk_local_file_details.
* Chk for Vendor and Partner Number
at selection-screen on p_partn.
* PERFORM chk_edi_partner. "001
* End of 001
* Validation of layout variant
at selection-screen on p_vari.
if p_vari is not initial.
perform variant_existence using p_vari.
endif.
*&**********************************************************************
*& Form : SCREEN_MODIFY
*& Description : Modify the SSCRN fields
*&**********************************************************************
form screen_modify .
loop at screen.
* Begin of 001
if p_trans is initial.
clear : p_logfil,
p_pf,
p_pt,
p_dt,
p_cnt,
p_test,
p_run,
p_path,
p_partn.
clear : p_local,p_edi.
p_logic = 'X'.
if screen-name = 'P_LOGIC' or
screen-name = 'P_LOGFIL' or
screen-name = 'P_PF' or
screen-name = 'P_PT' or
screen-name = 'P_DT' or
screen-name = 'P_CNT' or
screen-name = 'P_TEST' or
screen-name = 'P_RUN' or
screen-name = 'P_LOCAL' or
screen-name = 'P_PATH' or
screen-name = 'P_EDI' or
screen-name = 'P_PARTN'.
screen-input = '0'.
modify screen.
endif.
endif.
if p_trans = 'X'.
if p_logic = 'X'.
p_local = ' '.
p_path = ' '.
p_edi = ' '.
p_partn = ' '.
** Validate when empty
* IF p_logfil IS INITIAL.
* MESSAGE s047 DISPLAY LIKE 'E'. "Please enter a Logical File
* ELSEIF p_pf IS INITIAL .
* MESSAGE s048 DISPLAY LIKE 'E'. "Please enter a value for the File Sender
* ELSEIF p_pt IS INITIAL.
* MESSAGE s049 DISPLAY LIKE 'E'. "Please enter a value for the File Receiver
* ELSEIF p_dt IS INITIAL.
* MESSAGE e065 DISPLAY LIKE 'E'. "Please enter a value for the Data Type
* ELSEIF p_cnt IS INITIAL.
* MESSAGE s066 DISPLAY LIKE 'E'. "Please enter a value for the Counter
* ENDIF.
elseif p_local = 'X'.
p_logic = ' '.
p_logfil = ' '.
p_pf = ' '.
p_pt = ' '.
p_dt = ' '.
p_cnt = ' '.
p_test = ' '.
p_run = ' '.
p_edi = ' '.
p_partn = ' '.
* Validation for the File Local's Path and Filename
if p_local = 'X'.
* IF p_path IS INITIAL.
* MESSAGE s043 DISPLAY LIKE 'E'. "Please enter a value for the Path and File Name
* ENDIF.
endif.
elseif p_edi = 'X'.
p_logic = ' '.
p_logfil = ' '.
p_pf = ' '.
p_pt = ' '.
p_dt = ' '.
p_cnt = ' '.
p_test = ' '.
p_run = ' '.
p_local = ' '.
p_path = ' '.
** Check the value for the Partner Number
* PERFORM partner_num_chk.
endif.
endif.
* End of 001
if p_logic = 'X'.
if screen-name = 'P_PATH' or
screen-name = 'P_FNAME' or
screen-name = 'P_PARTN'.
screen-input = '0'.
modify screen.
endif.
endif.
if p_local = 'X'.
if screen-name = 'P_PF' or
screen-name = 'P_PT' or
screen-name = 'P_DT' or
screen-name = 'P_CNT' or
screen-name = 'P_TEST' or
screen-name = 'P_LOGFIL' or
screen-name = 'P_RUN' or
screen-name = 'P_PARTN'.
screen-input = '0'.
modify screen.
endif.
endif.
if p_edi = 'X'.
if screen-name = 'P_PATH' or
screen-name = 'P_FNAME' or
screen-name = 'P_PF' or
screen-name = 'P_PT' or
screen-name = 'P_DT' or
screen-name = 'P_LOGFIL' or
screen-name = 'P_RUN' or
screen-name = 'P_CNT' or
screen-name = 'P_TEST'.
screen-input = '0'.
modify screen.
endif.
endif.
* IF P_DISP = 'X'.
* IF SCREEN-NAME = 'P_PATH' OR
* SCREEN-NAME = 'P_FNAME' OR
* SCREEN-NAME = 'P_PF' OR
* SCREEN-NAME = 'P_PT' OR
* SCREEN-NAME = 'P_DT' OR
* SCREEN-NAME = 'P_CNT' OR
* SCREEN-NAME = 'P_PARTN'.
* SCREEN-INPUT = '0'.
* MODIFY SCREEN.
* ENDIF.
* ENDIF.
endloop.
perform chk_edi_partner. "001
endform. " SCREEN_MODIFY
*&**********************************************************************
*& Form : PLANT_CHK *********************************************
*& Description : Validations for the PLANT Field on the SSCRN **********
*&**********************************************************************
form plant_chk .
data: lv_werks type werks_d.
if p_plant is not initial.
select single werks from t001w into lv_werks where werks = p_plant .
if sy-subrc <> 0.
message e012. " Please enter a valid Plant
exit.
endif.
endif.
endform. " PLANT_CHK
*&*********************************************************************************
*& Form : LGORT_CHK *******************************************************
*& Description : Validation for the Storage Location field value on the SSCRN *****
*&*********************************************************************************
form lgort_chk using p_s_strloc_low.
data: lv_lgort type lgort_d.
clear lv_lgort.
select single lgort from t001l into lv_lgort where lgort eq p_s_strloc_low.
if sy-subrc <> 0.
message e013.
exit.
endif.
endform. " LGORT_CHK
*&*********************************************************************************
*& Form : VENDOR_CHK ********************************************************
* Description : Validation for the Vendor field value on the SSCRN ****************
*&*********************************************************************************
form vendor_chk .
data: lv_lifnr type lifnr.
clear lv_lifnr.
select single lifnr from lfa1 into lv_lifnr where lifnr = p_suppl.
if sy-subrc <> 0.
message e073 with p_suppl.
endif.
endform. " VENDOR_CHK
&*********************************************************************************
*& Form : MRP_CONTROLLER_CHK ***********************************************
*& Description : Validate the field value of the MRP COntroller on the SSCRN ******
*&*********************************************************************************
form mrp_controller_chk using p_s_mprct_low.
data: lv_dispo type dispo.
clear lv_dispo.
select single dispo from t024d into lv_dispo where dispo eq p_s_mprct_low.
if sy-subrc <> 0.
message e015. "Please enter a valid MRP Controller
exit.
endif.
endform. " MRP_CONTROLLER_CHK
******************************************************************************
*& Form : MATERIAL_CHK ************************************************
*& Description : Validate the Material Number value entered on the SSCRN *****
******************************************************************************
form material_chk .
data: lv_matnr.
clear lv_matnr.
select single matnr from mara into lv_matnr where matnr = s_matnr-low.
if sy-subrc <> 0.
message e016. "Please enter a valid Material Number
endif.
endform. " MATERIAL_CHK
*****************************************************************************************************
*& Form : SPECIAL_STOCK_CHK ******************************************************************
*& Description : Validation for the field value of Special Stock Indicator entered on the SSCRN *****
*****************************************************************************************************
form special_stock_chk .
data: lv_sobkz type sobkz.
clear lv_sobkz.
select single sobkz from t148 into lv_sobkz where sobkz = s_sobkz-low.
if sy-subrc <> 0.
message e018. "Please enter a valid Special Stock Indicator
endif.
endform. " SPECIAL_STOCK_CHK
*******************************************************************************************
*& Form : MOVT_TYPE_CHK ************************************************************
*& Description : Validation for the field value of Movement Type entered on the SSCRN *****
*******************************************************************************************
form movt_type_chk .
data: lv_bwart type bwart.
clear lv_bwart.
select single bwart from t156 into lv_bwart where bwart = s_mvtpe-low.
if sy-subrc <> 0.
message e019. "Please enter a valid Movement Type
endif.
endform. " MOVT_TYPE_CHK
&**********************************************************************************************
*& Form : CHK_BOXES_INIT_CHK ************************************************************
*& Description : CHeck whether atleast one of the Check-Boxes have been selected or not! *******
*& If not then raise a message confirming the same *******************************
*&**********************************************************************************************
form chk_boxes_init_chk .
if p_disp is initial and p_trans is initial.
clear: p_local,p_edi.
p_logic = 'X'.
clear: p_logfil,p_pf,p_pt,p_dt,p_cnt,p_test,p_run,p_path,p_partn.
loop at screen.
if screen-name = 'P_LOGFIL' or
screen-name = 'P_PF' or
screen-name = 'P_PT' or
screen-name = 'P_DT' or
screen-name = 'P_CNT' or
screen-name = 'P_TEST' or
screen-name = 'P_RUN' or
screen-name = 'P_PATH' or
screen-name = 'P_PARTN' .
screen-input = '0'.
modify screen.
endif.
endloop.
message e046 display like 'I'
with 'Please select atleast one Check Box from'
'Processing Dialog and Processing File Transfer'.
exit.
endif.
endform. " CHK_BOXES_INIT_CHK
*&************************************************************************************
*& Form : PARTNER_NUM_CHK *****************************************************
*& Description : Validate the value ebetered for the Partner number on the SSCRN *****
*&************************************************************************************
form partner_num_chk .
data: lv_parnum type edpp1-parnum.
select single parnum from edpp1 into lv_parnum
where parnum = p_partn.
if sy-subrc <> 0.
message e067 ."DISPLAY LIKE 'E'. "Please enter a valid partner number
endif.
endform. " PARTNER_NUM_CHK
*&******************************************************************************************************
*& Form : CHK_EDI_PARTNER ***********************************************************************
*& Description : When the Data Transfer is opted via EDI, the Vendor and the Partner Number field ******
*& values on the SSCRN must be the same. If not then raise an error message **************
*&******************************************************************************************************
form chk_edi_partner.
if p_edi = 'X' and p_partn is initial.
loop at screen.
case screen-name.
when 'P_EDI' or 'P_PARTN' or 'P_LOGIC' or 'P_LOCAL'.
screen-active = '1'.
modify screen.
when others.
endcase.
endloop.
message e067.
elseif ( p_suppl is not initial ) and ( p_edi = 'X' ) and ( p_partn is not initial ).
loop at screen.
case screen-name.
when 'P_EDI' or 'P_PARTN' or 'P_LOGIC' or 'P_LOCAL'.
screen-active = '1'.
modify screen.
when others.
endcase.
endloop.
* Check the value for the Partner Number
perform partner_num_chk.
if p_suppl ne p_partn.
message e046 with text-037 text-038 .
exit.
endif.
endif.
endform. " CHK_EDI_PARTNER
*&**************************************************************************************
*& Form CHK_LOCAL_FILE_DETAILS ********************************************************
*& Description : Check the values for the Path and FIle Name for Local DOwnload ********
*&**************************************************************************************
form chk_local_file_details .
if p_local = 'X'.
if p_path is initial.
loop at screen.
case screen-name.
when 'P_LOCAL' or 'P_PATH'.
screen-active = '1'.
modify screen.
when others.
endcase.
endloop.
message e043. ""Please enter a value for the Path and File Name
endif.
endif.
endform.
Hope to hear from u soon !!!
Regards,
Deepu.K
‎2008 Jun 13 11:40 AM
Create a AT SELECTION-SCREEN. area and do your edits here. This event is basically the PAI (Process after Input) routine and will execute before the START-OF-SELECTION.
You should be able to use your MESSSAGE Exxx verb in here when you detect an error message.
‎2008 Jun 13 2:17 PM
Hello Paul,
As per ur advice I've used the EVENT AT SSCRN .
Now I'm able to raise a ERROR Message on the SSCRN.
But now I've a Problem.
After the errors are corrected on the SSCRN as per the messages raised,
and when pressed ENTER,
the control is going for the execution part i.e START OF SELECTION.
My Qn is why the control is going to the START OF SELECTION EVENT when I didn't press F8.
How to resolve this ?
Any clues ?
Regards,
Deepu.K
‎2008 Jun 13 2:23 PM
hi,
after raising error message, write this statement.
STOP or EXIT. so that the control doesnt go to next step.
Regards
Sandeep Reddy
‎2008 Jun 13 2:33 PM
Hello Sandeep,
I tried with Stop and Exit .
but still the problem persists !!!
Any clues ??
Regards,
Deepu.K