09-05-2007 8:38 AM
Hi All,
When iam using a message type as 'W' (Warning) in my program , the output is not showing the warning message , instead it showing the error message . Can any one solve my doubt . Plz tell me the explanations for my problem .
My Sample Code :
DATA: BEGIN OF structure,
name(10) TYPE c,
age TYPE i,
place(10) TYPE c,
END OF structure.
DATA : wa LIKE structure,
itab LIKE structure OCCURS 0.
DATA : v_var TYPE i .
*BREAK-POINT.
wa-name = 'raj'.
wa-age = 26.
wa-place = 'bangalore'.
APPEND wa TO itab.
CLEAR wa.
wa-name = 'praveen'.
wa-age = 23.
wa-place = 'chennai'.
APPEND wa TO itab.
CLEAR wa.
READ TABLE itab INTO wa WITH KEY name = 'TAJ'.
IF sy-subrc = 0.
WRITE : / wa-name,
wa-age,
wa-place.
ELSEIF sy-subrc = 4.
MESSAGE text-001 TYPE 'W'.
ENDIF.
09-05-2007 8:41 AM
Hi
Warning message can be used at AT SELECTION-SCREEN event, not in START-OF-SELECTION: here you should use a message I.
Max
09-05-2007 8:41 AM
Hi
Warning message can be used at AT SELECTION-SCREEN event, not in START-OF-SELECTION: here you should use a message I.
Max
09-05-2007 9:05 AM
Thank you. I got the idea . Its right that warning message will work only in selection-screen .
09-05-2007 8:43 AM
HI,
have you activated you code properly?
if yes try this
message w001.
double click on 001 and maintain the msg in this case you will get the desired.
or else use msg type I ie information message
thanks
vivekanand
09-05-2007 8:43 AM
hi,
Plz dont specify sy-subrc = 4 in elseif.
simply do it like
IF sy-subrc = 0.
WRITE : / wa-name,
wa-age,
wa-place.
ELSE.
MESSAGE text-001 TYPE 'W'.
ENDIF.
Reward if useful
Thanks,
Gaurav
09-05-2007 8:58 AM
Hi,
Warning messages can be used at only at (AT SELECTION-SCREEN) event.I ahve modified ur code and checked it worked.
DATA: BEGIN OF structure,
name(10) TYPE c,
age TYPE i,
place(10) TYPE c,
END OF structure.
DATA : wa LIKE structure,
itab LIKE structure OCCURS 0.
DATA : v_var TYPE i .
parameters : p_raj like mara-matnr.
*BREAK-POINT.
wa-name = 'raj'.
wa-age = 26.
wa-place = 'bangalore'.
APPEND wa TO itab.
CLEAR wa.
wa-name = 'praveen'.
wa-age = 23.
wa-place = 'chennai'.
APPEND wa TO itab.
CLEAR wa.
at selection-screen.
READ TABLE itab INTO wa WITH KEY name = p_raj.
IF sy-subrc = 0.
WRITE : / wa-name,
wa-age,
wa-place.
ELSEIF sy-subrc = 4.
MESSAGE text-001 TYPE 'W'.
ENDIF.
Regards,
Nagaraj