‎2006 Oct 13 1:18 PM
Hi Friends,
How to write error messages on the selection screen, pls give me an example.
Regards,
Venu
‎2006 Oct 13 1:22 PM
Hi venu
IF NOT S_PERSK IS INITIAL.
SELECT SINGLE PERSK
FROM PA0001
INTO PA0001-PERSK
WHERE PERSK IN S_PERSK.
IF SY-SUBRC NE 0.
MESSAGE E003(ZMESS).
ENDIF.
ENDIF.
Write above code...
what evr the field u want to validate..
award points if useful..
cheers
‎2006 Oct 13 1:24 PM
and click on ZMESS and it will take to se93 and there declare the messages
‎2006 Oct 13 1:25 PM
at selection-screen.
if <condition>.
MESSAGE 'Error' TYPE 'E'.
endif.
‎2006 Oct 13 1:32 PM
Hi Venu,
E- ERROR MESSAGE
S-STATUS MESSAGE
IF NOT S_EBELN[] IS INITIAL.
SELECT SINGLE EBELN
INTO LV_EBELN
FROM EKKO
WHERE EBELN IN S_EBELN.
IF SY-SUBRC <> 0.
<b> MESSAGE E000(ZLKPL_MSGCLASS) WITH 'Enter a</b> Material Number'.
V_FLAG = 'X'.
ENDIF.
Thanks
Vikranth Khimavath
‎2006 Oct 13 1:45 PM
Hi u have to define ur msg class via transaction se91 and define ur msg at there.
These r some examples:
DATA: mid TYPE sy-msgid VALUE 'SABAPDOCU',
mtype TYPE sy-msgty VALUE 'I',
num TYPE sy-msgno VALUE '014'.
MESSAGE ID mid TYPE mtype NUMBER num.
DATA: oref TYPE REF TO cx_sy_arithmetic_error,
text TYPE string.
TRY.
...
CATCH cx_sy_arithmetic_error INTO oref.
text = oref->get_text( ).
MESSAGE text TYPE 'I'.
ENDTRY.
DATA mtext TYPE string.
CALL FUNCTION ... EXCEPTIONS error_message = 4.
IF sy-subrc = 4.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
INTO mtext
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
MESSAGE i010 WITH 'This' 'is' 'not' 'America'.
‎2006 Oct 13 1:49 PM
Hi Venu,
If You want to give an error message on Selection Screen You can write the code as per the below example code.
Let say You want to validate Company Code
IF NOT S_BUKRS[] IS INITIAL.
SELECT SINGLE BUKRS
INTO T001-BUKRS
FROM T001
WHERE BUKRS IN S_BUKRS.
IF SY-SUBRC <> 0.
Message e000(zz) with 'Invalid Company Code'.
ENDIF.
ENDIF.
Hope this example helps your objective.
Regards,
sksingh
‎2006 Oct 13 1:50 PM
Hi,
at selection-screen.
SELECT SINGLE * FROM APQI INTO IT_APQI
WHERE DATATYP = GC_BDC
AND MANDANT = SY-MANDT
AND ( ( GROUPID = GC_GROUP1 OR
GROUPID = GC_GROUP2 ) )
AND QSTATE <> GC_QSTATE.
IF SY-SUBRC EQ 0.
MESSAGE E000(ZZ) WITH TEXT-050 TEXT-051.
ENDIF.
regards
amole