Error message into a Variable.
Dear users,
I have a rather usual (unusual from the weekend beers for me though!!) query which I can't figure out a proper way to implement.
My requirement is like this:
I have a message class in which I want to define a text 'Employee number & not found'.
I want to use this in the program, but not to raise this error. Instead, I want to move this error message with the Employee number into a Character(200) variable.
So instead of using MESSAGE e0xx(messageclass) USING employee number, I would like to move the error text into a variable which looks like:
lv_text = e0xx(messageclass) USING '1234' which stores the text 'Employee number 1234 not found' in lv_text.
How would I acheive it??
Thanks, V!
Try tis way
message e999(00) with i_emp-empno into lv_text.
press f1 in message will provide you more details
a®
Similar Messages
-
How can I put all output error message into a String Variable ??
Dear Sir:
I have following code, When I run it and I press overflow radio button, It outputs following message:
Caught RuntimeException: java.lang.NullPointerException
java.lang.NullPointerException
at ExceptionHandling.ExceptTest.actionPerformed(ExceptTest.java:72)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:291)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)Caught RuntimeException: java.lang.NullPointerException
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)I hope to catch all these error message into a String Variable such as StrErrorMsg, then I can use System.out.println(StrErrorMsg) to print it out or store somewhere, not only display at runtime,
How can I do this??
Thanks a lot,
See code below.
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.FileInputStream;
import javax.swing.ButtonGroup;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
public class ExceptTest extends JFrame implements ActionListener {
private double[] a;
private JRadioButton divideByZeroButton;
private JRadioButton badCastButton;
private JRadioButton arrayBoundsButton;
private JRadioButton nullPointerButton;
private JRadioButton negSqrtButton;
private JRadioButton overflowButton;
private JRadioButton noSuchFileButton;
private JRadioButton throwUnknownButton;
public ExceptTest() {
JPanel p = new JPanel();
ButtonGroup g = new ButtonGroup();
p.setLayout(new GridLayout(8, 1));
divideByZeroButton = addRadioButton("Divide by zero", g, p);
badCastButton = addRadioButton("Bad cast", g, p);
arrayBoundsButton = addRadioButton("Array bounds", g, p);
nullPointerButton = addRadioButton("Null pointer", g, p);
negSqrtButton = addRadioButton("sqrt(-1)", g, p);
overflowButton = addRadioButton("Overflow", g, p);
noSuchFileButton = addRadioButton("No such file", g, p);
throwUnknownButton = addRadioButton("Throw unknown", g, p);
getContentPane().add(p);
private JRadioButton addRadioButton(String s, ButtonGroup g, JPanel p) {
JRadioButton button = new JRadioButton(s, false);
button.addActionListener(this);
g.add(button);
p.add(button);
return button;
public void actionPerformed(ActionEvent evt) {
try {
Object source = evt.getSource();
if (source == divideByZeroButton) {
a[1] = a[1] / a[1] - a[1];
} else if (source == badCastButton) {
Frame f = (Frame) evt.getSource();
} else if (source == arrayBoundsButton) {
a[1] = a[10];
} else if (source == nullPointerButton) {
Frame f = null;
f.setSize(200, 200);
} else if (source == negSqrtButton) {
a[1] = Math.sqrt(-1);
} else if (source == overflowButton) {
a[1] = 1000 * 1000 * 1000 * 1000;
int n = (int) a[1];
} else if (source == noSuchFileButton) {
FileInputStream is = new FileInputStream("Java Source and Support");
} else if (source == throwUnknownButton) {
throw new UnknownError();
} catch (RuntimeException e) {
System.out.println("Caught RuntimeException: " + e);
e.printStackTrace();
System.out.println("Caught RuntimeException: " + e);
} catch (Exception e) {
System.out.println("Caught Exception: " + e);
public static void main(String[] args) {
JFrame frame = new ExceptTest();
frame.setSize(150, 200);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
frame.show();
}yes, I update as follows,
but not looks good.
import java.io.*;
public class UncaughtLogger implements Thread.UncaughtExceptionHandler {
private File file;
private static String errorMessage;
public UncaughtLogger(File file) {
this.file = file;
//Thread.setDefaultUncaughtExceptionHandler(this);
public UncaughtLogger(String str) {
this.errorMessage = str;
Thread.setDefaultUncaughtExceptionHandler(this);
//@Override()
public void uncaughtException(Thread t, Throwable e){
try {
log(e);
} catch (Throwable throwable) {
System.err.println("error in logging:");
throwable.printStackTrace();
private void log(Throwable e) throws IOException {
PrintWriter out = new PrintWriter(new FileWriter(file, true));
try {
e.printStackTrace(out);
} finally {
out.close();
private static UncaughtLogger logger = new UncaughtLogger(new File("C:/temp/log.txt"));
private static UncaughtLogger logger2 = new UncaughtLogger(errorMessage);
public static void main(String[] args) {
String s1 = "Hello World!";
s1 = null;
String s2 = s1.getClass().getName();
System.out.println(s1);
System.out.println(s2);
System.out.println("errorMessage =" + errorMessage);
} -
Error ,message into table
Hi all,
i am trying to put a error message into a table...any idea how i can get this without doing move 'matnr & is in error' into my table?
thanxHi,
There's a few ways you could do this;
Construct your message first (i.e. combine the message text and variables into one string, then move this into the table)
or
Don't store the text, instead store the message ID, number and variable parts of the message. This has the advantage if you're running a multi-language system the log can be used by users of different languages.
Regards,
Nick -
How to catch error message inside a variable?
Hi,
I'm trying to catch the error message inside a variable using this this command below:-
<%=odiRef.getPrevStepLog("MESSAGE")%>
Could you please tell me what is the right approach to capture the error message inside a variable.
Thanks
AnindyaHi Bhabani,
I have done this and select an oracle schema.But the variables only captures the (null).Please look into this.You must have one step prior to this refresh variable. Then only it can get the status as given below.
Returns the one-letter code indicating the status with which the previous step terminated. The state R (Running) is never returned.
D: Done (success)
E: Error
Q: Queued
W: Waiting
M: Warning
If you want the complete error details then you will face issues in case of multi line message. For this best option would be jython variable.Could please provide me some idea how to use this jython variable.I will update you on this soon
Thanks
Anindya -
Capturing oracle error codes into a variable
Hi
Can someone show me how it is possible to save an Oracle defined error code into a variable? What I am trying to do is when a stored procedure fails an Oracle error is raised, such as ORA-xxxx, then pass this code into variable to be saved into a log.
How do I achieve this?user633278 wrote:
How do I achieve this?Function SQLCODE in PL/SQL exception handler returns error code. SQLERRM returns message:
SQL> declare
2 x number;
3 begin
4 x := 1/0;
5 exception
6 when others
7 then
8 dbms_output.put_line('Error code: ' || SQLCODE);
9 dbms_output.put_line('Error message: ' || SQLERRM);
10 end;
11 /
Error code: -1476
Error message: ORA-01476: divisor is equal to zero
PL/SQL procedure successfully completed.
SQL> SY. -
Insert error message into session
hi all,
I need to Insert error message into the log of SM35 session.
1. I have created a BDC that creates a session in SM35.
2. The session is scheduled daily and gets executed automatically.
3. there is a scenario where the session should be stopped manually with a error message.
the system doesnt generate any error automatically for that scenario
can any one pls tell me whether its possible to put a manual error into SM35 session log ?
Thanks in Advance,
SanthosiniHi,
There's a few ways you could do this;
Construct your message first (i.e. combine the message text and variables into one string, then move this into the table)
or
Don't store the text, instead store the message ID, number and variable parts of the message. This has the advantage if you're running a multi-language system the log can be used by users of different languages.
Regards,
Nick -
Error message into warning message KO450
Hi,
There are unsettle RA value in project PAD-9114. Because of this unsettle RA value in the project we are not able to close the project and receiving error message like below:
1.There is still WIP for wbs
2.Balance of wbs is not zero.
There is still WIP for WBS PAD-9114
Message no. KO450
Diagnosis
The WIP for WBS PAD-9114 has not been cleared.
System Response
WBS PAD-9114 cannot be deleted.
Procedure
Calculate the WIP for WBS PAD-9114 so that it can be cleared. Then settle WBS PAD-9114, including the cleared WIP in the settlement.
How to change above error message into warning message so that it will allow us to close the project.
With regards,
V.krishnamoorthyHi,
Thanks for your answer. But still i am receiving the same error
There is still WIP for WBS PAD-9114
Message no. KO450
Diagnosis
The WIP for WBS PAD-9114 has not been cleared.
System Response
WBS PAD-9114 cannot be deleted.
Procedure
Calculate the WIP for WBS PAD-9114 so that it can be cleared. Then settle WBS PAD-9114, including the cleared WIP in the settlement.
With regards,
V.krishnamoorthy -
Change of error message into warning message
While doing FBZP i have found the following error.
Clearing acct only allowed for an outgoing bill of exch.pmnt
Message no. F3029
I am not able to go further, the above message is coming.
I want to make the error message into warning message.
Please suggest, how to overcomeHello BSR,
The Error message F3029 is raised when the clearing account (T042I-VKONT) is filled but the payment method in question is not defined as "Bill/exchange".
I assume that the field is not changable at the moment. You may make necessary changes (delete the entry or delete the specified account) with the instructions below.
1. Go to Tcd: FBZP -> Click [Pmt methods in country]
2. Select the entry for the erroneous country(?)/payment method
3. Change Payment method classification to 'Bill/ex' and save
Now you should be able to change "Set Up Bank Determination for Payment
Transactions" table.
If you still want to use this payment method, please change back to the original classification after making necessary changes in T042I.
I believe this information would help you in resolving the reported issue.
Best Regards,
Vanessa Barth. -
Convert Error Message into Warning Message
I wanted to change alternate account into existing GL account. But it is not permitting to post because it is having balance. So i wanted to change error message into warning message. i tried with the following process but still it is not showing warning message showing as error message only. please suggest us.
a) OBMSG
Application area Msg Allowed Standard Switch Off
FH 007 W E tick mark
b) OBA5
Msg Online BatchI Standard
007 w w w
Please suggest me i need it urgently.
Regards
D.J. LaxmiHi,
Certain Error messages are not passed to be changed to warning message eventhough you maintained proper customization for the same. I can only recommend you that neutralize the balance of Gl account and change if reporting is accepted.
Regards,
Chintan Joshi -
Throwing error message in BEx variable
HI,
I am using one of the variables in the user exit in cmod. in step1 & step2 I determine some values to be poplated in the variables. What is the ABAP command if say I want to show an error message on the variable screen? For Example, if I want to print that the value is invalid or somethingI want to re-phrase my quesitons a little bit.
IN user exit there are 3 i-steps. What I want to do is the following.
In i-step 2 I determine the values for 4 variables based on the 2 values that have default values. This works fine.
However, if the user changes selection, I want to be able to check in i-step3 what user input and return an error i f values are not valid, so that the query does not run. It seems like step3 does not let me do it.
Thank you,
Andrei -
How to Inscribe all the error messages into a single package ??
Hi,
I want to Inscribe all the error messages into a single package., and call the concern package from the exception block in every sp by passing the error code to that package, which will return the Concern error message to the calling Sp.,
Can any one help me out how to accomplish this ., ?
regards
RajaI want to Inscribe all the error messages into a single package., Why do you want to inscribe all the messages in a package?
I would suggest you to store them in a table instead and you can write a functin to retrive the error messages required.
But if your requirement is for 'Package' then assuming that you store all the error messages in a table 'error_table' (say) following code may help you .
CREATE TABLE Error_Table (
Error_Code VARCHAR2(10),
Error_Desc VARCHAR2(1024));Now insert your error codes and descriptions in this table.
CREATE OR REPLACE PACKAGE pkg_Error_Handler
AS
FUNCTION f_Get_Error_Message(p_Error_Code Error_Table.Error_Code%TYPE) RETURN VARCHAR2;
END pkg_Error_Handler;/
CREATE OR REPLACE PACKAGE BODY pkg_Error_Handler
AS
FUNCTION f_Get_Error_Message
(p_Error_Code Error_Table.Error_Code%TYPE)
RETURN VARCHAR2
IS
lv_Error_msg Error_Table.Error_desc%TYPE;
BEGIN
BEGIN
SELECT Error_desc
INTO lv_Error_msg
FROM Error_Table
WHERE Error_Code = p_Error_Code;
EXCEPTION
WHEN No_Data_Found THEN
lv_Error_msg := 'No such error code '
||p_Error_Code
||' defined in the system';
WHEN OTHERS THEN
lv_Error_msg := p_Error_Code;
END;
RETURN lv_Error_msg;
END f_Get_Error_Message;
END pkg_Error_Handler;
/and you can call this packaged funtion from any exception block to get the error description.
Regards,
Abhijit.
N.B.: Code not tested -
Error message in Bex Variable screen
Hello All,
In my BW I have a new variable of type interval for the selection criterion calendar year/month .
I want to check high value of the interval if it is lesser than or equal to current calendar year/month (that is 201405) then report can be executed.Else if it is greater than current calendar year/month (that is 201405) an error message has to be displayed for the user to change the value.
Can anyone help me in knowing how this can be done.
Many Thanks,
PSHi,
This can be handled by writing code in Cmod i_step = 3.
IF I_STEP = 3.
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE VNAM = 'Give the tech.name of user input variable'
IF LOC_VAR_RANGE-HIGH GT SY-DATUM+0(6).
CALL FUNCTION 'RRMS_MESSAGE_HANDLING'
EXPORTING
I_CLASS = 'RSBBS'
I_TYPE = 'I' " It will throw Warning Message
I_NUMBER = '000'
I_MSGV1 = 'Give the message which you need to display'.
RAISE no_replacement.
ENDIF.
ENDLOOP.
ENDIF.
Hope this gives an idea.
PS:In case you need to throw an error message then replace I_TYPE = 'I' by I_TYPE = 'E' .
Regards,
AL
Message was edited by: Anshu Lilhori -
How to display error message with some variable
Hi
I want to display errror message along with material number which is thr in d LOOP .
Basically i want some variable to display along with error message .
Can anybody suggest me how can i go about it?
Edited by: sonal musale on Apr 14, 2009 12:06 PMHi,
In the message class, suppose you use 001 for invalid material message.
So keep it like:-
Invalid Material : &1
in the message class for 001.
Now in loop use as:-
loop at itab into wa.
"perform validations
"if validation fails for current material
MESSAGE e001 WITH wa-matnr.
endloop.
Similary you can use more variables:-
Invalid Material : &1 &2 &3
MESSAGE e001 WITH <variable1> <variable2> <variable3>.
Hope this helps you.
Regards,
Tarun -
How to store BDC error messages into oracle database table?
Hello Experts,
I have a peculier requirement wherein I need to store the error messages occured while executing the transaction using BDC (Call Transaction Method) in an Oracle Database table format. Is that possible, if yes, how?
Thanks in advance.Hi,
Structure of BDCMSGCOLL.
TCODE -> BDC Transaction code
DYNAME -> Batch input module name
DYNUMB -> Batch input screen number
MSGTYP ->Batch input message type
MSGSPRA -> Language ID of a message
MSGID -> Batch input message ID
MSGNR -> Batch input message number
MSGV1 -> Variable part of a message
MSGV2 -> Variable part of a message
MSGV3 -> Variable part of a message
MSGV4 -> Variable part of a message
FLDNAME -> Field name
Ex :
DATA : BDCMSGCOLL TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE,
BDCDATA TYPE TABLE OF BDCDATA WITH HEADER LINE.
CALL TRANSACTION 'MM01' USING BDCDATA MODE N UPDATE S MESSAGES INTO BDCMSGCOLL.
IF SY-SUBRC 0.
PERFORM ERR.
CLEAR I_MSG.
REFRESH I_MSG.
ENDIF.
*& Form ERR
text
--> p1 text
<-- p2 text
form ERR .
DATA V_MSG(255) TYPE C.
READ TABLE I_MSG WITH KEY MSGTYP = 'E'.
IF SY-SUBRC = 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = I_MSG-MSGID
LANG = 'E'
NO = I_MSG-MSGNR
V1 = I_MSG-MSGV1
V2 = I_MSG-MSGV2
V3 = I_MSG-MSGV3
V4 = I_MSG-MSGV4
IMPORTING
MSG = V_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE V_MSG. " Error Message Displayed Here.
CLEAR V_MSG.
ENDIF.
endform. " ERR
hope this will help you.
Reward if found helpfull,
Cheers,
Chaitanya. -
How to add the error message into Delivery Error Log (VL10A,VL10X)
Hi,
I have a to add my custom message into Delivery creation error log (VBFS, VBSS)
This message should be shown in the Collective process log (VL10X, VL10A).
Please give me the soln to solve this problem.
I have searched in SDN, i didnt get the proper solution
Thanks
ShankarHI,
Make use of the BADi "LE_SHP_DELIVERY_PROC"
Use the method DELIVERY_FINAL_CHECK.
Pass the error messages in table CT_FINCHDEL.
Regards,
Ankur Parab
Maybe you are looking for
-
How to get more colour for my solaris 8
Hi All Before I used Solaris 8 for my PC with video card ATI Rage 3D Xpert 98. It only supports 1024X768X256 Colour. Now I changed my video card to ATI Rage 128 pro, but I still get 256 Colour. I checked HCL list, this card should support true colour
-
View access denied to Subject .. on ProvisioningTask: Worflow
Good Morning! I am using Identity Manager 8.1, I am creating a Workflow for end users but I have the next error when I am ejecuting the work flow, "View access denied to Subject .. on ProvisioningTask: Worflow". The next is the activity: <Activity id
-
SAP GRC AC 5.3 Roles provisioning
Dear all, Anyone knows if SAP BW, SAP XI, SAP WF and SAP SP are standard sopported by SAP GRC AC for the roles provisioning? Thanks for your help! Kind regards, Sergio
-
What is the quality of a DVD burned with the Toast BluRay plug-in?
I would like to purchase the plug-in for Toast 9 that allows you to burn BluRay content onto a DVD. I realize that it will not produce a "real" BD, but will it produce DVDs that are more HD quality than the normal SD quality? Rick
-
Continuing Bridge Cs6 problems
Have been close to a month now and no Bridge? Have uninstalled CS6 again. How can you do a Beta with half the program. Since the Bridge anomally seems to be happening in Windows and Mac, it would seem someone could figure this out. To recap once