Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How To Handle Error Message In TCD Recording?

Hi All,

I tried recording a transaction (my own transaction) by not enterring value in an obligatory field. the error message came. but when i executed the script, it showed an error. but actualy, the error message was expected right? how to handle this situation? i tried with tcd and sapgui recording. both gave almot the same result.

i am including the script which i have written.

***************************

MESSAGE ( MSG_1 ).

*TCD ( ZCUST , ZCUST_1 , ECC ).

SAPGUI ( SAP_1 , ECC ).

ENDMESSAGE ( E_MSG_1 ).

v_mno = &tfill.

v_msg = E_MSG_1[v_mno]-msgtext.

v_mtp = E_MSG_1[v_mno]-msgtyp.

            • If Msg Type is E *** **** It Has To Be E ****

IF ( v_mtp = 'E' and v_msg = 'Account no AC02 does not exist EXIT = X').

logtext(0,'Passed').

ELSE.

log(v_mtp).

log(v_msg).

logtext(1,'Failed').

ENDIF.

      • End Of The Condition For Message Type E ******

Former Member
Former Member replied

Jubish, your code is OK, but the error message will be caught by the default message rules - which state that error messages fail the script.

As Markus already hinted, the best way to solve this problem is to define a rule in the MESSAGE command like this:

1. Double-click MSG_1 inside MESSAGE ( MSG_1 ).

2. Add a new line to the table

3. Enter the following:

Mode 'R' (for "Require")

MSGID <i>Message class of your message</i>

MSGNR <i>Message number of your message</i>

<b>Important</b>: Try to use message class and message number to identify a message instead of the text. Why? It is a more stable solution (different logon languages, changes to the message text, variables within the text)

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question