Code to display error msg if duplicate entry
I have an upload program to upload csv file to itab, and i need a sample code for the employee id to give me an error message if a duplicate employee id is found during execution.
After Upload you can delete the Duplicates comparing the employee Id.
It Will be Possible only when you use OLE and read the file records line by Line. I am not sure of the error Handling with OLE control. It may lead to some performance issues..
Similar Messages
-
Display error message when duplicate entry made
hello
i have a jsp form, from that i have insert my data to the database, and also the insert values shows on the other jsp file.
i have used jdbc for that.
My problem is that when i made the dulicate entry for the partocular on field value, it doesnot shows error on jsp file.
The error is shown in tomcat server, but not in any file.
i have also made that paticulay field not null.
my sql table is as follows:
Name Null? Type
GL_CODE NOT NULL NUMBER(4)
GL_DESCR NOT NULL VARCHAR2(80)
DB_AMT NUMBER(15,2)
CR_AMT NUMBER(15,2)
GL_TYPE VARCHAR2(2)
GL_PCT NUMBER(4,2)
plz help me..
plz provide me query for that..
thanxHi,
You should catch the SQLException that will occure when you try to insert the values (that is if you have created a unique constraint in the database)
/Kaj -
OBA5 : Error Message for duplicate entry
Hi
In Tcode OBA5 - i enter F5 as Apllication area and i select new entries - i Enter 117 - and i Enter E before i save.
but when i go to MIRO to check if there is an error message for duplicate entry, i find just a Warning Message !
Please did i forget any thing ? please advise.
Thank You,Hello,
OBA5 should be enough, but you must remenber that the following fields must be identical for duplicate invoice check:
Company code (BUKRS)
Vendor number (LIFNR)
Currency (WAERS)
Reference number (XBLNR)
Amount in document currency (WRBTR)
Document date (BLDAT)
Note 305201 is also helpful.
Cheers -
hi,
how i display error msg on page by using af:message from beans, based on some processing? i tried , but error msg is not coming on af:message?
i m using jdv10g. i checked by system.out.println(errormsg), & it displaying in console, but not on af:message.
thankshi thanks,
it is showing the message on af:messages on top of page. i want to display it on af:message fm bean.
i dragged a af:message fm components palette. i associated its value attribute to errormsg property in bean like this-
<af:message id="m1" message="#{xxbean.errormsg}"
inlineStyle="color:rgb(255,0,0);"/>
//in bean
private String errormsg = "";
based on some processing i filled the 'errormsg' property with desirable error string, by this.errormsg="error....." .
& getter method is there for returing the value, on page.
GlobalOnly= true for af:messages.
i m using 10gdev
Edited by: user78995 on Apr 7, 2010 2:44 AM -
FacesContext can't display error msg !
Hi guys,
I got this problem. For this function:
public User saveUser(User user) throws DBException {
try {
User newUser = this.userDao.saveUser(user);
return newUser;
} catch (DataIntegrityViolationException di) {
String msg = "duplicate user id";
this.logger.error(msg, de);
throw new DuplicateUserIdException(msg);
=======================================
then the below function is to execute when user click the submit button
public String submitAction() {.....
catch (DuplicateUserIdException de) {
String msg = "Username already exists";
this.logger.info(msg);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage( FacesMessage.SEVERITY_INFO, msg, msg));
return QueryResults.RETRY;
========================================
public class DuplicateUserIdException extends DBException {
private String username;
public DuplicateUserIdException(String newUsername) {
super("Username " + newUsername + " already exist");
this.username = newUsername;
public String getUsername() {
return this.username;
====================================
So when I click on the submit button after entering a duplicate username, it will just go back to the same page and no error message display. Username is a primary key and email address is set to UNIQUE in MySQL DB. I read the log file and indeed all the error messages can be catched. The registration.jsp page is like:
<h:inputText value="#{userBean.username}" id="username" required="true">
<f:validateLength maximum="20" minimum="5"/>
</h:inputText>
<h:message for="username"/>
but I got my login page also the same h:inputText as above.
I am using JSF + Spring + Hibernate.
I hv tried to fix it a few time but failed !
Appreciate any help here.K> then the below function is to execute when user click
K> the submit button
K>
K> public String submitAction() {.....
K>
K> catch (DuplicateUserIdException de) {
K> String msg = "Username already exists";
K> this.logger.info(msg);
K> FacesContext.getCurrentInstance().addMessage(null,
K> l, new FacesMessage( FacesMessage.SEVERITY_INFO,
K> msg, msg));
K> return QueryResults.RETRY;
K> }
K> }
K> So when I click on the submit button after entering a
K> duplicate username, it will just go back to the same
K> page and no error message display. Username is a
K> primary key and email address is set to UNIQUE in
K> MySQL DB. I read the log file and indeed all the
K> error messages can be catched. The registration.jsp
K> page is like:
K>
K> <h:inputText value="#{userBean.username}"
K> id="username" required="true">
K> <f:validateLength maximum="20" minimum="5"/>
K> </h:inputText>
K> <h:message for="username"/>
K>
K> but I got my login page also the same h:inputText as
K> above.
K>
K> I am using JSF + Spring + Hibernate.
K>
K> I hv tried to fix it a few time but failed !
K> Appreciate any help here.
Ok, we have to keep in mind the request processing lifecycle here. Your
submitAction() method is called after conversion and validation have
already occurred. Therefore, you can never queue an error from an
action handler. Here's why.
When your submitAction() is called, you queue a message into the faces
context. Whatever you return from submitAction(), it's ultimately going
to cause a requestDispatcher.forward() or
httpServletRespones.sendRedirect(). Both of these cause a new
FacesContext instance to be created, obliterating your carefully queued
message.
The best practice I've seen used is to handle the validation as close to
the component in which the validation error occured as possible. I
recommend creating a custom validator method binding, that does the
trick. This is really easy to do. Just add a method to your bean:
public void validate(FacesContext context,
UIComponent component,
Object value) throws ValidatorException {
// queue the message here, make sure to call component.setValid(false)
Then, in your inputText, you say:
<h:inputText value="#{userBean.username}" validator="#{userBean.validate}
id="username" required="true">
<f:validateLength maximum="20" minimum="5"/>
</h:inputText>
And you're done.
Ed (JSR-252 Spec co-lead) -
Problm in displaying error msg
hi
i hav written error message for production sheduler...
if the input is wrong i want the errror to be displayed as invalid input...
if they dnt enter any data then no need to display any error msg i hav written this below code...
here im getting error if i dont enter account group and if i enter correct group also it is giving error msg...
wt is wrong in my code?
AT SELECTION-SCREEN on s_fevor.
s_fevor-sign = 'I'.
s_fevor-option = 'EQ'.
s_fevor-low = s_fevor.
s_fevor-high = s_fevor.
APPEND s_fevor.
CLEAR s_fevor.
IF not s_fevor-low in s_fevor.
SELECT fevor
from afko
INTO TABLE t_fevor
WHERE fevor in s_fevor.
IF sy-subrc ne 0.
MESSAGE e001.
ENDIF.
ENDIF.Hello
Please modify your code as below .WHICH WIll work for all scenarios i mean even if you give Option as EXCLUSIVE also .....
AT SELECTION-SCREEN on s_fevor.
DATA : l_t_fevor TYPE TABLE OF afko-fevor WITH HEADER LINE.
SELECT fevor INTO TABLE l_t_fevor FROM afko.
LOOP AT s_fevor.
IF NOT s_fevor-low IS INITIAL.
READ TABLE l_t_fevor WITH KEY = s_fevor-low.
IF sy-subrc <> 0.
SET CURSOR FIELD 'S_FEVOR-LOW'.
MESSAGE e<> ENDIF.
ENDIF.
IF NOT s_FEVOR-high IS INITIAL.
READ TABLE l_t_fevor WITH KEY = s_fevor-high.
IF sy-subrc <> 0.
SET CURSOR FIELD 'S_FEVOR-HIGH'.
MESSAGE e<> ENDIF.
ENDIF.
ENDLOOP.
Regards -
ABAP Email Sending error - MSG 672 - No entry in queue yet
I am trying to send mail by using function module
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
and running the program rsconn01 also
but in SOST its giving message MSG 672 - No entry in queue yet.
Mail has not sent to recipent. any solutions?
Regards
RajanbabuHello,
Please check SCOT setting.
Following will help you in case of SCOT setting are not done.
Do this and chk notes
Note 129950 - Required Customizing for use of SAP connect
Note 957412 - Troubleshooting automatic email transmission in SAP Solution
Set-Up SAPconnect
Use
E-mails sent from an SAP application are first sent to a queue. The queued e-mails are subsequently sent by a periodic background job.
Therefore, for automatic e-mailing you need to:
u2022 set up SAPconnect
u2022 set up a periodic job for SAPconnect
This IMG activity is a prerequisite for the following scenarios:
u2022 Testing
u2022 Monitoring
Activities
Setup SAPConnect
1. In transaction SAPconnect: Administration (SCOT) choose View -> System status.
2. Choose Settings -> Default Domain.
3. Specify your default domain and confirm. For example, "mydomain.com".
4. In the Administration screen, double-click the SMTP node.
5. Check the box "node in use".
6. Specify the mail host for SMTP. For example, "mail.mydomain.com".
7. Specify a mail port. The default port is 25.
8. Choose "Set" (for "Internet").
9. Enter an asterisk (*) for "address area".
10. Choose Continue.
Schedule the periodic background job to send queued e-mails
11. Call transaction SCOT.
12. Choose View - Jobs.
The SAPconnect Job Administration screen is displayed.
13. Choose Job - Create.
A dialog box is displayed.
14. Specify a job name.
15. Confirm.
16. In the next window, select the variant SAP&CONNECTALL.
17. Choose Schedule job.
18. Choose Schedule Periodically.
A dialog box is displayed.
19. Specify a time period.
For example, 10 minutes.
20. Choose Create.
Regards,
Sameer
Edited by: Sameer on Mar 13, 2009 12:30 AM -
My fully charged iPhone has a black screen and is not responding but has Siri and sound. I connected to laptop and iTunes gives error msg indicating phone is locked and I to enter passcode. but I can't enter the passcode because the screen is black. I have never syncd with iTunes. What can I do to get my phone back?
First thing to try is to reset your device. Press and hold the Home and Sleep buttons simultaneously until the Apple logo appears. Let go of the buttons and let the device restart. See if that fixes your problem.
-
Getting error msg while posting entry in GL using F-02
Hi gurus,
While i am posting entry in GL using F-02 getting error message as "no controlling area has been assigned to company code"
can any help me out at the stage i dint want to configure co settings is there any way to pass the entries
Thanks & regards
NandiniHi Nandini,
Have you defined a GL account as a cost element? I think you have multiple company codes which are using same chart of accounts and this company code is also using the same chart of accounts. And also you have configured single controlling area for all company codes. Even though you have not assigned this company code to controlling area. The cost elements will create at controlling area level.
Due to this system is throwing error message.
Please check and let us know if you have other issue.
Regards,
Mukthar -
How to make a field editable again after displaying error msg (validation)
Dear All,
In dialog programming, I have written a validation on a text field that it should not be left blank by the user, but after displaying the message the field becomes gray (non-editable). How can I make it editable once again after displaying the error message.
My code is as following:
***INCLUDE MZFBPS1_SAVE_DATAF01 .
*& Form save_data
text
--> p1 text
<-- p2 text
FORM save_data .
****************Check For Empty Fields Start
if ZFBPS_GATE_IN-truck_code is INITIAL
or ZFBPS_GATE_IN-truck_no is INITIAL
or ZFBPS_GATE_IN-transporter_code is INITIAL.
MESSAGE e020(zmatlist).
endif.
****************Check For Empty Fields Start
Regards,
Alok.hi,
u can do it in chanin end chain.
For example if there are 10 fields in the screen and for 5 fields whenever the user enters wrong values u like to give some error message. You can declare that fields in the chain enchain so that only those fields will be input enabled and all other fields will disabled.
CHAIN.
FIELD chk_connobj.
FIELD chk_inst.
FIELD chk_devloc.
FIELD ehaud-haus.
FIELD eanl-anlage.
MODULE modify_screenfields.
ENDCHAIN.
*& Module modify_screenfields INPUT
* text
MODULE modify_screenfields INPUT.
CLEAR okcode.
okcode = sy-ucomm.
CASE okcode.
WHEN 'ENTER' OR 'EXECUTE'.
IF chk_connobj IS INITIAL AND chk_inst EQ c_x AND
chk_devloc EQ c_x. -----------> ur condition
IF ehaud-haus IS INITIAL.
SET CURSOR FIELD 'EHAUD-HAUS'.
MESSAGE e000(zo_spa) WITH text-017. " message obj
ELSE
loop at screen.
if screen-name = 'FIELD_NAME'.
field-name-input = 1. -----------> chnges to non-edit mod
modify screen.
endloop.
ENDIF.
ENDIF.
ENDMODULE.
Rgds
Anver
if hlped pls mark points -
hello this is the error message I receive when trying to open my Mozilla browser. a secondary error message appers afterward "could not load XPCOM". please advise, thank you!
Do a clean reinstall and delete the Firefox program folder before (re)installing a fresh copy of the current Firefox release.
*Download the full Firefox installer and save the file to the desktop<br>https://www.mozilla.org/en-US/firefox/all/
If possible uninstall your current Firefox version to cleanup the Windows registry and settings in security software.
*Do NOT remove "personal data" when you uninstall your current Firefox version, because this will remove all profile folders and you lose personal data like bookmarks and passwords including data in profiles created by other Firefox versions.
Remove the Firefox program folder before installing that newly downloaded copy of the Firefox installer.
*(32 bit Windows) "C:\Program Files\Mozilla Firefox\"
*(64 bit Windows) "C:\Program Files (x86)\Mozilla Firefox\"
*It is important to delete the Firefox program folder to remove all the files and make sure that there are no problems with files that were leftover after uninstalling.
*http://kb.mozillazine.org/Uninstalling_Firefox
Your bookmarks and other personal data are stored in the Firefox profile folder and won't be affected by an uninstall and (re)install, but make sure NOT to remove personal data when you uninstall Firefox as that will remove all Firefox profile folders and you lose your personal data.
*http://kb.mozillazine.org/Profile_folder_-_Firefox
*http://kb.mozillazine.org/Profile_backup
*http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Clean_reinstall -
Upgrade from RH8 to RH9 displays error msg for images/hyperlinks
We imported a RH8 project into RH9 on another computer. For the most part, it went smoothly; however, for some images and hyperlinks, we get the message: The image file "___.jpg" used in "______.htm" is outside of the current project and will not be shown in Project Manager.
Additionally, there are approximately 20 broken links displayed in the Broken Links tab.
Your suggestions would be appreciated as we have multple huge projects we need to upgrade. ThanksHi there
For each of the messages about the image being outside the project, you will need to carefully note the image file name, the topic and the location it is reporting. Then you will need to edit the topic and click on the image icon and browse to the image to choose it. That action should correct the link and copy the image into your project.
Broken links will have to be resolved on a "link by link" basis. I was assisting someone else in a different thread and it may be of use to you. Click the link below to view that thread.
Click here to view
Cheers... Rick -
Reg : error msg population
Hi
i got a requirement that from vl02n tcode if some condition fails one error message as to display and cursor has to show where that error msg is.Its should not terminate .i found exit i have code to populate error msg also.
Please help me regarding this issue
Thanks in advance
regards
Raodid you look at Matt's response above your post
Try to explain in more detail precisely what you have done and what you expect. -
Dear all,
I have a requirement in WEB DynPro, Our ESS system using WEB DynPro.
In ESS leave system need to display error message.ie
once leave approved, employees are not allowed to change the leave.
Any idea to write code to display error message.
Thanks.
Shruthi.Error messages can be displayed in two ways:
1. In the message area
2. As a popup
Below are the code snippets for it.
1.
* get message manager
DATA lo_api_controller TYPE REF TO if_wd_controller.
DATA lo_message_manager TYPE REF TO if_wd_message_manager.
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager.
CALL METHOD lo_message_manager->report_error_message
EXPORTING
message_text = 'Error message'.
2.
"Display Popup
DATA: l_popup TYPE REF TO if_wd_window,
l_text TYPE string_table.
APPEND `Error Message` TO l_text.
l_popup = wd_comp_controller->wd_get_api( )->get_window_manager( )->create_popup_to_confirm(
text = l_text
close_button = abap_false
button_kind = if_wd_window=>co_buttons_ok
message_type = if_wd_window=>co_msg_type_error
window_title = 'Error'
window_position = if_wd_window=>co_center ).
l_popup->open( ).
Hope this helps! -
MySQL duplicate entry deletion in 5.5.9
Hey all,
I've noticed that in the newest MySQL, I can no longer do:
ALTER TABLE test ADD UNIQUE INDEX unique_index (id);
ALTER TABLE test DROP INDEX unique_index;
to remove duplicates. I get the following error:
ERROR 1062 (23000): Duplicate entry '3' for key 'unique_index']
This worked fine before the major SQL upgrade. It also works fine on version 5.1.52 on my web host. I searched through the 5.5.9 release notes and I didn't see anything that should have changed this, but I'm no MySQL guru! Is this a feature or a bug? Any alternate suggestions for deleting duplicates that will work on this version and older versions of MySQL?
Thanks!
Scott
Edit: Just for clarity, the table I'm working on has a single primary key column (UNIQUE_KEY) (with 80+ other data columns) and I'm only detecting the duplicate row based on the value of the primary key column.
Last edited by firecat53 (2011-02-25 03:33:30)Alright, since I was apparently sucked in by this particular method the first time I googled the answer, care to enlighten me on the 'more practical' non-joke methods, as there appears to be more than one option.
Also, why is that a joke of a feature? Like I said, I'm no MySQL guru so I'm ready to learn!
Thanks,
Scott
edit: is this a 'more practical' method? It's hard when you're learning on your own to sort out the good from the bad sometimes
edit2: using the above method with this table:
+------+------+-------+
| id | data | data1 |
+------+------+-------+
| 1 | 10 | 100 |
| 2 | 100 | 1000 |
| 3 | 1000 | 500 |
| 3 | 1000 | 500 |
+------+------+-------+
and this query:
delete test from test left outer join (select min(id) as RowID, id from test group by id) as KeepRows on test.id=KeepRows.RowID where KeepRows.RowID is null;
I can't quite get it to work...it doesn't delete any rows. What am I missing there?
edit3: This method works -- is it a 'good' method or should I be looking at something different? Again, I'm just matching on duplicates in the primary key column (before the primary key is assigned):
create table test1 like test;
insert into test1 select * from test group by id;
drop table test;
rename table test1 to test;
Last edited by firecat53 (2011-02-25 03:55:10)
Maybe you are looking for
-
Possible to have "sub-templates" in Dreamweaver ?
Hello, I'm new to website building using dreamweaver, but I purchased a tutorial and I'm really starting to get it, though I have a question, let's say I want to create a website similar to this one : www.franzferdinand.co.uk All pages of that site h
-
ABAP development for certification
Hi all, When doing ABAP development in SAP certification which is coming under the Third Party Application Development, there it is given like the development should be done by means of SAP ABAP Add-on development kit under a special ABAP Workbench
-
Signing applets: Classnotfoundexception
Hi everyone, I've created a web application that contains an applet as well. In that applet ,the user should be given the opportunity to open and save files from and to a directory on his own computer. I've read alot of things about signing applets t
-
Reinstall Photoshop 8, Serial Number MIA
I have had PhotoShop Elements 8 installed on my late 2009 MacBook for several years. 2 years ago I got 11, when I installed it, 8 didn't go away, but it didn't seem to cause any problems. A few weeks ago I had a few things that were opening with 8
-
Happy accident?: AirPlay available on separate wifi networks
I have an apple airport express version 2011 hooked up to my ISP issued Zyxel modem/router. I use the airport express for a 5ghz signal that I use to stream Netflix and then mirror back onto apple tv for viewing in the living room. From my tests I ne