Convert UOM to Cases

Hi ABAP Experts,
Please let me know the Function Module name where in we can convert UOM (Unit of Measure) to Cases.
u2022     Outbound Delivery will have unique Shipping Point and the u201CPIECESu201D value will be a summation of the ordered quantities per line item. Unit of Measure for all the line items needs to be converted to Cases individually. This value of ordered quantities needs to be transmitted to TMS in cases but the Unit of Measure will not be transmitted.
How can this be achieved? Please provide your inputs. Thanks!
-Sowmya

FM's MD_CONVERT_MATERIAL_UNIT and MATERIAL_UNIT_CONVERSION are not working properly.
The value was 20.00 before. After calling the FM, it is changing to 0.0
I'm using like this:
CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'
    EXPORTING
      I_MATNR                    = TAB_LIPS-MATNR
      I_IN_ME                    = TAB_LIPS-MEINS "Base Unit of Measure
      I_OUT_ME                   = LC_C01         "Cases
      I_MENGE                    = TAB_LIPS-LFIMG "Actual quantity delivered (in sales units)
    IMPORTING
      E_MENGE                    = LTAB_LIPS-LFIMG
    EXCEPTIONS
     ERROR_IN_APPLICATION       = 1
     ERROR                      = 2
     OTHERS                     = 3
  IF SY-SUBRC <> 0.
  ENDIF.
Please do help. How to convert UOM to Cases?
Thanks,
Sowmya

Similar Messages

  • Inventory Report-Replacement path for Base UOM to Case and Standrad Cost

    Hi, We have a Scenario as below:
    Question1:
    We have a multiprovider contains 4 infocubes and 2 Master Data objects
    a.Demand
    b.Inventory
    c.Sales Orders
    d.In Transit
    Master Data objects
    a. Material (contains Base UOM to Case as Key Figure Attribute and also Base UOM as an attribute)
    b. Material Location (Contains material as an attribute and also Standard Cost as a Key Figure attribute)
    At the report level two formula variables are defined with replacement path for showing the Base UOM to Case and Standard Cost in columns.
    We have 4 reports on this multiprovider. There is a dialy sales report which gives the following details
    Material, Location, MRP Controller, CalDay, Base UOM, Actual Sales(AS), Dependent Demand(DD), Consumption Qyt(CQ), Base to Case UOM, Standard Cost
    In this report for all the records the Base to UOM and Standard Cost column is coming with values which is nothing but the replacement path on the material master key figure attribute. Though this report is on the multiprovider all the major keyfigures (AS, DD and CQ) are coming from a single cube( this is an observation from myside).
    We have another report which is the Inventory Report with the following details:
    Material, Location, MRP Controllder, Calday, Base UOM,      Unrestricted Inventory(UI), committed Inventory(CI), Back Order Qty(BOQ), In Transit by Sh/Rec(ITS), In Transit Pipeline(ITP), On Order Qty (OOQ), Current Inventory Position (CIP), Quality Inspection Stock(QIS), Block Stock(BS), Base to Case UOM, Standard Cost
    Now in this report for all the records the Base to Case UOM and standrad cost is not showing up. Is there anything which needs to be done in order to get the Base to Case UOM and standard cost for all the records.
    Question2:
    When Non-Cumulative and Cumulative key figures are combined at the multi provider and also at the report level, will there be any problem?
    Regards
    Vijay

    Hi,
    I think you can proceed with virtual characteristics for this.In the code you can truncate the time and you can display on the date:
    Regards
    Prasad

  • ISE 1.2 - Guest Account converted to lower-case automatically

    Hello
    I have an ISE appliance version 1.2 and sponsor portal
    I create accounts with upper case username and upper case password, but Sponsor portal convert it to lower case.
    I try to login with lower case or upper case. I can't login with both.

    Check the Multiport configurations and HTML page settings for converting the Alphabetic-Cases.:
    You can check the below link for step by step configuration of HTML-Page’s setting:
    Link-1
    http://www.cisco.com/en/US/docs/security/ise/1.2/user_guide/ise_custom_portals.html
    Link-2
    http://www.cisco.com/en/US/docs/security/ise/1.0/sponsor_guide/ise10_sponsor.html#wp1069407

  • Problem in converting into upper case urgent

    hi,
    i  working on module pool program.
    in the initial screen there is two fields one is number one is name.
    if i enter the name in the name field it is automatically converting into upper case,
    but in this case my select query is not working,how to solve this,i mean i have to take same as it is what i entered.
    kindly give me suggestion.it is urgent issue.i have to delever today.
    Thanks,
    mohan.

    hi
    in the Report to handle like this situation.. we use the extentions to the parameter  as  LOWER CASE .
    parameters p_t type char10 LOWER CASE .
    i think in the Module pool also.. we can do this in Properties of the FIELD... once check the Properties of the field... there  could be a chance.
    hi
    <b>there is field <b>checkbox called UPPER/LOWER CASE</b>at the bottom of the properties... if tick this u r porblem will be solved</b>
    Please Close this thread.. when u r problem is solved
    Reward if Helpful
    Regards
    Naresh Reddy K
    Message was edited by:
            Naresh Reddy

  • Value converting to upper case

    Hi,
    There is a table control, but when i am taking a value from the table in PAI of my screen, the value gets converted to upper case, can any one suggest me what would be happening. Is there any way to control this?
    Thanks in Advance,
    kushagra sharma

    Hi Sharma,
    Go to the screen painter for the table control screen, go to the screen attributes of the field (field you want to restrict the case change) and check the check box Upper/Lower case.
    Hope this may help you.
    Regards,
    Smart Varghese

  • [IDCS2-PC] PMString - convert to upper case

    Hi everybody,
    does somebody meet the problem that some of character couldn't be converted to upper case.
    I have
    PMString initialized with text
    "lørdag". When I call function
    ToUpper() I got
    "LøRDAG", where there is one character in lower case which wasn't transformed.
    Do somebody know why and which function should I used instead of that to be succesfull?
    ThanX,
    pyso

    Hi everybody,
    I've just found a solution. In SDK there is probably error because
    PMString.ToUpper() doesn't work well but
    WideString.ToUpper() works fine.
    bye,
    pyso

  • FM TO Get the Convert UOM

    Hi Experts
    IN QP03 Inspection Plan Charcterstics there is filed called UOM (MASSEINHSW) actually in Screen it is KG\cm2 but in table it is stored as +KGC+.
    In Program it is displying as KGC but i need to display kg\cm2 any FM to Convert this.
    Rgards
    Jagadish

    Hi,
    Check these below FM's
    CIF_GEN_CONVERT_BASE_UOM
    ISA_CONVERT_UOM
    CONVERSION_EXIT_SUOM_OUTPUT    HU number output conversion exit
    OIG_F_CONVERT_UOM_FOR_SCD      TD-F convert UOM for scd-calculation to different UOM        
    OIU_QCI_CONVERT_UOM            Convert units of measurement
    Regards,
    Jyothi CH.

  • RE: Converting to mixed case.

    >
    I recall seeing a method that would convert all upper or all lower case to
    mixed case. Does this sound familiar to anyone?
    Hello Everyone
    I've developed a single Domain Class to support this behavior. With this
    Domain Class you can choice to convert to mixed case each word of the
    text or only the initial word and the word after a period by setting the
    value of the ToUpdateEachWord attribute (boolean).
    Here is an example of this domain class.
    I hope this help you.
    Victor Navarro
    [email protected]

    we have a database which I want to use as the source for generating a Java API, and I need/want the Java classes and attributes to be (automatically) created with mixed case names. At the same time we have existing applications and scripts that access the database, and these assume case insensitive table and column names.Not sure if I got you right, but how about creating views as e.g in
    SQL> create or replace view "Dept"
      2  as
      3     select deptno "Deptno", dname "Dname", loc "Loc" from dept
      4  /
    View created.This will allow you to continue to query in case insensitive manner as well as case sensitive:
    SQL>
    SQL> select * from dept
      2  /
             DEPTNO DNAME          LOC
                 10 ACCOUNTING     NEW YORK
                 20 RESEARCH       DALLAS
                 30 SALES          CHICAGO
                 40 OPERATIONS     BOSTON
    SQL> select * from "Dept"
      2  /
             Deptno Dname          Loc
                 10 ACCOUNTING     NEW YORK
                 20 RESEARCH       DALLAS
                 30 SALES          CHICAGO
                 40 OPERATIONS     BOSTON
    SQL>As I understand, you could use the views (instead of the tables) to automatically generate mixed case classes while continuing to have case insensitve queries?!

  • Password Is Converted to Upper Case in WAS 7.0

    Hi Friends,
           I have a requirment where in we are using some funcation modules for User authontication  . The import parameter for password is converting the password into upper case . Is there any way that i can do some settings or use a data type that allows me to take the password as it is with out converting into upper case.
    We are working on WAS 7.0.
    Thanks,
    Mahesh

    Hi Ravi,
        I have done what ever u have suggested and it works...
       Is there any setting that we can do so that the Upper/Lower case Check box is checked by default when executing the FM from se37.
    Thanks
    Mahesh

  • Hi one pressing enter the fields are converted to upper case

    hi
    in table maintiance module pool program i have created thre are three fields
    kunnr name1 and email id
    now on pressing enter on maintiance screen the all the theree fields are converted to upper case i want to avoid this conversion to upper case....
    pls suggest
    and on pressing enter PAI is callled i want to avoid pai being called at this point of time
    regards
    Arora

    yes i have activated the table
    for tabel mantiance generater it is coming as disble so i suppose no need to gernereate table mantiance gerneartor again/
    ys in dynpro for shp to name uppe or lower case check box is checked but it is coming as disabled.
    pls suggest  how to delect it and wht does upper/lower case check box in special attributed means?
    regards
    nishant

  • When pressing enter the values are converted to upper case in module pool

    hi
    tehre are three fields for maintanece in module pool
    wheni press enter the fields are converted to upper case i want to avoid this as i dont want to have the upper case
    i need to save in table as waht user has inputed not in upper case
    so i dont want the fields to be automatically converted to upper case whne pressing enter on screen
    regards
    Nishant

    hi Nishant ,
    <b>The solution to ur problem is breifly explained with a sample module pool program .</b>check it below :
    IN the TOP INCLUDE**********************
    DATA :
           wempid TYPE z7684dp-empid ,   " same name as in the screen declaration
           wname TYPE  z7684dp-name,
           wacc TYPE  z7684dp-account,
           wdesg TYPE  z7684dp-designation,
           ok_code TYPE sy-ucomm ,
           wa_z7684dp TYPE z7684dp,
           t_z7684dp TYPE STANDARD TABLE OF z7684dp,
    *****IN THE PAI OF THE SCREEN 100(for example)***********
    MODULE user_command_0100 INPUT.
      CASE ok_code .
        WHEN 'CRE' .                 " function code for the pushbotton to insert the values
    TRANSLATE wdesg TO LOWER CASE.
    TRANSLATE wempid TO LOWER CASE.
    TRANSLATE wname TO LOWER CASE.
    TRANSLATE wacc TO LOWER CASE.
          wa_z7684dp-empid = wempid .
          wa_z7684dp-name = wname .
          wa_z7684dp-account = wacc .
          wa_z7684dp-designation = wdesg .
          INSERT INTO z7684dp VALUES wa_z7684dp .
          IF sy-subrc EQ 0 .
            MESSAGE 'SUCCESSFUL INSERTION TO TABLE' TYPE 'I' .
          ELSE .
            MESSAGE 'UNSUCCESSFUL INSERTION TO TABLE' TYPE 'I' .
          ENDIF.
          CLEAR: wa_z7684dp , wempid , wname , wacc , wdesg.
    REVERT BACK WITH ANY FURTHUR QUERIES
    <b>DO REWARD WITRH POINTS IF USEFUL :)</b>

  • Special character not being converted to upper case

    Hi all,
    I have an issue with special characters and upper/lower case.
    The character "ü" is in one of the values of an InfoObject and when loading we get an error message for this value. The character "Ü" is in RSKC, but still we are getting an error when loading.
    We are converting the values to upper case in the transfer rules, but this special character is not being converted to upper case...
    We start with the value "Heüringen" and after conversion we have the value "HEüRINGEN" where we want to have "HEÜRINGEN".
    Do you have any idea why this characer is not being converted?
    Any ideas are welcome!
    Best regards,
    TMV

    Hi Praveen,
    What does this module actually do? What kind of characters will the special chars be replaced with?
    Br,
    TMV

  • HP PRIME : convert() bug in CAS mode (firmware 8151)

    Hello,A bug appears when trying to convert units in CAS mode.how to reproduce: go to CAS mode,type: CONVERT(0_K,1_°C)and you will get this result : −272.15_(譕菬⓬璡扱㌁觅ﱅ譖౵譗ࡽ亊訂Ⓛ㰏甃Ⴡʹヲ謆၏ҡ抹謁袔ॄ) as you see somthing goes wrong in unit name... for info : It's the most recent firware (from july 2015) 8151. 

    Please let us know some examples of expressions that you tried, what you expected, and what happened instead.  ALSO please let us know what modes your Prime is in (e.g. RPN Entry mode, or CAS view), because Prime behaves very differently depending on the Home Settings and CAS Settings.  Which app is the currently active app (shown in the display's title bar) can also alter Prime's behavior.  When you let us know these things, we'll be able to discern why you are getting syntax errors.
    If I were a betting man, I'd wager a nickel that the problem is due to your Prime being in RPN mode.  If so, you have to use RPN syntax, not algebraic syntax.  Example: 5_ft, Enter, 1_in, Enter, CONVERT --> 60_in (just like on your HP 48).  Do I win a nickel?
    Disclaimer: I do not work for HP. I'm just another happy HP calculator user.
    -Joe-

  • Converting UOM

    Hi,
            We have difference in UOM in for materials between R/3 and Planning area. We use CT in planning area where as we have M in material master. We don't want to change the Planning area UOM settings as there are many more materials that we are having in CT. BUt the transfer to R/3 is failing even though we maintain the conversion in material master and CIF over to APO.
    How can we convert the CT to M when we transfer data to R/3?
    Thanks.

    Actually the orders moving back from APO to R/3 should be moving in base unit of measure of the material. Base UoM gets CIFed from R/3 to APO. As long as you maintain UoM conversions from base UoM to planning area UoM in the material master, this should work. So using the APO inbound enhancement I mentioned, you can ensure that the product master captures the conversion parameters from base to planning area UoM.
    I would advise maintaining the design discussed above, instead of forcing product master to have base UoM same as planning area UoM, which i think is the solution you have. In this case you would need to manage many R/3 inbound enhancements (you can check in SMOD transaction by search term CIF*)

  • How do i convert the following case statement to a table and still implement it in the store procedure.

    if @CustNo = '0142'          begin              insert #custnos (CustNo, ClientNo)              values ('0142', '1100')                      ,('0142', '1200')                      ,('0142', '1201')                      ,('0142', '1700')                      ,('0142', '1602')                      ,('0142', '1202')                      ,('0142', '1603')                      ,('0142', '2002')          endstore procUSE ODSSupport
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_NULLS ON
    GO
    if exists (select * from dbo.sysobjects where id = object_id(N'dbo.pr_Load_PASOArgusClaims_Work') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    BEGIN
    drop procedure dbo.pr_Load_PASOArgusClaims_Work
    IF OBJECT_ID ('dbo.pr_Load_PASOArgusClaims_Work') IS NOT NULL
    PRINT '<<< FAILED DROPPING PROCEDURE dbo.pr_Load_PASOArgusClaims_Work >>>'
    ELSE
    PRINT '<<< DROP PROCEDURE dbo.pr_Load_PASOArgusClaims_Work >>>'
    END
    GO
    CREATE PROC dbo.pr_Load_PASOArgusClaims_Work
    @BatchNo varchar(7) = null,
    @CustNo char(4) = null,
    @NewBatchNo varchar(7) = null
    AS
    /* Object dbo.pr_Load_PASOArgusClaims_Work 2006234 */
    -- SSR# : 2242
    -- Date : 12/23/2005
    -- Author : Roxy Newbill
    -- Description : Add new PASO BCAT 1602
    -- SSR# 1932 - 2/22/2006 SEN - Add logic to include only ArgusCustNo - 0142
    -- and change PharmacyClaim.ProcessDate to DateWritten
    -- SSR# : 2419
    -- Date : 08/22/2006
    -- Author : Betty Doran
    -- Description : PASO reports project
    -- Correct mapping of Dispense fee amt from 'AmtProfFee' to 'DispenseFee' -
    -- Mapping changed by Argus - did not inform PHP. Used in calcs for mClaimTotAmtCharge and
    -- mClaimAmtAllowed fields.
    -- SSR# : 2496
    -- Date : 06/27/2007
    -- Author : Roxy Newbil
    -- Description : PASO Reporting Project
    -- Add data load for new columns: Prescription No, Drug Name, NDC
    -- SSR# : PEBB PROJECT
    -- Date : 10/13/2009
    -- Author : Tj Meyer
    -- Description : Add BCAT 1201 for new PEBB business--
    -- SSR# : 132707
    -- Date : 12/17/2009
    -- Author : Terry Phillips
    -- Description : PASO Reporting Project
    -- Fix data length issues for Argus_SubGroupId,Argus_PlanCode,vchParticipantId,
    -- vchProviderId
    -- SSR# : 3253
    -- Date : 03/28/2011
    -- Author : Susan Naanes
    -- Description : PrescriptionNo increased in size from 7 to 12 characters
    -- SSR# : SPOCK project
    -- Date : 08/09/2012
    -- Author : Raymond Beckett
    -- Description : Modifed to bring in RxKey from PharmacyClaim instead of using identity value for iRecId
    -- Also, modified to load any new batches since last batch loaded into PASOArgusClaims
    -- if @BatchNo not supplied
    -- Various 'fixes'
    -- - removed grouping from initial query due to unique grouping caused by BatchNo, ClaimNumber, ClaimType
    -- SSR# : TFS 5264 - Premera Remediation -(3997)
    -- Date : 12/21/2012
    -- Author : Satish Pandey
    -- Description : Add BCATs 1202 and 1603 to the Where clause selecting pharmclm.ArgusClientNo as BCAT
    -- SSR# : TFS 10286
    -- Date : 1/15/2014
    -- Author : Raymond Beckett
    -- Description : Add HRI Customer Number and BCAT's. Also add Customer Number and alternate batchno to parameters
    -- Only use '@NewBatchNo' if adding data from missed custno and the batchno already exists in PASOArgusClaims
    -- ITSM Ticket : 1800925
    -- Date : 4/15/2014
    -- Author : Roxy Newbill
    -- Description : Silverton Hospital had new BCAT (2002) with start of 2014 business. This was never accomodated for
    -- Adding this BCAT in so that we can start capturing these claims (Note, special insert being done to capture
    -- all BCAT 2002 claims prior to this fix.)
    -- ITSM Ticket : TFS 14587 -Intel BCAT Remediation
    -- Date : 08/14/2014
    -- Author : Andrew Omofonma
    -- Description : Added BCAT's (1604,& 2103) for Intel
    SET NOCOUNT ON
    DECLARE @iCount int
    create table #tmpArgusWork (
    iRecId int,
    BatchNo varchar (7) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    BatchDateTime datetime NULL ,
    BatchStatus varchar (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    ReadyDateTime datetime NULL ,
    Argus_GroupId varchar (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    Argus_SubGroupId varchar (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    Argus_ClassId varchar (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    Argus_PlanCode varchar (8) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    Argus_BusinessCategory varchar (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    FacetsClaimSubType varchar (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    PASOClaimType varchar (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    vchClaimNumber varchar (14) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    dtPaidDate datetime NULL ,
    dtProcessDate datetime NULL ,
    dtServiceDate datetime NULL ,
    vchParticipantId varchar (14) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    vchProviderId varchar (12) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    vchProviderName varchar (55) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    mClaimTotAmtCharge money NULL ,
    mClaimAmtDiscount money NULL ,
    mClaimAmtAllowed money NULL ,
    mClaimAmtDenied money NULL ,
    mClaimAmtDeduct money NULL ,
    mClaimAmtCoinsurance money NULL ,
    mClaimAmtCopay money NULL ,
    mClaimAmtPaid money NULL ,
    PASO_GroupId varchar (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    PASO_SubGroupId varchar (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    PASO_ClassID varchar (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    PASO_PlanCode varchar (8) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    PASO_BusinessCategory varchar (8) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    RecordStatus varchar (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    ErrorDesc varchar (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    PrescriptionNo char(12) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    DrugName varchar(30)COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    NDC char(11) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    create table #batches (
    BatchNo char(7) not null
    primary key (BatchNo))
    create table #custnos (
    CustNo char(4),
    ClientNo char(5), -- bcats associated with the customer
    primary key (CustNo, ClientNo)
    DECLARE
    @len_Argus_SubGroupId smallint,
    @len_Argus_PlanCode smallint,
    @len_vchParticipantId smallint,
    @len_vchProviderId smallint
    --Get field lengths for the following fields
    SELECT @len_Argus_SubGroupId = 4, --datalength([@tmpArgusWork].[Argus_SubGroupId]),
    @len_Argus_PlanCode = 8, --datalength(@tmpArgusWork.Argus_PlanCode),
    @len_vchParticipantId = 14, --datalength(@tmpArgusWork.vchParticipantId),
    @len_vchProviderId = 12 --datalength(@tmpArgusWork.vchProviderId)
    declare @maxbatch char(7)
    IF @BatchNo IS NULL
    begin
    -- assume normal run. Add ClientNo's and custno's to tables
    insert #custnos (CustNo, ClientNo)
    values ('0142', '1100')
    ,('0142', '1200')
    ,('0142', '1201')
    ,('0142', '1700')
    ,('0142', '1602')
    ,('0142', '1202')
    ,('0142', '1603')
    ,('0142', '2002')
    ,('0142', '1604')
    ,('0142', '2103')
    ,('0669', '*')
    -- get batches loaded since last batch loaded into PASOArgusClaims
    SELECT @maxbatch=Max(BatchNo)
    FROM ODSSupport.dbo.PASOArgusClaims
    declare @dt datetime
    declare @ds datetime
    select @dt = MIN(DateTimeStamp)
    from ODS.dbo.PharmacyClaim_Common
    where BatchNo <= @maxbatch
    and DateTimeStamp > DATEADD(dd,-16,getdate())
    insert #batches (BatchNo)
    select distinct BatchNo
    from ODS.dbo.PharmacyClaim_Common pcc
    inner join #custnos ct
    on ct.CustNo = pcc.ArgusCustNo
    and (
    ct.ClientNo = '*'
    or
    ct.ClientNo = pcc.ArgusClientNo
    where DateTimeStamp > @dt
    ; -- batch may have had a claim altered since last load, drop any batches already loaded into PASOArgusClaims
    with pba as (
    select distinct BatchNo
    from ODSSupport.dbo.PASOArgusClaims
    delete ba
    from #batches ba
    inner join pba
    on pba.BatchNo = ba.BatchNo
    end
    else if @NewBatchNo is not null and @CustNo is not null
    begin
    --make sure we haven't already done this batch number/customer combination
    set @maxbatch = @NewBatchNo
    SELECT @iCount=count(*)
    FROM PASOArgusClaims
    WHERE BatchNo=@maxbatch
    and Argus_BusinessCategory = @CustNo
    IF @iCount > 0
    begin
    PRINT 'Msg: Batch ' + @maxbatch + ' already exists for CustNo ' + @CustNo + '.'
    end
    else
    begin
    if @CustNo = '0142'
    begin
    insert #custnos (CustNo, ClientNo)
    values ('0142', '1100')
    ,('0142', '1200')
    ,('0142', '1201')
    ,('0142', '1700')
    ,('0142', '1602')
    ,('0142', '1202')
    ,('0142', '1603')
    ,('0142', '2002')
    ,('0142', '1604')
    ,('0142', '2103')
    end
    if @CustNo = '0669'
    begin
    insert #custnos (CustNo, ClientNo)
    values ('0669', '*')
    end
    insert #batches (BatchNo)
    values (@BatchNo)
    end
    end
    else
    begin
    --make sure we haven't already done this batch number
    set @maxbatch = @BatchNo
    SELECT @iCount=count(*)
    FROM PASOArgusClaims
    WHERE BatchNo=@maxbatch
    IF @iCount > 0
    begin
    PRINT 'Msg: Batch ' + @maxbatch + ' already loaded.'
    end
    else
    begin
    insert #batches (BatchNo)
    values (@maxbatch)
    end
    end
    ** Insert Pharmacy Claims to temporary table
    INSERT INTO #tmpArgusWork
    SELECT
    pharmClm.RxKey,
    isnull(@NewBatchNo, pharmClm.BatchNo),
    pharmclm.OrigDateTimeStamp as BatchDateTime,
    'PENDING' as BatchStatus,
    NULL as ReadyDateTime,
    substring(pharmClm.GrpNumber,1,8)as Argus_GroupID,
    left(pharmClm.ArgusSubgroup1,@len_Argus_SubGroupId) as Argus_SubgroupID,
    substring(pharmClm.GrpNumber,9,4) as Argus_ClassId,
    substring(pharmClm.GrpNumber,13,@len_Argus_PlanCode) as Argus_PlanCode,
    pharmClm.ArgusClientNo as Argus_BusinessCategory,
    '' as vchFacetsClaimSubtype,
    PASOClaimType = CASE WHEN pharmClm.ClaimType='A'
    THEN 'PHARMACY-ADJUST'
    ELSE 'PHARMACY'
    END,
    pharmClm.ClaimNo,
    pharmClm.DateCutoff as dtPaidDate,
    pharmClm.DateWritten as dtProcessDate,
    NULL as dtServiceDate,
    left(pharmClm.MemberId,@len_vchParticipantId) as vchParticipantId,
    left(pharmClm.PharmacyNo,@len_vchProviderId) as vchProviderId,
    vchProviderName = CASE WHEN pharmclm.PayMemberInd = 'Y'
    THEN 'Member Reimbursement'
    ELSE pharm.PharmName
    END,
    mClaimTotAmtCharge = CASE WHEN pharmclm.PayMemberInd = 'Y' -- When this is a member reimbursement use the amt paid
    THEN isnull(pharmClm.IngredientCostPaid,0) + isnull(pharmClm.DispenseFee,0) + isnull(APSFee,0) -- as amt charged.
    ELSE isnull(pharmClm.AmtBilled,0)
    END,
    case when pharmclm.PayMemberInd = 'Y'
    then isnull(pharmClm.AmtRejected,0) * -1
    else isnull(pharmClm.AmtBilled,0) - isnull(pharmClm.IngredientCostPaid,0) - isnull(pharmClm.DispenseFee,0) - isnull(APSFee,0) -isnull(pharmClm.AmtRejected,0)
    end as mClaimAmtDiscount,
    isnull(pharmClm.IngredientCostPaid,0) + isnull(pharmClm.DispenseFee,0) + isnull(APSFee,0) as mClaimAmtAllowed,
    isnull(pharmClm.AmtRejected,0) as mClaimAmtDenied,
    isnull(pharmClm.MemberPaidAmt,0) - isnull(pharmClm.MemberCopayAmt,0) as mClaimAmtDeduct,
    0 as mClaimAmtCoinsurance,
    isnull(pharmClm.MemberCopayAmt,0) as mClaimAmtCopay,
    isnull(pharmClm.AmtPaid,0) + isnull(APSFee,0) as mClaimAmtPaid,
    NULL as PASO_GroupID,
    NULL as PASO_SubgroupID,
    NULL as PASO_ClassID,
    NULL as PASO_PlanCode,
    NULL as PASO_BusinessCategory,
    'OK' as RecordStatus,
    NULL as ErrorDesc,
    PrescriptionNo = pharmClm.PrescriptionNo,
    DrugName = pharmClm.DrugName,
    NDC = pharmClm.NDC
    FROM ODS..PharmacyClaim as pharmClm
    LEFT JOIN ODS..pharmacy as pharm on
    pharmClm.PharmacyNo = pharm.PharmacyNo
    INNER join #batches ba
    on ba.BatchNo = pharmClm.BatchNo
    INNER join #custnos ct
    on ct.CustNo = pharmClm.ArgusCustNo
    and (
    ct.ClientNo = '*'
    or
    ct.ClientNo = pharmClm.ArgusClientNo
    WHERE pharmClm.ClaimType in ('P','A') -- Processed or Adjusted
    --AND pharmClm.ProcessCode <> 'MC' --code doesn't exist
    --GROUP BY
    -- pharmClm.BatchNo,
    -- substring(pharmClm.GrpNumber,1,8),
    -- substring(pharmClm.GrpNumber,9,4) ,
    -- substring(pharmClm.GrpNumber,13,@len_Argus_PlanCode),
    -- pharmClm.ArgusSubgroup1,
    -- pharmClm.ClaimNo,
    -- pharmClm.ArgusClientNo,
    -- pharmClm.DateCutoff,
    -- pharmClm.DateWritten,
    -- pharmClm.MemberId,
    -- pharmClm.PayMemberInd,
    -- pharmClm.PharmacyNo,
    -- pharm.PharmName,
    -- pharmClm.OrigDateTimeStamp,
    -- pharmClm.ClaimType,
    -- pharmClm.PrescriptionNo,
    -- pharmClm.DrugName,
    -- pharmClm.NDC
    IF @@RowCount=0
    BEGIN
    PRINT 'Msg: No records found.'
    RETURN
    END
    --Update the Discount column for these Pharmacy Claims
    --UPDATE @tmpArgusWork
    --SET mClaimAmtDiscount=mClaimTotAmtCharge-mClaimAmtAllowed-mClaimAmtDenied
    ** Get the lowest service Date for each claim and update temp table
    UPDATE #tmpArgusWork
    SET dtServiceDate = (SELECT min(pharmclm.DateSvc)
    FROM ODS..pharmacyClaim AS pharmclm
    WHERE pharmclm.ClaimNo = tcpr.vchClaimNumber
    AND pharmclm.MemberID = tcpr.vchParticipantId)
    FROM #tmpArgusWork as tcpr
    ** Copy over the eligibility fields that Argus provided
    UPDATE #tmpArgusWork
    SET PASO_GroupId = Argus_GroupID,
    PASO_SubGroupId = Argus_SubGroupId,
    PASO_ClassID=Argus_classid,
    PASO_PlanCode=Argus_PlanCode,
    PASO_BusinessCategory=Argus_BusinessCategory
    FROM #tmpArgusWork pw
    WHERE COALESCE(Argus_GroupID,'') <> ''
    OR COALESCE(Argus_SubGroupId,'') <> ''
    OR COALESCE(Argus_classid,'') <> ''
    OR COALESCE(Argus_PlanCode,'') <> ''
    OR COALESCE(Argus_BusinessCategory,'') <> ''
    ** If Argus did not provide all 5 eligibility fields, get them from faEnrollmentHistory
    ** based on the group, member, date of service
    UPDATE #tmpArgusWork
    SET PASO_GroupId = eh.GroupId,
    PASO_SubGroupId = eh.SubGroupId,
    PASO_ClassID=eh.Class,
    PASO_PlanCode=eh.PlanCode,
    PASO_BusinessCategory=eh.BusinessCategory
    FROM #tmpArgusWork pw
    INNER JOIN ODS..FAEnrollmentHistory eh
    ON eh.MemberID =pw.vchParticipantID
    AND eh.Groupid =pw.Argus_GroupID
    AND eh.eligind='Y'
    AND eh.ProcessCode<>'ID'
    AND pw.dtServiceDate BETWEEN eh.EligEffDate AND eh.EligTermDate
    WHERE COALESCE(Argus_GroupID,'') = ''
    OR COALESCE(Argus_SubGroupId,'') = ''
    OR COALESCE(Argus_classid,'') = ''
    OR COALESCE(Argus_PlanCode,'') = ''
    OR COALESCE(Argus_BusinessCategory,'') = ''
    ** If we have eligibility for all records, go ahead and set the ready date to today.
    IF NOT EXISTS ( SELECT *
    FROM #tmpArgusWork
    WHERE COALESCE(PASO_GroupID,'') = ''
    OR COALESCE(PASO_SubGroupID,'') = ''
    OR COALESCE(PASO_ClassID,'') = ''
    OR COALESCE(PASO_PlanCode,'') = ''
    OR COALESCE(PASO_BusinessCategory,'') = '')
    BEGIN
    UPDATE #tmpArgusWork
    SET ReadyDateTime=convert(varchar(10),GetDate(),101),
    BatchStatus='READY'
    END
    ELSE
    BEGIN
    PRINT 'Msg: Exceptions found.'
    UPDATE #tmpArgusWork
    SET RecordStatus='ERR',
    ErrorDesc='No valid Eligible span for this Member/Group/Subgroup at time of Service'
    WHERE COALESCE(PASO_GroupID,'') = ''
    OR COALESCE(PASO_SubGroupId,'') = ''
    OR COALESCE(PASO_ClassID,'') = ''
    OR COALESCE(PASO_PlanCode,'') = ''
    OR COALESCE(PASO_BusinessCategory,'') = ''
    END
    ** Insert the records into the final table.
    INSERT INTO PASOArgusClaims
    SELECT * FROM #tmpArgusWork
    SET NOCOUNT OFF
    END
    GO
    -- Verify that the stored procedure was created successfully.
    IF OBJECT_ID ('dbo.pr_Load_PASOArgusClaims_Work') IS NOT NULL
    PRINT '<<< CREATED PROCEDURE dbo.pr_Load_PASOArgusClaims_Work >>>'
    ELSE
    PRINT '<<< FAILED CREATING PROCEDURE dbo.pr_Load_PASOArgusClaims_Work >>>'
    GO
    GRANT EXECUTE ON dbo.pr_Load_PASOArgusClaims_Work to role_ODSLoad
    GO
    SET QUOTED_IDENTIFIER OFF
    GO
    SET ANSI_NULLS ON

    this part of the code below
    if@CustNo
    = '0142'
       begin
    insert #custnos(CustNo,
    ClientNo)
    values ('0142',
    '1100')
    ,('0142',
    '1200')
    ,('0142',
    '1201')
    ,('0142',
    '1700')
    ,('0142',
    '1602')
    ,('0142',
    '1202')
    ,('0142',
    '1603')
    ,('0142',
    '2002')
       end
    store proc
    How do I covert it to a common table where the values can be selected from when needed.

Maybe you are looking for

  • ITunes *recently* no longer importing.

    ITunes is up to date. No changes to it since the last patch- no importing/setting changes. All of a sudden, iTunes is no longer importing CDs w/ error correction on. It will skip from song to song after about 2 seconds and it leaves a blank file for

  • How to find rows in F table of a cube for a given request ID

    Can someone tell me how to find the rows in the F table of a cube for a given request id?

  • Skip_unusable_indexes and primary keys

    Hi, if have data for a big table splitted in multipe files which i want to load via sqlldr all in the same table as fast as possible. The indexes should be rebuild after the last file was loaded. So I use  SKIP_UNUSABLE_INDEXES=TRUE,SKIP_INDEX_MAINTE

  • Org Unit to PA and PSA Inheritence issue

    Hi, I am trying to create an Org Unit with effective from today or a future date. When I do this, PA and PSA is not getting inherited for the newly created Org Unit. But when I create an Org Unit with effective from past date, this issue is not there

  • Creative Cloud Desktop Installation Error

    While I mostly work off-line due to the nature of the material I work with, and needed to convert a PDF (produced by InDesign) back into InDesign format. Late last night I purchased the PDF2ID add-on, unaware that I also needed the CC Desktop in orde