Prevent duplicate outputs within a table?
Hi at all,
we have a table in a subform. At the moment there are several lines with the same material. This is ok.
Is it possible to prevent duplicate output in the form? We want to print out the rest of this line but set the material to blank.
I tried this with scripting with java script:
If (data.TF.DATA.field.rawValue == data.TF.DATA[-1].field.rawValue)
data.TF.DATA.field.rawValue = "";
Is it possible to point on the previous line with
DATA[-1]
This works for the conditional break so I hope this will works too.
I don`t want to use group levels...
Thanks.
Timo
Thanks for your answer.
It works.
data.formular.DATA.field::ready:layout - (FormCalc, client)
If ($.rawValue == data.form.DATA[-1].field.rawValue) then
this.presence = "hidden";
endif
Similar Messages
-
Need advice on preventing duplicate entries in People table
Hi,
In my database, I have a "People" table where I store basic information about people e.g. PersonId, FirstName, LastName, Gender, etc.
There will be lots of entries made into this table and I want to prevent duplicate entries as much as humanly possible. I'd appreciate some pointers on what I should do to minimize duplicates.
My primary concerns are:
Duplicate entries for the same person using the person's full name vs. given name e.g. Mike Smith and Michael Smith
Making sure that two separate individuals with identical names do get entered into the table and get their unique PersonId's.
Not even sure how I can even possibly know if two individuals with identical names are two different people without having additional information but I wanted to ask the question anyway.
Thanks, SamThank you all very much for your responses.
There are three separate issues/points here.
It is clear that it is impossible to prevent duplicates using only a person's first, middle and last names. Once I rely on an additional piece of information, then things get "easier" though nothing is bullet proof. I felt that this was self evident but
wanted to ask the question anyway.
Second issue is "potential" duplicates where there are some variations in the name e.g. Mike vs Michael. I'd like a bit more advice on this. I assume I need to create a table to define variations of a name to catch potential duplicates.
The third point is what Celko brought up -- rather nicely too :-) I understand both his and Erland's points on this as typical relational DB designs usually create people/user tables based upon their context e.g. Employees, Customers, etc.
I fundamentally disagree with this approach -- though it is currently the norm in most commercial DB designs. The reason for that is that it actually creates duplicates and my point is to prevent them. I'm going for more of an object based approach in the DB
design where a person is a person regardless of the different roles he/she may play and I see no reason in repeating some of the information about the person e.g. repeating first, last name, gender, etc in both customer and employee tables.
I strongly believe that all the information that are directly related to a person should be kept in the People table and referenced in different business contexts as necessary.
For example, I assign every person a PersonId in the People table. I then use the PersonId as part of the primary key in the Customers or Employees table as well. Obviously, PersonId is also a foreign key in Customers and Employees tables. This prevents the
need for a separate CustomerId and allows me to centralize all the personal data in the People table.
In my opinion this has three advantages:
Prevent duplication of data
Allow global edits e.g. if the last name of a female employee changes, it is automatically updated for her within the context of "Customer" role she may play in the application.
Last but not least, data enrichment where a person may enter additional data about himself/herself in different contexts. For example, in the employee context, we may have the person's spouse information through "Emergency Contacts" which may come handy
within the context of customer for this person.
Having everyone in the People table gives me these three advantages.
Thanks, Sam -
Prevent Duplicate Output Trigger from Item Level
Hi,
We have a requirement of whenever a pricing error happen to send the whole Order information from ECC to an external system through Idocs / Output Trigger.
The Output for pricing error can be configured by default at the item level. Hence if an ORder has multiple lines that have pricing issues we can get the same Order information sent twice bacuse of output getting triggered more than once.
Any way I can prevent the duplicate output trigger when multiple items for the same order has issues.
Regards,
ArunavaHi Arunava,
You can create a Output Routine using VOFM tcode and attach the routine to your Output type in NACE tcode.
Inside the routine you can keep check based on the line items / order information.
Thanks & Regards,
Ramya. -
Read two CSV files and remove the duplicate values within them.
Hi,
I want to read two CSV files(which contains more than 100 rows and 100 columns) and remove the duplicate values within that two files and merge all the unique values and display it as a single file.
Can anyone help me out.
Thanks in advance.kirthi wrote:
Can you help me....Yeah, I've just finished... Here's a skeleton of my solution.
The first thing I think you should do is write a line-parser which splits your input data up into fields, and test it.
Then fill out the below parse method, and test it with that debugPrint method.
Then go to work on the print method.
I can help a bit along the way, but if you want to do this then you have to do it yourself. I'm not going to do it for you.
Cheers. Keith.
package forums.kirthi;
import java.util.*;
import java.io.PrintStream;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import krc.utilz.io.ParseException;
import krc.utilz.io.Filez.LineParser;
import krc.utilz.io.Filez.CsvLineParser;
public class DistinctColumnValuesFromCsvFiles
public static void main(String[] args) {
if (args.length==0) args = new String[] {"input1.csv", "input2.csv"};
try {
// data is a Map of ColumnNames to Sets-Of-Values
Map<String,Set<String>> data = new HashMap<String,Set<String>>();
// add the contents of each file to the data
for ( String filename : args ) {
data.putAll(parse(filename));
// print the data to output.csv
print(data);
} catch (Exception e) {
e.printStackTrace();
private static Map<String,Set<String>> parse(String filename) throws IOException, ParseException {
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(filename));
CsvLineParser.squeeze = true; // field.trim().replaceAll("\\s+"," ")
LineParser<String[]> parser = new CsvLineParser();
int lineNumber = 1;
// 1. read the column names (first line of file) into a List
// 2. read the column values (subsequent lines of file) into a List of Set's of String's
// 3. build a Map of columnName --> columnValues and return it
} finally {
if(reader!=null)reader.close();
private static void debugPrint(Map<String,Set<String>> data) {
for ( Map.Entry<String,Set<String>> entry : data.entrySet() ) {
System.out.println("DEBUG: "+entry.getKey()+" "+Arrays.toString(entry.getValue().toArray(new String[0])));
private static void print(Map<String,Set<String>> data) {
// 1. get the column names from the table.
// 2. create a List of List's of String's called matrix; logically [COL][ROW]
// 3. print the column names and add the List<String> for this col to the matrix
// 4. print the matrix by inerating columns and then rows
} -
Hi All,
How to prevent users from entering duplicate records .
I want to show message duplicate value for one particular field.
User will be able to enter 300 or also 400 records at a time.
thnksYes, I want to check within the block.Yes also with inserted and committed and not committed records also.There are two things you can do, both are described here:
Duplicate key prevention
To look for duplicates within your block, you can use the duplicate summary function from Kevin Clarke described in that link. Then you can look for duplicates in the database table by doing a select, also described in that post.
I would not even try to use a record group -- read the post in the above link about that. -
Authorization issue within a table in BI
Hello All,
Here is my authorization issue :
We have set up an authorization on infoobject Zapplication. End user is allowed to choose "HR" only.
In Rsecadmin, infoObject Zapplication is restricted to "HR"
Then, this authorization object has been assigned to end user.
This user go to a specific table to select an application and a date.
When user display the possible value he only see "HR". Which means our authorization is correct.
However, this user can enter another value such as "SD". This value does exist in infoObject Zapplication. So, it means that there is an issue with our authorizations settings.
We have added a control table, it's even worse in this case, authorization are not checked at all and all available values are displayed.
Any idea to prevent the user to entered a value within this table ?
Why our authorization does not check the value entered directly in the table ?
Thanks &
Regards
CathHello
For info we manged to restrict acces on this table by using event table from table maintenance and we have combined it with a specific authorisation object.
Regs
C. -
Find duplicate values in a table based on combination of two columns.
In table which have millions of records -
I have a Table B under Schema A and i have to find the duplicate records in a table. My Table B uses the combination of columns to identify the unique values.
Scenario is something like this-
One SV_Id can have multiple SV_Details_Id and i have to find out if there is any duplicate in the table. (I have to use combination of columns to identify the unique values and there is no Primary Key, Foreign Key or Unique Key on the table)
then wrote the following query -
select SV_Id,SV_Details_Id count (*) from SchemaA.TableB group by SV_Id,SV_Details_Id having Count (*) > 1 ;
Is it correct as after firing the above query it is returning the rows which is not matching to the duplicate.
kindly help me.
Looking forward for some guidance -
Thanks in advance.What is the desired output??
Do you want to see only unique records??
Or you want to see the duplicate records.
Giving an example will make it easier to provide the required querty.
BTW here is an simple query which is used to delete the duplicate records and keep the unique records in table.
DELETE
FROM table_name a
WHERE EXISTS (SELECT 1
FROM table_name b
WHERE a.sv_id = b.sv_id
AND a.sv_detail_id = b.sv_detail_id
AND a.ROWID > b.ROWID
);Regards
Arun -
I would like to make sure there are no duplicate data entries in my Oracle 9i table (called MainTable) which has an Id field that is the primary key, ValData with a varchar data type, Fid and Fid2 are number data types.
Id ValData Fid Fid2
1 abc 34 2
2 efg 23 34
3 zeo 25 43Sometimes someone can enter a duplicate ValData, Fid and Fid2 and it will end up like this:
Id ValData Fid Fid2
1 abc 34 2
2 efg 23 34
3 zeo 25 43
4 zeo 25 43What constraints or restrictions can I place on the MainTable where it will never allow a duplicate entry into the table?
I would like to do this somehow in the database. If someone tries to enter a duplicate I should get a error message or something to indicate an attempt to enter duplicate data.
Please advise if this is possible?We told you above - next level of support is onsite but not sure your zipcode is similar to mine.
First you have to clarify if the three fields must be uniq as a combination or if valdata alone cannot be duplicated. In other words:
id valdata fid fid2
1 abc 34 2
2 abc 23 34
is this legal?
Depending on the answer you apply the appropriate solution. If answer is yes, you apply this:
alter table <table name> add constraint uniq_combination unique (valdata, fid, fid2);
if answer is that it is illegal because you want to prevent valdata alone to assume duplicate values, then:
alter table <table name> add constraint uniq_valdata unique (valdata);
See Guido's comment above concerning the handling of the DB generated error.
enrico -
Placing Subtotals within a Table - assistance needed!
Hi Experts,
I have a requirement for a change in a report that is created using XML Publisher and the output is from Release 12.
There are a table of values where the output presently looks like this (not every column included, to ease clarity):
Payee Site Amount Discount Payment Total Payable
GROUP A MILTON KE .00 70.50 .00 70.50
GROUP A MILTON KE .00 483.06 .00 483.06
GROUP B DIRECT DE .00 209.40 .00 209.40
GROUP B DIRECT DE .00 209.40 .00 209.40
GROUP A MILTON KE .00 141.00 .00 141.00
GROUP B DIRECT DE .00 172.98 .00 172.98
GROUP B DIRECT DE .00 244.65 .00 244.65
GROUP A MILTON KE .00 512.95 .00 512.95
Totals GBP 40,519.87 .00 .00 40,519.87 .00 40,519.87
The code for this presently is:
<?for-each:PARENT?>
-- Output each row with the fields listed in table
<?end for-each?>
-- The output the Final Totals row (this is not a calculated total, but a total field listed in the XML output)
An example of the XML is:
- <PARENT>
<PARTY_SITE_NAME>MILTON KEYNES</PARTY_SITE_NAME>
<PAYEE>GROUP A</PAYEE>
<INVOICE_NUM>A10008075</INVOICE_NUM>
<DUE_DATE>19-SEP-07</DUE_DATE>
<AMOUNT_REMAINING>739.92</AMOUNT_REMAINING>
<WITHHELD_AMOUNT>0</WITHHELD_AMOUNT>
<DISCOUNT_AMOUNT>0</DISCOUNT_AMOUNT>
<INTEREST_AMOUNT>0</INTEREST_AMOUNT>
<PAYMENT_AMOUNT>739.92</PAYMENT_AMOUNT>
<AMOUNT_REMAINING_FM>739.92</AMOUNT_REMAINING_FM>
<WITHHELD_AMOUNT_FM>0.00</WITHHELD_AMOUNT_FM>
<DISCOUNT_AMOUNT_FM>0.00</DISCOUNT_AMOUNT_FM>
<INTEREST_AMOUNT_FM>0.00</INTEREST_AMOUNT_FM>
<PAYMENT_AMOUNT_FM>739.92</PAYMENT_AMOUNT_FM>
<SELECTED_PS_TOTALS>739.92</SELECTED_PS_TOTALS>
<SELECTED_PS_TOTALS_FM>739.92</SELECTED_PS_TOTALS_FM>
</PARENT>
- <PARENT>
<PARTY_SITE_NAME>MILTON KEYNES</PARTY_SITE_NAME>
<PAYEE>GROUP A</PAYEE>
<INVOICE_NUM>H10001663</INVOICE_NUM>
<DUE_DATE>07-SEP-07</DUE_DATE>
<AMOUNT_REMAINING>66.24</AMOUNT_REMAINING>
<WITHHELD_AMOUNT>0</WITHHELD_AMOUNT>
<DISCOUNT_AMOUNT>0</DISCOUNT_AMOUNT>
<INTEREST_AMOUNT>0</INTEREST_AMOUNT>
<PAYMENT_AMOUNT>66.24</PAYMENT_AMOUNT>
<AMOUNT_REMAINING_FM>66.24</AMOUNT_REMAINING_FM>
<WITHHELD_AMOUNT_FM>0.00</WITHHELD_AMOUNT_FM>
<DISCOUNT_AMOUNT_FM>0.00</DISCOUNT_AMOUNT_FM>
<INTEREST_AMOUNT_FM>0.00</INTEREST_AMOUNT_FM>
<PAYMENT_AMOUNT_FM>66.24</PAYMENT_AMOUNT_FM>
<SELECTED_PS_TOTALS>66.24</SELECTED_PS_TOTALS>
<SELECTED_PS_TOTALS_FM>66.24</SELECTED_PS_TOTALS_FM>
</PARENT>
My requirements for this are:
1) To sort the table by Payee, grouping similar Payees together. This I have achieved by adding the below after <?for-each:PARENT?>.
<?sort:PAYEE?>
2) With the Payees grouped, to add a subtotal of each of the groups WITHIN the main table, something like this:
Payee Site Amount Discount Payment Total Payable
GROUP A MILTON KE .00 70.50 .00 70.50
GROUP A MILTON KE .00 483.06 .00 483.06
Subtotal= 553.46
GROUP B DIRECT DE .00 209.40 .00 209.40
GROUP B DIRECT DE .00 209.40 .00 209.40
Subtotal= 418.80
..etc
Totals GBP 40,519.87 .00 .00 40,519.87 .00 40,519.87
I am having trouble with getting this subtotal of each group to be within the table. My Psuedo-code I was thinging of was:
Declare variable sub_total = 0
Declare variable temp
For-Each Row
temp = this_row_payee
if(temp = next_row_payee) then
sub_total = sub_total + Total_Payable
Output this row
else
Output the subtotal
temp = next_row_payee
sub_total = 0
end if
End For-Each Row
I have tried using the for-each-group and using the Sum with current_group() but I am new to XML Publisher and would greatly welcome any feedback.
Thanks!
MarkI have solved it, many thanks for your reply which has provided me with the solution.
<?for-each-group:PARENT; PARTY_NAME1?>
<?sort: PARTY_NAME1?>
<?for-each: current-group()?>
-- Then list the placeholder fields e.g.
<?PARTY_SITE_NAME?>
<?INVOICE_NUM?>
... etc
<?end for-each?>
<?sum (current-group()/TOTAL_PAYABLES)?>
<?end for-each-group?>
This sorts the Payees into alphebetical order and then groups, then lists every row within the group, then and at the end of the group, the total pyables field is added up and provided as a subtotal.
Thanks,
Mark -
Prevent the Output Message when creating PO from inbound IDOC
Hi SAP Gurus,
In my project, I have to create PO from inbound IDOC (PORDCR) with a specific Document Type ('099').
Requirement: These PO should not generate the output message while the others (Doc Type # '099') do.
I have the Z fuction module which call BAPI_PO_CREATE for posting IDOC and it works fine.
In the existing system, there are some set up that trigger the output message type for PO (output NEU) when using ME21 or ME22, as a result my PO created with output message.
Can you please advise if there are some way (User Exit?) that prevent the output message in this scenario (specific PO Type) without touching the current Condition setup?
I'm new in MM and really need help!
Thanks,
Elaine.Hi Vinod,
I really appreciate your anwer. I'm going to explore this with my functional consultant.
Just like to have more questions:
1. Is it easier if we change the existing condition table instead of creating a new routine?
2. There are two forms for routine 101 (FORM KOBEV_101 and FORM KOBED_101). Can you explain to me why we need 2 here for what purpose of each form.
3. In the debug mode by using WE19 to post inbound IDOC, I change the SY-SUBRC = 4 and PO created without output message. Is it the right direction? Anything else I need to pay attention to?
Thanks again.
Regards,
Elaine. -
Hi There,
In SAP GRC 10.0, our team had an issue where we could not add duplicate fields from separate table (see ERROR: Select Currency/UoM field for the selected analyzed fields). This was resolved by the SAP Note 1904313/ 1904314 (http://service.sap.com/sap/support/notes/1904313).
We upgraded our system to SAP GRC 10.1 SP05 and could now add the duplicate fields from separate tables. SAP Note 1904313/ 1904314 was part of SAP GRC 10.1 SP03 so it makes sense that we, in a higher version (SP05), would be able to do this.
The issue now is when we add the duplicate fields from different tables and run the Ad-hoc Query to test if the data source works correctly, the No Data Selected warning persists. This means that the data source provides no data for analysis, which is required to write our business rules.
Below is an example:
Basic data source with just one currency reference field EBAN-WAERS.
When you run the Ad-Hoc Query you receive data.
Basic data source with second currency reference field EKKO-WAERS.
When you run the Ad-Hoc Query no data is found.
Please also make reference to the following thread logged by my colleague (ERROR: Select Currency/UoM field for the selected analyzed fields)
Any assistance to receive data with duplicate fields from separate tables will be highly appreciated.
Thanking you in advance.
Regards
Gary KhanHi
following are the error messages from dump
hrtText
There is already a line with the same key.
hat happened?
Error in ABAP application program.
The current ABAP program "SAPLCKMS" had to be terminated because one of the
statements could not be executed.
This is probably due to an error in the ABAP program.
rror analysis
You wanted to add an entry to table "\FUNCTION-POOL=CKMS\DATA=T_DYN_CKMLCR",
which you declared
with a UNIQUE KEY. However, there was already an entry with the
same key.
This may have been in an INSERT or MOVE statement, or within a
SELECT ... INTO statement.
In particular, you cannot insert more than one initial line into a
table with a unique key using the INSERT INITIAL LINE... statement.
rigger Location of Runtime Error
Program SAPLCKMS
Include LCKMSF01
Row 226
Module type (FORM)
Module Name DYNAMIC_PERIOD_CLOSING
Source code where dump ocured
222
223 APPEND ht_ckmlpp TO t_add_ckmlpp.
224 APPEND LINES OF ht_ckmlcr TO t_add_ckmlcr.
225 INSERT ht_ckmlpp INTO TABLE t_dyn_ckmlpp.
>>>> INSERT LINES OF ht_ckmlcr INTO TABLE t_dyn_ckmlcr.
227 ENDWHILE.
Also I guess there is problem with material ledger in R/3 side
I have never worked on material ledger before so dont hav idea of Tcode and tables in SAP R/3 for material ledger.
Thanks
Navneet -
Create a trigger for to prevent duplicate
Hi
How can I to build a trigger for insert , to prevent duplicate register when I use SQLLOADER ?The user guide is your friend.
As for an unique index:
CREATE UNIQUE INDEX <name> ON <table>(<column1>, <column2>);Again, refer to the user guide.
C. -
Does anyone have a suggestion regarding how to prevent duplicate posts with JSF?
As an example, I have one form that allows users to carry out CRUD operations on the data that is being displayed. All successfully processed requests result in a post back to this same page.
I really want to avoid the problems that could occur if a delete or new request gets reposted by an impatient user.
Any suggestions are welcome. I should also note that for scalability reasons, I prefer to avoid solutions which require storing token, etc. in the session. I will settle for such a strategy in the absence of a better solution.Thanks to all who responded. Just a couple follow-up questions and comments.
1. Can not use Shale. I'm in a heavily restricted corporate environment that limits me to IBM's (poor) implementation of JSF 1.0.
2. Would rather not address the problem soley through the use of JavaScript because users can always disable JavaScript.
3. Redirecting back to the page instead of forwarding back is not practical for three reasons. One, it will require my backing bean to make calls down into my application to retrieve data that would already have been readily available if I were forwarding, and I'm not comfortable with that performance decrease. Two, redirecting back to the form makes displaying of validation errors difficult. Three, redirecting to the page would successfully handle the circumstance where a user hits refresh, but doesn't handle the case of an impatient user who clicks the submit button twice while waiting for a response.
If anyone can propose a solution that works within these constraints, let me know.
Thanks again for those who are contributing. -
Prevent duplicate records?
hi
can any one tell me
how can i prevent the user from typing duplicate records into a tabular form? which trigger should i use?and how to do that?
and also how to restrict inserting duplicate records into my table throw a code which will be in my form.Kevin in his post said
>>
Although you cannot normally read other records in a multi row block without navigating to them, I have found a cunning method to do this validation using the power of calculation properties. You need three extra hidden fields, two of which have calculation properties, and a little function. (If you want to see how it works, try making the hidden fields visible).
Form program unit:
function COMPARISON (in1 number, in2 number) is
if in1 = in2 then
return(1);
else
return(0);
end if;
end;
3 new hidden fields:
CONTROL.PK_COPY
DATABLOCK.MATCH_FOUND
calculation mode: formula
formula: COMPARISON(:control.PK_COPY, :datablock.PK)
CONTROL.NUMBER_OF_MATCHES
calculation_mode: summary
summary_function: Sum
summarised_block: DATABLOCK
summarised_item: MATCH_FOUND
WHEN_VALIDATE_ITEM on DATABLOCK.PK
:control.pk_copy := :datablock.pk;
if :control.number_of_matches > 1 then
message('matching key found');
end if;
(DATABLOCK must have query_all_records = TRUE)
<<
what do i have to name my fields and what to do in each field?
becuase i got lost in what Kevin said.
please answer me! -
I would like to make sure there are no duplicate data entries in my JSP that populates an Oracle database with a table called MainTable. MainTable has an Id field that is the primary key, ValData with a varchar data type, Fid and Fid2 are number data types. Fid and Fid2 are foreign key values that are taken from another table.
Id ValData Fid Fid2
1 abc 34 2
2 efg 23 34
3 zeo 25 43Sometimes someone can enter duplicate data and the ValData, Fid and Fid2 will end up like this:
Id ValData Fid Fid2
1 abc 34 2
2 efg 23 34
3 zeo 25 43
4 zeo 25 43Is there anything in Java I can implement to prevent duplicate data entry in the above example?Thanks,
It now works after I added unique constraints to each of the fields.
Google results showed me that ORA-00001 is Oracle's Duplicate message and I added a condition in the SQLException Catch area and it catches all my Duplicate entry attempts and shows message to the user.
Here is what I have and would like to know if this is an efficient way I am doing this??
try
// db stuff
catch (SQLException sqle)
String message = sqle.getMessage();
if (message.indexOf("ORA-00001") != -1)
out.println("Duplicate Data entry.");
else
out.println("some other ORA error");
}
Maybe you are looking for
-
I am not able do download any apps from my app, be it paid or free. I don't see an icon for eg FREE to download an app. I just upgraded to i07 0.2, pls guide if there is some miss in setting..
-
OCR-text from pdf to pdf ?
Is it possible to copy the OCR-text from a pdf file obtained after Finereader and paste it in the original pdf?
-
HT1551 Apple TV - can only see Computers and Settings options (no internet)
sine the apple2 tv software was updated last week I can only see options for computers and settings whilst my internet connection is clearly working, I cannot access youtube or internet radio as there is no internet option any ideas how to fix this p
-
Apple's Image Capture & Officejet Pro 8600
How do I set up my OfficeJet Pro 8600 to work with Apple's Image Capture on my Macbook Air running OS X (10.9.3)? This question was solved. View Solution.
-
Itunes library, on local hard drive and in default location, does not load. The preference is pointing to the right place and reset doesn't do anything. This is what I did last. I had manually copied files directly in to /user/music/itunes/itunes mus