‎2007 Feb 02 5:10 PM
hi every one,
i just had to create an internal table and capture the error messages ( like vendor not exists) when validation check fails and send these error messages to internal table and also to screen.
can any one please give me piece of code for this.
thank you
pavan.
‎2007 Feb 02 5:16 PM
Hi,
Check this example.
DATA: T_ERROR(50) OCCURS 0 WITH HEADER LINE.
DATA: V_MESSAGE(50).
SELECT SINGLE * FROM LFA1
WHERE VENDOR = P_LIFNR.
IF SY-SUBRC <> 0.
Call the function module to format the message.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = '00'
NO = '398'
V1 = 'Vendor don't exists'
V2 = P_LIFNR
V3 = ''
V4 = ''
IMPORTING
MSG = V_MESSAGE.
append the error message.
T_ERROR = V_MESSAGE.
APPEND T_ERROR.
ENDIF.
END-OF-SELECTION.
Display the error message.
LOOP AT T_ERROR.
WRITE: / T_ERROR COLOR COL_NEGATIVE.
ENDLOOP.
Thanks,
Naren
‎2007 Feb 02 5:16 PM
Hi,
Check this example.
DATA: T_ERROR(50) OCCURS 0 WITH HEADER LINE.
DATA: V_MESSAGE(50).
SELECT SINGLE * FROM LFA1
WHERE VENDOR = P_LIFNR.
IF SY-SUBRC <> 0.
Call the function module to format the message.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = '00'
NO = '398'
V1 = 'Vendor don't exists'
V2 = P_LIFNR
V3 = ''
V4 = ''
IMPORTING
MSG = V_MESSAGE.
append the error message.
T_ERROR = V_MESSAGE.
APPEND T_ERROR.
ENDIF.
END-OF-SELECTION.
Display the error message.
LOOP AT T_ERROR.
WRITE: / T_ERROR COLOR COL_NEGATIVE.
ENDLOOP.
Thanks,
Naren
‎2007 Feb 02 5:22 PM
thank you narendran, but there are around 20 validation checks so do u think i need to call this function module format_message for each validation check, i mean 20 times.
please revert back if you dont understand my concern.
thank you
pavan kumar
‎2007 Feb 02 5:28 PM
Hi,
FORMAT_MESSAGE is used to get the message for the corresponding message id, message no..
If you don't want to use it..You can directly add the message to the error internal table..
Example
-
SELECT SINGLE * FROM LFA1
WHERE VENDOR = P_LIFNR.
IF SY-SUBRC <> 0.
CONCATENATE 'Vendor ' P_LIFNR ' not valid' into T_ERROR.
APPEND T_ERROR.
ENDIF.
Thanks,
Naren
‎2007 Feb 02 5:32 PM
thanks for your answer, do you also know how to send the captured error messages in internal table to user's outlook email.
please help me regarding this,
thank you
pavan
‎2007 Feb 02 6:13 PM
‎2007 Feb 02 6:31 PM
hi naren,
i just posted my question as a new thread, if possible try to answer it.
thanks
pavan