‎2008 Jun 09 8:37 AM
Hi,
If I enter wrong data on screen-field, I should get message and after if I press enter, I should come back to that screen-field again so that I can enter proper data and proceed.
What type of mesaage I should use here.
Kindly suggest me with coding.
thanks
‎2008 Jun 09 8:42 AM
write this code:
At selection screen.
IF P_PSPNR IS not initial INITIAL .
select * from <db table> into <> where .......
else.
MESSAGE E011(ZPS) .
LEAVE LIST-PROCESSING.
ENDIF.
Thanks
‎2008 Jun 09 8:43 AM
Hi Naresh,
Use Error Message type.
Refer the below coding:
AT SELECTION-SCREEN ON FIELD field_name.
SELECT query.
IF SY-SUBRC NE 0.
MESSAGE 'message text' TYPE 'E'.
ENDIF.Regards,
Sunil.
‎2008 Jun 09 9:06 AM
Hi,
if u are doing Module pool then in PAI.
Write the field name between CHAIN ENDCHAIN method and write the validation b/w the method.
If u need further clarification revert back.
Regards
Sandipan.
‎2008 Jun 09 9:12 AM
use like that:
SELECT bukrs
lifnr
gjahr
INTO CORRESPONDING FIELDS OF TABLE i_bsak
FROM bsak
WHERE budat IN s_budat
AND bukrs IN s_bukrs
AND blart IN s_blart
AND uzawe IN s_uzawe.
IF i_bsak[] IS INITIAL.
MESSAGE i019."No Records found
LEAVE LIST-PROCESSING.
ENDIF.
here if where condition is not satisfied, then internal table i_bsak will empty and a message will be displaying no records found. and once u click it will back to the selection screen, and from there u can again enter the correct inputs..
thanks,
Vipin
‎2008 Jun 09 9:31 AM
Hi Naresh,
For printing the Error Messages after validations of EKKO- EBELN, please find below the code.
module validate_ebeln input.
case ok_code_5000.
when 'DISP'.
select single ebeln
into ekko
from ekko
where ebeln = ekko-ebeln.
if sy-subrc <> 0.
clear ekko.
clear ok_code.
message e003 with ekko-ebeln. " PO Does Not exist
endif.
when 'CHAN'.
select single ebeln
into ekko
from ekko
where ebeln = ekko-ebeln.
if sy-subrc <> 0.
clear ekko.
clear ok_code_5000.
message e003 with ekko-ebeln. " PO Does not exists
endif.
when 'CREA'.
clear: w_ebeln,
w_bukrs,
w_bsart,
w_lifnr,
w_ekorg,
w_ekgrp,
w_aedat,
w_ernam,
t_po_item.
refresh t_po_item.
select single ebeln
into ekko
from ekko
where ebeln = ekko-ebeln.
if sy-subrc = 0.
clear ekko.
clear ok_code_5000.
message e004 with ekko-ebeln. " PO Already exists.
endif.
endcase.
endmodule. " VALIDATE_ebeln INPUT