Ajax checing for duplicte records
i am trying to have a form in ajx that will also insert a new
contact... i havit working with the insert part but i want to have
it check for duplicate records before inserting the contact... here
is the form ... and i also have a cfc for the functions
<cfcomponent output="false">
<cfset this.dsn="myserver">
<!--- Populates the grower list Select --->
<cffunction name="getCompany" access="remote"
returntype="array">
<cfset var rsData="">
<cfset var myReturn=ArrayNew(2)>
<cfset var i=0>
<cfquery name="rsData" datasource="myserver">
SELECT cid ,Company
FROM Contacts
order by Company asc
</cfquery>
<cfloop query="rsData">
<cfset myReturn[rsData.currentrow] [1]=rsdata.cid>
<cfset myReturn[rsData.currentrow] [2]=rsdata.Company>
</cfloop>
<cfreturn myReturn>
</cffunction>
<!--- Populates list related to grower --->
<cffunction name="getcontacts" access="remote"
returntype="array">
<cfargument name="cid" type="string" required="no">
<cfset var rsData="">
<cfset var myReturn=Arraynew(2)>
<cfset var i=0>
<cftry>
<cfquery name="rsdata" datasource="myserver">
SELECT cid, Company, FullName, Lname, Fname, Address1,
Address2, City, State, zip, country, Phone, ext, cell, Fax,
tollfree, Web, Email, Title, ExecutiveTitle
FROM Contacts
WHERE Contacts.Company = '#arguments.cid#'
</cfquery>
<cfcatch type="any">
<cfset returnStruct.success = false />
<cfset returnStruct.message = cfcatch.message />
</cfcatch>
</cftry>
<cfloop query="rsdata">
<cfif rsdata.recordcount gt 0>
<cfset myReturn[rsData.currentrow] [1]=rsdata.cid>
<cfset myReturn[rsData.currentrow] [2]=rsdata.FullName>
<!--- <cfelse>
<cfset rsdata.cid = 999999>
<cfset rsdata.FullName = 'none'>
<cfset myReturn[rsData.currentrow] [1]=rsdata.cid>
<cfset myReturn[rsData.currentrow] [2]=rsdata.FullName>
--->
</cfif>
</cfloop>
<cfreturn myReturn>
</cffunction>
<!--- Gets contact info for 2page
contacts!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
--->
<cffunction name="getcontactsinfo2" access="remote"
returnType="struct">
<cfargument name="growerName" type="string"
required="no">
<cfset var data="">
<cfset var c = "">
<cfset var s = structNew()>
<cftry>
<cfquery name="data" datasource="myserver">
SELECT cid, Company, FullName, Lname, Fname, Address1,
Address2, City, State, zip, country, Phone, ext, cell, Fax,
tollfree, Web, Email, Title, ExecutiveTitle
FROM Contacts
WHERE Company= <cfqueryparam cfsqltype="cf_sql_varcar"
value="#arguments.growerName#">
</cfquery>
<cfloop list="#data.columnlist#" index="c">
<cfset s[c] = data[c][1]>
</cfloop>
<cfcatch type="any">
<cfset returnStruct.success = false />
<cfset returnStruct.message = cfcatch.message />
</cfcatch>
</cftry>
<cfreturn s>
</cffunction>
<cffunction name="getcontactsinfo" access="remote"
returnType="struct">
<cfargument name="cid" type="numeric" required="true">
<cfset var data="">
<cfset var c = "">
<cfset var s = structNew()>
<cftry>
<cfquery name="data" datasource="myserver">
SELECT cid, Company, FullName, Lname, Fname, Address1,
Address2, City, State, zip, country, Phone, ext, cell, Fax,
tollfree, Web, Email, Title, ExecutiveTitle
FROM Contacts
WHERE contacts.cid= <cfqueryparam
cfsqltype="cf_sql_integer" value="#arguments.cid#">
</cfquery>
<!--- --->
<cfloop list="#data.columnlist#" index="c">
<cfset s[c] = data[c][1]>
</cfloop>
<cfcatch type="any">
<cfset returnStruct.success = false />
<cfset returnStruct.message = cfcatch.message />
</cfcatch>
</cftry>
<cfreturn s>
</cffunction>
<!--- Updates the database of grower contacts --->
<cffunction name="markTaskComplete" output="false"
returntype="struct" access="remote" hint="i mark a task
complete">
<cfargument name="cid2" type="numeric" required="true"
/>
<cfargument name="company2" type="string" required="true"
/>
<cfargument name="address2" type="string" required="true"
/>
<cfargument name="city2" type="string" required="true"
/>
<cfargument name="state2" type="string" required="true"
/>
<cfargument name="zip2" type="string" required="true"
/>
<cfset var qMarkTaskComplete = "" />
<cfset var returnStruct = structNew() />
<cfset returnStruct.success = true />
<cfset returnStruct.taskID = arguments.cid2 />
<cftry>
<cfquery name="qMarkTaskComplete"
datasource="myserver">
UPDATE
Contacts
SET
Company = <cfqueryparam value="#arguments.company2#"
cfsqltype="cf_sq_varcar" /> ,
Address1 = <cfqueryparam value="#arguments.address2#"
cfsqltype="cf_sq_varcar" /> ,
City = <cfqueryparam value="#arguments.city2#"
cfsqltype="cf_sq_varcar" />,
State = <cfqueryparam value="#arguments.state2#"
cfsqltype="cf_sq_varcar" />,
zip = <cfqueryparam value="#arguments.zip2#"
cfsqltype="cf_sq_varcar" />
WHERE
cid = <cfqueryparam value="#arguments.cid2#"
cfsqltype="cf_sq_int" />
</cfquery>
<cfcatch type="Database">
<cfset returnStruct.success = false />
<cfset returnStruct.message = cfcatch.message />
</cfcatch>
</cftry>
<cfdump var="#returnStruct#"/>
<cfreturn returnStruct />
</cffunction>
<cffunction name="lookupGrower" access="remote"
returntype="array">
<cfargument name="search" type="any" required="false"
default="">
<!--- Define variables --->
<cfset var data="">
<cfset var result=ArrayNew(1)>
<!--- Do search --->
<cfquery name="data" datasource="myserver">
SELECT cid, Company, FullName, Lname, Fname, Address1,
Address2, City, State, zip, country, Phone, ext, cell, Fax,
tollfree, Web, Email, Title, ExecutiveTitle
FROM Contacts
WHERE (Company LIKE '#ARGUMENTS.search#%')
</cfquery>
<!--- Build result array --->
<cfloop query="data">
<cfset ArrayAppend(result, Company)>
</cfloop>
<!--- And return it --->
<cfreturn result>
</cffunction>
<cffunction name="markTaskComplete2" output="false"
returntype="struct" access="remote" hint="i mark a task
complete">
<cfargument name="company3" type="string" required="true"
/>
<cfargument name="address3" type="string" required="true"
/>
<cfargument name="city3" type="string" required="true"
/>
<cfargument name="state3" type="string" required="true"
/>
<cfargument name="zip3" type="string" required="true"
/>
<cfset var qMarkTaskComplete = "" />
<cfset var returnStruct = structNew() />
<cfset returnStruct.success = true />
<cfset returnStruct.taskID = arguments.cid />
<cftry>
<cfquery name="qMarkTaskComplete"
datasource="myserver">
INSERT INTO KYIntranet.dbo.Contacts
(Company
,Address1
,City
,State
,zip)
VALUES
(<cfqueryparam value="#arguments.company3#"
cfsqltype="cf_sq_varcar" /> , <cfqueryparam
value="#arguments.address3#" cfsqltype="cf_sq_varcar" />
,<cfqueryparam value="#arguments.city3#"
cfsqltype="cf_sq_varcar" />,<cfqueryparam
value="#arguments.state3#" cfsqltype="cf_sq_varcar"
/>,<cfqueryparam value="#arguments.zip3#"
cfsqltype="cf_sq_varcar" />)
</cfquery>
<cfcatch type="any">
<cfset returnStruct.success = false />
<cfset returnStruct.message = cfcatch.message />
</cfcatch>
</cftry>
<cfreturn returnStruct />
</cffunction>
</cfcomponent>
From my understanding your table that gets inserted is
KYIntranet.dbo.Contacts . And i guess company field in that table
needs to be checked for duplicates. So you can put the company
field as primary key for that table. Inserting the same company
name can result in a Primary key exception meaning that a duplicate
has been entered. By this way you can check for duplicates.
<cftry>
<cfquery>Insert SQL code</cfquery>
<cfcatch>
<--Code to handle primary key exception-->
</cfcatch>
<cftry>
Similar Messages
-
OpenScript fails to record AJAX element for load testing
OpenScript 12.2.0.1 is failing to record AJAX element for load testing.
After I press a button a text box should appear in another part of the screen.
What can I do in this case?Hi,
I think your password is encrypted. Try replace password "a99fad1866af01d9375627d5d08d7f1c11ed4d3f6d5d2372d40908884a15b8e6" with your password.
Or Get output of obfuscate("your password") and replace "a99fad1866af01d9375627d5d08d7f1c11ed4d3f6d5d2372d40908884a15b8e6" with {{@deobfuscate( output of obfuscate("your password") )}}
Regards,
Deepu M -
Report takes long time for few records
hi frends,
I m facing one problem with my Web based erp application which is developed in .net , in my application when i open the report from my applicaiton , in my temp folder there one file gets created name is "rpt conmgr cache"
bcoz of this for few records also my report takes too much time and opens very slow and it takes long time, and it happens in some of the reports only , other reports are working cool and its not creating any file in temp folder,,, so can u guide me whats this file and what can be the solution for it,
Thanks
Mithunhi sabhajit,
i have already checked the sql query it is taking less then seconds.
any other steps u want me to check then pls let me know?
thanks mithun -
How to show multiple values for Unique records in Report
Here's my question/problem:
I've joined two tables, one table (TBL1) contains an object id (OBJ_ID) that repeats and the other table (TBL2) contains a date (DT), object type id (OBJ_TYP_ID), and object type description (OBJ_TYP_DES). The tables are joined by an inventory id (INV_ID).
The OBJ_ID repeats and has a Date value for each record. I want to report an unique OBJ_ID and show each Date for a particular OBJ_ID in multiple Columns.
An example of the current resultset looks like this:
OBJ_ID OBJ_TYP_ID OBJ_TYP_DES DATE
1 1 TYPE1 4/1/2009
2 1 TYPE1 4/1/2009
3 1 TYPE1 4/10/2009
1 2 TYPE2 5/3/2009
3 1 TYPE1 3/30/2005
4 1 TYPE1 4/1/2009
5 1 TYPE1 4/1/2009
5 2 TYPE2 5/1/2009
1 1 TYPE1 4/3/2007
1 1 TYPE1 3/30/2005
I want to express the resultset like this:
OBJ_ID OBJ_TYP_ID OBJ_TYPE_DES DATE1 DATE2 DATE3
1 1 TYPE1 4/1/2009 4/3/2007 3/30/2005
1 2 TYPE2 5/3/2009
2 1 TYPE1 4/1/2009
3 1 TYPE1 4/10/2009 3/30/2005
4 1 TYPE1 4/1/2009
5 1 TYPE1 4/1/2009
5 2 TYPE2 5/1/2009
What technique is best to use to do this? I know I could create another table and populate the rows/columns by reading data from this query, but is there a better way?Hi,
cclemmons wrote:
I want to express the resultset like this:
OBJ_ID OBJ_TYP_ID OBJ_TYPE_DES DATE1 DATE2 DATE3
1 1 TYPE1 4/1/2009 4/3/2007 3/30/2005
1 2 TYPE2 5/3/2009
2 1 TYPE1 4/1/2009
3 1 TYPE1 4/10/2009 3/30/2005
4 1 TYPE1 4/1/2009
5 1 TYPE1 4/1/2009
5 2 TYPE2 5/1/2009
What technique is best to use to do this? I know I could create another table and populate the rows/columns by reading data from this query, but is there a better way?Absolutely! You seem to have an instictive feeling that creating a separate table just for a query is inefficient. You instinct is 100% correct. Maybe in Oracle 7 there was a reason to do that, but today you can query results of other queries as if they were tables, so temporary tables like you describe are very rarely necessary, let alone convenient.
What you want to do is pivot the date columns. Here's one way
WITH original_query AS
SELECT obj_id
, obj_typ_id
, obj_typ_des
, dt -- date is not a good column name
FROM ... -- the rest of your original query goes here
, got_rnum AS
SELECT oq.*
, ROW_NUMBER () OVER ( PARTITION BY obj_id
, obj_typ_id
, obj_typ_des
ORDER BY dt DESC
) AS rnum
FROM original_query oq
SELECT obj_id
, obj_typ_id
, obj_typ_des
, MAX (CASE WHEN rnum = 1 THEN dt END) AS dt1
, MAX (CASE WHEN rnum = 2 THEN dt END) AS dt2
, MAX (CASE WHEN rnum = 3 THEN dt END) AS dt3
, MAX (CASE WHEN rnum = 4 THEN dt END) AS dt4
, MAX (CASE WHEN rnum = 5 THEN dt END) AS dt5
FROM got_rnum
GROUP BY obj_id
, obj_typ_id
, obj_typ_des
;As you can see, this adds two layers of queries on top of your original query. One of those layers is probably not needed; depending on what you're doing in your original main query, you can probably compute rnum there, and omit the got_rnum sub-query.
Also, depending on the relationship of obj_id, obj_typ_id and obj_typ_des, some of what I posted above may not be needed but including it won't really hurt.
If you want to know more about this technique, search for "pivot" or "rows to columns". A <tt>SELECT ... PIVOT ...</tt> keyword was introduced in Oracle 11, but most of what you'll find when you search for "pivot" doesn't assume you have Oracle 11 (nor does the query above require Oracle 11).
This assumes you know an upper limit (5 in the example above) of dts that can appear in any line of output.
See [this thread|http://forums.oracle.com/forums/thread.jspa?messageID=3527823�] for a discussion of some alternatives. -
Number for every record that is retrieved from (query)
Hello
I wish to put a number for every record that is retrieved
from the record that is output by this query
For example
For the first recored/row
Generated number, ksnumber, date
1, gg111 11/05/05
2, oo235 12/06/05
the query returned 2 records 1 and 2 are the number that is
generated with this code.
In addition if there is a built in function, where in the
code do I put it???
<cfquery name="gelov datasource="kl90">
SELECT
FROM
WHERE
ORDER BY
<cfswitch expression="#Form.orderBy#">
<cfks value="KSNUMBER">
KS.KS_NBR
</cfks>
<cfks value="CREATIONDATE">
KS.KREATDAT
</cfks>
</cfswitch>
</cfquery>
<!---html report--->
<cfswitch expression="#Form.outputFormat#">
<cfks value="HTML">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Ctwye Kss Report</title>
</head>
<style type="text/css">
table{
font-family:Arial, Helvetica, sans-serif;
font-size:10px;
td{
font-family:Arial, Helvetica, sans-serif;
font-size:10px;
th{
font-family:Arial, Helvetica, sans-serif;
font-size:10px;
h2{
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
h3{
font-family:Arial, Helvetica, sans-serif;
font-size:13px;
</style>
<body>
<cfoutput>
<table border="0" cellpadding="3" cellspacing="0">
<tr>
<td align="center">
<h3>Ctwye Kss
Report</h3><br><br></td>
</tr>
<tr>
<td align="center">
</h2>report returned #getCtwyeKss.RecordCount#
records</h2></td>
</tr>
<tr>
<td>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td width="160">Ks Number</td>
<td>Creation Date</td>
<!--- <td class="dataField">Address</td>
<td class="dataField">Type</td>
<td class="dataField">Description</td>--->
</tr>
<cfloop query="getCtwyeKss">
<tr bgcolor="<cfif currentrow mod
2>GHOSTWHITE<cfelse>WHITE</cfif>">
<td>#KS_NBR#</td>
<td>#dateformat(KREATDAT,"mm/dd/yyyy")#</td>
</tr>
</cfloop>
</table>
</td>
</tr>
</table>
</BODY>
</HTML>
</cfoutput>
</cfks>
<cfks value="CSV">
<CFHEADER NAME="Content-Disposition" VALUE="attachment;
filename=ctwye.csv">
<cfcontent type="application/msexcel">"Ks
Number","Creation Date"
<cfoutput
query="getCtwyeKss">#ltrim(KS_NBR)#,"#dateformat(KREATDAT,"mm/dd/yyyy")#"
<tr #IIF(getCtwyeKss.CurrentRow MOD
2,DE(''),DE('backgroundColor="##999"'))#>
<!---<tr bgcolor="<cfif currentrow mod
2>##808080<cfelse>##ffffff</cfif>"> --->
</cfoutput>
</cfks>
</cfswitch><cfks> is not a Coldfusion tag. Use <cfcase>
instead.
The following code will print the row numbers
<cfquery name="gelov" datasource="kl90">
select ksnumber, date
from yourTable
</cfquery>
<cfoutput query="gelov">
#currentrow#, #ksnumber#, #date#<br>
</cfoutput> -
Check for duplicate record in SQL database before doing INSERT
Hey guys,
This is part powershell app doing a SQL insert. BUt my question really relates to the SQL insert. I need to do a check of the database PRIOR to doing the insert to check for duplicate records and if it exists then that record needs
to be overwritten. I'm not sure how to accomplish this task. My back end is a SQL 2000 Server. I'm piping the data into my insert statement from a powershell FileSystemWatcher app. In my scenario here if the file dumped into a directory starts with I it gets
written to a SQL database otherwise it gets written to an Access Table. I know silly, but thats the environment im in. haha.
Any help is appreciated.
Thanks in Advance
Rich T.
#### DEFINE WATCH FOLDERS AND DEFAULT FILE EXTENSION TO WATCH FOR ####
$cofa_folder = '\\cpsfs001\Data_pvs\TestCofA'
$bulk_folder = '\\cpsfs001\PVS\Subsidiary\Nolwood\McWood\POD'
$filter = '*.tif'
$cofa = New-Object IO.FileSystemWatcher $cofa_folder, $filter -Property @{ IncludeSubdirectories = $false; EnableRaisingEvents= $true; NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite' }
$bulk = New-Object IO.FileSystemWatcher $bulk_folder, $filter -Property @{ IncludeSubdirectories = $false; EnableRaisingEvents= $true; NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite' }
#### CERTIFICATE OF ANALYSIS AND PACKAGE SHIPPER PROCESSING ####
Register-ObjectEvent $cofa Created -SourceIdentifier COFA/PACKAGE -Action {
$name = $Event.SourceEventArgs.Name
$changeType = $Event.SourceEventArgs.ChangeType
$timeStamp = $Event.TimeGenerated
#### CERTIFICATE OF ANALYSIS PROCESS BEGINS ####
$test=$name.StartsWith("I")
if ($test -eq $true) {
$pos = $name.IndexOf(".")
$left=$name.substring(0,$pos)
$pos = $left.IndexOf("L")
$tempItem=$left.substring(0,$pos)
$lot = $left.Substring($pos + 1)
$item=$tempItem.Substring(1)
Write-Host "in_item_key $item in_lot_key $lot imgfilename $name in_cofa_crtdt $timestamp" -fore green
Out-File -FilePath c:\OutputLogs\CofA.csv -Append -InputObject "in_item_key $item in_lot_key $lot imgfilename $name in_cofa_crtdt $timestamp"
start-sleep -s 5
$conn = New-Object System.Data.SqlClient.SqlConnection("Data Source=PVSNTDB33; Initial Catalog=adagecopy_daily; Integrated Security=TRUE")
$conn.Open()
$insert_stmt = "INSERT INTO in_cofa_pvs (in_item_key, in_lot_key, imgfileName, in_cofa_crtdt) VALUES ('$item','$lot','$name','$timestamp')"
$cmd = $conn.CreateCommand()
$cmd.CommandText = $insert_stmt
$cmd.ExecuteNonQuery()
$conn.Close()
#### PACKAGE SHIPPER PROCESS BEGINS ####
elseif ($test -eq $false) {
$pos = $name.IndexOf(".")
$left=$name.substring(0,$pos)
$pos = $left.IndexOf("O")
$tempItem=$left.substring(0,$pos)
$order = $left.Substring($pos + 1)
$shipid=$tempItem.Substring(1)
Write-Host "so_hdr_key $order so_ship_key $shipid imgfilename $name in_cofa_crtdt $timestamp" -fore green
Out-File -FilePath c:\OutputLogs\PackageShipper.csv -Append -InputObject "so_hdr_key $order so_ship_key $shipid imgfilename $name in_cofa_crtdt $timestamp"
Rich ThompsonHi
Since SQL Server 2000 has been out of support, I recommend you to upgrade the SQL Server 2000 to a higher version, such as SQL Server 2005 or SQL Server 2008.
According to your description, you can try the following methods to check duplicate record in SQL Server.
1. You can use
RAISERROR to check the duplicate record, if exists then RAISERROR unless insert accordingly, code block is given below:
IF EXISTS (SELECT 1 FROM TableName AS t
WHERE t.Column1 = @ Column1
AND t.Column2 = @ Column2)
BEGIN
RAISERROR(‘Duplicate records’,18,1)
END
ELSE
BEGIN
INSERT INTO TableName (Column1, Column2, Column3)
SELECT @ Column1, @ Column2, @ Column3
END
2. Also you can create UNIQUE INDEX or UNIQUE CONSTRAINT on the column of a table, when you try to INSERT a value that conflicts with the INDEX/CONSTRAINT, an exception will be thrown.
Add the unique index:
CREATE UNIQUE INDEX Unique_Index_name ON TableName(ColumnName)
Add the unique constraint:
ALTER TABLE TableName
ADD CONSTRAINT Unique_Contraint_Name
UNIQUE (ColumnName)
Thanks
Lydia Zhang -
Posting date issue for COGI records.
Hi all,
I have one issue regarding the posting date for the records which are being cleared from COGI.
_In case of MF47 (Postprocessing for REM) following is the behaviour,_
In this if GR has happened on say 1st and due to stock un-availability components are gone to Post processing, Now when stock of component inwarded on say 20th then GI posting happens on 20th in post processing record clearance
_Now in case of COGI (Automatic goods movement : Error handling) behaviour is different,_
In this scenario if GR has happened on say 1st and due to stock un-availability components are gone to Post processing (COGI), Now when stock of component inwarded on say 20th then GI posting happens on 1st in post processing record clearance
I want same should be happened in case of COGI also, is there any note/ correction/option available??
Thanks in advance
Regards,
Vinayak.Dear,
There are backlogs from the backflush in repetitive manufacturing. You can display these using Transaction MF47 and/or Transaction COGI. So schedule a job for program RMSERI11 on daily basis or hourly basis so it will clear the postprocessing errors.
But for some of the errors, it needs manual intervention like updating storage location, posting dates due to posting period block etc.
Hope clear to you.
Regards,
R.Brahmankar -
Material Description is not displaying for few records in Report
Dear Experts,
Report Material Description is not displaying for few records in Bex Report but for records it is coming and even the heading of the material Description is also not coming for this report.
Cud u plz suggest a good solution for it.
Regards,
Sai Phani.Hi Phani,
For the text of the material in records, check if there is text maintained for that material in the master data. also try by changing the text to medium text and long text.
regarding header, you will have same heading for key and text, you may use Materail ID / Description as the heading if you want.
regards,
Rk. -
How to genarate Primary Key for each record in XI Mapping
Hi,
I need to genarate primary key for each record in the paylod in mapping..
Eg: if i have a 10 reacords i need to have a primary key for each record..starting with the
Record Primary key
First 001
Secound 002
Tenth 010
If i need to write any user defined funtion... can any one provide the code for it.
Thanks
AmareshHi Bavesh,
I will explain with the example:
XML:
<Record 1>
<Primary key>
<value1>
<value2>
</Record 1>
<Record 2>
<Primary Key>
</Record 2>
like above i will be getting n number of recored and in each record i need to genarate primary key in XI.and the key sould be in sequence...
like for the first record 1 secound 2 like that primary key should add to the privous Primary key.
and this is for each payload.
Thanks
Amaresh -
How to set Display Only for some records in CAT2 Worklist
Hi,
I have a requirement to modify an attributes for some records in the Worklist of CAT2.
We have an external system where we book our time. Weekly we import data from that external system into CATSDB using BAPI for every single employee.
We would like when the user wants to modify his time sheet to be able to add/modify all records except those which were imported from the external system. Which means that those records should be in Display only mode / grayed out / before release.
Is there any user exit or BADI that could help to modify that attribute and that will be triggered before displaying the Worklist ?
Please advise !
Thanks,
StefanI've solved the problem.
First I've added customer field in CI_CATSDB structure and when I am importing the data I am populating that field with 'X', which means that this is record from the external application.
I've created enhancement implementation in Function group->CATS, screen->2003 MODULE->D2000_MODIFY_LOOP, subroutine->modify_d2000_loop where I am checking the field mentioned above if it is 'X' I am modifying the screnn-output = off.
It works, thak you for your help.
Regards,
Stefan -
SSRS 2008 R2 - Separate report for Each record?
Hi,
How do I create new pdf reports for each records from a table? The pdf files should be named as customerid.pdf and needs to be delivered in email or share path?
Each record has enough content for 5 page of pdf report.
How do we achieve this?
Thanks
RajYou can create a data driven subscription to loop through records in the table and create pdf based on number of customerid.
Have a look at this for DD subscriptions :
http://msdn.microsoft.com/en-us/library/ms169673.aspx
Kind Regards, Vikram Kansal Please mark solved if I've answered your question, vote for it as helpful to help other user's find a solution quicker -
Reading long text for more records at a time
Hi all,
We have a requirement for which that data like textid textname textobject and language must be taken in to an internal table and for each record in the internal table i have to read the long text inorder to compare the long text for the given search text.
If i use Read_text inside the loop and endloop it works but it may not be appropriate in performance point of view.
Is there any function module which can read long texts for more records at a time.
The long text data in STXL will be in raw data format right? is there any way to convert raw data to normal so that by hitting the STXL i can read the long text data for more than one record at a time.
Thanks in advance
sanju.HI Sanju,
Below is a code snippet which describes reading a long text frm the screen and appending it into the internal table.This code is actually to read the text from the screen and inserting a record into STXl and STXH.
From your query what i understood is that you are storing the long text from the screen into a internal table and so you not want to use the read_text FM due to performance issue.
Since tdline(tline table) is 132 char long format i use this small logic to read the screen data and append it to my internal table.
*Data Declarations
DATA: lv_strlen TYPE i,
lv_create TYPE boolean,
lv_desc TYPE string.
DATA: ls_text TYPE tline,
ls_basic_text TYPE stxh.
DATA: lt_text TYPE ztty_tline_tab.
CONSTANTS:
lc_tdid TYPE thead-tdid VALUE 'Z001',
lc_tdobject TYPE thead-tdobject VALUE 'Z_ALERTS'.
*Appending the text to the internal table.
lv_strlen = STRLEN( iv_alert_text-alert_text ).
lv_desc = iv_alert_text-alert_text.
IF lv_strlen < 132.
ls_text-tdformat = '*'.
ls_text-tdline = lv_desc.
APPEND ls_text TO lt_text.
ELSE.
*logic to wrap text
DO.
ls_text-tdformat = '*'.
IF STRLEN( lv_desc ) < 132.
ls_text-tdformat = '*'.
ls_text-tdline = lv_desc.
APPEND ls_text TO lt_text.
EXIT.
ENDIF.
IF lv_desc+132(1) <> ' '.
CONCATENATE lv_desc(131) '-' INTO ls_text-tdline.
lv_desc = lv_desc+131.
ELSE.
ls_text-tdformat = '*'.
ls_text-tdline = lv_desc(132).
lv_desc = lv_desc+132.
ENDIF.
APPEND ls_text TO lt_text.
ENDDO.
ENDIF.
Please award graciously if found helpful.Please do ask me if i have not answered you properly.
Thank you.
Message was edited by:
P M Harish -
Table cntrol field to be display/Change only For each record
Hi all,
How to set a particular Field in table control either as display only or
change only for <b>each row</b> based on certain condition.I need to set this property for each record in table control not for the entire coloumn?.I know the procedure for setting up an entire coloumn in table control either as diplay or change only using <b>Loop at screen</b> statement.
Conditions:
If Material is batch managed:
itab-batch field has to be <b>Display only</b> mode.
if material is not batch managed:
itab-batch field has to be <b>change mode</b>.
<b>O/p of Table Control :</b>
Material Batch
1000 Display only
2000 Change only
8000 Change only
3500 Display only
3600 Display onlyHi Ravi,
Thanks for your reply.I have put the code as u said. It is modifying the whole coloumn insted of modifying Current row of the coloumn.
I have tried to modify the screen property using Table control attributes (TC-COLS).The following commented code is that logic.Even that also doing the same thing.Can yoy please tell me how to do it.
MODULE tc_get_lines OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'X_ZPINV-CHARG'.
IF fg_batch = ' '.
screen-input = 0.
ELSE.
screen-input = 1.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
LOOP AT tc-cols INTO tc_wa
WHERE screen-name = 'X_ZPINV-CHARG'.
IF x_zpinv-matnr IS NOT INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = x_zpinv-matnr
IMPORTING
output = v_matnr.
SELECT SINGLE * FROM marc WHERE matnr = v_matnr
AND werks = w_plant.
IF marc-xchar IS INITIAL.
tc_wa-screen-input = 0.
ELSE.
tc_wa-screen-input = 1.
ENDIF.
MODIFY tc-cols FROM tc_wa INDEX sy-tabix." transporting screen-input
ENDIF.
ENDLOOP.
ENDMODULE. "TC_GET_LINES OUTPUT -
Bapi_po_create is not creating Purchase Orders for multiple records in file
Hi All.
iam trying to create contracts and Purchase Orders In me21n,me31k .
here iam using bdc for contract creation against services and using bapi_po_create for PO Creations.
in this process i could create contracts and POs for the first record in the file but for second record bapi_po_create couldnt create POs and the return table in bapi says
1.document contains no items.
2.no services or limits have been maintained.
wil be waiitng for r great answer.
bye.
regards.
seeta.Hi Seeta Ram,
Did you pass the table PO_ITEM_SCHEDULES to BAPI_PO_CREATE with the coresponding Item numbers for each item in the table PO_ITEMS?
Regards,
Vitz. -
Can I connect a line in for audio recording on my iPhone?
I would like to use Garage Band for iOS to generate digital recordings of my LP collection. Is it possible to do this through a line into the iPhone directly from my stereo/turntable? Is a separate app required to convert the input/output jack on the phone for "line" recording?
Google something like "copy vinyl to iphone".
Maybe you are looking for
-
Problem with ratings-based smart playlists in iOS5.
I use ratings-based smart playlists to organize my music. For example, a typical smart playlist will include all songs from a given genre rated 3 stars or better. Playlists work perfectly on PC/iTunes and iPad (and used to work perfectly on iPhone/
-
I want to get the iPhone 4 but I can only get it for the early upgrade price. Nobody on our Family Plan is upgrade eligible either, everybody is only early upgrade eligible. I really do not want to pay $399 to get an iPhone. My older sister (not on t
-
How can i speed up my computer
I was wondering if I need to do anything in particular to clean up/speed up my IMac computer. I originally purchased it in early 2010 and have not had any problems per se but at times it does appear to run slow and I am having to wait for the spinni
-
Can't update ipod cause playlist being updated do not exist
I installed my ipod software. Great! Easy to use. Then my computer crashed for other reasons. I got a new computer, installed again, and when I try to update my iPod, iTunes tells me they can't update my songs because the playlists I am updating (I d
-
Envelope Printing Incorrectly to HP laserjet
When installing to one of the Mavericks upgrades last year, my old HP laser jet 3700n would no longer print envelopes correctly from either WordMac or from PrintShop3. I blamed the old age of the printer (More than 10 years) and no recent driver made