How to use BAPI_RE_CN_CHANGE to insert conditions
Hi,
I need to insert conditions in a RE contract, i find out that the BAPI BAPI_RE_CN_CHANGE could do this, but it's not working, the BAPI return is OK, but no records are inserted in the cointract.
Anyone can send me the parameters that i had to pass to the BAPI ou a example code of it ?
Thanks a lot.
Hello,
I have solved the problem, i'm sending a invalid parameter to the BAPI.
Now the condition is being inserted into the contract.
Thanks
Similar Messages
-
How to use i for if condition in a for i in loop?
Hi friends,
I have a question on how to use i for IF condition in a loop, in order to get an efficient programming and results. Here is outlined SQL:
cursor is
select c1,c2,c3 from table1; -- 100 rows returned.
open cursor
loop
fetch c1,c2,c3 into v1,v2,v3;
for i in 1..3 loop
if 'v'||i between 90 and 100 then
v_grade := 'Excellent';
elsif 'v'||i between 80 and 89 then
elsif 'v'||i between 50 and 59 then
end if;
end loop;
close cursor;
This way, I don't need to use a lot of if..then for hard code v1,v2,v3,.... actually I have more v..
But Oracle gave an error of this usage of 'if 'v'||i' or 'v'||to_char(i).
Thanks for any advice in advance!user508774 wrote:
Thanks for comments and advices. But I didn't get your inputs clearly. Are you saying I don't need to use PL/SQL to achieve this?Correct. Ronel and John showed you the basic approaches. SQL is not a mere I/O language for making read and write calls. It is a very capable, flexible and powerful language. One can solve a problem with a few lines of SQL code, that will take 100's of lines of PL/SQL or Java code.
So do not underestimate what can be done in SQL.
v_cmd := 'UPDATE parts_categ_counts SET w1='||v1||', w2='||v2||...||v9||' WHERE seq='||vseq||';
EXECUTE IMMEDIATE v_cmd;This code is also wrong. Besides the fact that there is no need for dynamic SQL, this approach creates a brand new SQL statement each loop iteration.
SQL is source code. It needs to be parsed (compiled). The end result is an executable program that is called a cursor. This cursor needs to be stored in server memory (the SQL Shared Pool in the SGA).
The problem with your code is that it is slow and expensive - it generates lots of unique SQL statements that need CPU for parsing and server memory for storage.
These add up to a very significant performance overhead. That is the wrong approach. The correct approach is the same one that you would use in any other programming language.
Let's say you need to use Java to process a bunch of CSV files - exact same CSV layout used by each file. A file needs to be read, processed, and a log file created.
Will you write a Java program that loops through the files, for each file found, write a Java program for processing that file, compile it, then execute it?
Or would you write a Java program that takes the name of the file as input, and then process that file and writes the log file?
The 2nd approach provides a program that can process any of those CSV files - one simply needs to pass the filename as an input parameter.
Your code and approach use the 1st method. Not the 2nd. And that is why it is wrong.
To create a SQL program with parameters is done by using bind variables. Instead of
v_cmd := 'UPDATE parts_categ_counts SET w1='||v1||', w2='||v2||...||v9||' WHERE seq='||vseq||';
The following SQL source code should be created:
v_cmd := 'UPDATE parts_categ_counts SET w1=:v1, w2=:v2 ..., w9=:v9 WHERE seq= :vseq';
The tokens with the colon prefix (such as :v1), are bind variables. Think of these as the parameters to the SQL cursor.
The server parses this SQL into a cursor. You can now execute the same cursor over and over again, using different bind variables. (just like the 2nd approach above that one would use in Java)
In PL/SQL, this is made even easier as you can code native SQL code with PL/SQL code and use PL/SQL variables in it. The PL/SQL compiler is clever enough to do the SQL parsing, variable binding, and cursor execution for you. So in PL/SQL, you would use:
UPDATE parts_categ_counts SET w1=v1, w2=v2 ..., w9=v9 WHERE seq= vseq;
Where v1 and the others are PL/SQL variables.
That all said - PL/SQL is only used for data crunching, when the processing of data is too complex for the SQL language to deal with. And this is very seldom the case.
The main reason for using PL/SQL it to provide processing flow control, conditional processing and error handling, for SQL code. As the SQL language does not have these features. -
How to use complex function as condition in Oracle Rule Decision Table?
How to use complex function as condition in Oracle Rule Decision Table?
We want to compare an incoming date range with the date defined in the rules. This date comparison is based on the input date in the fact & the date as defined for each rule. Can this be done in a decision table?I see a couple of problems here.
First, what you posted below is not a syntactically valid query. It seems to be part of a larger query, specifically, this looks to be only the GROUP BY clause of a query.
Prabu ammaiappan wrote:
Hi,
I Have a group function in the Query. Below is the Query i have used it,
GROUP BY S.FREIGHTCLASS,
R.CONTAINERKEY,
S.SKU,
S.DESCR ||S.DESCRIPTION2,
S.PVTYPE,
RD.LOTTABLE06,
R.WAREHOUSEREFERENCE,
RD.TOLOC,
R.ADDWHO,
R.TYPE,
S.CWFLAG,
S.STDNETWGT,
S.ORDERUOM,
R.ADDDATE,
C.DESCRIPTION,
(CASE WHEN P.POKEY LIKE '%PUR%' THEN 'NULL' ELSE to_char(P.PODATE,'dd/mm/yyyy') END),
NVL((CASE WHEN R.ADDWHO='BOOMI' THEN RDD.SUPPLIERNAME END),SS.COMPANY),
RDD.BRAND,
S.NAPA,
RD.RECEIPTKEY,
R.SUSR4,
P.POKEY,
RDD.SUSR1,
r.STATUS, DECODE(RDD.SUSR2,' ',0,'',0,RDD.SUSR2),
rd.SUSR3Second, the answer to your primary question, "How do I add a predicate with with a MAX() function to my where clause?" is that you don't. As you discovered, if you attempt to do so, you'll find it doesn't work. If you stop and think about how SQL is processed, it should make sense to you why the SQL is not valid.
If you want to apply a filter condition such as:
trunc(max(RD.DATERECEIVED)) BETWEEN TO_DATE('01/08/2011','DD/MM/YYYY') AND TO_DATE('01/08/2011','DD/MM/YYYY')you should do it in a HAVING clause, not a where clause:
select ....
from ....
where ....
group by ....
having max(some_date) between this_date and that_date;Hope that helps,
-Mark -
How to use AND,OR,NOT condition in Pattern Matching in java
how to use AND,OR,NOT condition in Pattern Matching in java
Please anyone give example..Stop asking these stupid vague questions and do some of your own research.
Start here:
http://www.regular-expressions.info/
http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html -
HOW TO USE LOGICAL AND OR CONDITION TOGETHER
Please do not post subject in ALL CAPITALS
Hi All there,
How to use logical and or condition together
I wanted to use logical AND OR condition together in where clause of Select Query.
eg where xyz and or abc
Regards
Sagar
Edited by: Matt on Mar 17, 2009 1:05 PM
Edited by: Matt on Mar 17, 2009 1:05 PMhi,
You cannot use the logical and or condition together at the same time in SQL statement. Sachin is correct while using the and and or in the same condition. You can get the data using or condition in SQL statement, and then use the delete statement of internal table using the end condition. please find the following code for the same.
select *
from dtab
where cond1 eq 'A1'
or cond2 eq 'A2'.
if sy-subrc eq 0.
delete itab where cond1 eq 'A1' and 'A2'.
endif.
regards,
Veeresh -
How to use the MAX DATE condition in WHERE CLAUSE FILEDS
Hi,
I am trying to fetch the result for getting maximun date but when i try to execute the query i am getting the error as follows.
CONDITION : trunc(max(RD.DATERECEIVED)) BETWEEN TO_DATE('01/08/2011','DD/MM/YYYY') AND TO_DATE('01/08/2011','DD/MM/YYYY')
ERROR: Group function is not allowed here.
CHEERS,
PRABU AMMAIAPPANI see a couple of problems here.
First, what you posted below is not a syntactically valid query. It seems to be part of a larger query, specifically, this looks to be only the GROUP BY clause of a query.
Prabu ammaiappan wrote:
Hi,
I Have a group function in the Query. Below is the Query i have used it,
GROUP BY S.FREIGHTCLASS,
R.CONTAINERKEY,
S.SKU,
S.DESCR ||S.DESCRIPTION2,
S.PVTYPE,
RD.LOTTABLE06,
R.WAREHOUSEREFERENCE,
RD.TOLOC,
R.ADDWHO,
R.TYPE,
S.CWFLAG,
S.STDNETWGT,
S.ORDERUOM,
R.ADDDATE,
C.DESCRIPTION,
(CASE WHEN P.POKEY LIKE '%PUR%' THEN 'NULL' ELSE to_char(P.PODATE,'dd/mm/yyyy') END),
NVL((CASE WHEN R.ADDWHO='BOOMI' THEN RDD.SUPPLIERNAME END),SS.COMPANY),
RDD.BRAND,
S.NAPA,
RD.RECEIPTKEY,
R.SUSR4,
P.POKEY,
RDD.SUSR1,
r.STATUS, DECODE(RDD.SUSR2,' ',0,'',0,RDD.SUSR2),
rd.SUSR3Second, the answer to your primary question, "How do I add a predicate with with a MAX() function to my where clause?" is that you don't. As you discovered, if you attempt to do so, you'll find it doesn't work. If you stop and think about how SQL is processed, it should make sense to you why the SQL is not valid.
If you want to apply a filter condition such as:
trunc(max(RD.DATERECEIVED)) BETWEEN TO_DATE('01/08/2011','DD/MM/YYYY') AND TO_DATE('01/08/2011','DD/MM/YYYY')you should do it in a HAVING clause, not a where clause:
select ....
from ....
where ....
group by ....
having max(some_date) between this_date and that_date;Hope that helps,
-Mark -
[WebIntelligence Reporting] How to use count function with condition !?
Post Author: xuanthuyit
CA Forum: WebIntelligence Reporting
Hi everyone,
I want to make a report like this with WebIntelligence reporting.
I want to show the number of Outlet of each chanel (Horeca, Grocery, Convenience) at the end of report !
But I don't know how to do that with WebIntelligence Reporting.
Please help asap. . .
Thank you verry much,Post Author: jsanzone
CA Forum: WebIntelligence Reporting
xuanthuyit:
Apparently =count() [and use of a where] was permissible in previous versions of BusObjects, however, things in XI are different (as other users tell me, being XI is my first experience w/ BusObj...), so anyhow, here is the solution to your question.
You will have have to create two variables for each condition you have. One variable will be the "helper" and the other variable will be the "worker". For instance, create a variable called channel_x and the formula: =if(channel="haney";<metric>;0) (where "haney" is the name of your organization and <metric> is the metric you are using to count or sum things in your report). Once channel_x is saved create another variable called channel_x_count and the formula: =sum([channel_x]). Once channel_x_count is saved, then on your report towards the bottom you can use the Template bar to drag in a new table (perhaps you want to use the Horizontal Table type), and then you can drag channel_x_count into your new table. You will have to repeat the creations of more channel_x type variables (maybe call it channel_y and channel_y_count) or something more descriptive, but in any case substitute the "haney" constant for the next store you want to track, etc, etc. -
Hi, experts
I want to create a FI certification with the document type SA, but this type need to insert reansion code to be created. As there is no such field in the BAPI_ACC_DOCUMENT_POST. How can I input reason code? Could I use the exit structure of bapi EXTENSION1 or EXTENSION2?
Is there any sample code for that?
Thank you very much.Refer below threads
USING EXTENSION tables parameter in BAPI_ACC_DOCUMENT_POST
BAPI_ACC_DOCUMENT_POST (EXTENSION)
Hope this helpss... -
How to use standard DIFF pricing condition in pricing procedure
In my pricing procedure
there is total amount value including Tax
& I want to apply DIFF (Rounding Off) condition on that total
but I don't know how It apply ?
please provide me solution.
thank you .actually In the pricing procedure
after some pricing condition there is TOTAL
then apply TAX (JLST)
then Amount inclusive of tax
then I have to apply DIFF condition to round off the "Amount inclusive of tax" .
but I do not know how I apply it
please provide me solution -
How to use more than one condition together?
Dear,
I want to set more than one condition type and use it together for any objects in page, for example page item,page button and etc.
Is it possible to handle in "PL/SQL Experssion" at condition type?(e.g =>"Request= Expression" and "Current page!= Expression 1",..) if no is answer, please tell me other ways.
Regards,
Saeed.Hi Saeed,
Saeed Hassanpour wrote:
I'd like to know about CGI and Browsers conditions. Can I refer to document or essay about condition type in pl/sql?
Yes, you can also refer CGI Environment Variables and Browser conditions in "PL/SQL Expression".
For example :
The condition type "When cgi_env SERVER_NAME = Expression 1" can be transformed to "PL/SQL Expression" as:
OWA_UTIL.GET_CGI_ENV('SERVER_NAME') = 'MyServer'
The condition type for Browser condtions can be can be transformed to "PL/SQL Expression" as:
instr(upper(OWA_UTIL.GET_CGI_ENV('HTTP_USER_AGENT')),upper('Firefox/37.0')) > 0
Following is old but comprehensive documentation about Condition Types:
https://docs.oracle.com/cd/E14373_01/appdev.32/e11838/condition.htm#HTMDB25942
Hope this helps!
Regards,
Kiran -
How to use outer join condition in my below query.
Hi All,
How to use outer join condition in my below query.
In the table APPS_JP.GEDIS_OFFER_HEADER goh I have more records
in the table APPS_JP.GEDIS_ORDER_BUILDS gob I have less number of records.
I want all the records from APPS_JP.GEDIS_OFFER_HEADER goh
including other conditions.
I have tried goh.OFFER_NO=gob.OFFER_NO(+) but same result.
[code]SELECT GOH.ORIG_SYSTEM,
gsp.USER_NAME,
goh.ORDER_NO,
goh.OMEGA_ORDER_NUMBER,
goh.ORDER_TYPE,
gc.CUSTOMER_ID,
gc.OMEGA_CUSTOMER_NUMBER,
CASE WHEN gc.PRIVATE = 'N' THEN gc.CUSTOMER_NAME ELSE '' END
AS COMPANY_NAME,
goh.ORDER_STATUS,
goh.TOTAL_SELLING_PRICE,
goh.TOTAL_MARGIN,
ga1.ADDRESS1
|| ','
|| ga1.ADDRESS2
|| ','
|| ga1.ADDRESS3
|| ','
|| ga1.POSTAL_CODE
|| ','
|| ga1.CITY
AS SHIPPING_ADDRESS,
ga2.ADDRESS1
|| ','
|| ga2.ADDRESS2
|| ','
|| ga2.ADDRESS3
|| ','
|| ga2.POSTAL_CODE
|| ','
|| ga2.CITY
AS BILLING_ADDRESS,
ga.ADDRESS_ID,
gol.DESCRIPTION,
APPS_JP.TZ.to_local_date (goh.OFFER_DATE, goh.OFFER_DATE_UTC)
AS OFFER_DATE,
gc.LEVEL_8,
goh.NO_OF_BUILDS,
gob.SFDC_ID,
goh.PURCHASE_ORDER_NO AS PO,
gc1.CUSTOMER_NAME AS END_USAGE,
gol.LOB,
goh.TOTAL_MARGIN_PCT,
goh.TOTAL_DISCOUNT,
goh.TOTAL_DISCOUNT_PCT
FROM APPS_JP.GEDIS_OFFER_HEADER goh,
APPS_JP.GEDIS_ORDER_BUILDS gob,
APPS_JP.GEDIS_ORDER_LINES gol,
APPS_JP.GEDIS_OFFER_RELATED_CUSTOMER gorc,
APPS_JP.GEDIS_OFFER_RELATED_CUSTOMER ship,
APPS_JP.GEDIS_OFFER_RELATED_CUSTOMER bill,
APPS_JP.GEDIS_CUSTOMER gc,
APPS_JP.GEDIS_CUSTOMER gc1,
APPS_JP.GEDIS_CONTACT gct,
APPS_JP.GEDIS_ADDRESS ga,
APPS_JP.GEDIS_ADDRESS_NORM ga1,
APPS_JP.GEDIS_ADDRESS_NORM ga2,
(SELECT DISTINCT SALESPERSON_ID, USER_NAME
FROM APPS_JP.GEDIS_SALESPERSON
WHERE SALESPERSON_ID IN
(SELECT TO_NUMBER (COLUMN_VALUE) AS SALESPERSON_ID
FROM TABLE (APPS_GLOBAL.SplitString ('337309'))))
gsp
WHERE goh.ORDER_NO <> 0
AND goh.OFFER_NO <> 0
AND goh.OFFER_NO=gol.OFFER_NO
AND gol.BUILD_NO = 1
AND gol.LINE_NO = 1
AND goh.OFFER_NO=gob.OFFER_NO
AND gob.BUILD_NO = 1
AND goh.OFFER_NO = gorc.OFFER_NO
AND gct.CONTACT_ID = gorc.CONTACT_ID
AND ga.CUSTOMER_ID = gc.CUSTOMER_ID
AND ga.PRIMARY = 'Y'
AND goh.LEAD_SALESPERSON=gsp.SALESPERSON_ID
AND goh.OFFER_NO = ship.OFFER_NO
AND ship.RELATION_TYPE = 'SHIP'
AND ga1.ADDRESS_ID = ship.ADDRESS_ID
AND ga1.CUSTOMER_ID = gc1.CUSTOMER_ID
AND goh.OFFER_NO = bill.OFFER_NO
AND bill.RELATION_TYPE = 'BILL'
AND ga2.ADDRESS_ID = bill.ADDRESS_ID
AND goh.OFFER_DATE BETWEEN APPS_JP.TZ.LOCAL_TO_DB_DATE (
SYSDATE - 30
AND APPS_JP.TZ.LOCAL_TO_DB_DATE (SYSDATE)
AND gorc.RELATION_TYPE = 'BASE'
AND gorc.CUSTOMER_ID = gc.CUSTOMER_ID
AND goh.SALES_CHANNEL = gc.SALES_CHANNEL
AND gc.SALES_CHANNEL = 'SMB'
AND goh.LEAD_SALESPERSON IN (goh.CREATED_BY, goh.LEAD_SALESPERSON)
ORDER BY goh.OFFER_NO;[/code]
Please help me how to use this outer join condition.
Thanks in advance.Hi,
If you want all the rows from goh, then you don't want any conditions like goh.OFFER_NO <> 0.
Make all the joins to goh outer joins, and make all conditions that apply to any tables joined to goh (or to tables joined to them) part of the join condition, like this:
FROM APPS_JP.GEDIS_OFFER_HEADER goh
LEFT OUTER JOIN APPS_JP.GEDIS_ORDER_BUILDS gob ON gob.OFFER_NO = goh.OFFER_NO
AND gob.BUILD_NO = 1
LEFT OUTER JOIN APPS_JP.GEDIS_ORDER_LINES gol ON gol.OFFER_NO = goh.OFFER_NO
AND gol.BUILD_NO = 1
AND gol.LINE_NO = 1
LEFT OUTER JOIN APPS_JP.GEDIS_OFFER_RELATED_CUSTOMER
gorc ...
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
Simplify the problem as much as possible. For example, do you really need all those tables to show what the problem is? Of course, you need them in tyour real query, but if you understand a solution that only involves 4 or 5 tables, you'll know how to apply it to any number of tables.
Explain, using specific examples, how you get those results from that data.Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
See the forum FAQ https://forums.oracle.com/message/9362002#9362002 -
How to use SQl server 2005's SQLXMLBulkLoad with JAVA
Hi All,
I am in a big problem identifying how to use xml bulk insert functionality of sql server 2005 with java.
I need to enter millions of data into the sql server 2005 database.
All the material i saw on net includes vb script or asp.net sripts to do so.
Somebody please tell how I can do this with JAVA.
Thanks.In this forum we commonly discuss connections from Oracle to foreign databases. When you want to connect with your SQL Server to Oracle it would be better to ask that in a Microsoft forum as they support their LINKED SERVER mechanism.
The linked server set up is for example described in the Microsoft knowledge base as:
280106 - HOW TO: Set Up and Troubleshoot a Linked Server to Oracle in SQL Server
In newer SQl Server releases the name changed see for example:
How to run a SQL Server 2005 Integration Services package as a SQL Server Agent job step
View products that this article applies to.
Article ID : 912911
As you can see they are commonly using OLEDB driver. So you might have to install Oracle's OLEDB driver as well. Else you might think about using OLEDB to ODBC bridge -
Using of bulk insert create problem
How to use the bulk insert statement in my jsp and which should be updated into the database.
I've tried this one:
bulk insert test from test1.txt with (fieldterminator=':')but it gives an error as:
u don't have permission to use bulk statement.
Could any1 get me rid off from this problem.
in advance thanks.....Most likely the person responsible for permissions in your database could help you out there. If you're here looking for a way to execute commands that you aren't authorized to execute, you are wasting your time.
-
How to use direct select and insert or load to speedup the process instead of cursur
Hi friends,
I have stored procedure .In SP i am using cursur to load data from Parent to several child table.
I have attached the script with this message.
And my problem is how to use direct select and insert or load to speedup the process instead of cursur.
Can any one please suggest me how to change this scripts pls.
USE [IconicMarketing]
GO
/****** Object: StoredProcedure [dbo].[SP_DMS_INVENTORY] Script Date: 3/6/2015 3:34:03 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <ARUN,NAGARAJ>
-- Create date: <11/21/2014>
-- Description: <STORED PROCEDURE FOR DMS_INVENTORY>
-- =============================================
ALTER PROCEDURE [dbo].[SP_DMS_INVENTORY]
@Specific_Date varchar(20) ,
@DealerNum Varchar(6),
@Date_Daily varchar(50)
AS
BEGIN
SET NOCOUNT ON;
--==========================================================================
-- INVENTORY_CURSUR
--==========================================================================
DECLARE
@FileType varchar(50),
@ACDealerID varchar(50),
@ClientDealerID varchar(50),
@DMSType varchar(50),
@StockNumber varchar(50),
@InventoryDate datetime ,
@StockType varchar(100),
@DMSStatus varchar(50),
@InvoicePrice numeric(18, 2),
@CostPack varchar(50),
@SalesCost numeric(18, 2),
@HoldbackAmount numeric(18, 2),
@ListPrice numeric(18, 2),
@MSRP varchar(max),
@LotLocation varchar(50),
@TagLine varchar(max),
@Certification varchar(max),
@CertificationNumber varchar(max),
@VehicleVIN varchar(50),
@VehicleYear bigint ,
@VehicleMake varchar(50),
@VehicleModel varchar(50),
@VehicleModelCode varchar(50),
@VehicleTrim varchar(50),
@VehicleSubTrimLevel varchar(max),
@Classification varchar(max),
@TypeCode varchar(100),
@VehicleMileage bigint ,
@EngineCylinderCount varchar(10) ,
@TransmissionType varchar(50),
@VehicleExteriorColor varchar(50),
@VehicleInteriorColor varchar(50),
@CreatedDate datetime ,
@LastModifiedDate datetime ,
@ModifiedFlag varchar(max),
@InteriorColorCode varchar(50),
@ExteriorColorCode varchar(50),
@PackageCode varchar(50),
@CodedCost varchar(50),
@Air varchar(100),
@OrderType varchar(max),
@AgeDays bigint ,
@OutstandingRO varchar(50),
@DlrAccessoryRetail varchar(50),
@DlrAccessoryCost varchar(max),
@DlrAccessoryDesc varchar(max),
@ModelDesc varchar(50),
@Memo1 varchar(1000),
@Memo2 varchar(max),
@Weight varchar(max),
@FloorPlan numeric(18, 2),
@Purchaser varchar(max),
@PurchasedFrom varchar(max),
@InternetPrice varchar(50),
@InventoryAcctDollar numeric(18, 2),
@VehicleType varchar(50),
@DealerAccessoryCode varchar(50),
@AllInventoryAcctDollar numeric(18, 2),
@BestPrice varchar(50),
@InStock bigint ,
@AccountingMake varchar(50),
@GasDiesel varchar(max),
@BookValue varchar(10),
@FactoryAccessoryDescription varchar(max),
@TotalReturn varchar(10),
@TotalCost varchar(10),
@SS varchar(max),
@VehicleBody varchar(max),
@StandardEquipment varchar(max),
@Account varchar(max),
@CalculatedPrice varchar(10),
@OriginalCost varchar(10),
@AccessoryCore varchar(10),
@OtherDollar varchar(10),
@PrimaryBookValue varchar(10),
@AmountDue varchar(10),
@LicenseFee varchar(10),
@ICompany varchar(max),
@InvenAcct varchar(max),
@Field23 varchar(max),
@Field24 varchar(max),
@SalesCode bigint,
@BaseRetail varchar(10),
@BaseInvAmt varchar(10),
@CommPrice varchar(10),
@Price1 varchar(10),
@Price2 varchar(10),
@StickerPrice varchar(10),
@TotInvAmt varchar(10),
@OptRetail varchar(max),
@OptInvAmt varchar(10),
@OptCost varchar(10),
@Options1 varchar(max),
@Category varchar(max),
@Description varchar(max),
@Engine varchar(max),
@ModelType varchar(max),
@FTCode varchar(max),
@Wholesale varchar(max),
@Retail varchar(max),
@Draft varchar(max),
@myerror varchar(500),
@Inventoryid int,
@errornumber int,
@errorseverity varchar(500),
@errortable varchar(50),
@errorstate int,
@errorprocedure varchar(500),
@errorline varchar(50),
@errormessage varchar(1000),
@Invt_Id int,
@flatfile_createddate datetime,
@FtpDate date,
@Inv_cur varchar(1000),
@S_Year varchar(4),
@S_Month varchar(2),
@S_Date varchar(2),
@Date_Specfic varchar(50),
@Param_list nvarchar(max),
@Daily_Date Varchar(50);
--====================================================================================
--DECLARE CURSUR FOR SPECIFIC DATE (OR) DEALER-ID WITH SPECIFIC DATE (OR) CURRENT DATE
--====================================================================================
set @Date_Specfic = Substring(@Specific_Date,1,4) +'-'+Substring(@Specific_Date,5,2)+'-'+Substring(@Specific_Date,7,2);
set @Daily_Date = SUBSTRING(@Date_Daily,14,4) + '-' + SUBSTRING(@Date_Daily,18,2)+ '-' + SUBSTRING(@date_Daily,20,2)
IF @Daily_Date IS NOT NULL
BEGIN
Delete From [dbo].[DMS_INVENTORY_DETAILS]
Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where CONVERT (date,FtpDate)=CONVERT (date,GETDATE()));
Delete From [dbo].[DMS_INVENTORY_AMOUNT]
Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where CONVERT (date,FtpDate)=CONVERT (date,GETDATE()));
Delete From [dbo].[ICONIC_INVENTORY_VEHICLE]
Where DMSInventoryVehicleID in(select ID from [dbo].[DMS_INVENTORY] where CONVERT (date,FtpDate)=CONVERT (date,GETDATE()));
Delete From [dbo].[DMS_INVENTORY_VEHICLE]
Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where CONVERT (date,FtpDate)=CONVERT (date,GETDATE()));
Delete From [dbo].[ICONIC_EQUITY_INVENTORY_COMPARE]
Where InventoryVehicleId in(select ID from [dbo].[DMS_INVENTORY] where CONVERT (date,FtpDate)=CONVERT (date,GETDATE()));
Delete From [dbo].[DMS_INVENTORY]
Where ID in(select ID from [dbo].[DMS_INVENTORY] where CONVERT (date,FtpDate)=CONVERT (date,GETDATE()));
DECLARE Inventory_Cursor CURSOR FOR
SELECT * from [dbo].[FLATFILE_INVENTORY] where
CONVERT (date,flatfile_createddate) = CONVERT (date,GETDATE()) order by flatfile_createddate;
END
Else
BEGIN
if (@Date_Specfic IS NOT NULL AND @DealerNum != '?????')
BEGIN
Delete From [dbo].[DMS_INVENTORY_DETAILS]
Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic AND DMSDealerID='ACTEST' + @DealerNum);
Delete From [dbo].[DMS_INVENTORY_AMOUNT]
Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic AND DMSDealerID='ACTEST' + @DealerNum);
Delete From [dbo].[ICONIC_INVENTORY_VEHICLE]
Where DMSInventoryVehicleID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic AND DMSDealerID='ACTEST' + @DealerNum);
Delete From [dbo].[DMS_INVENTORY_VEHICLE]
Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic AND DMSDealerID='ACTEST' + @DealerNum);
Delete From [dbo].[ICONIC_EQUITY_INVENTORY_COMPARE]
Where InventoryVehicleId in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic AND DMSDealerID='ACTEST' + @DealerNum);
Delete From [dbo].[DMS_INVENTORY]
Where ID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic AND DMSDealerID='ACTEST' + @DealerNum);
DECLARE Inventory_Cursor CURSOR FOR
SELECT * from [dbo].[FLATFILE_INVENTORY] where FtpDate=@Date_Specfic AND ACDealerID='ACTEST' + @DealerNum;
END
ELSE
BEGIN
Delete From [dbo].[DMS_INVENTORY_DETAILS]
Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic);
Delete From [dbo].[DMS_INVENTORY_AMOUNT]
Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic);
Delete From [dbo].[ICONIC_INVENTORY_VEHICLE]
Where DMSInventoryVehicleID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic);
Delete From [dbo].[DMS_INVENTORY_VEHICLE]
Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic);
Delete From [dbo].[ICONIC_EQUITY_INVENTORY_COMPARE]
Where InventoryVehicleId in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic);
Delete From [dbo].[DMS_INVENTORY]
Where ID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic);
DECLARE Inventory_Cursor CURSOR FOR
SELECT * from [dbo].[FLATFILE_INVENTORY] where FtpDate=@Date_Specfic;
END
END
OPEN Inventory_Cursor
FETCH NEXT FROM Inventory_Cursor
INTO
@FileType ,
@ACDealerID ,
@ClientDealerID ,
@DMSType ,
@StockNumber ,
@InventoryDate ,
@StockType ,
@DMSStatus ,
@InvoicePrice ,
@CostPack ,
@SalesCost ,
@HoldbackAmount ,
@ListPrice ,
@MSRP ,
@LotLocation ,
@TagLine ,
@Certification ,
@CertificationNumber ,
@VehicleVIN ,
@VehicleYear ,
@VehicleMake ,
@VehicleModel ,
@VehicleModelCode ,
@VehicleTrim ,
@VehicleSubTrimLevel ,
@Classification ,
@TypeCode ,
@VehicleMileage ,
@EngineCylinderCount ,
@TransmissionType ,
@VehicleExteriorColor ,
@VehicleInteriorColor ,
@CreatedDate ,
@LastModifiedDate ,
@ModifiedFlag ,
@InteriorColorCode ,
@ExteriorColorCode ,
@PackageCode ,
@CodedCost ,
@Air ,
@OrderType ,
@AgeDays ,
@OutstandingRO ,
@DlrAccessoryRetail ,
@DlrAccessoryCost ,
@DlrAccessoryDesc ,
@ModelDesc ,
@Memo1 ,
@Memo2 ,
@Weight ,
@FloorPlan ,
@Purchaser ,
@PurchasedFrom ,
@InternetPrice ,
@InventoryAcctDollar ,
@VehicleType ,
@DealerAccessoryCode ,
@AllInventoryAcctDollar ,
@BestPrice ,
@InStock ,
@AccountingMake ,
@GasDiesel ,
@BookValue ,
@FactoryAccessoryDescription ,
@TotalReturn ,
@TotalCost ,
@SS ,
@VehicleBody ,
@StandardEquipment ,
@Account ,
@CalculatedPrice ,
@OriginalCost ,
@AccessoryCore ,
@OtherDollar ,
@PrimaryBookValue ,
@AmountDue ,
@LicenseFee ,
@ICompany ,
@InvenAcct ,
@Field23 ,
@Field24 ,
@SalesCode ,
@BaseRetail ,
@BaseInvAmt ,
@CommPrice ,
@Price1 ,
@Price2 ,
@StickerPrice ,
@TotInvAmt ,
@OptRetail ,
@OptInvAmt ,
@OptCost ,
@Options1 ,
@Category ,
@Description ,
@Engine ,
@ModelType ,
@FTCode ,
@Wholesale ,
@Retail ,
@Draft ,
@flatfile_createddate,
@FtpDate;
WHILE @@FETCH_STATUS = 0
BEGIN
--==========================================================================
-- INSERT INTO INVENTORY (PARENT TABLE)
--==========================================================================
BEGIN TRY
INSERT INTO [dbo].[DMS_INVENTORY]
DMSDealerID,
StockNumber,
DMSType,
InventoryDate,
FtpDate
VALUES (@ClientDealerID,@StockNumber,@DMSType,@InventoryDate,@FtpDate);
END TRY
BEGIN CATCH
SELECT
@errornumber = ERROR_NUMBER(),
@errorseverity = ERROR_SEVERITY(),
@errortable = 'DMS_INVENTORY',
@errorstate = ERROR_STATE(),
@errorprocedure = ERROR_PROCEDURE(),
@errorline = ERROR_LINE(),
@errormessage = ERROR_MESSAGE();
--==========================================================================
-- INSERT ERRORS INTO DMSLOG_INVENTORY_ERROR
--==========================================================================
EXEC [SP_DMS_INVENTORY_ERROR] @FileType,@ACDealerID,@ClientDealerID,@DMSType,@StockNumber,@InventoryDate,@StockType,@DMSStatus,@InvoicePrice,@CostPack,
@SalesCost,@HoldbackAmount,@ListPrice,@MSRP,@LotLocation,@TagLine,@Certification,@CertificationNumber,@VehicleVIN,@VehicleYear,@VehicleMake,@VehicleModel,@VehicleModelCode,
@VehicleTrim,@VehicleSubTrimLevel,@Classification,@TypeCode,@VehicleMileage,@EngineCylinderCount,@TransmissionType,@VehicleExteriorColor,@VehicleInteriorColor,
@CreatedDate,@LastModifiedDate,@ModifiedFlag,@InteriorColorCode,@ExteriorColorCode,@PackageCode,@CodedCost,@Air,@OrderType,@AgeDays,@OutstandingRO,
@DlrAccessoryRetail,@DlrAccessoryCost,@DlrAccessoryDesc,@ModelDesc,@Memo1,@Memo2,@Weight,@FloorPlan,@Purchaser,@PurchasedFrom,@InternetPrice,
@InventoryAcctDollar,@VehicleType,@DealerAccessoryCode,@AllInventoryAcctDollar,@BestPrice,@InStock,@AccountingMake,@GasDiesel,@BookValue,
@FactoryAccessoryDescription,@TotalReturn,@TotalCost,@SS,@VehicleBody,@StandardEquipment,@Account,@CalculatedPrice,@OriginalCost,@AccessoryCore,
@OtherDollar,@PrimaryBookValue,@AmountDue,@LicenseFee,@ICompany,@InvenAcct,@Field23,@Field24,@SalesCode,@BaseRetail,@BaseInvAmt,@CommPrice,@Price1,
@Price2,@StickerPrice,@TotInvAmt,@OptRetail,@OptInvAmt,@OptCost,@Options1,@Category,@Description,@Engine,@ModelType,@FTCode,@Wholesale,@Retail,@Draft,
@ERRORNUMBER,@ERRORSEVERITY,@ERRORTABLE,@ERRORSTATE,@ERRORPROCEDURE,@ERRORLINE,@errormessage,@FtpDate
END CATCH
-- PRINT @errornumber;
-- PRINT @errorseverity;
-- PRINT @errortable;
-- PRINT @errorprocedure;
-- PRINT @errorline;
-- PRINT @errormessage;
-- PRINT @errorstate;
set @myerror = @@ERROR;
-- This -- PRINT statement -- PRINTs 'Error = 0' because
-- @@ERROR is reset in the IF statement above.
-- PRINT N'Error = ' + @myerror;
set @Inventoryid = scope_identity();
-- PRINT @Inventoryid;
--==========================================================================
-- INSERT INTO DMS_INVENTORY_DETAILS (CHILD TABLE)
--==========================================================================
BEGIN TRY
INSERT INTO [dbo].[DMS_INVENTORY_DETAILS]
DMSInventoryID,
StockType,
DMSStatus,
LotLocation,
TagLine,
Certification,
CertificationNumber,
CreatedDate,
LastModifiedDate,
ModifiedFlag,
PackageCode,
OrderType,
AgeDays,
OutstandingRO,
Memo1,
Memo2,
Purchaser,
PurchasedFrom,
DealerAccessoryCode,
InStock,
AccountingMake,
SS,
Account,
AccessoryCore,
ICompany,
InvenAcct,
Field23,
Field24,
SalesCode,
Draft,
FTCode,
FtpDate
VALUES (
@InventoryID,
@StockType,
@DMSStatus,
@LotLocation,
@TagLine,
@Certification,
@CertificationNumber,
@CreatedDate,
@LastModifiedDate,
@ModifiedFlag,
@PackageCode,
@OrderType,
@AgeDays,
@OutstandingRO,
@Memo1,
@Memo2,
@Purchaser,
@PurchasedFrom,
@DealerAccessoryCode,
@InStock,
@AccountingMake,
@SS,
@Account,
@AccessoryCore,
@ICompany,
@InvenAcct,
@Field23,
@Field24,
@SalesCode,
@Draft,
@FTCode,
@FtpDate
END TRY
BEGIN CATCH
SELECT
@errornumber = ERROR_NUMBER(),
@errorseverity = ERROR_SEVERITY(),
@errorstate = ERROR_STATE(),
@errortable = 'DMS_INVENTORY_DETAILS',
@errorprocedure = ERROR_PROCEDURE(),
@errorline = ERROR_LINE(),
@errormessage = ERROR_MESSAGE();
--==========================================================================
-- INSERT ERRORS INTO DMSLOG_INVENTORY_ERROR
--==========================================================================
EXECUTE [SP_DMS_INVENTORY_ERROR] @FileType,@ACDealerID,@ClientDealerID,@DMSType,@StockNumber,@InventoryDate,@StockType,@DMSStatus,@InvoicePrice,@CostPack,
@SalesCost,@HoldbackAmount,@ListPrice,@MSRP,@LotLocation,@TagLine,@Certification,@CertificationNumber,@VehicleVIN,@VehicleYear,@VehicleMake,@VehicleModel,@VehicleModelCode,
@VehicleTrim,@VehicleSubTrimLevel,@Classification,@TypeCode,@VehicleMileage,@EngineCylinderCount,@TransmissionType,@VehicleExteriorColor,@VehicleInteriorColor,
@CreatedDate,@LastModifiedDate,@ModifiedFlag,@InteriorColorCode,@ExteriorColorCode,@PackageCode,@CodedCost,@Air,@OrderType,@AgeDays,@OutstandingRO,
@DlrAccessoryRetail,@DlrAccessoryCost,@DlrAccessoryDesc,@ModelDesc,@Memo1,@Memo2,@Weight,@FloorPlan,@Purchaser,@PurchasedFrom,@InternetPrice,
@InventoryAcctDollar,@VehicleType,@DealerAccessoryCode,@AllInventoryAcctDollar,@BestPrice,@InStock,@AccountingMake,@GasDiesel,@BookValue,
@FactoryAccessoryDescription,@TotalReturn,@TotalCost,@SS,@VehicleBody,@StandardEquipment,@Account,@CalculatedPrice,@OriginalCost,@AccessoryCore,
@OtherDollar,@PrimaryBookValue,@AmountDue,@LicenseFee,@ICompany,@InvenAcct,@Field23,@Field24,@SalesCode,@BaseRetail,@BaseInvAmt,@CommPrice,@Price1,
@Price2,@StickerPrice,@TotInvAmt,@OptRetail,@OptInvAmt,@OptCost,@Options1,@Category,@Description,@Engine,@ModelType,@FTCode,@Wholesale,@Retail,@Draft,
@ERRORNUMBER,@ERRORSEVERITY,@ERRORTABLE,@ERRORSTATE,@ERRORPROCEDURE,@ERRORLINE,@errormessage,@FtpDate
END CATCH
--==========================================================================
-- INSERT INTO DMS_INVENTORY_AMOUNT (CHILD TABLE)
--==========================================================================
BEGIN TRY
INSERT INTO [dbo].[DMS_INVENTORY_AMOUNT]
DMSInventoryID,
AllInventoryAcctDollar,
OtherDollar,
PrimaryBookValue,
AmountDue,
LicenseFee,
CalculatedPrice,
OriginalCost,
BookValue,
TotalReturn,
TotalCost,
DlrAccessoryRetail,
DlrAccessoryCost,
DlrAccessoryDesc,
InternetPrice,
InventoryAcctDollar,
BestPrice,
Weight,
FloorPlan,
CodedCost,
InvoicePrice,
CostPack,
SalesCost,
HoldbackAmount,
ListPrice,
MSRP,
BaseRetail,
BaseInvAmt,
CommPrice,
Price1,
Price2,
StickerPrice,
TotInvAmt,
OptRetail,
OptInvAmt,
OptCost,
Wholesale,
Retail,
FtpDate
VALUES (
@InventoryID,
@AllInventoryAcctDollar,
@OtherDollar,
@PrimaryBookValue,
@AmountDue,
@LicenseFee,
@CalculatedPrice,
@OriginalCost,
@BookValue,
@TotalReturn,
@TotalCost,
@DlrAccessoryRetail,
@DlrAccessoryCost,
@DlrAccessoryDesc,
@InternetPrice,
@InventoryAcctDollar,
@BestPrice,
@Weight,
@FloorPlan,
@CodedCost,
@InvoicePrice,
@CostPack,
@SalesCost,
@HoldbackAmount,
@ListPrice,
@MSRP,
@BaseRetail,
@BaseInvAmt,
@CommPrice,
@Price1,
@Price2,
@StickerPrice,
@TotInvAmt,
@OptRetail,
@OptInvAmt,
@OptCost,
@Wholesale,
@Retail,
@FtpDate
END TRY
BEGIN CATCH
SELECT
@errornumber = ERROR_NUMBER(),
@errorseverity = ERROR_SEVERITY(),
@errortable = 'DMS_INVENTORY_AMOUNT',
@errorstate = ERROR_STATE(),
@errorprocedure = ERROR_PROCEDURE(),
@errorline = ERROR_LINE(),
@errormessage = ERROR_MESSAGE();
--==========================================================================
-- INSERT ERRORS INTO DMSLOG_INVENTORY_ERROR
--==========================================================================
EXEC [SP_DMS_INVENTORY_ERROR] @FileType,@ACDealerID,@ClientDealerID,@DMSType,@StockNumber,@InventoryDate,@StockType,@DMSStatus,@InvoicePrice,@CostPack,
@SalesCost,@HoldbackAmount,@ListPrice,@MSRP,@LotLocation,@TagLine,@Certification,@CertificationNumber,@VehicleVIN,@VehicleYear,@VehicleMake,@VehicleModel,@VehicleModelCode,
@VehicleTrim,@VehicleSubTrimLevel,@Classification,@TypeCode,@VehicleMileage,@EngineCylinderCount,@TransmissionType,@VehicleExteriorColor,@VehicleInteriorColor,
@CreatedDate,@LastModifiedDate,@ModifiedFlag,@InteriorColorCode,@ExteriorColorCode,@PackageCode,@CodedCost,@Air,@OrderType,@AgeDays,@OutstandingRO,
@DlrAccessoryRetail,@DlrAccessoryCost,@DlrAccessoryDesc,@ModelDesc,@Memo1,@Memo2,@Weight,@FloorPlan,@Purchaser,@PurchasedFrom,@InternetPrice,
@InventoryAcctDollar,@VehicleType,@DealerAccessoryCode,@AllInventoryAcctDollar,@BestPrice,@InStock,@AccountingMake,@GasDiesel,@BookValue,
@FactoryAccessoryDescription,@TotalReturn,@TotalCost,@SS,@VehicleBody,@StandardEquipment,@Account,@CalculatedPrice,@OriginalCost,@AccessoryCore,
@OtherDollar,@PrimaryBookValue,@AmountDue,@LicenseFee,@ICompany,@InvenAcct,@Field23,@Field24,@SalesCode,@BaseRetail,@BaseInvAmt,@CommPrice,@Price1,
@Price2,@StickerPrice,@TotInvAmt,@OptRetail,@OptInvAmt,@OptCost,@Options1,@Category,@Description,@Engine,@ModelType,@FTCode,@Wholesale,@Retail,@Draft,
@ERRORNUMBER,@ERRORSEVERITY,@ERRORTABLE,@ERRORSTATE,@ERRORPROCEDURE,@ERRORLINE,@errormessage,@FtpDate
END CATCH
--==========================================================================
-- INSERT INTO DMS_INVENTORY_VEHICLE (CHILD TABLE)
--==========================================================================
BEGIN TRY
INSERT INTO [dbo].[DMS_INVENTORY_VEHICLE]
DMSInventoryID,
InteriorColorCode,
ExteriorColorCode,
Air,
ModelDesc,
VehicleType,
VehicleVIN,
VehicleYear,
VehicleMake,
VehicleModel,
VehicleModelCode,
VehicleTrim,
VehicleSubTrimLevel,
Classification,
TypeCode,
VehicleMileage,
FtpDate,
EngineCylinderCount
VALUES (
@InventoryID,
@InteriorColorCode,
@ExteriorColorCode,
@Air,
@ModelDesc,
@VehicleType,
@VehicleVIN,
@VehicleYear,
@VehicleMake,
@VehicleModel,
@VehicleModelCode,
@VehicleTrim,
@VehicleSubTrimLevel,
@Classification,
@TypeCode,
@VehicleMileage,
@FtpDate,
@EngineCylinderCount
END TRY
BEGIN CATCH
SELECT
@errornumber = ERROR_NUMBER(),
@errorseverity = ERROR_SEVERITY(),
@errortable = 'DMS_INVENTORY_VEHICLE',
@errorstate = ERROR_STATE(),
@errorprocedure = ERROR_PROCEDURE(),
@errorline = ERROR_LINE(),
@errormessage = ERROR_MESSAGE();
--==========================================================================
-- INSERT ERRORS INTO DMSLOG_INVENTORY_ERROR
--==========================================================================
EXEC [SP_DMS_INVENTORY_ERROR] @FileType,@ACDealerID,@ClientDealerID,@DMSType,@StockNumber,@InventoryDate,@StockType,@DMSStatus,@InvoicePrice,@CostPack,
@SalesCost,@HoldbackAmount,@ListPrice,@MSRP,@LotLocation,@TagLine,@Certification,@CertificationNumber,@VehicleVIN,@VehicleYear,@VehicleMake,@VehicleModel,@VehicleModelCode,
@VehicleTrim,@VehicleSubTrimLevel,@Classification,@TypeCode,@VehicleMileage,@EngineCylinderCount,@TransmissionType,@VehicleExteriorColor,@VehicleInteriorColor,
@CreatedDate,@LastModifiedDate,@ModifiedFlag,@InteriorColorCode,@ExteriorColorCode,@PackageCode,@CodedCost,@Air,@OrderType,@AgeDays,@OutstandingRO,
@DlrAccessoryRetail,@DlrAccessoryCost,@DlrAccessoryDesc,@ModelDesc,@Memo1,@Memo2,@Weight,@FloorPlan,@Purchaser,@PurchasedFrom,@InternetPrice,
@InventoryAcctDollar,@VehicleType,@DealerAccessoryCode,@AllInventoryAcctDollar,@BestPrice,@InStock,@AccountingMake,@GasDiesel,@BookValue,
@FactoryAccessoryDescription,@TotalReturn,@TotalCost,@SS,@VehicleBody,@StandardEquipment,@Account,@CalculatedPrice,@OriginalCost,@AccessoryCore,
@OtherDollar,@PrimaryBookValue,@AmountDue,@LicenseFee,@ICompany,@InvenAcct,@Field23,@Field24,@SalesCode,@BaseRetail,@BaseInvAmt,@CommPrice,@Price1,
@Price2,@StickerPrice,@TotInvAmt,@OptRetail,@OptInvAmt,@OptCost,@Options1,@Category,@Description,@Engine,@ModelType,@FTCode,@Wholesale,@Retail,@Draft,
@ERRORNUMBER,@ERRORSEVERITY,@ERRORTABLE,@ERRORSTATE,@ERRORPROCEDURE,@ERRORLINE,@errormessage,@FtpDate
END CATCH
--==========================================================================
-- MOVE CURSUR TO NEXT RECORD
--==========================================================================
FETCH NEXT FROM Inventory_Cursor
INTO @FileType ,
@ACDealerID ,
@ClientDealerID ,
@DMSType ,
@StockNumber ,
@InventoryDate ,
@StockType ,
@DMSStatus ,
@InvoicePrice ,
@CostPack ,
@SalesCost ,
@HoldbackAmount ,
@ListPrice ,
@MSRP ,
@LotLocation ,
@TagLine ,
@Certification ,
@CertificationNumber ,
@VehicleVIN ,
@VehicleYear ,
@VehicleMake ,
@VehicleModel ,
@VehicleModelCode ,
@VehicleTrim ,
@VehicleSubTrimLevel ,
@Classification ,
@TypeCode ,
@VehicleMileage ,
@EngineCylinderCount ,
@TransmissionType ,
@VehicleExteriorColor ,
@VehicleInteriorColor ,
@CreatedDate ,
@LastModifiedDate ,
@ModifiedFlag ,
@InteriorColorCode ,
@ExteriorColorCode ,
@PackageCode ,
@CodedCost ,
@Air ,
@OrderType ,
@AgeDays ,
@OutstandingRO ,
@DlrAccessoryRetail ,
@DlrAccessoryCost ,
@DlrAccessoryDesc ,
@ModelDesc ,
@Memo1 ,
@Memo2 ,
@Weight ,
@FloorPlan ,
@Purchaser ,
@PurchasedFrom ,
@InternetPrice ,
@InventoryAcctDollar ,
@VehicleType ,
@DealerAccessoryCode ,
@AllInventoryAcctDollar ,
@BestPrice ,
@InStock ,
@AccountingMake ,
@GasDiesel ,
@BookValue ,
@FactoryAccessoryDescription ,
@TotalReturn ,
@TotalCost ,
@SS ,
@VehicleBody ,
@StandardEquipment ,
@Account ,
@CalculatedPrice ,
@OriginalCost ,
@AccessoryCore ,
@OtherDollar ,
@PrimaryBookValue ,
@AmountDue ,
@LicenseFee ,
@ICompany ,
@InvenAcct ,
@Field23 ,
@Field24 ,
@SalesCode ,
@BaseRetail ,
@BaseInvAmt ,
@CommPrice ,
@Price1 ,
@Price2 ,
@StickerPrice ,
@TotInvAmt ,
@OptRetail ,
@OptInvAmt ,
@OptCost ,
@Options1 ,
@Category ,
@Description ,
@Engine ,
@ModelType ,
@FTCode ,
@Wholesale ,
@Retail ,
@Draft ,
@flatfile_createddate,
@FtpDate;
END
CLOSE Inventory_Cursor;
DEALLOCATE Inventory_Cursor;
SET ANSI_PADDING OFF
END
Arunraj KumarThank you.
And another question if the data is already there in the child table if i try to load alone it must delete the old data in the child tablee and need to get load the new data and
How to do this ?
Arunraj Kumar
You can do that with an IF EXISTS condition
IF EXISTS (SELECT 1
FROM YourChildTable c
INNER JOIn @temptable t
ON c.Bkey1 = t.Bkey1
AND c.Bkey2 = t.Bkey2
DELETE t
FROM YourChildTable c
INNER JOIn @temptable t
ON c.Bkey1 = t.Bkey1
AND c.Bkey2 = t.Bkey2
INSERT INTO YourChildTable
where Bkey1,Bkey2 etc forms the business key of the table
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
How to use if condition in XML Publisher Desk Top
Hi..,
How to use if condition in XML Publisher desk Top.
Please guide me.
Thanks,
Suresh.What kind of condition you want to use?
You can use Condition like this:
<?xdofx:if condition then value1
else if condition then Value2
else Value3
end if?>
Please go thru XML Publisher User Guide.
Thanks
Ravi
[email protected]
Maybe you are looking for
-
Itunes unresponsive when switching between two devices
For God Sake help me with this, i have so many apps on my iTunes(mac) ,since i updated my itunes from 11 to 12 it has been my worst nightmare ever.. whenever i attach two or more devices ,switching between devices it becomes unresponsive so that i ha
-
Hi, I want to develop a swf application like yahoo interactive stock chart as below http://finance.yahoo.com/echarts?s=ADBE+Interactive#chart1:symbol=adbe;range=1y;indicator= dividend+volume;charttype=line;crosshair=on;ohlcvalues=0;logscale=on;source
-
Hello, I've got some problems with refreshing data, displayed via chain of view accessors. OutputTexts have values like <af:iterator var="round" value="..."> #{round.OlympiadRoundView.OlympiadPlaceLOV.Town} So it is iterator var . accessor1 . accesso
-
Help with Terms Discounts when Freight included in Line Items
I have a unusual situation and I wondered if anyone has any ideas of how to perhaps help with it. This is client who is getting his system step intially and we are trying to figure out how to best deal with this issue. There is a vendor that has term
-
How Do I convert image in xml data file back into a JPG?
I have a user submitted for with an image field and some text fields on it. User uploads an image, enters text, clicks submit by email. I get the xml data file by email. I create a spreadsheet from it. text field data is there, in the image field col