‎2007 Sep 17 4:35 PM
Hi.
The code that is being run is :
message 'check loads' type 'E'.
I want it to not send out the message "check loads", but to display the information in the particular table fields and also log it. What would be the syntax to post the data for a particular field in a table? Would you use the EXTRACT command and then the particular field names?
Also, I know that error message type 'E' logs the error, but it also stops the other jobs that are scheduled.
Would message type 'S' be suitable to log the error AND keep the other jobs that are scheduled to still run even though a previous job had an error?
‎2007 Sep 17 4:40 PM
Welcome to SDN.
Use this variation of MESSAGE -
... INTO text
Effect
With this addition, you assign the short text of the message to the variable text. The message type does not matter. The program flow is not interrupted and there is no message processing taking place. For text, a character-type data object is expected.
The addition INTO cannot be specified at the output of a user-defined text.
Example
The short text of a message sent in a function module is stored in the data object mtext when handling the exception error_message with help of the respective system fields.
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.
Regards,
Amit
Reward all helpful replies.
‎2007 Sep 17 4:40 PM
Welcome to SDN.
Use this variation of MESSAGE -
... INTO text
Effect
With this addition, you assign the short text of the message to the variable text. The message type does not matter. The program flow is not interrupted and there is no message processing taking place. For text, a character-type data object is expected.
The addition INTO cannot be specified at the output of a user-defined text.
Example
The short text of a message sent in a function module is stored in the data object mtext when handling the exception error_message with help of the respective system fields.
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.
Regards,
Amit
Reward all helpful replies.
‎2007 Sep 17 5:31 PM
Ok, maybe this might help clarify what I want:
This is the Code
-
message 'check loads' type 'E'.
else.
Read table [table name] with key [file name] = '101'
[file name] = '250'.
if sy-subrc = '0'.
open dataset dsn for output in text mode encoding default.
transfer flag_n to dsn.
close dataset dsn.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
COMMANDNAME = CMDNAME
ADDITIONAL_PARAMETERS =
OPERATINGSYSTEM = SY-OPSYS
TARGETSYSTEM = tgtsys
DESTINATION =
STDOUT = 'X'
STDERR = 'X'
TERMINATIONWAIT = 'X'
TRACE =
IMPORTING
STATUS =
EXITCODE =
TABLES
EXEC_PROTOCOL = rec
EXCEPTIONS
NO_PERMISSION = 1
COMMAND_NOT_FOUND = 2
PARAMETERS_TOO_LONG = 3
SECURITY_RISK = 4
WRONG_CHECK_CALL_INTERFACE = 5
PROGRAM_START_ERROR = 6
PROGRAM_TERMINATION_ERROR = 7
X_ERROR = 8
PARAMETER_EXPECTED = 9
TOO_MANY_PARAMETERS = 10
ILLEGAL_COMMAND = 11
WRONG_ASYNCHRONOUS_PARAMETERS = 12
CANT_ENQ_TBTCO_ENTRY = 13
JOBCOUNT_GENERATION_ERROR = 14
OTHERS = 15
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
-
The job log has these fields:
Date Time Message text Message class Message no. Message type
-
I want the job log to display in the 'Message text' field the particular table info.
The info that I want displayed are in a particular table with these fields:
Job Name Tivoli message Tivoli status Table data status
-
Is there a possible way to log all of this info in the job log for users to see why the job didnt finish, and also to keep the other scheduled jobs from canceling?
Thanks
‎2007 Sep 17 4:57 PM
Man that was fast. Are you a bot?
Anyway, I am still analyzing the answer. There may be more info I need. I am dealing with tables.....
‎2007 Sep 18 3:17 AM
Yes, type "S" messages will be written to the Job Log and the program will continue... whereas "E" messages will stop processing in the job. Obviously you'd want to set some "g_error_flag" in your code so that you don't perform any processing that should only occur in a "good" situation.
So, for example something like:
message s398(00) with 'Error with system command' l_usercommand 'at' sy-uzeit.will just go to the job log. Also, you might have a look at writing exceptions to the system log - that may be even better for your purpose (have a look at function RSLG_WRITE_SYSLOG_ENTRY et al).
Jonathan