Problem In Inserting Multiple Values In Ztable

Hi,
I had developed a table in which i am inserting the data from the BSEG table and the problem is if there are multiple values wr.t. GL AAccount ID(HKONT) it is picking up only the last value of it as i want to store all of them.
I had searched in SDN first but not able to get the desierd help.
Here is the code which i had developed for it..
Report ztest.
TABLES : BSEG.
TYPES : BEGIN OF ITAB,
        MANDT TYPE BSEG-MANDT ,  "client"
        BUKRS TYPE BSEG-BUKRS,   "company code"
        GJAHR TYPE BSEG-GJAHR,   "fiscal Year"
        HKONT TYPE BSEG-HKONT,   "G/L account No"
        SHKZG TYPE BSEG-SHKZG,   "Debit/ Credit Indicator"
        TAMT   TYPE I,
        END OF ITAB.
DATA : W_ITAB TYPE ITAB ,
       T_ITAB TYPE ITAB OCCURS 0.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE T1.
SELECT-OPTIONS : PBUKRS FOR BSEG-BUKRS, PGJAHR FOR BSEG-GJAHR,PVALUT FOR BSEG-VALUT.
SELECTION-SCREEN END OF BLOCK B1.
DATA  :  BEGIN OF itab1 OCCURS 0.
          INCLUDE STRUCTURE Ztab21.
DATA  :   END OF itab1.
SELECT MANDT BUKRS GJAHR HKONT SHKZG PSWBT
       FROM BSEG
       INTO TABLE itab1
  WHERE BUKRS IN PBUKRS AND GJAHR IN PGJAHR AND VALUT IN PVALUT.
SORT ITAB1 BY HKONT.
LOOP AT ITAB1.
INSERT INTO ZTAB21 VALUES itab1.
WRITE:/ ITAB1-HKONT,ITAB1-SHKZG,ITAB1-TAMT.
ENDLOOP.

Hi,
First of all , dont write database update statements inside LOOP
SELECT MANDT BUKRS GJAHR HKONT SHKZG PSWBT
       FROM BSEG
       INTO TABLE itab1
  WHERE BUKRS IN PBUKRS AND GJAHR IN PGJAHR AND VALUT IN PVALUT.
SORT ITAB1 BY HKONT.
LOOP AT ITAB1.
INSERT INTO ZTAB21 VALUES itab1.   " should be before loop
WRITE:/ ITAB1-HKONT,ITAB1-SHKZG,ITAB1-TAMT.
ENDLOOP.
For using same itab for direct insert, Custom table ZTAB21 should have field names same as BSEG.
Else, you have to write as below:
LOOP AT ITAB1.
wa_ztab21-tfield1 = itab1-bukrs.
append wa_ztab21 to i_ztab21.
WRITE:/ ITAB1-HKONT,ITAB1-SHKZG,ITAB1-TAMT.
ENDLOOP.
MODIFY ZTAB21 FROM TABLE i_ztab21.
Regards,
Nisha Vengal.

Similar Messages

  • I am facing a problem in passing multiple values as out parameters from fo

    Hi All,
    i am facing a problem in passing multiple values as out parameters from for loop.
    EX:
    i have a select statment inside a loop like.....
    PACKAGE SPEC:
    create or replace PACKAGE EMP_PKG AS
    TYPE TAB_NUM IS TABLE OF SCOTT.EMP.EMPNO%TYPE;
    TYPE TAB_NAME IS TABLE OF SCOTT.EMP.ENAME%TYPE;
    TYPE TAB_JOB IS TABLE OF SCOTT.EMP.JOB%TYPE;
    temp_table TAB_NUM;
    procedure test(temp_TAB_e_no OUT TAB_NUM,
    temp_TAB_e_name OUT TAB_NAME,
    temp_TAB_e_job OUT TAB_JOB);
    END EMP_PKG;
    PACKAGE BODY:
    create or replace PACKAGE BODY EMP_PKG AS
    v_e_no NUMBER;
    procedure test(temp_TAB_e_no OUT TAB_NUM,
    temp_TAB_e_name OUT TAB_NAME,
    temp_TAB_e_job OUT TAB_JOB) IS
    BEGIN
    select EMPNO bulk collect into temp_table from emp;
    for i in 1..temp_table.count loop
    v_e_no := temp_table(i);
    select empno,
    ename,
    job
    into temp_TAB_e_no(i),
    temp_TAB_e_name(i),
    temp_TAB_e_job(i)
    from emp
    where empno = v_e_no;
    end loop;
    end test;
    END EMP_PKG;
    PROBLEM FACING IS:
    I am expecting all rows returning from bellow select statment ...
    select empno,
    ename,
    job
    into temp_TAB_e_no(i),
    temp_TAB_e_name(i),
    temp_TAB_e_job(i)
    from emp
    where empno = v_e_no;
    But,while running the SP , i am getting error like
    ORA-06531: Reference to uninitialized collection
    ORA-06512: at "SCOTT.EMP_PKG", line 16
    why i am not getting all values as out parameters.please provide a solution for me.
    Thanks in advance my friend.

    user9041629 wrote:
    Hi All,
    i am facing a problem in passing multiple values as out parameters from for loop.
    EX:
    i have a select statment inside a loop like.....
    PACKAGE SPEC:
    create or replace PACKAGE EMP_PKG AS
    TYPE TAB_NUM IS TABLE OF SCOTT.EMP.EMPNO%TYPE;
    TYPE TAB_NAME IS TABLE OF SCOTT.EMP.ENAME%TYPE;
    TYPE TAB_JOB IS TABLE OF SCOTT.EMP.JOB%TYPE;
    temp_table TAB_NUM;
    procedure test(temp_TAB_e_no OUT TAB_NUM,
    temp_TAB_e_name OUT TAB_NAME,
    temp_TAB_e_job OUT TAB_JOB);
    END EMP_PKG;
    PACKAGE BODY:
    create or replace PACKAGE BODY EMP_PKG AS
    v_e_no NUMBER;
    procedure test(temp_TAB_e_no OUT TAB_NUM,
    temp_TAB_e_name OUT TAB_NAME,
    temp_TAB_e_job OUT TAB_JOB) IS
    BEGIN
    select EMPNO bulk collect into temp_table from emp;
    for i in 1..temp_table.count loop
    v_e_no := temp_table(i);
    select empno,
    ename,
    job
    into temp_TAB_e_no(i),
    temp_TAB_e_name(i),
    temp_TAB_e_job(i)
    from emp
    where empno = v_e_no;
    end loop;
    end test;
    END EMP_PKG;
    PROBLEM FACING IS:
    I am expecting all rows returning from bellow select statment ...
    select empno,
    ename,
    job
    into temp_TAB_e_no(i),
    temp_TAB_e_name(i),
    temp_TAB_e_job(i)
    from emp
    where empno = v_e_no;
    But,while running the SP , i am getting error like
    ORA-06531: Reference to uninitialized collection
    ORA-06512: at "SCOTT.EMP_PKG", line 16
    why i am not getting all values as out parameters.please provide a solution for me.
    Thanks in advance my friend.Probably not a bad thing that this isn't working for you.
    This is a horrible way to return the contents of a table.
    Are you doing this for educational purpose, or ... what is your goal here? If you just want to return a result set to a client you'd want to look in to using a REF CURSOR and not a bunch of arrays combined with horribly procedural (slow) code.

  • Problem in passing multiple values between reports

    Can anyone help me in passing multiple values in prompts between reports in CRYSTAL REPORTS 2008  using opendoc or any method. I am able to pass single value from main report to second report. but not able to pass multiple values. Plz help me . Thanks in advance

    Hi Ramy,
    How you are passing your prompt values ? where you have created these prompts ? i.e. created these prompts in report level or stored procedure or Add command ?
    Thanks,
    Sastry

  • How do I insert multiple values into different fields in a stored procedure

    I am writing a Stored Procedure where I select data from various queries, insert the results into a variable and then I insert the variables into final target table. This works fine when the queries return only one row. However I have some queries that return multiple rows and I am trying to insert them into different fields in the target table. My query is like
    SELECT DESCRIPTION, SUM(AMOUNT)
    INTO v_description, v_amount
    FROM SOURCE_TABLE
    GROUP BY DESCRIPTION;
    This returns values like
    Value A , 100
    Value B, 200
    Value C, 300
    The Target Table has fields for each of the above types e.g.
    VALUE_A, VALUE_B, VALUE_C
    I am inserting the data from a query like
    INSERT INTO TARGET_TABLE (VALUE_A, VALUE_B, VALUE_C)
    VALUES (...)
    How do I split out the values returned by the first query to insert into the Insert Statement? Or do I need to split the data in the statement that inserts into the variables?
    Thanks
    GB

    "Some of the amounts returned are negative so the MAX in the select statement returns 0 instead of the negative value. If I use MIN instead of MAX it returns the correct negative value. However I might not know when the amount is going to be positive or negative. Do you have any suggestions on how I can resolve this?"
    Perhaps something like this could be done in combination with the pivot queries above, although it seems cumbersome.
    SQL> with data as (
      2        select  0 a, 0 b,  0 c from dual   -- So column a has values {0, 1, 4},
      3  union select  1 a, 2 b, -3 c from dual   --    column b has values {0, 2, 5},
      4  union select  4 a, 5 b, -6 c from dual ) --    column c has values {0, -3, -6}.
      5  --
      6  select  ( case when max.a > 0 then max.a else min.a end) abs_max_a
      7  ,       ( case when max.b > 0 then max.b else min.b end) abs_max_b
      8  ,       ( case when max.c > 0 then max.c else min.c end) abs_max_c
      9  from    ( select  ( select max(a) from data ) a
    10            ,       ( select max(b) from data ) b
    11            ,       ( select max(c) from data ) c
    12            from      dual ) max
    13  ,       ( select  ( select min(a) from data ) a
    14            ,       ( select min(b) from data ) b
    15            ,       ( select min(c) from data ) c
    16            from      dual ) min
    17  /
    ABS_MAX_A  ABS_MAX_B  ABS_MAX_C
             4          5         -6
    SQL>

  • Problem in Showing multiple values into one text box.

    Hi all,
    How can show i multiple row values into one text box. here text box is multi line type.
    i have one table it has content column, it has number of rows. i need to show those data into one text box in form. how can i solve it?
    my sample code here,
    egin
    --:block3.txt_to := :parameter.p_current_user||''||':'||:block3.txt_From;
    -- go_item('txt_from');
    insert into chat(fromid,toid,content)values(:block3.fromid,:block3.toid,:block3.txt_From);
    :block3.txt_From:= null;
    commit;
    :block3.txt_to := :parameter.p_current_user||''||':'||:block3.txt_From;
    go_item('txt_from');
    declare
    cursor c4 is select content from chat where toid = :block3.fromid;
    rec1 c4%rowtype;
    begin
    open c4;
    loop
    fetch c4 into rec1;
    exit when c4%notfound;
    null;
    end loop;
    end;
    --select content into :block3.txt_to from chat where toid= :block3.fromid;
    end;
    please give me some tips to solve it.
    thanks
    gurus

    Hi,
    Try giving CHR(10) for line feed.
    DECLARE
         CURSOR C4 IS SELECT CONTENT FROM CHAT WHERE TOID = :BLOCK3.FROMID;
         Str_Temp VARCHAR2(20);
    BEGIN
         :BLOCK3.TXT_TO := '';
         OPEN C4;
         LOOP
              FETCH C4 INTO Str_Temp;
              EXIT WHEN C4%NOTFOUND;
              :BLOCK3.TXT_TO := :BLOCK3.TXT_TO || CHR(10) || Str_Temp;
         END LOOP;
         CLOSE C4;
    END;Regards,
    Manu.
    If this answer is helpful or correct, please mark it. Thanks.

  • Problem in Inserting the Value in the column through Stored Procedure

    stored procedure is created and i need
    to insert data into the SALES_TRADEIN, from the parent table (Flatfile_sales),through COMMAND PROMPT.
    I have 2 details TradeIn_1 and TradeIn_2.
    I need to insert details of TradeIn_1 in SALES_TRADEIN
    TABLE if the column of TradeIn_1 is null then i need to insert TradeIn_2 details.
    If the TradeIn_1 is not null then i have insert
    TradeIn_1 details and go to next column.
    This is the Scenario but i wrote the Script
    so anyone please view it and give the solution how to change that insert statement.
    -- =============================================
    -- Stored Procedure for Flatfile_Sales
    -- =============================================
    ---==========Sales_Cursor
    --USE [IconicMarketing]
    --GO
    DECLARE
    @FileType varchar(50),
    @ACDealerID varchar(50),
    @ClientDealerID varchar(50),
    @DMSType varchar(50),
    @DealNumber varchar(50),
    @CustomerNumber varchar(50),
    @CustomerName varchar(50),
    @CustomerFirstName varchar(50),
    @CustomerLastName varchar(50),
    @CustomerAddress varchar(50),
    @CustomerCity varchar(50),
    @CustomerState varchar(50),
    @CustomerZip varchar(50),
    @CustomerCounty varchar(50),
    @CustomerHomePhone varchar(50),
    @CustomerWorkPhone varchar(50),
    @CustomerCellPhone varchar(50),
    @CustomerPagerPhone varchar(50),
    @CustomerEmail varchar(50),
    @CustomerBirthDate varchar(50),
    @MailBlock varchar(50),
    @CoBuyerName varchar(50),
    @CoBuyerFirstName varchar(50),
    @CoBuyerLastName varchar(50),
    @CoBuyerAddress varchar(50),
    @CoBuyerCity varchar(50),
    @CoBuyerState varchar(50),
    @CoBuyerZip varchar(50),
    @CoBuyerCounty varchar(50),
    @CoBuyerHomePhone varchar(50),
    @CoBuyerWorkPhone varchar(50),
    @CoBuyerBirthDate varchar(50),
    @Salesman_1_Number varchar(50),
    @Salesman_1_Name varchar(50),
    @Salesman_2_Number varchar(50),
    @Salesman_2_Name varchar(50),
    @ClosingManagerName varchar(50),
    @ClosingManagerNumber varchar(50),
    @F_AND_I_ManagerNumber varchar(50),
    @F_AND_I_ManagerName varchar(50),
    @SalesManagerNumber varchar(50),
    @SalesManagerName varchar(50),
    @EntryDate varchar(50),
    @DealBookDate varchar(50),
    @VehicleYear varchar(50),
    @VehicleMake varchar(50),
    @VehicleModel varchar(50),
    @VehicleStockNumber varchar(50),
    @VehicleVIN varchar(50),
    @VehicleExteriorColor varchar(50),
    @VehicleInteriorColor varchar(50),
    @VehicleMileage varchar(50),
    @VehicleType varchar(50),
    @InServiceDate varchar(50),
    @HoldBackAmount varchar(50),
    @DealType varchar(50),
    @SaleType varchar(50),
    @BankCode varchar(50),
    @BankName varchar(50),
    @SalesmanCommission varchar(50),
    @GrossProfitSale varchar(50),
    @FinanceReserve varchar(50),
    @CreditLifePremium varchar(50),
    @CreditLifeCommision varchar(50),
    @TotalInsuranceReserve varchar(50),
    @BalloonAmount varchar(50),
    @CashPrice varchar(50),
    @AmountFinanced varchar(50),
    @TotalOfPayments varchar(50),
    @MSRP varchar(50),
    @DownPayment varchar(50),
    @SecurityDesposit varchar(50),
    @Rebate varchar(50),
    @Term varchar(50),
    @RetailPayment varchar(50),
    @PaymentType varchar(50),
    @RetailFirstPayDate varchar(50),
    @LeaseFirstPayDate varchar(50),
    @DayToFirstPayment varchar(50),
    @LeaseAnnualMiles varchar(50),
    @MileageRate varchar(50),
    @APRRate varchar(50),
    @ResidualAmount varchar(50),
    @LicenseFee varchar(50),
    @RegistrationFee varchar(50),
    @TotalTax varchar(50),
    @ExtendedWarrantyName varchar(50),
    @ExtendedWarrantyTerm varchar(50),
    @ExtendedWarrantyLimitMiles varchar(50),
    @ExtendedWarrantyDollar varchar(50),
    @ExtendedWarrantyProfit varchar(50),
    @FrontGross varchar(50),
    @BackGross varchar(50),
    @TradeIn_1_VIN varchar(50),
    @TradeIn_2_VIN varchar(50),
    @TradeIn_1_Make varchar(50),
    @TradeIn_2_Make varchar(50),
    @TradeIn_1_Model varchar(50),
    @TradeIn_2_Model varchar(50),
    @TradeIn_1_ExteriorColor varchar(50),
    @TradeIn_2_ExteriorColor varchar(50),
    @TradeIn_1_Year varchar(50),
    @TradeIn_2_Year varchar(50),
    @TradeIn_1_Mileage varchar(50),
    @TradeIn_2_Mileage varchar(50),
    @TradeIn_1_Gross varchar(50),
    @TradeIn_2_Gross varchar(50),
    @TradeIn_1_Payoff varchar(50),
    @TradeIn_2_Payoff varchar(50),
    @TradeIn_1_ACV varchar(50),
    @TradeIn_2_ACV varchar(50),
    @Fee_1_Name varchar(50),
    @Fee_1_Fee varchar(50),
    @Fee_1_Commission varchar(50),
    @Fee_2_Name varchar(50),
    @Fee_2_Fee varchar(50),
    @Fee_2_Commission varchar(50),
    @Fee_3_Name varchar(50),
    @Fee_3_Fee varchar(50),
    @Fee_3_Commission varchar(50),
    @Fee_4_Name varchar(50),
    @Fee_4_Fee varchar(50),
    @Fee_4_Commission varchar(50),
    @Fee_5_Name varchar(50),
    @Fee_5_Fee varchar(50),
    @Fee_5_Commission varchar(50),
    @Fee_6_Name varchar(50),
    @Fee_6_Fee varchar(50),
    @Fee_6_Commission varchar(50),
    @Fee_7_Name varchar(50),
    @Fee_7_Fee varchar(50),
    @Fee_7_Commission varchar(50),
    @Fee_8_Name varchar(50),
    @Fee_8_Fee varchar(50),
    @Fee_8_Commission varchar(50),
    @Fee_9_Name varchar(50),
    @Fee_9_Fee varchar(50),
    @Fee_9_Commission varchar(50),
    @Fee_10_Name varchar(50),
    @Fee_10_Fee varchar(50),
    @Fee_10_Commission varchar(50),
    @ContractDate varchar(50),
    @InsuranceName varchar(50),
    @InsuranceAgentName varchar(50),
    @InsuranceAddress varchar(50),
    @InsuranceCity varchar(50),
    @InsuranceState varchar(50),
    @InsuranceZip varchar(50),
    @InsurancePhone varchar(50),
    @InsurancePolicyNumber varchar(50),
    @InsuranceEffectiveDate varchar(50),
    @InsuranceExpirationDate varchar(50),
    @InsuranceCompensationDeduction varchar(50),
    @TradeIn_1_InteriorColor varchar(50),
    @TradeIn_2_InteriorColor varchar(50),
    @PhoneBlock varchar(50),
    @LicensePlateNumber varchar(50),
    @Cost varchar(50),
    @InvoiceAmount varchar(50),
    @FinanceCharge varchar(50),
    @TotalPickupPayment varchar(50),
    @TotalAccessories varchar(50),
    @TotalDriveOffAmount varchar(50),
    @EmailBlock varchar(50),
    @ModelDescriptionOfCarSold varchar(50),
    @VehicleClassification varchar(50),
    @ModelNumberOfCarSold varchar(50),
    @GAPPremium varchar(50),
    @LastInstallmentDate varchar(50),
    @CashDeposit varchar(50),
    @AHPremium varchar(50),
    @LeaseRate varchar(50),
    @DealerSelect varchar(50),
    @LeasePayment varchar(50),
    @LeaseNetCapCost varchar(50),
    @LeaseTotalCapReduction varchar(50),
    @DealStatus varchar(50),
    @CustomerSuffix varchar(50),
    @CustomerSalutation varchar(50),
    @CustomerAddress2 varchar(50),
    @CustomerMiddleName varchar(50),
    @GlobalOptOut varchar(50),
    @LeaseTerm varchar(50),
    @ExtendedWarrantyFlag varchar(50),
    @Salesman_3_Number varchar(50),
    @Salesman_3_Name varchar(50),
    @Salesman_4_Number varchar(50),
    @Salesman_4_Name varchar(50),
    @Salesman_5_Number varchar(50),
    @Salesman_5_Name varchar(50),
    @Salesman_6_Number varchar(50),
    @Salesman_6_Name varchar(50),
    @APRRate2 varchar(50),
    @APRRate3 varchar(50),
    @APRRate4 varchar(50),
    @Term2 varchar(50),
    @SecurityDeposit2 varchar(50),
    @DownPayment2 varchar(50),
    @TotalOfPayments2 varchar(50),
    @BasePayment varchar(50),
    @JournalSaleAmount varchar(50),
    @IndividualBusinessFlag varchar(50),
    @InventoryDate varchar(50),
    @StatusDate varchar(50),
    @ListPrice varchar(50),
    @NetTradeAmount varchar(50),
    @TrimLevel varchar(50),
    @SubTrimLevel varchar(50),
    @BodyDescription varchar(50),
    @BodyDoorCount varchar(50),
    @TransmissionDesc varchar(50),
    @EngineDesc varchar(50),
    @TypeCode varchar(50),
    @SLCT2 varchar(50),
    @DealDateOffset varchar(50),
    @AccountingDate varchar(50),
    @CoBuyerCustNum varchar(50),
    @CoBuyerCell varchar(50),
    @CoBuyerEmail varchar(50),
    @CoBuyerSalutation varchar(50),
    @CoBuyerPhoneBlock varchar(50),
    @CoBuyerMailBlock varchar(50),
    @CoBuyerEmailBlock varchar(50),
    @RealBookDate varchar(50),
    @CoBuyerMiddleName varchar(50),
    @CoBuyerCountry varchar(50),
    @CoBuyerAddress2 varchar(50),
    @CoBuyerOptOut varchar(50),
    @CoBuyerOccupation varchar(50),
    @CoBuyerEmployer varchar(50),
    @Country varchar(50),
    @Occupation varchar(50),
    @Employer varchar(50),
    @Salesman2Commission varchar(50),
    @BankAddress varchar(50),
    @BankCity varchar(50),
    @BankState varchar(50),
    @BankZip varchar(50),
    @LeaseEstimatedMiles varchar(50),
    @AFTReserve varchar(50),
    @CreditLifePrem varchar(50),
    @CreditLifeRes varchar(50),
    @AHRes varchar(50),
    @Language varchar(50),
    @BuyRate varchar(50),
    @DMVAmount varchar(50),
    @Weight varchar(50),
    @StateDMVTotFee varchar(50),
    @ROSNumber varchar(50),
    @Incentives varchar(50),
    @CASS_STD_LINE1 varchar(50),
    @CASS_STD_LINE2 varchar(50),
    @CASS_STD_CITY varchar(50),
    @CASS_STD_STATE varchar(50),
    @CASS_STD_ZIP varchar(50),
    @CASS_STD_ZIP4 varchar(50),
    @CASS_STD_DPBC varchar(50),
    @CASS_STD_CHKDGT varchar(50),
    @CASS_STD_CART varchar(50),
    @CASS_STD_LOT varchar(50),
    @CASS_STD_LOTORD varchar(50),
    @CASS_STD_URB varchar(50),
    @CASS_STD_FIPS varchar(50),
    @CASS_STD_EWS varchar(50),
    @CASS_STD_LACS varchar(50),
    @CASS_STD_ZIPMOV varchar(50),
    @CASS_STD_Z4LOM varchar(50),
    @CASS_STD_NDIAPT varchar(50),
    @CASS_STD_NDIRR varchar(50),
    @CASS_STD_LACSRT varchar(50),
    @CASS_STD_ERROR_CD varchar(50),
    @NCOA_AC_ID varchar(50),
    @NCOA_COA_ADDSRC varchar(50),
    @NCOA_COA_MATCH varchar(50),
    @NCOA_COA_MOVTYP varchar(50),
    @NCOA_COA_DATE varchar(50),
    @NCOA_COA_DELCD varchar(50),
    @NCOA_COA_RTYPE varchar(50),
    @NCOA_COA_RTNCD varchar(50),
    @NCOA_COA_LINE1 varchar(50),
    @NCOA_COA_LINE2 varchar(50),
    @NCOA_COA_CITY varchar(50),
    @NCOA_COA_STATE varchar(50),
    @NCOA_COA_ZIP varchar(50),
    @NCOA_COA_ZIP4 varchar(50),
    @NCOA_COA_DPBC varchar(50),
    @NCOA_COA_CHKDGT varchar(50),
    @NCOA_COA_CART varchar(50),
    @NCOA_COA_LOT varchar(50),
    @NCOA_COA_LOTORD varchar(50),
    @NCOA_COA_URB varchar(50),
    @NCOA_COA_Z4LOM varchar(50),
    @NCOA_COA_ACTION varchar(50),
    @NCOA_COA_QNAME varchar(50),
    @NCOA_DPV_AA varchar(50),
    @NCOA_DPV_A1 varchar(50),
    @NCOA_DPV_BB varchar(50),
    @NCOA_DPV_CC varchar(50),
    @NCOA_DPV_M1 varchar(50),
    @NCOA_DPV_M3 varchar(50),
    @NCOA_DPV_N1 varchar(50),
    @NCOA_DPV_P1 varchar(50),
    @NCOA_DPV_P3 varchar(50),
    @NCOA_DPV_RR varchar(50),
    @NCOA_DPV_R1 varchar(50),
    @NCOA_DPV_STATUS varchar(50),
    @NCOA_DPV_F1 varchar(50),
    @NCOA_DPV_G1 varchar(50),
    @NCOA_DPV_U1 varchar(50),
    @SalesID int;
    DECLARE Sales_Cursor CURSOR FOR
    SELECT * from FLATFILE_SALES;
    OPEN Sales_Cursor
    FETCH NEXT FROM Sales_Cursor
    INTO @FileType ,
    @ACDealerID ,
    @ClientDealerID ,
    @DMSType ,
    @DealNumber ,
    @CustomerNumber ,
    @CustomerName ,
    @CustomerFirstName ,
    @CustomerLastName ,
    @CustomerAddress ,
    @CustomerCity ,
    @CustomerState ,
    @CustomerZip ,
    @CustomerCounty ,
    @CustomerHomePhone ,
    @CustomerWorkPhone ,
    @CustomerCellPhone ,
    @CustomerPagerPhone ,
    @CustomerEmail ,
    @CustomerBirthDate ,
    @MailBlock ,
    @CoBuyerName ,
    @CoBuyerFirstName ,
    @CoBuyerLastName ,
    @CoBuyerAddress ,
    @CoBuyerCity ,
    @CoBuyerState ,
    @CoBuyerZip ,
    @CoBuyerCounty ,
    @CoBuyerHomePhone ,
    @CoBuyerWorkPhone ,
    @CoBuyerBirthDate ,
    @Salesman_1_Number ,
    @Salesman_1_Name ,
    @Salesman_2_Number ,
    @Salesman_2_Name ,
    @ClosingManagerName ,
    @ClosingManagerNumber ,
    @F_AND_I_ManagerNumber ,
    @F_AND_I_ManagerName ,
    @SalesManagerNumber ,
    @SalesManagerName ,
    @EntryDate ,
    @DealBookDate ,
    @VehicleYear ,
    @VehicleMake ,
    @VehicleModel ,
    @VehicleStockNumber ,
    @VehicleVIN ,
    @VehicleExteriorColor ,
    @VehicleInteriorColor ,
    @VehicleMileage ,
    @VehicleType ,
    @InServiceDate ,
    @HoldBackAmount ,
    @DealType ,
    @SaleType ,
    @BankCode ,
    @BankName ,
    @SalesmanCommission ,
    @GrossProfitSale ,
    @FinanceReserve ,
    @CreditLifePremium ,
    @CreditLifeCommision ,
    @TotalInsuranceReserve ,
    @BalloonAmount ,
    @CashPrice ,
    @AmountFinanced ,
    @TotalOfPayments ,
    @MSRP ,
    @DownPayment ,
    @SecurityDesposit ,
    @Rebate ,
    @Term ,
    @RetailPayment ,
    @PaymentType ,
    @RetailFirstPayDate ,
    @LeaseFirstPayDate ,
    @DayToFirstPayment ,
    @LeaseAnnualMiles ,
    @MileageRate ,
    @APRRate ,
    @ResidualAmount ,
    @LicenseFee ,
    @RegistrationFee ,
    @TotalTax ,
    @ExtendedWarrantyName ,
    @ExtendedWarrantyTerm ,
    @ExtendedWarrantyLimitMiles ,
    @ExtendedWarrantyDollar ,
    @ExtendedWarrantyProfit ,
    @FrontGross ,
    @BackGross ,
    @TradeIn_1_VIN ,
    @TradeIn_2_VIN ,
    @TradeIn_1_Make ,
    @TradeIn_2_Make ,
    @TradeIn_1_Model ,
    @TradeIn_2_Model ,
    @TradeIn_1_ExteriorColor ,
    @TradeIn_2_ExteriorColor ,
    @TradeIn_1_Year ,
    @TradeIn_2_Year ,
    @TradeIn_1_Mileage ,
    @TradeIn_2_Mileage ,
    @TradeIn_1_Gross ,
    @TradeIn_2_Gross ,
    @TradeIn_1_Payoff ,
    @TradeIn_2_Payoff ,
    @TradeIn_1_ACV ,
    @TradeIn_2_ACV ,
    @Fee_1_Name ,
    @Fee_1_Fee ,
    @Fee_1_Commission ,
    @Fee_2_Name ,
    @Fee_2_Fee ,
    @Fee_2_Commission ,
    @Fee_3_Name ,
    @Fee_3_Fee ,
    @Fee_3_Commission ,
    @Fee_4_Name ,
    @Fee_4_Fee ,
    @Fee_4_Commission ,
    @Fee_5_Name ,
    @Fee_5_Fee ,
    @Fee_5_Commission ,
    @Fee_6_Name ,
    @Fee_6_Fee ,
    @Fee_6_Commission ,
    @Fee_7_Name ,
    @Fee_7_Fee ,
    @Fee_7_Commission ,
    @Fee_8_Name ,
    @Fee_8_Fee ,
    @Fee_8_Commission ,
    @Fee_9_Name ,
    @Fee_9_Fee ,
    @Fee_9_Commission ,
    @Fee_10_Name ,
    @Fee_10_Fee ,
    @Fee_10_Commission ,
    @ContractDate ,
    @InsuranceName ,
    @InsuranceAgentName ,
    @InsuranceAddress ,
    @InsuranceCity ,
    @InsuranceState ,
    @InsuranceZip ,
    @InsurancePhone ,
    @InsurancePolicyNumber ,
    @InsuranceEffectiveDate ,
    @InsuranceExpirationDate ,
    @InsuranceCompensationDeduction ,
    @TradeIn_1_InteriorColor ,
    @TradeIn_2_InteriorColor ,
    @PhoneBlock ,
    @LicensePlateNumber ,
    @Cost ,
    @InvoiceAmount ,
    @FinanceCharge ,
    @TotalPickupPayment ,
    @TotalAccessories ,
    @TotalDriveOffAmount ,
    @EmailBlock ,
    @ModelDescriptionOfCarSold ,
    @VehicleClassification ,
    @ModelNumberOfCarSold ,
    @GAPPremium ,
    @LastInstallmentDate ,
    @CashDeposit ,
    @AHPremium ,
    @LeaseRate ,
    @DealerSelect ,
    @LeasePayment ,
    @LeaseNetCapCost ,
    @LeaseTotalCapReduction ,
    @DealStatus ,
    @CustomerSuffix ,
    @CustomerSalutation ,
    @CustomerAddress2 ,
    @CustomerMiddleName ,
    @GlobalOptOut ,
    @LeaseTerm ,
    @ExtendedWarrantyFlag ,
    @Salesman_3_Number ,
    @Salesman_3_Name ,
    @Salesman_4_Number ,
    @Salesman_4_Name ,
    @Salesman_5_Number ,
    @Salesman_5_Name ,
    @Salesman_6_Number ,
    @Salesman_6_Name ,
    @APRRate2 ,
    @APRRate3 ,
    @APRRate4 ,
    @Term2 ,
    @SecurityDeposit2 ,
    @DownPayment2 ,
    @TotalOfPayments2 ,
    @BasePayment ,
    @JournalSaleAmount ,
    @IndividualBusinessFlag ,
    @InventoryDate ,
    @StatusDate ,
    @ListPrice ,
    @NetTradeAmount ,
    @TrimLevel ,
    @SubTrimLevel ,
    @BodyDescription ,
    @BodyDoorCount ,
    @TransmissionDesc ,
    @EngineDesc ,
    @TypeCode ,
    @SLCT2 ,
    @DealDateOffset ,
    @AccountingDate ,
    @CoBuyerCustNum ,
    @CoBuyerCell ,
    @CoBuyerEmail ,
    @CoBuyerSalutation ,
    @CoBuyerPhoneBlock ,
    @CoBuyerMailBlock ,
    @CoBuyerEmailBlock ,
    @RealBookDate ,
    @CoBuyerMiddleName ,
    @CoBuyerCountry ,
    @CoBuyerAddress2 ,
    @CoBuyerOptOut ,
    @CoBuyerOccupation ,
    @CoBuyerEmployer ,
    @Country ,
    @Occupation ,
    @Employer ,
    @Salesman2Commission ,
    @BankAddress ,
    @BankCity ,
    @BankState ,
    @BankZip ,
    @LeaseEstimatedMiles ,
    @AFTReserve ,
    @CreditLifePrem ,
    @CreditLifeRes ,
    @AHRes ,
    @Language ,
    @BuyRate ,
    @DMVAmount ,
    @Weight ,
    @StateDMVTotFee ,
    @ROSNumber ,
    @Incentives ,
    @CASS_STD_LINE1 ,
    @CASS_STD_LINE2 ,
    @CASS_STD_CITY ,
    @CASS_STD_STATE ,
    @CASS_STD_ZIP ,
    @CASS_STD_ZIP4 ,
    @CASS_STD_DPBC ,
    @CASS_STD_CHKDGT ,
    @CASS_STD_CART ,
    @CASS_STD_LOT ,
    @CASS_STD_LOTORD ,
    @CASS_STD_URB ,
    @CASS_STD_FIPS ,
    @CASS_STD_EWS ,
    @CASS_STD_LACS ,
    @CASS_STD_ZIPMOV ,
    @CASS_STD_Z4LOM ,
    @CASS_STD_NDIAPT ,
    @CASS_STD_NDIRR ,
    @CASS_STD_LACSRT ,
    @CASS_STD_ERROR_CD ,
    @NCOA_AC_ID ,
    @NCOA_COA_ADDSRC ,
    @NCOA_COA_MATCH ,
    @NCOA_COA_MOVTYP ,
    @NCOA_COA_DATE ,
    @NCOA_COA_DELCD ,
    @NCOA_COA_RTYPE ,
    @NCOA_COA_RTNCD ,
    @NCOA_COA_LINE1 ,
    @NCOA_COA_LINE2 ,
    @NCOA_COA_CITY ,
    @NCOA_COA_STATE ,
    @NCOA_COA_ZIP ,
    @NCOA_COA_ZIP4 ,
    @NCOA_COA_DPBC ,
    @NCOA_COA_CHKDGT ,
    @NCOA_COA_CART ,
    @NCOA_COA_LOT ,
    @NCOA_COA_LOTORD ,
    @NCOA_COA_URB ,
    @NCOA_COA_Z4LOM ,
    @NCOA_COA_ACTION ,
    @NCOA_COA_QNAME ,
    @NCOA_DPV_AA ,
    @NCOA_DPV_A1 ,
    @NCOA_DPV_BB ,
    @NCOA_DPV_CC ,
    @NCOA_DPV_M1 ,
    @NCOA_DPV_M3 ,
    @NCOA_DPV_N1 ,
    @NCOA_DPV_P1 ,
    @NCOA_DPV_P3 ,
    @NCOA_DPV_RR ,
    @NCOA_DPV_R1 ,
    @NCOA_DPV_STATUS ,
    @NCOA_DPV_F1 ,
    @NCOA_DPV_G1 ,
    @NCOA_DPV_U1 ;
    WHILE @@FETCH_STATUS = 0
    BEGIN
    PRINT @VehicleVIN ;
    --===============================================================================
    -- ****************** insert into Sales Table ***********
    INSERT INTO Sales
    IconicDealerID,
    DealNumber,
    CustomerNumber,
    DMSType,
    ContractDate
    VALUES (@ClientDealerID,@DealNumber,@CustomerNumber,@DMSType,@ContractDate);
    set @SalesID = scope_identity();
    PRINT @SalesID;
    --================================================================================
    --Insert into SALES_TRADEIN Table
    INSERT INTO SALES_TRADEIN
    SalesID,
    TradeIn_VIN,
    TradeIn_Make,
    TradeIn_Model,
    TradeIn_ExteriorColor,
    TradeIn_Year,
    TradeIn_Mileage,
    TradeIn_Gross,
    TradeIn_Payoff,
    TradeIn_ACV,
    TradeIn_InteriorColor
    VALUES (
    @SalesID,
    case when @TradeIn_1_VIN null then @TradeIn_1_VIN else @TradeIn_2_VIN end,
    case when @TradeIn_1_Make is null then @TradeIn_1_Make else @TradeIn_2_Make end,
    case when @TradeIn_1_Model is null then @TradeIn_1_Model else @TradeIn_2_Model end,
    case when @TradeIn_1_ExteriorColor is null then @TradeIn_1_ExteriorColor else @TradeIn_2_ExteriorColor end,
    case when @TradeIn_1_Year is null then @TradeIn_1_Year else @TradeIn_2_Year end,
    case when @TradeIn_1_Mileage is null then @TradeIn_1_Mileage else @TradeIn_2_Mileage end,
    case when @TradeIn_1_Gross is null then @TradeIn_1_Gross else @TradeIn_2_Gross end,
    case when @TradeIn_1_Payoff is not null then @TradeIn_1_Payoff else @TradeIn_2_Payoff end,
    case when @TradeIn_1_ACV is null then @TradeIn_1_ACV else @TradeIn_2_ACV end,
    case when @TradeIn_1_InteriorColor is null then @TradeIn_1_InteriorColor else @TradeIn_1_InteriorColor end
    --===============================================================================
    --Insert into SALES_VEHICLE Table
    INSERT INTO SALES_VEHICLE
    SalesID ,
    VehicleYear ,
    VehicleMake ,
    VehicleModel ,
    VehicleStockNumber ,
    VehicleVIN ,
    VehicleExteriorColor ,
    VehicleInteriorColor ,
    VehicleMileage ,
    VehicleType ,
    InServiceDate ,
    LeaseAnnualMiles ,
    ExtendedWarrantyName ,
    ExtendedWarrantyTerm ,
    ExtendedWarrantyLimitMiles ,
    LicensePlateNumber ,
    ModelDescriptionOfCarSold ,
    VehicleClassification ,
    ModelNumberOfCarSold ,
    ExtendedWarrantyFlag ,
    TrimLevel ,
    SubTrimLevel ,
    BodyDescription ,
    BodyDoorCount ,
    TransmissionDesc ,
    EngineDesc ,
    TypeCode ,
    Weight ,
    LeaseEstimatedMiles
    VALUES (
    @SalesID,@VehicleYear,@VehicleMake,@VehicleModel,@VehicleStockNumber,@VehicleVIN,
    @VehicleExteriorColor,@VehicleInteriorColor,@VehicleMileage,@VehicleType,
    @InServiceDate,@LeaseAnnualMiles,@ExtendedWarrantyName,@ExtendedWarrantyTerm,
    @ExtendedWarrantyLimitMiles,@LicensePlateNumber,@ModelDescriptionOfCarSold,
    @VehicleClassification,@ModelNumberOfCarSold,@ExtendedWarrantyFlag,
    @TrimLevel,@SubTrimLevel,@BodyDescription,@BodyDoorCount,
    @TransmissionDesc,@EngineDesc,@TypeCode,@Weight,@LeaseEstimatedMiles
    --======================================================================================
    --Insert into SALES_FEE Table
    INSERT INTO SALES_FEE
    SalesID ,
    Fee_Name ,
    Fee_Fee ,
    Fee_Commission
    VALUES (
    @SalesID,
    case
    when @Fee_1_Name is not null then @Fee_1_Name
    when @Fee_2_Name is not null then @Fee_2_Name
    when @Fee_3_Name is not null then @Fee_3_Name
    when @Fee_4_Name is not null then @Fee_4_Name
    when @Fee_5_Name is not null then @Fee_5_Name
    when @Fee_6_Name is not null then @Fee_6_Name
    when @Fee_7_Name is not null then @Fee_7_Name
    when @Fee_8_Name is not null then @Fee_8_Name
    when @Fee_9_Name is not null then @Fee_9_Name
    else @Fee_10_Name end,
    case
    when @Fee_1_Fee is not null then @Fee_1_Fee
    when @Fee_2_Fee is not null then @Fee_2_Fee
    when @Fee_3_Fee is not null then @Fee_3_Fee
    when @Fee_4_Fee is not null then @Fee_4_Fee
    when @Fee_5_Fee is not null then @Fee_5_Fee
    when @Fee_6_Fee is not null then @Fee_6_Fee
    when @Fee_7_Fee is not null then @Fee_7_Fee
    when @Fee_8_Fee is not null then @Fee_8_Fee
    when @Fee_9_Fee is not null then @Fee_9_Fee
    else @Fee_10_Fee end,
    case
    when @Fee_1_Commission is not null then @Fee_1_Commission
    when @Fee_2_Commission is not null then @Fee_2_Commission
    when @Fee_3_Commission is not null then @Fee_3_Commission
    when @Fee_4_Commission is not null then @Fee_4_Commission
    when @Fee_5_Commission is not null then @Fee_5_Commission
    when @Fee_6_Commission is not null then @Fee_6_Commission
    when @Fee_7_Commission is not null then @Fee_7_Commission
    when @Fee_8_Commission is not null then @Fee_8_Commission
    when @Fee_9_Commission is not null then @Fee_9_Commission
    else @Fee_10_Commission end
    --======================================================================================
    --Insert into SALES_HR Table
    INSERT INTO SALES_HR
    SalesID ,
    Salesman_Number ,
    Salesman_Name ,
    ClosingManagerName ,
    ClosingManagerNumber ,
    F_AND_I_ManagerNumber ,
    F_AND_I_ManagerName ,
    SalesManagerNumber ,
    SalesManagerName
    VALUES (
    @SalesID ,
    case
    when @Salesman_1_Number is not null then @Salesman_1_Number
    when @Salesman_2_Number is not null then @Salesman_2_Number
    when @Salesman_3_Number is not null then @Salesman_3_Number
    when @Salesman_4_Number is not null then @Salesman_4_Number
    when @Salesman_5_Number is not null then @Salesman_5_Number
    else @Salesman_6_Number end,
    case
    when @Salesman_1_Name is not null then @Salesman_1_Name
    when @Salesman_2_Name is not null then @Salesman_2_Name
    when @Salesman_3_Name is not null then @Salesman_3_Name
    when @Salesman_4_Name is not null then @Salesman_4_Name
    when @Salesman_5_Name is not null then @Salesman_5_Name
    else @Salesman_6_Name end,
    @ClosingManagerName ,
    @ClosingManagerNumber ,
    @F_AND_I_ManagerNumber ,
    @F_AND_I_ManagerName ,
    @SalesManagerNumber ,
    @SalesManagerName
    --======================================================================================
    --Insert into SALES_COBUYER Table
    INSERT INTO SALES_COBUYER
    SalesID ,
    CoBuyerName ,
    CoBuyerFirstName ,
    CoBuyerLastName ,
    CoBuyerAddress ,
    CoBuyerCity ,
    CoBuyerState ,
    CoBuyerZip ,
    CoBuyerCounty ,
    CoBuyerHomePhone ,
    CoBuyerWorkPhone ,
    CoBuyerBirthDate ,
    CoBuyerCustNum ,
    CoBuyerCell ,
    CoBuyerEmail ,
    CoBuyerSalutation ,
    CoBuyerMiddleName ,
    CoBuyerCountry ,
    CoBuyerAddress2 ,
    CoBuyerOptOut ,
    CoBuyerOccupation ,
    CoBuyerEmployer ,
    CoBuyerPhoneBlock ,
    CoBuyerMailBlock ,
    CoBuyerEmailBlock
    VALUES (
    @SalesID,@CoBuyerName,@CoBuyerFirstName,@CoBuyerLastName,@CoBuyerAddress,
    @CoBuyerCity,@CoBuyerState,@CoBuyerZip,@CoBuyerCounty,@CoBuyerHomePhone,
    @CoBuyerWorkPhone,@CoBuyerBirthDate,@CoBuyerCustNum,@CoBuyerCell,
    @CoBuyerEmail,@CoBuyerSalutation,@CoBuyerMiddleName,@CoBuyerCountry,
    @CoBuyerAddress2,@CoBuyerOptOut,@CoBuyerOccupation,@CoBuyerEmployer,
    @CoBuyerPhoneBlock,@CoBuyerMailBlock,@CoBuyerEmailBlock
    --======================================================================================
    --Insert into SALES_CUSTOMER Table
    INSERT INTO SALES_CUSTOMER
    SalesID ,
    IndividualBusinessFlag ,
    PhoneBlock ,
    EmailBlock ,
    CustomerName ,
    CustomerFirstName ,
    CustomerLastName ,
    CustomerAddress ,
    CustomerCity ,
    CustomerState ,
    CustomerZip ,
    CustomerCounty ,
    CustomerHomePhone ,
    CustomerWorkPhone ,
    CustomerCellPhone ,
    CustomerPagerPhone ,
    CustomerEmail ,
    CustomerBirthDate ,
    MailBlock ,
    CustomerSuffix ,
    CustomerSalutation ,
    CustomerAddress2 ,
    CustomerMiddleName ,
    GlobalOptOut ,
    InsuranceName ,
    InsuranceAgentName ,
    InsuranceAddress ,
    InsuranceCity ,
    InsuranceState ,
    InsuranceZip ,
    InsurancePhone ,
    InsurancePolicyNumber ,
    InsuranceEffectiveDate ,
    InsuranceExpirationDate ,
    InsuranceCompensationDeduction ,
    Country ,
    Occupation ,
    Employer ,
    CASS_STD_LINE1 ,
    CASS_STD_LINE2 ,
    CASS_STD_CITY ,
    CASS_STD_STATE ,
    CASS_STD_ZIP ,
    CASS_STD_ZIP4 ,
    CASS_STD_DPBC ,
    CASS_STD_CHKDGT ,
    CASS_STD_CART ,
    CASS_STD_LOT ,
    CASS_STD_LOTORD ,
    CASS_STD_URB ,
    CASS_STD_FIPS ,
    CASS_STD_EWS ,
    CASS_STD_LACS ,
    CASS_STD_ZIPMOV ,
    CASS_STD_Z4LOM ,
    CASS_STD_NDIAPT ,
    CASS_STD_NDIRR ,
    CASS_STD_LACSRT ,
    CASS_STD_ERROR_CD ,
    NCOA_AC_ID ,
    NCOA_COA_ADDSRC ,
    NCOA_COA_MATCH ,
    NCOA_COA_MOVTYP ,
    NCOA_COA_DATE ,
    NCOA_COA_DELCD ,
    NCOA_COA_RTYPE ,
    NCOA_COA_RTNCD ,
    NCOA_COA_LINE1 ,
    NCOA_COA_LINE2 ,
    NCOA_COA_CITY ,
    NCOA_COA_STATE ,
    NCOA_COA_ZIP ,
    NCOA_COA_ZIP4 ,
    NCOA_COA_DPBC ,
    NCOA_COA_CHKDGT ,
    NCOA_COA_CART ,
    NCOA_COA_LOT ,
    NCOA_COA_LOTORD ,
    NCOA_COA_URB ,
    NCOA_COA_Z4LOM ,
    NCOA_COA_ACTION ,
    NCOA_COA_QNAME ,
    NCOA_DPV_AA ,
    NCOA_DPV_A1 ,
    NCOA_DPV_BB ,
    NCOA_DPV_CC ,
    NCOA_DPV_M1 ,
    NCOA_DPV_M3 ,
    NCOA_DPV_N1 ,
    NCOA_DPV_P1 ,
    NCOA_DPV_P3 ,
    NCOA_DPV_RR ,
    NCOA_DPV_R1 ,
    NCOA_DPV_STATUS ,
    NCOA_DPV_F1 ,
    NCOA_DPV_G1 ,
    NCOA_DPV_U1
    VALUES (
    @SalesID ,
    @IndividualBusinessFlag ,
    @PhoneBlock ,
    @EmailBlock ,
    @CustomerName ,
    @CustomerFirstName ,
    @CustomerLastName ,
    @CustomerAddress ,
    @CustomerCity ,
    @CustomerState ,
    @CustomerZip ,
    @CustomerCounty ,
    @CustomerHomePhone ,
    @CustomerWorkPhone ,
    @CustomerCellPhone ,
    @CustomerPagerPhone ,
    @CustomerEmail ,
    @CustomerBirthDate ,
    @MailBlock ,
    @CustomerSuffix ,
    @CustomerSalutation ,
    @CustomerAddress2 ,
    @CustomerMiddleName ,
    @GlobalOptOut ,
    @InsuranceName ,
    @InsuranceAgentName ,
    @InsuranceAddress ,
    @InsuranceCity ,
    @InsuranceState ,
    @InsuranceZip ,
    @InsurancePhone ,
    @InsurancePolicyNumber ,
    @InsuranceEffectiveDate ,
    @InsuranceExpirationDate ,
    @InsuranceCompensationDeduction ,
    @Country ,
    @Occupation ,
    @Employer ,
    @CASS_STD_LINE1 ,
    @CASS_STD_LINE2 ,
    @CASS_STD_CITY ,
    @CASS_STD_STATE ,
    @CASS_STD_ZIP ,
    @CASS_STD_ZIP4 ,
    @CASS_STD_DPBC ,
    @CASS_STD_CHKDGT ,
    @CASS_STD_CART ,
    @CASS_STD_LOT ,
    @CASS_STD_LOTORD ,
    @CASS_STD_URB ,
    @CASS_STD_FIPS ,
    @CASS_STD_EWS ,
    @CASS_STD_LACS ,
    @CASS_STD_ZIPMOV ,
    @CASS_STD_Z4LOM ,
    @CASS_STD_NDIAPT ,
    @CASS_STD_NDIRR ,
    @CASS_STD_LACSRT ,
    @CASS_STD_ERROR_CD ,
    @NCOA_AC_ID ,
    @NCOA_COA_ADDSRC ,
    @NCOA_COA_MATCH ,
    @NCOA_COA_MOVTYP ,
    @NCOA_COA_DATE ,
    @NCOA_COA_DELCD ,
    @NCOA_COA_RTYPE ,
    @NCOA_COA_RTNCD ,
    @NCOA_COA_LINE1 ,
    @NCOA_COA_LINE2 ,
    @NCOA_COA_CITY ,
    @NCOA_COA_STATE ,
    @NCOA_COA_ZIP ,
    @NCOA_COA_ZIP4 ,
    @NCOA_COA_DPBC ,
    @NCOA_COA_CHKDGT ,
    @NCOA_COA_CART ,
    @NCOA_COA_LOT ,
    @NCOA_COA_LOTORD ,
    @NCOA_COA_URB ,
    @NCOA_COA_Z4LOM ,
    @NCOA_COA_ACTION ,
    @NCOA_COA_QNAME ,
    @NCOA_DPV_AA ,
    @NCOA_DPV_A1 ,
    @NCOA_DPV_BB ,
    @NCOA_DPV_CC ,
    @NCOA_DPV_M1 ,
    @NCOA_DPV_M3 ,
    @NCOA_DPV_N1 ,
    @NCOA_DPV_P1 ,
    @NCOA_DPV_P3 ,
    @NCOA_DPV_RR ,
    @NCOA_DPV_R1 ,
    @NCOA_DPV_STATUS ,
    @NCOA_DPV_F1 ,
    @NCOA_DPV_G1 ,
    @NCOA_DPV_U1
    --======================================================================================
    --Insert into SALES_AMOUNT Table
    INSERT INTO SALES_AMOUNT
    SalesID ,
    HoldBackAmount ,
    ExtendedWarrantyDollar ,
    ExtendedWarrantyProfit ,
    FrontGross ,
    BackGross ,
    MileageRate ,
    APRRate ,
    ResidualAmount ,
    LicenseFee ,
    RegistrationFee ,
    TotalTax ,
    Cost ,
    InvoiceAmount ,
    FinanceCharge ,
    TotalPickupPayment ,
    TotalAccessories ,
    TotalDriveOffAmount ,
    SalesmanCommission ,
    GrossProfitSale ,
    FinanceReserve ,
    CreditLifePremium ,
    CreditLifeCommision ,
    TotalInsuranceReserve ,
    BalloonAmount ,
    CashPrice ,
    AmountFinanced ,
    TotalOfPayments ,
    MSRP ,
    DownPayment ,
    SecurityDesposit ,
    Rebate ,
    Term ,
    RetailPayment ,
    LeasePayment ,
    LeaseNetCapCost ,
    LeaseTotalCapReduction ,
    APRRate2 ,
    APRRate3 ,
    GAPPremium ,
    LeaseTerm ,
    CashDeposit ,
    AHPremium ,
    LeaseRate ,
    Incentives ,
    StateDMVTotFee ,
    BuyRate ,
    DMVAmount ,
    CreditLifePrem ,
    CreditLifeRes ,
    AHRes ,
    Salesman2Commission ,
    ListPrice ,
    NetTradeAmount ,
    APRRate4 ,
    Term2 ,
    SecurityDeposit2 ,
    DownPayment2 ,
    TotalOfPayments2 ,
    BasePayment ,
    JournalSaleAmount
    VALUES (
    @SalesID,@HoldBackAmount,@ExtendedWarrantyDollar,@ExtendedWarrantyProfit,
    @FrontGross,@BackGross,@MileageRate,@APRRate,@ResidualAmount,@LicenseFee,
    @RegistrationFee,@TotalTax,@Cost,@InvoiceAmount,@FinanceCharge,
    @TotalPickupPayment,@TotalAccessories,@TotalDriveOffAmount,@SalesmanCommission,
    @GrossProfitSale,@FinanceReserve,@CreditLifePremium,@CreditLifeCommision,
    @TotalInsuranceReserve,@BalloonAmount,@CashPrice,@AmountFinanced,@TotalOfPayments,
    @MSRP,@DownPayment,@SecurityDesposit,@Rebate,@Term,@RetailPayment,@LeasePayment,
    @LeaseNetCapCost,@LeaseTotalCapReduction,@APRRate2,@APRRate3,@GAPPremium,
    @LeaseTerm,@CashDeposit,@AHPremium,@LeaseRate,@Incentives,@StateDMVTotFee,
    @BuyRate,@DMVAmount,@CreditLifePrem,@CreditLifeRes,@AHRes,@Salesman2Commission,
    @ListPrice,@NetTradeAmount,@APRRate4,@Term2,@SecurityDeposit2,
    @DownPayment2,@TotalOfPayments2,@BasePayment,@JournalSaleAmount
    --===========================================================================
    --Insert into SALES_BANKINFO Table
    INSERT INTO SALES_BANKINFO
    SalesID ,
    SLCT2 ,
    DealDateOffset ,
    DealerSelect ,
    DealStatus ,
    DealType ,
    SaleType ,
    BankCode ,
    BankName ,
    PaymentType ,
    BankAddress ,
    BankCity ,
    BankState ,
    BankZip ,
    AFTReserve ,
    Language ,
    ROSNumber
    VALUES (
    @SalesID,@SLCT2,@DealDateOffset,@DealerSelect,@DealStatus,@DealType,
    @SaleType,@BankCode,@BankName,@PaymentType,@BankAddress,@BankCity,
    @BankState,@BankZip,@AFTReserve,@Language,@ROSNumber
    ---=======================================================
    INSERT INTO SALES_DATE
    SalesID ,
    AccountingDate ,
    InventoryDate ,
    StatusDate ,
    LastInstallmentDate ,
    RetailFirstPayDate ,
    LeaseFirstPayDate ,
    DayToFirstPayment ,
    EntryDate ,
    DealBookDate ,
    RealBookDate
    VALUES (
    @SalesID ,
    convert (datetime,@AccountingDate) ,
    -- CAST (@AccountingDate AS datetime),
    convert (datetime,@InventoryDate) ,
    -- CAST (@InventoryDate AS datetime),
    convert (datetime,@StatusDate) ,
    -- CAST (@StatusDate AS datetime),
    convert (datetime,@LastInstallmentDate),
    -- CAST (@LastInstallmentDate AS datetime),
    convert (datetime,@RetailFirstPayDate) ,
    -- CAST (@RetailFirstPayDate AS datetime),
    @LeaseFirstPayDate ,
    convert (datetime,@DayToFirstPayment),
    -- CAST (@DayToFirstPayment AS datetime),
    convert (datetime,@EntryDate),
    -- CAST (@EntryDate AS datetime),
    convert (datetime,@DealBookDate),
    -- CAST (@DealBookDate AS datetime),
    convert (datetime,@RealBookDate)
    -- CAST (@RealBookDate AS datetime)
    */---=======================================================
    --======================================================================================
    -- Move cursor to Next record
    FETCH NEXT FROM Sales_Cursor
    INTO @FileType ,
    @ACDealerID ,
    @ClientDealerID ,
    @DMSType ,
    @DealNumber ,
    @CustomerNumber ,
    @CustomerName ,
    @CustomerFirstName ,
    @CustomerLastName ,
    @CustomerAddress ,
    @CustomerCity ,
    @CustomerState ,
    @CustomerZip ,
    @CustomerCounty ,
    @CustomerHomePhone ,
    @CustomerWorkPhone ,
    @CustomerCellPhone ,
    @CustomerPagerPhone ,
    @CustomerEmail ,
    @CustomerBirthDate ,
    @MailBlock ,
    @CoBuyerName ,
    @CoBuyerFirstName ,
    @CoBuyerLastName ,
    @CoBuyerAddress ,
    @CoBuyerCity ,
    @CoBuyerState ,
    @CoBuyerZip ,
    @CoBuyerCounty ,
    @CoBuyerHomePhone ,
    @CoBuyerWorkPhone ,
    @CoBuyerBirthDate ,
    @Salesman_1_Number ,
    @Salesman_1_Name ,
    @Salesman_2_Number ,
    @Salesman_2_Name ,
    @ClosingManagerName ,
    @ClosingManagerNumber ,
    @F_AND_I_ManagerNumber ,
    @F_AND_I_ManagerName ,
    @SalesManagerNumber ,
    @SalesManagerName ,
    @EntryDate ,
    @DealBookDate ,
    @VehicleYear ,
    @VehicleMake ,
    @VehicleModel ,
    @VehicleStockNumber ,
    @VehicleVIN ,
    @VehicleExteriorColor ,
    @VehicleInteriorColor ,
    @VehicleMileage ,
    @VehicleType ,
    @InServiceDate ,
    @HoldBackAmount ,
    @DealType ,
    @SaleType ,
    @BankCode ,
    @BankName ,
    @SalesmanCommission ,
    @GrossProfitSale ,
    @FinanceReserve ,
    @CreditLifePremium ,
    @CreditLifeCommision ,
    @TotalInsuranceReserve ,
    @BalloonAmount ,
    @CashPrice ,
    @AmountFinanced ,
    @TotalOfPayments ,
    @MSRP ,
    @DownPayment ,
    @SecurityDesposit ,
    @Rebate ,
    @Term ,
    @RetailPayment ,
    @PaymentType ,
    @RetailFirstPayDate ,
    @LeaseFirstPayDate ,
    @DayToFirstPayment ,
    @LeaseAnnualMiles ,
    @MileageRate ,
    @APRRate ,
    @ResidualAmount ,
    @LicenseFee ,
    @RegistrationFee ,
    @TotalTax ,
    @ExtendedWarrantyName ,
    @ExtendedWarrantyTerm ,
    @ExtendedWarrantyLimitMiles ,
    @ExtendedWarrantyDollar ,
    @ExtendedWarrantyProfit ,
    @FrontGross ,
    @BackGross ,
    @TradeIn_1_VIN ,
    @TradeIn_2_VIN ,
    @TradeIn_1_Make ,
    @TradeIn_2_Make ,
    @TradeIn_1_Model ,
    @TradeIn_2_Model ,
    @TradeIn_1_ExteriorColor ,
    @TradeIn_2_ExteriorColor ,
    @TradeIn_1_Year ,
    @TradeIn_2_Year ,
    @TradeIn_1_Mileage ,
    @TradeIn_2_Mileage ,
    @TradeIn_1_Gross ,
    @TradeIn_2_Gross ,
    @TradeIn_1_Payoff ,
    @TradeIn_2_Payoff ,
    @TradeIn_1_ACV ,
    @TradeIn_2_ACV ,
    @Fee_1_Name ,
    @Fee_1_Fee ,
    @Fee_1_Commission ,
    @Fee_2_Name ,
    @Fee_2_Fee ,
    @Fee_2_Commission ,
    @Fee_3_Name ,
    @Fee_3_Fee ,
    @Fee_3_Commission ,
    @Fee_4_Name ,
    @Fee_4_Fee ,
    @Fee_4_Commission ,
    @Fee_5_Name ,
    @Fee_5_Fee ,
    @Fee_5_Commission ,
    @Fee_6_Name ,
    @Fee_6_Fee ,
    @Fee_6_Commission ,
    @Fee_7_Name ,
    @Fee_7_Fee ,
    @Fee_7_Commission ,
    @Fee_8_Name ,
    @Fee_8_Fee ,
    @Fee_8_Commission ,
    @Fee_9_Name ,
    @Fee_9_Fee ,
    @Fee_9_Commission ,
    @Fee_10_Name ,
    @Fee_10_Fee ,
    @Fee_10_Commission ,
    @ContractDate ,
    @InsuranceName ,
    @InsuranceAgentName ,
    @InsuranceAddress ,
    @InsuranceCity ,
    @InsuranceState ,
    @InsuranceZip ,
    @InsurancePhone ,
    @InsurancePolicyNumber ,
    @InsuranceEffectiveDate ,
    @InsuranceExpirationDate ,
    @InsuranceCompensationDeduction ,
    @TradeIn_1_InteriorColor ,
    @TradeIn_2_InteriorColor ,
    @PhoneBlock ,
    @LicensePlateNumber ,
    @Cost ,
    @InvoiceAmount ,
    @FinanceCharge ,
    @TotalPickupPayment ,
    @TotalAccessories ,
    @TotalDriveOffAmount ,
    @EmailBlock ,
    @ModelDescriptionOfCarSold ,
    @VehicleClassification ,
    @ModelNumberOfCarSold ,
    @GAPPremium ,
    @LastInstallmentDate ,
    @CashDeposit ,
    @AHPremium ,
    @LeaseRate ,
    @DealerSelect ,
    @LeasePayment ,
    @LeaseNetCapCost ,
    @LeaseTotalCapReduction ,
    @DealStatus ,
    @CustomerSuffix ,
    @CustomerSalutation ,
    @CustomerAddress2 ,
    @CustomerMiddleName ,
    @GlobalOptOut ,
    @LeaseTerm ,
    @ExtendedWarrantyFlag ,
    @Salesman_3_Number ,
    @Salesman_3_Name ,
    @Salesman_4_Number ,
    @Salesman_4_Name ,
    @Salesman_5_Number ,
    @Salesman_5_Name ,
    @Salesman_6_Number ,
    @Salesman_6_Name ,
    @APRRate2 ,
    @APRRate3 ,
    @APRRate4 ,
    @Term2 ,
    @SecurityDeposit2 ,
    @DownPayment2 ,
    @TotalOfPayments2 ,
    @BasePayment ,
    @JournalSaleAmount ,
    @IndividualBusinessFlag ,
    @InventoryDate ,
    @StatusDate ,
    @ListPrice ,
    @NetTradeAmount ,
    @TrimLevel ,
    @SubTrimLevel ,
    @BodyDescription ,
    @BodyDoorCount ,
    @TransmissionDesc ,
    @EngineDesc ,
    @TypeCode ,
    @SLCT2 ,
    @DealDateOffset ,
    @AccountingDate ,
    @CoBuyerCustNum ,
    @CoBuyerCell ,
    @CoBuyerEmail ,
    @CoBuyerSalutation ,
    @CoBuyerPhoneBlock ,
    @CoBuyerMailBlock ,
    @CoBuyerEmailBlock ,
    @RealBookDate ,
    @CoBuyerMiddleName ,
    @CoBuyerCountry ,
    @CoBuyerAddress2 ,
    @CoBuyerOptOut ,
    @CoBuyerOccupation ,
    @CoBuyerEmployer ,
    @Country ,
    @Occupation ,
    @Employer ,
    @Salesman2Commission ,
    @BankAddress ,
    @BankCity ,
    @BankState ,
    @BankZip ,
    @LeaseEstimatedMiles ,
    @AFTReserve ,
    @CreditLifePrem ,
    @CreditLifeRes ,
    @AHRes ,
    @Language ,
    @BuyRate ,
    @DMVAmount ,
    @Weight ,
    @StateDMVTotFee ,
    @ROSNumber ,
    @Incentives ,
    @CASS_STD_LINE1 ,
    @CASS_STD_LINE2 ,
    @CASS_STD_CITY ,
    @CASS_STD_STATE ,
    @CASS_STD_ZIP ,
    @CASS_STD_ZIP4 ,
    @CASS_STD_DPBC ,
    @CASS_STD_CHKDGT ,
    @CASS_STD_CART ,
    @CASS_STD_LOT ,
    @CASS_STD_LOTORD ,
    @CASS_STD_URB ,
    @CASS_STD_FIPS ,
    @CASS_STD_EWS ,
    @CASS_STD_LACS ,
    @CASS_STD_ZIPMOV ,
    @CASS_STD_Z4LOM ,
    @CASS_STD_NDIAPT ,
    @CASS_STD_NDIRR ,
    @CASS_STD_LACSRT ,
    @CASS_STD_ERROR_CD ,
    @NCOA_AC_ID ,
    @NCOA_COA_ADDSRC ,
    @NCOA_COA_MATCH ,
    @NCOA_COA_MOVTYP ,
    @NCOA_COA_DATE ,
    @NCOA_COA_DELCD ,
    @NCOA_COA_RTYPE ,
    @NCOA_COA_RTNCD ,
    @NCOA_COA_LINE1 ,
    @NCOA_COA_LINE2 ,
    @NCOA_COA_CITY ,
    @NCOA_COA_STATE ,
    @NCOA_COA_ZIP ,
    @NCOA_COA_ZIP4 ,
    @NCOA_COA_DPBC ,
    @NCOA_COA_CHKDGT ,
    @NCOA_COA_CART ,
    @NCOA_COA_LOT ,
    @NCOA_COA_LOTORD ,
    @NCOA_COA_URB ,
    @NCOA_COA_Z4LOM ,
    @NCOA_COA_ACTION ,
    @NCOA_COA_QNAME ,
    @NCOA_DPV_AA ,
    @NCOA_DPV_A1 ,
    @NCOA_DPV_BB ,
    @NCOA_DPV_CC ,
    @NCOA_DPV_M1 ,
    @NCOA_DPV_M3 ,
    @NCOA_DPV_N1 ,
    @NCOA_DPV_P1 ,
    @NCOA_DPV_P3 ,
    @NCOA_DPV_RR ,
    @NCOA_DPV_R1 ,
    @NCOA_DPV_STATUS ,
    @NCOA_DPV_F1 ,
    @NCOA_DPV_G1 ,
    @NCOA_DPV_U1;
    END
    CLOSE Sales_Cursor;
    DEALLOCATE Sales_Cursor;
    GO
    SET ANSI_PADDING OFF
    GO

    Duplicate thread:
    problem - original

  • How to insert multiple values from a single LOV box...?(cont)

    Hi..I have a medical form and under the conclusions box, I have set up a LOV with various values. That part works fine.
    The thing is I do not want to pick a single value. The format which I write in the conclusions in that box is
    1. "............"
    2. " "
    3...etc...
    But when I go to choose the 2nd value, it replaces the first one I had inserted. Any tips please??

    "My way", should have done exactly that. Every time you open the lov and choose a value it should be aapended to the already existing value in the textfield (assuming taht the length of the textfield is long enough)."
    -Well thats the thing, If I try to add more than one value into ONE text field when I open up the LOV..it just replaces the first value with teh second value. Right now wihtout the LOV this is the format it gets stored into the database. The conclusions are typed in manually and when i query from sql plus it comes the way I typed it in. For example:
    1. Mild concentric LVH
    2. Normal LV systolic function ; EF 75 %
    3. Diastolic dysfunction
    I just copy/pasted that from sql. This is saved in a column in a table named ProcedureSummary. I want to insert values exactly this way into one field. Except when i do that currently with the LOV, it replaces the old value with a new value.
    I hope i make sense, sorry for the bother!

  • Insert multiple values

    CREATE or REPLACE TRIGGER dept_hist_trigger BEFORE delete or update ON dept FOR EACH ROW
    BEGIN
    INSERT INTO dept_hist values (:old.deptno,:old.dname,:old.loca);
    END;
    i have created a trigger like above..
    but  my requirement is i want to insert 180 columns....
    is there any best way to do ..

    >
    is there any best way to do
    >
    The best way is to name all the columns. There is nothing like old.* that you can use.
    G.

  • Problem when Reading Multiple values from Arduino to Vb

    Hi Mates,
    I am getting 4 values from Arduino using Serial.Println statement 4 times. How do I need to receive these values to 4 different variables in VB without using any buttons. We have to serial data received as per my knowledge.
    I've written the following code in VB.
    Imports System
    Imports System.ComponentModel
    Imports System.Threading
    Imports System.IO.Ports
    Public Class Form1
        Dim myPort As Array  'COM Ports detected on the system will be stored here
        Delegate Sub SetTextCallback(ByVal [text] As String) 'Added to prevent threading errors during receiveing of data
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            SerialPort1.PortName = "COM5"         'Set SerialPort1 to the selected COM port at startup
            SerialPort1.BaudRate = 9600         'Set Baud rate to the selected value on
            SerialPort1.Open()
            'Timer1.Start()
        End Sub
        Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
            ReceivedText(SerialPort1.ReadLine())    'Automatically called every time a data is received at the serialPort
        End Sub
        Private Sub ReceivedText(ByVal [text] As String)
            'compares the ID of the creating Thread to the ID of the calling Thread
            If Me.rtbReceived.InvokeRequired Then
                Dim x As New SetTextCallback(AddressOf ReceivedText)
                Me.Invoke(x, New Object() {(text)})
            Else
                Me.rtbReceived.Text &= [text]
            End If
        End Sub
    End Class
    How do I need to differentiate the values in ReceivedText function and How can I display those values in 4 text boxes. I am able to display all the values in rtbReceived text box as 100200300400100200300400... So on
    Assume values from Arduino are 100, 200, 300 & 400
    Your suggestions would be more helpful to complete my project, Thanks in Advance
    Thanks,
    Santhosh

    How do I need to differentiate the values in ReceivedText function and How can I display those values in 4 text boxes. I am able to display all the values in rtbReceived text box as 100200300400100200300400... So on
    Assume values from Arduino are 100, 200, 300 & 400
    Based on the example you have provided you would simply use the String.Substring function to break the string apart ot every 4 characters.
    https://msdn.microsoft.com/en-us/library/aka44szs%28v=vs.110%29.aspx
    You could do that in a loop that changes the starting character position from 0 in an increment of 4.
    However I suspect that won't work properly, either because there are characters that you are not revealing as a result of the way that you are display your results, or because your data gets out of sync. 
    If your device sends synchronizing characters (such as an end-of-record byte, or perhaps just a CrLf) then the correct process is to append (not overwite) the text you receive.  Use a string, not a text box text property, for this buffer. Then you need
    to break apart this buffer by scanning forward until you find a complete message - a record identifier and enough (12?) following characters to create a full sentence.  Then break it apart using substrings.
    If your device data stream does not include something that marks the beginning or end of a complete transmission then you can still try breaking it apart every four characters, and see how reliable it is.

  • Fnd_flex_keyval.validate_segs API does not insert FLEXFIELD value

    Hello,
    I',m using fnd_flex_keyval.validate_segs API in order to load ccid's, but having problems to insert "flexfield" value in R12. The code is as follows:
    vResult := apps.fnd_flex_keyval.validate_segs ('CREATE_COMBINATION', -- operation
    'SQLGL', -- appl_short_name
    'GL#', -- key_flex_code
    50328, -- structure_number
    '916.01.0001001.001.6104500102.000.000000' -- concat_segments
    'V', -- values_or_ids
    SYSDATE, -- validation_date
    'ALL', -- displayable
    NULL, -- data_set
    NULL,-- vrule
    NULL, -- where_clause
    NULL, -- get_columns
    FALSE, -- allow_nulls
    FALSE, -- allow_orphans
    260, -- resp_appl_id
    50678, -- resp_id
    1573, -- user_id
    NULL, -- select_comb_from_view
    NULL, -- no_combmsg
    NULL-- where_clause_msg
    Thanks in advance

    Not much clear what you are ultimately trying to achieve. On HR you may find some %util% packages that help you validate against a lookup, even considering the language of the environment. I guess it was hr_pump_utils.It has validations against lookup tables as well as other entities, bye giving the user value and returning the code or id if found.
    If not, you can create your own, passing the lookup type, the description, and optionally the language and use that to query the lookups table and validate the info received.

  • Submit multiple values

    Hi all,
    For my school project i'm building a student grade application using Servlets and JSP.
    Teachers can add grades for students.
    When a teacher chooses an subject, fo example math, a list with all the students of the class is displayed.
    After every name, there is an input field.
    The teacher can add or update grades for the students.
    In my form i have a loop which prints a input for the grade and an hidden input for the user id.
    What is the best way to store the data in the database with my servlet?
    When i submit the grades i want to know what grade belongs to which user id.
    And how can i check if there is already a grade for that user, update.
    I got it working, but i just want to make it work the right way.
    Here is my jsp:
    <%Iterator itr;%>
    <% List data= (List)session.getAttribute("studentlist");
            for (itr=data.iterator(); itr.hasNext(); )
                    String value=(String)itr.next();
                    String value2=(String)itr.next();
    %>
    <tr>
        <td><label for="student"><%=value%></label></td>
         <td><input type="hidden" name="student" value="<%=value2%>" /><td>
        <td><input type="text" name="grade" id="<%=value%>" /></td>
    </tr>
    <%}%>Here is my Servlet:
    String[] grades = request.getParameterValues("grade");
                    String[] student = request.getParameterValues("student");
                    for(int i=0;i<student.length;i++){
                        strQuery = "insert " +
                                    "into " +
                                    "cijfer " +
                                    "values(" +
                                    "null,"+grades[i]+",NOW(),1,'"+SubjectId+"',"+student[i]+")";It's not just about inserting multiple values, but inserting mltiple values for multiple students :)
    I just want to do it the right and clean way.
    Can i get some help please?
    Thnx in advance.
    Edited by: vishantpoeran on Apr 12, 2010 2:21 PM

    Hello,
    Check the below code.
    DATA: t_sel TYPE TABLE OF rsparams with header line.
    t_sel-selname = 'SO_OBJ_N'.
    t_sel-kind = 'P'.
    t_sel-sign = 'I'.
    t_sel-option = 'EQ'.
    t_sel-low = 'YCRM01_REP_0590235 '.
    APPEND T_SEL.
    CLEAR T_SEL.
    t_sel-selname = 'P_ONLYNU'.
    t_sel-kind = 'P'.
    t_sel-sign = 'I'.
    t_sel-option = 'EQ'.
    t_sel-low = SPACE.
    APPEND T_SEL.
    CLEAR T_SEL.
    t_sel-selname = 'P_ONLYTA'.
    t_sel-kind = 'P'.
    t_sel-sign = 'I'.
    t_sel-option = 'EQ'.
    t_sel-low = SPACE.
    APPEND T_SEL.
    CLEAR T_SEL.
    t_sel-selname = 'P_NOTMP'.
    t_sel-kind = 'P'.
    t_sel-sign = 'I'.
    t_sel-option = 'EQ'.
    t_sel-low = 'X'.
    APPEND T_SEL.
    CLEAR T_SEL.
    t_sel-selname = 'P_NOTMP'.
    t_sel-kind = 'P'.
    t_sel-sign = 'I'.
    t_sel-option = 'EQ'.
    t_sel-low = 'X'.
    APPEND T_SEL.
    CLEAR T_SEL.
    t_sel-selname = 'P_SHPR'.
    t_sel-kind = 'P'.
    t_sel-sign = 'I'.
    t_sel-option = 'EQ'.
    t_sel-low = 'LSVIM*'.
    APPEND T_SEL.
    CLEAR T_SEL.
    t_sel-selname = 'P_VIEW'.
    t_sel-kind = 'P'.
    t_sel-sign = 'I'.
    t_sel-option = 'EQ'.
    t_sel-low = 'X'
    APPEND T_SEL.
    CLEAR T_SEL.
    t_sel-selname = 'P_UPLOAD'.
    t_sel-kind = 'P'.
    t_sel-sign = 'I'.
    t_sel-option = 'EQ'.
    t_sel-low = 'X'.
    APPEND T_SEL.
    CLEAR T_SEL.
    submit ZRSUNISCAN_FINAL_UC  WITH SELECTION-TABLE T_SELAND
    RETURN.
    tHANKS.
    rAMYA.

  • Query for multiple value search

    Hi
    I got struck when I try to construct SQL query to fetch multiple values in WHERE clause.
    SELECT columnName from someTable
    WHERE someValue = {here is the problem, I have multiple values here which I get from some array}
    Is there any way I can put multiple values to where clause?

    here we go
    this????
    SQL> var LIST varchar2(200)
    SQL> EXEC :LIST := '10,20';
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL>  SELECT items.EXTRACT('/l/text()').getStringVal() item
      2   FROM TABLE(XMLSEQUENCE(
      3   EXTRACT(XMLTYPE('<all><l>'||
      4   REPLACE(:LIST,',','</l><l>')||'</l></all>')
      5  ,'/all/l'))) items;
    ITEM
    10
    20
    Elapsed: 00:00:00.04
    SQL> ed
    Wrote file afiedt.buf
      1  SELECT empno,
      2         ename
      3    FROM emp
      4   WHERE dno IN (SELECT items.EXTRACT ('/l/text()').getStringVal () item
      5                   FROM TABLE (XMLSEQUENCE (EXTRACT
      6*                   (XMLTYPE ('<all><l>' || REPLACE (:LIST, ',', '</l><l>') || '</l></all>'), '/all/l') ) )
    SQL> /
         EMPNO ENAME
          7934 MILLER
          7839 KING
          7782 CLARK
          7902 FORD
          7876 ADAMS
          7788 SCOTT
          7566 JONES
          7369 SMITH
    8 rows selected.

  • Problem in mapping with multiple values

    Hi all,
    I am facing a problem during mapping. I am explainning the problem with a example.
    Suppose i have a source table named Employee which has two columns emp no and account no. I have a target table Emp_account which has also the same columns.
    One employee may have more than one accounts. In source table this account nos are stored in account no column in one row corresponding to emp no. The multiple values in account no are separated by comma for one record in source table.
    But in the target table Emp_account a single record will be inserted for each employee's separate account. There should not be multiple values separated by comma in account no column of target table.
    So if any employee has two accounts this will be stored as one row in source table but in target table it will divided into two different rows for each account.
    EMPLOYEE(Source)
    emp no account no
    10 101, 102
    EMP_ACCOUNT(Target)
    emp no account no
    10 101
    10 102
    Think I explained the requirement.. How can i made this in OWB mapping editor..Is it possible?...Can any operator perform this task...If any of u know about this plzz give some solution..It's very important ..
    Thanks & Regards,
    Sumanta Das

    Hi,
    With reference to your question.
    Can any operator perform this task..I don't think any single operator will help you.
    I suggest using an intermediate (staging) table by using a PL SQL procedure with output port to store the values of account number provided the number of accounts are limited. Else use an array variable for account of an employee.
    In short no simple solution because of the bad source design else the pivot/unpivot operator would have helped you.
    Cheers
    - Mohammed

  • Search help multiple values selection problem

    Hello Friends,
    I am using FM f4_if_int_table_value_request FM to display multiple values on selection screen
    in AT-selection-screen on value request event.
    Multiple values are getting displayed perfectly .
    Then after that I am using DYNP_VALUES_UPDATE FM to return the values back to screen.
    But the problem is in the select-option field . It only picks the last value selected.
    I have a row:
    I EQ 'last value selected from F4 help screen''.
    Is there a way to update multiple rows in the select option selection screen field.
    Thanks.

    Hi Suhas,
    you may try the following:
    TABLES spfli.
    SELECT-OPTIONS: s_carrid FOR spfli-carrid.
    SELECTION-SCREEN: PUSHBUTTON /1(20) but1 USER-COMMAND carr.
    INITIALIZATION.
      but1 = 'Choose CARRID(s)'.
    AT SELECTION-SCREEN.
      CASE sy-ucomm.
        WHEN 'CARR'.
          TYPES: t_return_tab  TYPE ddshretval.
          TYPES: BEGIN OF ty_line,
            carrid   TYPE spfli-carrid,
            carrname TYPE scarr-carrname,
          END OF ty_line.
          DATA: it_list TYPE STANDARD TABLE OF ty_line,
                wa_return_tab TYPE t_return_tab,
                i_return_tab TYPE STANDARD TABLE OF t_return_tab,
                v_repid TYPE sy-repid,
                v_dynnr TYPE sy-dynnr.
          v_repid = sy-repid.
          v_dynnr = sy-dynnr.
          SELECT carrid carrname
          FROM scarr
          INTO TABLE it_list.
          IF sy-subrc = 0.
            CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
              EXPORTING
                retfield        = 'CARRID'
                dynpprog        = v_repid
                dynpnr          = v_dynnr
    *        dynprofield     = 'S_CARRID-LOW'
                value_org       = 'S'
                multiple_choice = 'X'
              TABLES
                value_tab       = it_list
                return_tab      = i_return_tab
              EXCEPTIONS
                parameter_error = 1
                no_values_found = 2
                OTHERS          = 3.
            IF sy-subrc = 0.
              s_carrid-sign = 'I'.
              s_carrid-option = 'EQ'.
              LOOP AT i_return_tab INTO wa_return_tab.
                s_carrid-low = wa_return_tab-fieldval.
                APPEND s_carrid.
              ENDLOOP.
              READ TABLE s_carrid INDEX 1.
            ENDIF.
          ENDIF.
      ENDCASE.
    What I have done is:
    - not linking the result of the F4 search to field S_CARRID-LOW
    - inserting this F4 search into event AT SELECTION SCREEN. This allows to see the select-options filled when its contents are actually populated.
    I hope this helps. Kind regards,
    Alvaro

  • How to insert or update multiple values into a records of diff fields

    Hai All
    I have to insert or update or multiple values into a single records of diff fields from one to another table.
    Table1 has 3 fields
    Barcode bardate bartime
    0011 01-02-10 0815
    0022 01-02-10 0820
    0011 01-02-10 1130
    0022 01-02-10 1145
    0011 01-02-10 1230
    0022 01-02-10 1235
    0011 01-02-10 1645
    0022 01-02-10 1650
    these are the times that comes in at 0815 and goes break at 1130 and comes in at 1230 and goes home at 1645
    from these table i have to insert into another table called table2
    and the fields are barcode, date,timein intrin,introut,tiomout
    And the output want to like this
    barcode timein intrin introut timeout date
    0011 0815 1130 1230 1645 01-02-10
    0022 0820 1145 1235 1650 01-02-10
    If any give some good answer it will be help full..
    Thanks & Regards
    Srikkanth.M

    SQL> with table1 as (
      2  select '0011' Barcode,'01-02-10' bardate,'0815' bartime from dual union
      3  select '0022','01-02-10','0820' from dual union
      4  select '0011','01-02-10','1130' from dual union
      5  select '0022','01-02-10','1145' from dual union
      6  select '0011','01-02-10','1230' from dual union
      7  select '0022','01-02-10','1235' from dual union
      8  select '0011','01-02-10','1645' from dual union
      9  select '0022','01-02-10','1650' from dual
    10  )
    11  select barcode, bardate,
    12         max(decode(rn,1,bartime,null)) timein,
    13         max(decode(rn,2,bartime,null)) intrin,
    14         max(decode(rn,3,bartime,null)) introut,
    15         max(decode(rn,4,bartime,null)) timeout from (
    16                          select barcode, bardate, bartime,
    17                                 row_number() over (partition by barcode, bardate
    18                                                    order by bartime) rn
    19                            from table1)
    20  group by barcode, bardate;
    BARC BARDATE  TIME INTR INTR TIME
    0011 01-02-10 0815 1130 1230 1645
    0022 01-02-10 0820 1145 1235 1650Max
    http://oracleitalia.wordpress.com

Maybe you are looking for