Convert Alpha-Numeric to Numeric values

Hi,
I have a requirement like there is a doc.no. which has alpha -numeric values (Eg:DA 112333).
When i extract  this value i should be able to get only 112333 as the final output.
How can i achieve this?
Its not a fixed thing that only first two values will be alphabets it can occur anywhere in the sequence.
Thanks in advance
Merlin

Hi,
Check if you can make use of this sample code..
Report xyz.
DATA: l_str TYPE c LENGTH 10 VALUE '3D5X12YZ35',
      l_str1 TYPE c LENGTH 10,
      l_alpha TYPE string VALUE 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
      c TYPE c.
DO 10 TIMES.
  c = l_str.
  IF c CA l_alpha.
    c = space.
  ELSE.
    CONCATENATE l_str1 c INTO l_str1.
  ENDIF.
  SHIFT l_str LEFT.
ENDDO.
CONDENSE l_str1.
WRITE l_str1.

Similar Messages

  • Converting char type to numeric

    hi,
    is there any Function Module that converts char type to numeric.
    thanks.

    hi,
    data : w_num type i,
             w_char type char10.
    Use can asign character to numeric in PGM by using the statement try endtry.
    try .
    w_num = w_char.
    endtry.
    Regards,
    Prabhudas

  • Convert rows into comma seperated values

    Hello I have a question,
    I have a table like this.
    Memid           values
    1                  10
    1                 20
    2                30
    3                50
    3                60
    3               10
    i want to convert it like this
    memid              values
    1 10,20
    2                      30
    3                       50,60,10
    Can you please provide a solution.. 
    Thanks

    SELECT Memid,
    STUFF((SELECT ',' + CAST([values] AS varchar(10))
    FROM Table
    WHERE Memid = t.Memid
    FOR XML PATH(''),TYPE),value('.','varchar(max)'),1,1,'') AS [values]
    FROM (SELECT DISTINCT Memid FROM Table)t
    see
    http://visakhm.blogspot.in/2014/01/rowset-concatenation-with-special.html
    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

  • Sa-learn says "Argument 'perl_version' isn't numeric in numeric ge"

    Since yesterday, the sa-learn component of Spamassassin complains:
    Argument "perl_version" isn't numeric in numeric ge (>=) at (eval 525) line 1.
    Argument "perl_version" isn't numeric in numeric ge (>=) at (eval 1018) line 1.
    This is a known problem with a known solution (upgrade Spamassassin to 3.4.0). It's discussed here, for example. My worry is that once I manually update or patch Spamassassin, I'll be off the track for Mac OS X Server updates.
    Advice?

    Hi,
    It pays to RTFM. Since DBD 1.22 only Oracle 9i+ libraries are supported. According to your output, install picked 8.1.7 libraries for build. If you do not want to upgrade - your best bet would be DBD 1.20:
    http://search.cpan.org/dist/DBD-Oracle/Oracle.pm#Which_version_DBD::Oracle_is_for_me?
    --romas                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Reading Numeric UDF null value in DI

    We have a UDF of Numeric(4) that can be NULL, 0, 1, 2, etc. We try to read it from DI, and if it is NULL, then set the result to be -1 (the default value we difined), so we can differentiate NULL and 0.
    The C# code we have look like this:
    int LineNumber = -1;
    SAPbobsCOM.Company oCompany;
    // Code to get Company
    SAPbobsCOM.Documents oDoc = oCompany.GetBusinessObject(BoObjectTypes.oQuotations);
    oDoc.GetByKey(100); // Get the document by DocEntry
    LineNumber = (int)oDoc.UserFields.Fields.Item("U_XX_LN").Value;
    The problem is LineNumber gets 0 even if in the database U_XX_LN is NULL. We tried the code below and got the same result because oDoc.UserFields.Fields.Item("U_XX_LN").Value.ToString() always return '0' if it is NULL.
    if (string.IsNullOrEmpty(oDoc.UserFields.Fields.Item("U_XX_LN").Value.ToString()))
        LineNumber = -1;
    else
        LineNumber = (int)oDoc.UserFields.Fields.Item("U_XX_LN").Value;
    The question is: how can we set it to default -1 if in the database the value is NULL?
    Thank you,
    Grace

    Hi Grace,
    Unfortunately the DI API automatically converts database null values to a default value for the datatype (eg null for numeric becomes 0 and null for strings is an empty string). If you want to differentiate between null and zero you will need to query the table using the isnull command rather than reading the table through the UserTables object:
    oRecordSet.DoQuery("select isnull(U_XX_LN, -1) as U_XX_LN from [@MYTABLE] where Code = 'MYCODE')
    This will convert the null value to a -1 in the recordset so you can tell the difference between nulls and zeros.
    Kind Regards,
    Owen

  • Converting an image into numeric array?

    I want to sum all the pixel values in a image. I was thinking of using the Add Array Elements VI. Is their an easy way to convert an U8 or an I16 bit image into a numeric array? Thank you in advance.

    Is this a BW image? (If the image is paletted or color, a summing operation is poorly defined! )
    Just convert your image data to a 2D boolean array using unflatten pixmap, then feed the 1bit pixmap to "boolean to 0..1" followed by the SUM operation (in case it overflows, you might want to convert it to a better representation before summing, e.g. DBL. "boolean to 0,1" generates I16).
    Message Edited by altenbach on 06-01-2005 02:44 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    SumImage.png ‏2 KB

  • ORA-06502 - Convert varchar fielddata into numeric fielddata

    Hi,
    I've placed two tables in my mapping canvas; SRC_EMPLOYEES and TRG_EMPLOYEES and I'm trying to transfer data between them.
    There is a small difference between one of the data colums of both tables; The source table contains a varchar(15) telephone field, while the target table only allows numeric inserts in the telephone field. Some employees have spaces in their telephone number, others have dots, etc. Is there an object in the palette that can filter out dots, spaces, etc? If so, how can I use it?
    Here's the error I received:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    Thanks for the help, I really appreciate it!
    Michiel, the Netherlands

    For those who are interested:
    I added an expression operator between source and target and used REPLACE to filter out spaces, dots, etc.

  • Numeric Row Height Value Fixed but Different

    Hi Everyone,
    On my front panel, I have a 1D array (column) of Numerics next to a 1D array (column) of strings. I need them to line up. I believe that the row height for numerics is not changeable, but for strings you can change it.
    Here is my problem, on different PCs I have found that the numeric row heights have different fixed values. On my development PC (LabVIEW 2011, 32 bit), the row height is 22 pixels. On all other test PCs (also LabVIEW 2011, 32 bit) the row height is 20 pixels. I need the arrays to line up on all PCs, but it looks different.
    Does anyone have any suggestions on how I can fix this issue?
    Solved!
    Go to Solution.

    "Get Text rect.vi"will tell you how big the bounding rectangle is for text rendered using the font you choose while also concidering "Bold" etc.
    Using that function should give you a way of dtermining how large the text ends-up being and then you JUST* have to sett all of the proeprties to match.
    Ben
    * yes, the word "JUST" is a four letter word in my book as well.
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Convert float to a numeric with 3 decimals

    Hi,
    How can I convert a float number to a numeric number with 3 decimals?
    Tks,
    Daniela

    hi Daniela,
      Declare it as type <b>P</b>
    i.e,
       Data : v_float type f,
              v_dec   type p decimals 3.
              v_dec = v_float.
        write : v_float, v_dec.
    Regards,
    Santosh

  • How to ignorenon-numeric parameter field value

    Post Author: burhan.survery
    CA Forum: General
    I am passing a parameter to a subreport. While running the report, I get an error which says that the parameter field is a non-numeric value. I'm not sure why since, the parameter field should be passing a quantity. Is there a way for me to check if the parameter field is passing a non-numeric value and if so, ignore it so  that the report continues.
    thanks.
    b

    Post Author: bettername
    CA Forum: General
    Strange! I would have imagined from the fact that it gave you the original "non-numeric" error that it must be passing a string (how can a number be non-numeric!), but that's clearly not the case.  I'm stumped...  What does Crystal identify the 'source' field as (do a 'browse data' or 'show field types')? I assume that the parameter datatype is the same as the source field? 
    What's your data source (SQL Server, DB2 etc...)?  Is there a way you can validate everything is numeric outside of Crystal?

  • Why do converted pdf files contain numerous errors?

    When I convert a pdf to word there are many errors in the worrd document.   When I save the document to my document library it dissapears.  Whats up?

    Hi there,
    I'm having the same problem, started only recently. Did you find a reason/solution?
    I've tried Windows 7 and Windows XP, no difference. IE and FF open on page 2, but Chrome opens on page 1, as it should.
    Googling around I found people having similar problems after updating to new version of AIR and Acrobat Reader, so it might be a bug/incompatibility introduced by those updates.
    My best guess is that it has to do with the reading order being improperly generated by the PDF library (FPDF in my case).
    Thanks for reading!
    Marc

  • As of 2 weeks ago, buttons on some sites have a small box beside then with 2 alpha and 2 numeric characters - what do I need to change?

    I have checked my settings and plug-ins and cannot correct it. My Firefox on my work laptop doesn't get these, and neither does Internet Explorer. I'm thinking its a Java thing, but not sure. It's obviously to do with the button (action button). Any suggestions?
    Site example: http://weather.gc.ca/radar/index_e.html?id=WHK
    All animation buttons are these little character boxes rather than "play", "pause", etc.
    I can send a picture if you need one. Won't let me paste it into this box.
    Thanks,
    Peter Spettigue

    I looked at the radar, but didn't see any problem.
    Hello,
    In order to better assist you with your issue please provide us with a screenshot. If you need help to create a screenshot, please see [[How do I create a screenshot of my problem?]]
    Once you've done this, attach the saved screenshot file to your forum post by clicking the '''Browse...''' button below the ''Post your reply'' box. This will help us to visualize the problem.
    Thank you!

  • Convert Scientific Notation to Numeric (ABAP)

    I am currently consuming a WebService from XIgnite, that is returning a 7.5863900E-01 and I need to update the TCURR (Exchange Rate table) with .758639. 
    I need an ABAP example to use to place within the program that is importing the data for exchange rates.
    Thanks.

    try this:
    DATA: W_EXPO TYPE QPMK-SOLLWERT,
          W_PCKDECI(16)  TYPE P DECIMALS 3.
    MOVE : '7.5863900E-01' TO W_EXPO,
           W_EXPO TO W_PCKDECI.

  • Converting Column Header to Rows Value in SQL Query

    Dear Guys,find blew the table from A1_30 to YetToDue columns. I need from A1_30 to A356 columns convert into row values and that values column head name like Abstract. A1_30 A31_60 A61_90 A91_120 A121_180A181_365A365 BalArr NoOfLoanLoanOS YetToDue
    0 0 0 101 0 0 0 909 66730 909 3637
    0 40 0 0 0 0 0 1818 66681 1818 3637
    0 56 0 0 0 0 0 1818 70210 1818 5455
    0 0 66 0 0 0 0 909 73735 909 7273
    0 35 0 0 0 0 0 2727 73327 2727 7273
    0 0 66 0 0 0 0 909 73353 909 7273
    0 40 0 0 0 0 0 909 66778 909 3637
    0 40 0 0 0 0 0 1818 66744 1818 3637
    0 0 0 101 0 0 0 909 66787 909 3637
    0 40 0 0 0 0 0 1818 66671 1818 3637
    0 56 0 0 0 0 0 1818 70201 1818 5455
    0 56 0 0 0 0 0 1818 70204 1818 5455
    0 0 66 0 0 0 0 909 73331 909 7273
    0 40 0 0 0 0 0 1818 66726 1818 3637
    0 40 0 0 0 0 0 2727 66798 2727 3637
    0 40 0 0 0 0 0 909 66676 909 3637
    0 40 0 0 0 0 0 1818 66685 1818 3637
    0 56 0 0 0 0 0 1818 70209 1818 5455
    0 57 0 0 0 0 0 1818 70226 1818 5455
    0 35 0 0 0 0 0 2727 73762 2727 7273
    0 0 66 0 0 0 0 909 73333 909 7273
    0 40 0 0 0 0 0 1818 66759 1818 3637
    0 40 0 0 0 0 0 882 66597 882 8826
    0 40 0 0 0 0 0 2727 66789 2727 3637
    0 40 0 0 0 0 0 2646 66609 2646 8826
    0 40 0 0 0 0 0 2646 66641 2646 8826
    0 57 0 0 0 0 0 1818 70193 1818 5455
    0 56 0 0 0 0 0 1818 70202 1818 5455
    0 35 0 0 0 0 0 2727 73757 2727 7273
    0 0 66 0 0 0 0 909 73345 909
    7273
    I expecting the results:
    Abstract BalArr NoOfLoan LoanOS YetToDue
    A0_30 0 0 0 0
    A31_60 45261 1579445 45261 122852
    A61_90 4545 367097 4545 36365
    A91_120 1818 133517 1818 7274
    A121_180 0 0 0 0
    A181_365 0 0 0 0
    A365 0 0 0 0
    pls help I really appreciate ..

    Dear Partrck Hurst.I have facing struggle with my store procedure , It work very slow performance when i pass the entryPlease go through my store procedure and let me advice if i wrote the script wrongly .ALTER PROCEDURE [dbo].[MFDB_GenerateDCBCollection]
    @i_BranchId INT,
    @i_SHGId INT,
    @p_SHGMemberId INT,
    @i_LoanNumber INT,
    @i_DayOpenDate DATETIME,
    @o_ErrorStatus INT Output
    ) AS
    --WITH ENCRYPTION AS
    DECLARE @p_DayOpenDate AS DATETIME
    DECLARE @p_BranchId AS INT
    DECLARE @D_FromDate AS DATE
    DECLARE @D_ToDate AS DATE
    DECLARE @E_ToDate AS DATE
    DECLARE @p_RecordCounter AS INT
    DECLARE @p_RecordCount AS INT
    DECLARE @p_TempCollectionId AS INT
    DECLARE @p_TempStateId AS INT
    DECLARE @p_TempRegionId AS INT
    DECLARE @p_TempBranchId AS INT
    DECLARE @p_TempSHGId AS INT
    DECLARE @p_TempSHGName AS VARCHAR(75)
    DECLARE @p_TempSHGMemberId AS INT
    DECLARE @p_TempMemberId AS INT
    DECLARE @p_TempMemberName AS VARCHAR(75)
    DECLARE @p_TempVillageName AS VARCHAR(100)
    DECLARE @p_TempPanchayatName AS VARCHAR(100)
    DECLARE @p_TempPanchayatId AS INT
    DECLARE @p_TempVillageId AS INT
    DECLARE @p_TempInstNumber AS INT
    DECLARE @p_TempLoanNumber AS INT
    DECLARE @p_TempDisbursedDate AS DATE
    DECLARE @p_TempStatus AS INT
    DECLARE @p_TempLoanSchemeId AS INT
    DECLARE @p_TempLCategoryId AS INT
    DECLARE @p_TempLActivityId AS INT
    DECLARE @p_TempLActSpecId AS INT
    DECLARE @p_TempLoanAmount AS NUMERIC(18,2)
    DECLARE @p_TempApprovalStatus AS INT
    DECLARE @p_TempFundingAgencyId AS INT
    DECLARE @p_TempOpenBalPrin AS NUMERIC(18,2)
    DECLARE @p_TempOpenBalInt AS NUMERIC(18,2)
    DECLARE @p_TempStdPrin AS NUMERIC(18,2)
    DECLARE @p_TempStdInt AS NUMERIC(18,2)
    DECLARE @p_TempCollPrin AS NUMERIC(18,2)
    DECLARE @p_TempCollInt AS NUMERIC(18,2)
    DECLARE @p_TempAdvancePrin AS NUMERIC(18,2)
    DECLARE @p_TempAdvanceInt AS NUMERIC(18,2)
    DECLARE @p_TempArrearPrin AS NUMERIC(18,2)
    DECLARE @p_TempArrearInt AS NUMERIC(18,2)
    DECLARE @p_TempBalancePrin AS NUMERIC(18,2)
    DECLARE @p_TempBalanceInt AS NUMERIC(18,2)
    DECLARE @p_TempDemandDate AS DATE
    DECLARE @p_TempCollectionDate AS DATE
    DECLARE @p_TempLStatus AS INT
    DECLARE @p_TempLSourceId AS INT
    DECLARE @p_TempVoucherName AS VARCHAR(75)
    DECLARE @p_TempInsurance AS NUMERIC(18,2)
    DECLARE @p_TempUpFrontFess AS NUMERIC(18,2)
    DECLARE @p_TempDocumentFees AS NUMERIC(18,2)
    DECLARE @p_TotalInterest AS NUMERIC(18,2)
    DECLARE @i_Month AS INT = 1
    DECLARE @p_Year AS INT = 2015
    DECLARE @i_SHGMemberId AS INT
    BEGIN TRANSACTION DCBGenerated
    BEGIN
    Set @o_ErrorStatus = 0
    SELECT @D_FromDate = DATEADD(MONTH, @i_Month - 1, DATEADD(YEAR, @p_Year - 1900, 0)) --as [START DATE]
    SELECT @D_ToDate = DATEADD(MONTH, @i_Month, DATEADD(YEAR, @p_Year - 1900, -1)) --as [EMD DATE]
    SELECT @i_SHGMemberId = MFDB_SHGMemberId FROM MFDB_SHGMEMBER_MASTER WHERE MFDB_SHGId = @i_SHGId AND MFDB_MemberId = @p_SHGMemberId
    SELECT @p_TempVillageName = MFDB_VillageName,
    @p_TempVillageId = MFDB_VillageId ,
    @p_TempPanchayatId = MFDB_PanchayatId ,
    @p_TempPanchayatName = MFDB_PanchayatName
    FROM MFDB_SHG_MASTER WHERE MFDB_SHGId = @i_SHGId
    /* Drop and Create TempCollection Table. This table has all installments for a given member */
    CREATE TABLE #TEMPDCBCOLLECTION
    [MFDB_LedgerNumber] [int] IDENTITY(1,1) NOT NULL,
    [MFDB_StateId] [int] NOT NULL,
    [MFDB_RegionId] [int] NOT NULL,
    [MFDB_BranchId] [int] NOT NULL,
    [MFDB_SHGId] [int] NOT NULL,
    [MFDB_SHGName] [varchar](75) NOT NULL,
    [MFDB_ShgMemberId] [int] NOT NULL,
    [MFDB_MemberName] [varchar](50) NOT NULL,
    [MFDB_LoanNumber] [int] NOT NULL,
    [MFDB_LoanAmount] [int] NOT NULL
    ) ON [PRIMARY]
    /* Drop and Create TempCollection Table. This table has all installments for a given member */
    ;WITH CTE_1 AS
    SELECT CT.MFDB_StateId AS StateId,
    CT.MFDB_RegionId AS RegionId,
    CT.MFDB_BranchId AS BranchId,
    CT.MFDB_SHGId AS ShgId,
    SM.MFDB_SHGName AS ShgName,
    CT.MFDB_SHGMemberId AS SHGMemberId,
    SMM.MFDB_MemberName AS MemberName,
    CT.MFDB_LoanNumber AS LoanNumber,
    LM.MFDB_LoanAmount AS LoanAmount
    FROM dbo.MFDB_COLLECTION_TXN CT
    LEFT JOIN dbo.MFDB_COLLECTION_AUDIT CA
    On CT.MFDB_SHGId = CA.MFDB_SHGId
    And CT.MFDB_MemberId = CA.MFDB_MemberId
    And CT.MFDB_LoanNumber = CA.MFDB_LoanNumber
    And CT.MFDB_CollectionId = CA.MFDB_CollectionId
    And CT.MFDB_LSourceId = CA.MFDB_LSourceId
    INNER JOIN dbo.MFDB_SHG_MASTER SM
    On CT.MFDB_SHGId = SM.MFDB_SHGId
    INNER JOIN dbo.MFDB_SHGMEMBER_MASTER SMM
    On CT.MFDB_SHGId = SMM.MFDB_SHGId
    And CT.MFDB_SHGMemberId = SMM.MFDB_SHGMemberId
    INNER JOIN dbo.MFDB_LOANAPPLICATION_MASTER LM
    ON LM.MFDB_SHGId = CT.MFDB_SHGId
    AND LM.MFDB_ShgMemberId = CT.MFDB_ShgMemberId
    AND LM.MFDB_LoanNumber = CT.MFDB_LoanNumber
    Where DATEDIFF(DAY,MFDB_CollectionDate,@i_DayOpenDate) = 0
    And CT.MFDB_CollectionAmount > 0
    And CT.MFDB_CollApprovedBy IS NULL
    AND CT.MFDB_BranchId = @i_BranchId
    AND CT.MFDB_SHGId = @i_SHGId
    AND CT.MFDB_ShgMemberId = @i_SHGMemberId
    AND CT.MFDB_LoanNumber = @i_LoanNumber
    CTE_2 AS
    SELECT DISTINCT
    StateId,
    RegionId,
    BranchId,
    ShgId,
    ShgName,
    SHGMemberId,
    MemberName,
    LoanNumber,
    LoanAmount
    FROM CTE_1
    INSERT INTO #TEMPDCBCOLLECTION ([MFDB_StateId],[MFDB_RegionId],[MFDB_BranchId],[MFDB_SHGId],[MFDB_SHGName],[MFDB_ShgMemberId],[MFDB_MemberName],[MFDB_LoanNumber],[MFDB_LoanAmount])
    SELECT StateId,
    RegionId,
    BranchId,
    ShgId,
    ShgName,
    SHGMemberId,
    MemberName,
    LoanNumber,
    LoanAmount
    FROM CTE_2
    DECLARE DCBMonthCursor CURSOR FOR
    SELECT [MFDB_StateId],
    [MFDB_RegionId],
    [MFDB_BranchId],
    [MFDB_SHGId],
    [MFDB_SHGName],
    [MFDB_ShgMemberId],
    [MFDB_MemberName],
    [MFDB_LoanNumber],
    [MFDB_LoanAmount]
    FROM #TEMPDCBCOLLECTION
    OPEN DCBMonthCursor
    FETCH NEXT FROM DCBMonthCursor
    INTO @p_TempStateId ,
    @p_TempRegionId ,
    @p_TempBranchId ,
    @p_TempSHGId ,
    @p_TempSHGName ,
    @p_TempSHGMemberId ,
    @p_TempMemberName ,
    @p_TempLoanNumber ,
    @p_TempLoanAmount
    WHILE (@@FETCH_STATUS = 0)
    BEGIN
    Set @p_TotalInterest = 0
    Select @p_TotalInterest = SUM(MFDB_StdInterest) From MFDB_LOAN_DISBURSEMENT Where MFDB_SHGId = @p_TempSHGId And MFDB_ShgMemberId = @p_TempSHGMemberId And MFDB_LoanNumber = @p_TempLoanNumber
    ;With
    CTE_1 AS
    SELECT LM.MFDB_StateId AS StateId ,
    LM.MFDB_RegionId AS RegionId,
    LM.MFDB_BranchId AS BranchId,
    LM.MFDB_SHGId AS SHGId,
    SM.MFDB_SHGName AS SHGName,
    LM.MFDB_ShgMemberId AS SHGMemId,
    LM.MFDB_MemberName AS MemberName,
    SM.MFDB_VillageId AS VillageId,
    LM.MFDB_LoanNumber AS LoanNo,
    LM.MFDB_LoanAmount AS LoanAmount,
    LM.MFDB_DisburseDate AS DisbursedDate,
    ISNULL((SELECT LD.MFDB_DemandDate
    FROM dbo.MFDB_LOAN_DISBURSEMENT LD
    Where LD.MFDB_SHGId = LM.MFDB_SHGId
    And LD.MFDB_ShgMemberId = LM.MFDB_ShgMemberId
    And LD.MFDB_LoanNumber = LM.MFDB_LoanNumber
    And DATEDIFF(DAY,LD.MFDB_DemandDate,@i_DayOpenDate) = 0
    And LD.MFDB_ApprovalStatus = 1 ),NULL) AS DemandDate,
    ISNULL((SELECT TOP 1 CT.MFDB_CollectionDate
    FROM dbo.MFDB_COLLECTION_TXN CT
    Inner Join dbo.MFDB_COLLECTION_AUDIT CA
    On CT.MFDB_SHGId = CA.MFDB_SHGId
    And CT.MFDB_ShgMemberId = CA.MFDB_ShgMemberId
    And CT.MFDB_LoanNumber = CA.MFDB_LoanNumber
    And CT.MFDB_LSourceId = CA.MFDB_LSourceId
    And CT.MFDB_CollectionId = CA.MFDB_CollectionId
    WHERE CT.MFDB_SHGId = LM.MFDB_SHGId
    AND CT.MFDB_ShgMemberId = LM.MFDB_ShgMemberId
    AND CT.MFDB_LoanNumber = LM.MFDB_LoanNumber
    And DATEDIFF(DAY,CT.MFDB_CollectionDate,@i_DayOpenDate) = 0
    ORDER BY CA.MFDB_CollectionId DESC),NULL) AS CollectionDate,
    ISNULL((SELECT TOP 1 CA.MFDB_InstallmentNumber
    FROM dbo.MFDB_COLLECTION_AUDIT CA
    Inner Join dbo.MFDB_COLLECTION_TXN CT
    On CT.MFDB_SHGId = CA.MFDB_SHGId
    And CT.MFDB_ShgMemberId = CA.MFDB_ShgMemberId
    And CT.MFDB_LoanNumber = CA.MFDB_LoanNumber
    And CT.MFDB_LSourceId = CA.MFDB_LSourceId
    And CT.MFDB_CollectionId = CA.MFDB_CollectionId
    WHERE CA.MFDB_SHGId = LM.MFDB_SHGId
    AND CA.MFDB_ShgMemberId = LM.MFDB_ShgMemberId
    AND CA.MFDB_LoanNumber = LM.MFDB_LoanNumber
    And DATEDIFF(DAY,CT.MFDB_CollectionDate,@i_DayOpenDate) = 0
    ORDER BY CA.MFDB_CollectionId DESC),
    ISNULL((SELECT LD.MFDB_InstallmentNumber
    FROM dbo.MFDB_LOAN_DISBURSEMENT LD
    Where LD.MFDB_SHGId = LM.MFDB_SHGId
    And LD.MFDB_ShgMemberId = LM.MFDB_ShgMemberId
    And LD.MFDB_LoanNumber = LM.MFDB_LoanNumber
    And DATEDIFF(DAY,LD.MFDB_DemandDate,@i_DayOpenDate) = 0
    And LD.MFDB_ApprovalStatus = 1 ),0)) AS IntallNo,
    ISNULL(CAST((SELECT TOP 1 NR.MFDB_BalancePrincipal
    FROM dbo.MFDB_NEW_DCB_REPORT NR
    WHERE NR.MFDB_SHGId = LM.MFDB_SHGId
    AND NR.MFDB_ShgMemberId = LM.MFDB_ShgMemberId
    AND NR.MFDB_LoanNumber = LM.MFDB_LoanNumber
    ORDER BY NR.MFDB_LedgerNumber DESC) AS NUMERIC(18,0)),0) AS ArrPrincipal,
    ISNULL(CAST((SELECT TOP 1 NR.MFDB_BalanceInterest
    FROM dbo.MFDB_NEW_DCB_REPORT NR
    WHERE NR.MFDB_SHGId = LM.MFDB_SHGId
    AND NR.MFDB_ShgMemberId = LM.MFDB_ShgMemberId
    AND NR.MFDB_LoanNumber = LM.MFDB_LoanNumber
    ORDER BY NR.MFDB_LedgerNumber DESC) AS NUMERIC(18,0)),0) AS ArrInterest,
    0 AS CurrDemandPrin,
    0 AS CurrDemandInt,
    ISNULL((SELECT CAST(SUM(ISNULL(CA.MFDB_CollectedPrincipal,0) +
    ISNULL(CA.MFDB_AdvancePrincipal,0) +
    ISNULL(CA.MFDB_ArrearPrincipal,0)) AS NUMERIC(18,0))
    FROM dbo.MFDB_COLLECTION_AUDIT CA
    Inner Join dbo.MFDB_COLLECTION_TXN CT
    On CT.MFDB_SHGId = CA.MFDB_SHGId
    And CT.MFDB_ShgMemberId = CA.MFDB_ShgMemberId
    And CT.MFDB_LoanNumber = CA.MFDB_LoanNumber
    And CT.MFDB_LSourceId = CA.MFDB_LSourceId
    And CT.MFDB_CollectionId = CA.MFDB_CollectionId
    WHERE CA.MFDB_SHGId = LM.MFDB_SHGId
    AND CA.MFDB_ShgMemberId = LM.MFDB_ShgMemberId
    AND CA.MFDB_LoanNumber = LM.MFDB_LoanNumber
    And DATEDIFF(DAY,CT.MFDB_CollectionDate,@i_DayOpenDate) = 0
    ),0) AS CurrCollPri,
    ISNULL((SELECT CAST(SUM(ISNULL(CA.MFDB_CollectedInterest,0) +
    ISNULL(CA.MFDB_AdvanceInterest,0) +
    ISNULL(CA.MFDB_ArrearInterest,0)) AS NUMERIC(18,0))
    FROM dbo.MFDB_COLLECTION_AUDIT CA
    Inner Join dbo.MFDB_COLLECTION_TXN CT
    On CT.MFDB_SHGId = CA.MFDB_SHGId
    And CT.MFDB_ShgMemberId = CA.MFDB_ShgMemberId
    And CT.MFDB_LoanNumber = CA.MFDB_LoanNumber
    And CT.MFDB_LSourceId = CA.MFDB_LSourceId
    And CT.MFDB_CollectionId = CA.MFDB_CollectionId
    WHERE CA.MFDB_SHGId = LM.MFDB_SHGId
    AND CA.MFDB_ShgMemberId = LM.MFDB_ShgMemberId
    AND CA.MFDB_LoanNumber = LM.MFDB_LoanNumber
    And DATEDIFF(DAY,CT.MFDB_CollectionDate,@i_DayOpenDate) = 0
    ),0) AS CurrCollInt,
    ISNULL(CAST((SELECT TOP 1 NR.MFDB_AdvCBPrincipal
    FROM dbo.MFDB_NEW_DCB_REPORT NR
    WHERE NR.MFDB_SHGId = LM.MFDB_SHGId
    AND NR.MFDB_ShgMemberId = LM.MFDB_ShgMemberId
    AND NR.MFDB_LoanNumber = LM.MFDB_LoanNumber
    ORDER BY NR.MFDB_LedgerNumber DESC) AS NUMERIC(18,0)),0) AS AdvOBPri,
    ISNULL(CAST((SELECT TOP 1 NR.MFDB_AdvCBInterest
    FROM dbo.MFDB_NEW_DCB_REPORT NR
    WHERE NR.MFDB_SHGId = LM.MFDB_SHGId
    AND NR.MFDB_ShgMemberId = LM.MFDB_ShgMemberId
    AND NR.MFDB_LoanNumber = LM.MFDB_LoanNumber
    ORDER BY NR.MFDB_LedgerNumber DESC) AS NUMERIC(18,0)),0) AS AdvOBInt,
    0 AS AdvCBPri,
    0 AS AdvCBInt,
    0 AS BalancePri,
    0 AS BalanceInt,
    ISNULL((SELECT CAST(SUM(ISNULL(CA.MFDB_CollectedPrincipal,0) +
    ISNULL(CA.MFDB_AdvancePrincipal,0) +
    ISNULL(CA.MFDB_ArrearPrincipal,0)) AS NUMERIC(18,0))
    FROM dbo.MFDB_COLLECTION_AUDIT CA
    Inner Join dbo.MFDB_COLLECTION_TXN CT
    On CT.MFDB_SHGId = CA.MFDB_SHGId
    And CT.MFDB_ShgMemberId = CA.MFDB_ShgMemberId
    And CT.MFDB_LoanNumber = CA.MFDB_LoanNumber
    And CT.MFDB_LSourceId = CA.MFDB_LSourceId
    And CT.MFDB_CollectionId = CA.MFDB_CollectionId
    WHERE CA.MFDB_SHGId = LM.MFDB_SHGId
    AND CA.MFDB_ShgMemberId = LM.MFDB_ShgMemberId
    AND CA.MFDB_LoanNumber = LM.MFDB_LoanNumber
    And DATEDIFF(DAY,CT.MFDB_CollectionDate,@i_DayOpenDate) >= 0
    ),0) AS OS_Pri,
    ISNULL((SELECT CAST(SUM(ISNULL(CA.MFDB_CollectedInterest,0) +
    ISNULL(CA.MFDB_AdvanceInterest,0) +
    ISNULL(CA.MFDB_ArrearInterest,0)) AS NUMERIC(18,0))
    FROM dbo.MFDB_COLLECTION_AUDIT CA
    Inner Join dbo.MFDB_COLLECTION_TXN CT
    On CT.MFDB_SHGId = CA.MFDB_SHGId
    And CT.MFDB_ShgMemberId = CA.MFDB_ShgMemberId
    And CT.MFDB_LoanNumber = CA.MFDB_LoanNumber
    And CT.MFDB_LSourceId = CA.MFDB_LSourceId
    And CT.MFDB_CollectionId = CA.MFDB_CollectionId
    WHERE CA.MFDB_SHGId = LM.MFDB_SHGId
    AND CA.MFDB_ShgMemberId = LM.MFDB_ShgMemberId
    AND CA.MFDB_LoanNumber = LM.MFDB_LoanNumber
    And DATEDIFF(DAY,CT.MFDB_CollectionDate,@i_DayOpenDate) >= 0
    ),0) AS OS_Int,
    0 AS RepaymentPercentage,
    LM.MFDB_LoanSchemeId AS LoanProduct,
    LM.MFDB_LActivityId AS LoanActivity,
    LM.MFDB_LActSpecId AS LoanSubActivity,
    LM.MFDB_FundingAgencyId AS FundAgencyId,
    LM.MFDB_LSourceId AS SourceId
    FROM dbo.MFDB_LOANAPPLICATION_MASTER LM
    Left Join dbo.MFDB_SHG_MASTER SM
    On SM.MFDB_ShgId = LM.MFDB_ShgId
    WHERE LM.MFDB_ApprovalStatus= 3
    AND LM.MFDB_DisburseDate IS NOT NULL
    AND LM.MFDB_StateId = @p_TempStateId
    AND LM.MFDB_RegionId = @p_TempRegionId
    AND LM.MFDB_BranchId = @p_TempBranchId
    AND LM.MFDB_SHGId = @p_TempSHGId
    AND LM.MFDB_ShgMemberId = @p_TempSHGMemberId
    AND LM.MFDB_LoanNumber = @p_TempLoanNumber
    CTE_2 AS
    SELECT StateId, RegionId, BranchId, SHGId, SHGName, SHGMemId, MemberName, VillageId , LoanNo, LoanAmount, DisbursedDate,DemandDate, CollectionDate, IntallNo,
    ArrPrincipal,
    ArrInterest,
    CurrDemandPrin,
    CurrDemandInt,
    ISNULL(ISNULL(ArrPrincipal,0) + ISNULL(CurrDemandPrin,0),0) AS TotDemandPri,
    ISNULL(ISNULL(ArrInterest,0) + ISNULL(CurrDemandInt,0),0) AS TotDemandInt,
    AdvOBPri,
    AdvOBInt,
    CurrCollPri,
    CurrCollInt,
    AdvCBPri,
    AdvCBInt,
    BalancePri,
    BalanceInt,
    ISNULL(ISNULL(LoanAmount,0) - ISNULL(OS_Pri,0),0) AS OS_Pri,
    ISNULL(ISNULL(@p_TotalInterest,0) - ISNULL(OS_Int,0),0) OS_Int,
    CONVERT(INT,RepaymentPercentage) AS RepaymentPercentage,
    LoanProduct,
    LoanActivity,
    LoanSubActivity,
    FundAgencyId,
    SourceId
    FROM CTE_1
    CTE_3 AS
    SELECT StateId, RegionId, BranchId, SHGId, SHGName, SHGMemId, MemberName, VillageId , LoanNo, LoanAmount, DisbursedDate,DemandDate, CollectionDate, IntallNo,
    ArrPrincipal,
    ArrInterest,
    CurrDemandPrin,
    CurrDemandInt,
    TotDemandPri,
    TotDemandInt,
    CASE WHEN AdvOBPri < 0 THEN AdvOBPri * -1 ELSE AdvOBPri END AS AdvOBPri,
    CASE WHEN AdvOBInt < 0 THEN AdvOBInt * -1 ELSE AdvOBInt END AS AdvOBInt,
    CurrCollPri,
    CurrCollInt,
    CASE WHEN ISNULL(TotDemandPri,0) = 0 THEN ISNULL((CurrCollPri + AdvOBPri),0)
    WHEN ISNULL(TotDemandPri,0) > 0 AND ISNULL(CurrCollPri + AdvOBPri,0) > ISNULL(TotDemandPri,0) THEN ISNULL(ISNULL(CurrCollPri + AdvOBPri,0) - ISNULL(TotDemandPri,0),0)
    WHEN ISNULL(TotDemandPri,0) > 0 AND ISNULL(CurrCollPri + AdvOBPri,0) < ISNULL(TotDemandPri,0) THEN 0
    WHEN ISNULL(CurrCollPri + AdvOBPri,0) = ISNULL(TotDemandPri,0) THEN 0
    ELSE 0 END AS AdvCBPri,
    CASE WHEN ISNULL(TotDemandInt,0) = 0 THEN ISNULL((CurrCollInt + AdvOBInt),0)
    WHEN ISNULL(TotDemandInt,0) > 0 AND ISNULL(CurrCollInt + AdvOBInt,0) > ISNULL(TotDemandInt,0) THEN ISNULL(ISNULL(CurrCollInt + AdvOBInt,0) - ISNULL(TotDemandInt,0),0)
    WHEN ISNULL(TotDemandInt,0) > 0 AND ISNULL(CurrCollInt + AdvOBInt,0) < ISNULL(TotDemandInt,0) THEN 0
    WHEN ISNULL(CurrCollInt + AdvOBInt,0) = ISNULL(TotDemandInt,0) THEN 0
    ELSE 0 END AS AdvCBInt,
    0 AS BalancePri,
    0 AS BalanceInt,
    OS_Pri,
    OS_Int,
    0 AS Repayment,
    LoanProduct,
    LoanActivity,
    LoanSubActivity,
    FundAgencyId,
    SourceId,
    CONVERT(CHAR(3), @i_DayOpenDate, 0) + ' - ' + RIGHT(CONVERT(CHAR(4), YEAR(@i_DayOpenDate)),2) AS Months
    FROM CTE_2
    INSERT INTO dbo.MFDB_NEW_DCB_REPORT
    ( [MFDB_TxnDate]
    ,[MFDB_StateId]
    ,[MFDB_RegionId]
    ,[MFDB_BranchId]
    ,[MFDB_SHGId]
    ,[MFDB_SHGName]
    ,[MFDB_ShgMemberId]
    ,[MFDB_MemberName]
    ,[MFDB_VillageId]
    ,[MFDB_LoanNumber]
    ,[MFDB_LoanAmount]
    ,[MFDB_DisbursedDate]
    ,[MFDB_DemandDate]
    ,[MFDB_CollectionDate]
    ,[MFDB_InstallmentNumber]
    ,[MFDB_ArrearPrincipal]
    ,[MFDB_ArrearInterest]
    ,[MFDB_DemandPrincipal]
    ,[MFDB_DemandInterest]
    ,[MFDB_TotDemandPrincipal]
    ,[MFDB_TotDemandInterest]
    ,[MFDB_AdvOBPrincipal]
    ,[MFDB_AdvOBInterest]
    ,[MFDB_CollectedPrincipal]
    ,[MFDB_CollectedInterest]
    ,[MFDB_AdvCBPrincipal]
    ,[MFDB_AdvCBInterest]
    ,[MFDB_BalancePrincipal]
    ,[MFDB_BalanceInterest]
    ,[MFDB_OS_Pri]
    ,[MFDB_OS_Int]
    ,[MFDB_RepaymentPercentage]
    ,[MFDB_LoanSchemeId]
    ,[MFDB_LActivityId]
    ,[MFDB_LActSpecId]
    ,[MFDB_FundAgencyId]
    ,[MFDB_LSourceId]
    ,[MFDB_Months]
    ,[MFDB_PanchayatId]
    ,[MFDB_PanchayatName]
    ,[MFDB_VillageName]
    SELECT @i_DayOpenDate ,StateId, RegionId, BranchId, SHGId, SHGName, SHGMemId, MemberName, VillageId , LoanNo, LoanAmount, DisbursedDate,DemandDate,CollectionDate,IntallNo,
    ArrPrincipal,ArrInterest,CurrDemandPrin,CurrDemandInt,TotDemandPri,TotDemandInt,AdvOBPri,AdvOBInt,CurrCollPri,CurrCollInt,
    CASE WHEN AdvCBPri < 0 THEN 0 ELSE AdvCBPri END,
    CASE WHEN AdvCBInt < 0 THEN 0 ELSE AdvCBInt END,
    CASE WHEN ISNULL(TotDemandPri,0) = 0 THEN 0
    WHEN ISNULL(TotDemandPri,0) > 0 AND ISNULL(CurrCollPri + AdvOBPri,0) > ISNULL(TotDemandPri,0) THEN 0
    WHEN ISNULL(TotDemandPri,0) > 0 AND ISNULL(CurrCollPri + AdvOBPri,0) < ISNULL(TotDemandPri,0) THEN ABS(ISNULL(ISNULL(CurrCollPri + AdvOBPri,0) - ISNULL(TotDemandPri,0),0) * -1)
    WHEN ISNULL(CurrCollPri + AdvOBPri,0) = ISNULL(TotDemandPri,0) THEN 0
    ELSE 0 END AS BalancePri,
    CASE WHEN ISNULL(TotDemandInt,0) = 0 THEN 0
    WHEN ISNULL(TotDemandInt,0) > 0 AND ISNULL(CurrCollInt + AdvOBInt,0) > ISNULL(TotDemandInt,0) THEN 0
    WHEN ISNULL(TotDemandInt,0) > 0 AND ISNULL(CurrCollInt + AdvOBInt,0) < ISNULL(TotDemandInt,0) THEN ABS(ISNULL(ISNULL(CurrCollInt + AdvOBInt,0) - ISNULL(TotDemandInt,0),0) * -1)
    WHEN ISNULL(CurrCollInt + AdvOBInt,0) = ISNULL(TotDemandInt,0) THEN 0
    ELSE 0 END AS BalanceInt,
    OS_Pri,
    OS_Int,
    0 AS Repayment,
    LoanProduct,LoanActivity,LoanSubActivity,FundAgencyId,SourceId,Months,@p_TempPanchayatId,@p_TempPanchayatName,@p_TempVillageName
    FROM CTE_3
    If @@Error != 0
    Begin
    Set @o_ErrorStatus = 1
    ROLLBACK TRANSACTION DCBGenerated
    RETURN
    End
    FETCH NEXT FROM DCBMonthCursor
    INTO @p_TempStateId ,
    @p_TempRegionId ,
    @p_TempBranchId ,
    @p_TempSHGId ,
    @p_TempSHGName ,
    @p_TempSHGMemberId ,
    @p_TempMemberName ,
    @p_TempLoanNumber ,
    @p_TempLoanAmount
    END
    CLOSE DCBMonthCursor
    DEALLOCATE DCBMonthCursor
    DELETE FROM #TEMPDCBCOLLECTION
    If @@Error != 0
    Begin
    Set @o_ErrorStatus = 1
    ROLLBACK TRANSACTION DCBGenerated
    RETURN
    End
    END
    COMMIT TRANSACTION DCBGenerated

  • Convert date/time to a value in second

    Hello,
    I want to convert a basic date time variable into a numeric one corresponding to the time (in second) passed since January,1,1970 in order to put it in a SQL statment as a criteria.
    Is someone able to help me ?
    Regards

    If you have an java.util.Date object you can call getTime() method on it. It will return milliseconds. Just divide it on 1000. Here is example code:
    java.util.Date date = new java.util.GregorianCalendar(2001, 7, 6).getTime();
    long seconds = date.getTime() / 1000;
    //Your code
    Best regards, Alex.

Maybe you are looking for

  • High volume Printing for GLM?

    I understand from various sources GLM can support high volume label output provided the correct enhancements and support packs are installed and configured.  This may include updates to WWI.  We are currently running ECC6 EHP5, SAP_BASIS 10, EHSM 3,

  • Moving a Time Machine backup from a directly connected external disk to that disk on OSX Server

    I have an iMac that has been using an external drive for Time Machine (TM) backups since 2013, so there is a lot of history in the backups.  I now have a Mac Mini running OS X Server, and would like to transfer the drive to the Mac Mini, but continue

  • Using Message ID in the SOAP header (Sender)

    Hi Experts, The scenario is SOAP to IDoc. We have requirement to insert the Message ID in the SOAP header for avoiding duplicate messages from the SOAP client. Please note SOAP client is unable to support URL parameter, so we have to use Message ID i

  • IPhoto pictures appear grainy

    I am new to this forum and am in no way an expert on computers or photography- so excuse any stupidity in my questions. All photos that I have uploaded to iPhoto appear grainy, blurry and appear to have problems with highlights and just appear very b

  • Zooming out in iweb

    I'm designing a webpage that is much larger than my monitor. How can I zoom out, so I can view the entire contents to proportion the page?