GROUP BY USING CASE ?

SELECT
E.ACTV_DESC AS ACTV_DESC,
E.ACTV_CDE AS ACTV_CDE,
COUNT(E.ACTV_CDE) AS CNT_ACTV_CDE,
CASE WHEN B.VET_OTHR_ELIG_CDE ='01' THEN 'NO' ELSE NULL END AS VET_NO, -- new column to be added
CASE WHEN B.VET_OTHR_ELIG_CDE IN ('02','03','04') THEN 'YES' ELSE NULL END AS VET_YES --new column to be added
FROM
ETR_RGT_PARTC A,
ETR_INT_PARTC_INTK_JS B,
ETR_SDT_PARTC_PGM_ACTV C,
ETR_VM_SM_STFFNME D,
ETR_SMT_ACTV_MSTR E
WHERE
A.PARTC_ID = B.PARTC_ID AND
B.PARTC_ID = C.PARTC_ID AND
B.APPLC_ID = C.APPLC_ID AND
B.PGM_ID = C.PGM_ID AND
C.RESP_STFF_ID = D.STFF_ID AND
C.PGM_ID = E.PGM_ID AND
C.ACTV_ID = E.ACTV_ID AND
(D.RACF_ID LIKE :P_RACF_ID||'%') AND
C.LOC_ID LIKE 'ES%' AND
(TRUNC(C.CRTE_DTE) >= :P_FROM_DATE AND
TRUNC(C.CRTE_DTE) <=:P_TO_DATE) AND
D.STFF_LOC_ID = 'ES00'||:P_LOCL_OFFC_ID
AND D.CLOS_DTE IS NULL
GROUP BY
ACTV_DESC,
ACTV_CDE
ORDER BY ACTV_CDE;
we cant group by using alias in this situation what shud i do ?
Thanks in advance

If you want to group by using the added new columns as well, then all you need to do is - put the full CASE statements into group by clause without alias.
But if you do not want to group by your data based on the added new columns then you can use the inline view and do the group by first based on first 2 columns and then do the CASE afterwards.
Also, one error I noticed in the give query is that you are doing COUNT on the column E.ACTV_CDE which is also your group by column - E.ACTV_CDE. This means that you will always receive 1 as count for each actv_cde as you are doing the grouping on the same column.

Similar Messages

  • I am having issue in group by using decode and case in pl/sql

    my query is some thing like this but having more column in select. when i am firing this query it is giving result but that is not proper
    my problem is , like if there are 3 more values for uh.sflowtype (0,1,2) then group by is not working for them and those are coming in different row , i need them to be combined
    query is :
    select substr(uh.sstartdatetime,1,8) DateTime,
    ( case
    when uh.sflowtype=7 then 'sms'
    when uh.sflowtype=9 then 'mms'
    when uh.sflowtype=10 then 'gprs'
    else 'voice'
    end )
    as flowtype from e_vpn_usagehistory uh where 1=1 and uh.nspid='1' AND ((substr(uh.sstartdatetime,1,8) >= 20130507 )
    AND (substr(uh.sstartdatetime,1,8) <= 20130606)) GROUP BY substr(uh.sstartdatetime,1,8),uh.sflowtype
    order by substr(uh.sstartdatetime,1,8) DESC
    result :
    DATETIME FLOWTYPE
    20130507 voice
    20130507 voice
    20130507 voice
    20130507 sms
    20130507 mms
    but i need
    20130507 voice
    20130507 sms
    20130507 mms
    so what should i do?
    please suggest me

    996962 wrote:
    my query is some thing like this but having more column in select. when i am firing this query it is giving result but that is not proper
    my problem is , like if there are 3 more values for uh.sflowtype (0,1,2) then group by is not working for them and those are coming in different row , i need them to be combined
    query is :
    select substr(uh.sstartdatetime,1,8) DateTime,
    ( case
    when uh.sflowtype=7 then 'sms'
    when uh.sflowtype=9 then 'mms'
    when uh.sflowtype=10 then 'gprs'
    else 'voice'
    end )
    as flowtype from e_vpn_usagehistory uh where 1=1 and uh.nspid='1' AND ((substr(uh.sstartdatetime,1,8) >= 20130507 )
    AND (substr(uh.sstartdatetime,1,8) <= 20130606)) GROUP BY substr(uh.sstartdatetime,1,8),uh.sflowtype
    order by substr(uh.sstartdatetime,1,8) DESC
    result :
    DATETIME FLOWTYPE
    20130507 voice
    20130507 voice
    20130507 voice
    20130507 sms
    20130507 mms
    but i need
    20130507 voice
    20130507 sms
    20130507 mms
    so what should i do?
    please suggest meWell, you are grouping by substr(uh.sstartdatetime,1,8),uh.sflowtype
    so different values of sflowtype that aren't 7,9 or 10 will be grouped separately.
    You therefore need to group by your case statement instead of just the sflowtype.
    The most worrying thing though is that you have sstartdatetime that appears to be a varchar2 and not a date.
    If it is a date, you are applying a substr (which applies to strings) to a date. you then compare the result
    of the substr to a number.
    This is a recipe for future problems: sort it out using the correct conversion functions with format masks.
    Edited by: Paul Horth on May 14, 2013 1:25 PM

  • How to use CASE or DECODE in this?

    Hi , I have a query like this
    AND ...smthng
    AND --smtg
    AND age BETWEEN ....For the last AND clause for age column, I have the values passed from IN param of this SP in form of strings
    '0-30', '31-60', '61-90', and '91+'. The IN param is of course VARCHAR2.
    What I want to do in this AND clause
    e.g. for age range '0-30', the AND clause should be
    AND age BETWEEN ( if this range is '0-30' then ) 0 AND 30 ( if range is '31-60') then BETWEEN 31 AND 60.. and so on...
    However this BETWEEN will work till 61-90 range but for 91+ , there is no upper bound so it should be
    AND age>91
    Now , i am not sure how to achieve this both BETWEEN and '>' clauses in the same AND statement.
    DECODE will not work and am not sure how to use the CASE in this situation as even that can not solve this issue.
    Dont want to make the last AND clause dynamic
    Please suggest me how to do this.
    Thanks,
    Aashish
    Edited by: Aashish S. on Oct 21, 2011 6:01 PM

    A third alternative would be to choose a suitably large value as a high end for the 91+ group and use something like:
    age between to_number(CASE WHEN instr(:param, '+') = 0
                                  THEN substr(:param, 1, instr(:param, '-') -1)
                                  ELSE substr(:param, 1, instr(:param, '+') -1) end) and
                to_number(CASE WHEN instr(:param, '+') = 0
                               THEN substr(:param, instr(:param, '-') +1)
                               ELSE '9999' END)John

  • Need help in this sql query to use Case Statement

    hi All,
    I have the below query -
    SELECT DISTINCT OFFC.PROV_ID
    ,OFFC.WK_DAY
    ,CASE
    WHEN OFFC.WK_DAY ='MONDAY' THEN 1
    WHEN OFFC.WK_DAY ='TUESDAY' THEN 2
    WHEN OFFC.WK_DAY ='WEDNESDAY' THEN 3
    WHEN OFFC.WK_DAY ='THURSDAY' THEN 4
    WHEN OFFC.WK_DAY ='FRIDAY' THEN 5
    WHEN OFFC.WK_DAY ='SATURDAY' THEN 6
    WHEN OFFC.WK_DAY ='SUNDAY' THEN 7
    END AS DOW
    ,OFFC.OFFC_OPENG_TIME
    ,OFFC.OFFC_CLSNG_TIME
    FROM GGDD.PROV_OFFC_HR OFFC
    WHERE OFFC.PROV_ID='0000600'
    WITH UR;
    this query is bringing results in 6 differnt rows with opening and closing time for each day separately. I want to generate the data in one row with each day having opening and closing time, so for 7 days, total 14 columns with opening and closing time. But i am not able to do that using case statement.
    can somebody help me in achieving that.
    thanks,
    iamhere

    Hi,
    Welcome to the forum!
    That's called a Pivot .
    Instead of having 1CASE expression, have 14, one for the opening and one for the closing time each day, and do GROUP BY to combine them onto one row.
    SELECT       OFFC.PROV_ID
    ,       MIN (CASE WHEN OFFC.WK_DAY ='MONDAY'    THEN OFFC.OFFC_OPENG_TIME END)     AS mon_opn
    ,       MIN (CASE WHEN OFFC.WK_DAY ='MONDAY'    THEN OFFC.OFFC_CLSNG_TIME END)     AS mon_cls
    ,       MIN (CASE WHEN OFFC.WK_DAY ='TUESDAY'   THEN OFFC.OFFC_OPENG_TIME END)     AS tue_opn
    ,       MIN (CASE WHEN OFFC.WK_DAY ='TUESDAY'   THEN OFFC.OFFC_CLSNG_TIME END)     AS tue_cls
    FROM        GGDD.PROV_OFFC_HR OFFC
    WHERE       OFFC.PROV_ID     = '0000600'
    GROUP BY  offc.prov_id
    ;This assumes there is (at most) only one row in the table for each distinct prov_id and weekday. If not, what do you want to do? Post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data.
    The staement above works in Oracle 8.1 and up, but there's a better way (SELECT ... PIVOT) available in Oracle 11. What version are you using? (It's always a good idea to include this when you post a question.)
    Edited by: Frank Kulash on Jan 6, 2011 8:22 PM

  • Photostream, iCloud Photo Sharing, iPhoto, my phone, and use cases all around

    I have a fre pretty basic use case questions about Photostream.
    I take a lot of pictures on my iPhone. They magically appear in iPhoto on my Mac. I'm told that by having the import feature in iPhoto turned on, those photos will stay in iPhoto on my iMac forever - or at least after I pass the 30 days/1,000 most recent photos limits.
    So that leaves me to ask: what am I supposed to do with the photos on my phone? Just leave them there to eat up storage? Or delete them at some point? Delete all the photos on my phone after I import those that Photostream hadn't already captured? Is there any benefit to importing a duplicate photo if I have Photostream importing turned on? And are they truly, really duplicate photos? Are the iPhone photos in my Photostream duplicated on my phone until they fall out of Photostream? Are iPhone photos duplicated if they're in a shared stream?
    I just don't know what I should do with the photos on my iPhone once they're on my iMac, and I'm not truly confident that they're on my iMac for good or that they're truly the same file as the original.

    on the mac/iphoto, move photos in the Photo stream group into some other album. 
    foatbttpo1567,In iPhoto on a mac you need to download the photos to an event - not an album. An album would only reference them in the photo stream, but not store the photos in the iPhoto library. Turning on "Automatic Import", as Old Toad suggested, will do that and create monthly events.
    I'm told that by having the import feature in iPhoto turned on, those photos will stay in iPhoto on my iMac forever - or at least after I pass the 30 days/1,000 most recent photos limits.
    The 30 days/1000 photos limit applies to the temporary storage in iCloud - the time you have to grab them and to import them. Once they are in an event, you have them safe.
    So that leaves me to ask: what am I supposed to do with the photos on my phone? Just leave them there to eat up storage? Or delete them at some point? Delete all the photos on my phone after I import those that Photostream hadn't already captured?
    Photo Stream is a handy feature for transmitting photos, but don't rely on it for permanent storage. If you ever have to reset your iPhone or reinstall your Mac, or to reset the photo stream, your photos from the stream may be gone. Keep always a copy of your photos either in the Camera roll on your phone or in iPhoto events on your mac, and make sure that these copies are regularly backed up.
    As for the "truly duplicates" - Photo stream will send optimized versions to the devices, but to a mac the full original version. You may want to read the FAQ:  iCloud: Photo Stream FAQ

  • How to use case when in Select qry?

    Hi Friends,
    I want to use Case when in Select qry, my situation is like this
    SELECT bmatnr blgort bj_3asiz bmat_kdauf b~mat_kdpos
           SUM( ( case when bshkzg = 'S' then bmenge else 0 END ) -
            ( case when bshkzg = 'H' then bmenge else 0 END ) ) AS qty
           INTO corresponding fields of table it_projsal
        FROM mseg AS b
            INNER JOIN mkpf AS a ON bmblnr = amblnr
                                AND bmandt = amandt
        WHERE abudat  < '20061201' AND blgort IN ('1050')
          and b~mandt = '350'
        GROUP BY bmatnr bj_3asiz bmat_kdauf bmat_kdpos b~lgor
    If we give like this it gives an error.
    Please help me, how to use or handle in select qry itself.
    Regards
    Shankar

    this is not a way to select data from the DB tables.
    first get all the data from the DB tables then u have to do SUM Ups .
    Regards
    prabhu

  • Sql proposed to use case statement

    Hi All
    Can anyone help me here
    This code works fine,here inthe inner sub queries(b,c,d,e,f),i am getting the weekly counts of usage data from the table mf_wer_OBI_USAGE_reqq.
    As this is hitting same table with the similar set of queries so i was adviced to use case statement by taking the wk_1...5 in variable and making the query better
    I am unable to figure out how to proceed.
    Appreciate your help here.
    Thanks
    create table mf_wer_OBI_USAGE_reqq_WK
    as select x.user_name id,x.mon MONTH_COUNT,x.wk_1 WEEK1_COUNT,x.wk_2 WEEK2_COUNT,x.wk_3 WEEK3_COUNT,x.wk_4 WEEK4_COUNT,x.wk_5 WEEK5_COUNT,x.subject_area_name,
    y.EMP_FIRST_NAME FIRSTNAME,y.EMP_LAST_NAME SURNAME,y.E_MAIL_ADDRESS USER_MAILID,y.ouc OUC
    from (select a.user_name,a.mon,a.subject_area_name,b.wk_1,c.wk_2,d.wk_3,e.wk_4,f.wk_5
    from (select user_name,sum(count_us_st) mon,subject_area_name from mf_wer_OBI_USAGE_reqq group by user_name,subject_area_name) a,
    (select user_name,sum(count_us_st) wk_1,subject_area_name from mf_wer_OBI_USAGE_reqq where extract(day from start_dt) between 1 and 7
    group by user_name,subject_area_name) b,
    (select user_name,sum(count_us_st) wk_2,subject_area_name from mf_wer_OBI_USAGE_reqq where extract(day from start_dt) between 8 and 14
    group by user_name,subject_area_name) c,
    (select user_name,sum(count_us_st) wk_3,subject_area_name from mf_wer_OBI_USAGE_reqq where extract(day from start_dt) between 15 and 21
    group by user_name,subject_area_name) d,
    (select user_name,sum(count_us_st) wk_4,subject_area_name from mf_wer_OBI_USAGE_reqq where extract(day from start_dt) between 22 and 28
    group by user_name,subject_area_name) e,
    (select user_name,sum(count_us_st) wk_5,subject_area_name from mf_wer_OBI_USAGE_reqq where extract(day from start_dt) between 29 and 31
    group by user_name,subject_area_name) f
    where a.user_name=b.user_name(+)
    and a.subject_area_name=b.subject_area_name(+)
    and a.user_name=c.user_name(+)
    and a.subject_area_name=c.subject_area_name(+)
    and a.user_name=d.user_name(+)
    and a.subject_area_name=d.subject_area_name(+)
    and a.user_name=e.user_name(+)
    and a.subject_area_name=e.subject_area_name(+)
    and a.user_name=f.user_name(+)
    and a.subject_area_name=f.subject_area_name(+)) x,
    dm_employee y
    where x.user_name=y.id and
    y.active_flg='Y';

    Swas_fly wrote:
    This code works fineIf it's fine, why try to fix it?
    Post your table (only the relevant columns as a CREATE TABLE statement) and some sample data (INSERT into) and your required output.
    Post your code between these tags:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

  • Use case for financial data

    Hi All,
    I've a question about potential use case for Oracle spatial. Data structures are following:
    Clients
    Account (have a dimension of balance, can be zero or above zero)
    Client to account relationship
    E.g.
    Client C1 is a borrower to Account A1 (balance = 0)
    Client C1 is a co borrower to Account A2 (balance > 0)
    Client C2 is a co borrower to Account A1 (balance > 0)
    Client C3 is a co borrower to Account A3 (balance > 0)
    Currently, database is modeled as a set of three tables, e.g.
    Client
    ID
    DATA
    Account
    ID
    DATA
    BALANCE
    CLIENT_TO_ACCOUNT
    CLIENT_ID
    RELATIONSHIP (E.g borrower)
    ACCOUNT_ID
    Business limitations:
    We are not interested in independent graphs for which all accounts have balance = 0 (let's call it inactive graph), however we might need occasionally query it
    Users are interested in vertices/edges with account which have balance = 0, but linked (up to level N) to active account for analysis purposes
    There is no well defined root (e.g. there can be 2 or more clients which are co borrowers to same account)
    99% of queries will be against active graphs
    Graphs are mutable, e.g. new relationships (edges) may be created/deleted during the day
    Users are potentially interested in free navigation in whole independent graph, starting from root.
    Root is determined by certain business rule
    Need to process active graphs daily as bulk
    Problems which I am trying to solve:
    Limit the amount of data which may need to be processed - based on the analysis of current system, we only need 5% of data + some delta for 99% processing
    Make sure performance does not degrade with time as we get more historical (processed data) - we can not deleted accounts with balance = 0 as potentially new relationship may arrive with new accounts with balance > 0
    Current solution that I am thinking of :
    Artificially partition the data universe as active and inactive graphs. All indexes would be local to two partitions.
    E.g.
    GROUP
    GROUP_ID PK
    ACTIVE_FLAG (partition key)
    CLIENT
    GROUP_ID (PARTITION BY FK TO GROUP)
    ACCOUT
    GROUP_ID (PARTITION BY FK TO GROUP)
    CLIENT_TO_ACCOUNT
    GROUP_ID (PARTITION BY FK TO GROUP)
    The issues I am seeing right now:
    1. Graphs(groups) may be potentially unlimited, so I will need a artificially limit the size using some dividing algorithms - leading to
    2. Graphs(groups) may need to be joined or divided
    3. Graphs(groups) will have to be activated/deactivated - e.g. moved to different partitions.
    4. Data loading, activation/deactivation algorithms are not simple
    So I am thinking about Oracle Spatial (Network) to model this problem.
    Questions:
    1) Can I model this problem using Oracle Spatial?
    2) Will I gain any performance improvement?
    3) Is there any explanation or white paper on how to do this for this particular type of problem?
    4) Will the solution based on Oracle Spatial solve the problems outlined above?
    5) Will my solution (without using Oracle spatial) work at all? Or there are some fundamental issues..
    Thanks you!

    Either add a LOV to the JobID attribute definition in the VO (if the JobID will be editable) or simply add the job description to the select statement (join to the job table) as a reference attribute

  • BPM USE CASE.

    Hi All,
    I am new to oracle BPM and learning it through some samples. We need to build a process very soon and would like your advise on the use case.
    1. Everyday we need to run a process which grabs the records from the database based on some criteria. How can we implement this in BPM?
    2. We need to post these records(or notifications) to a group of users through webcenter client. How can we integrate webcenter to BPM?
    3. Users need to act on these notifications and after that the result should be synched up with the database.
    4. Automatic notifications should be sent to higher management if no action is taken on the prev notification.
    I know i am asking too much. But we just need some pointers or high level suggestions as what kind of activities or process we need to use in BPM to implement this.
    Thanks very much.

    Hi
    I am also a newbie and the following are some of my suggestions, experts can suggest a better way if there is any.
    1. Everyday we need to run a process which grabs the records from the database based on some criteria. How can we implement this in BPM? - I would guess you can use Mediator to poll the database and create the process
    2. We need to post these records(or notifications) to a group of users through webcenter client. How can we integrate webcenter to BPM? - BPM Integration with Webcenter is done using Process Portal
    3. Users need to act on these notifications and after that the result should be synched up with the database. - I would guess you can use Database Adapater to sync up the database
    4. Automatic notifications should be sent to higher management if no action is taken on the prev notification. - SLA can be set in the Human Task.
    Hope this helps.
    Venkat

  • OIM OID use cases

    From where can i get the use cases for practice on OIM OID provisioning reconciliation and other aspects

    Hi Dear,
    thanks for your reply and we are using OIM 9.x version. Checked Root DN value as you suggested (see below snap shot for oid resource definition):-
    Admin Id     cn=username
    Admin Password     *******
    Group Reconciliation Time Stamp     
    Last Target Delete Recon TimeStamp     
    Last Target Recon TimeStamp     
    Last Trusted Delete Recon TimeStamp     
    Last Trusted Recon TimeStamp     
    Port     6060
    Prov Attribute Lookup Code     AttrName.Prov.Map.OID
    Prov Group Attribute Lookup Code     AttrName.Group.Prov.Map.OID
    Prov Role Attribute Lookup Code     AttrName.Role.Prov.Map.OID
    Role Reconciliation Time Stamp     
    Root DN     DC=oracle,DC=com
    SSL     false
    Server Address     My server name
    Use XL Org Structure     false

  • How can i construct this query without using CASE statement?

    I've a following code. I'm using this script in Hibernet. So, i cannot use CASE there. Because, hibernet doesn't support case in select statement. How can i construct the same thing which will give me the same result without using CASE?
    SELECT ofc.FLT_LCL_ORIG_DT
         , ofc.CARR_IATA_CD
         , ofc.FLT_NBR
         , ofc.ORIG_ARPT_CD
         , ofc.DEST_ARPT_CD
         , sum( ofc.CNCT_PSGR_CNT) AS BOOKED_CNCT_PSGR_CNT
         , sum( CASE WHEN o.fsdr_mrkt_cd = 'D' AND d.fsdr_mrkt_cd = 'D'           THEN '0'
            ELSE to_char(ofc.CNCT_PSGR_CNT,'99')                             END ) AS BOOKED_INTL_CNCT_PSGR_CNT
         , sum(CASE WHEN o.fsdr_mrkt_cd||d.fsdr_mrkt_cd = 'DD'
                    THEN '0'
            ELSE to_char(ofc.CNCT_PSGR_CNT,'99')
            END) AS NEW_BCNT
    FROM OPS_FLT_CNCT ofc
                        , STN o
                        , STN d
                    WHERE ofc.CNCT_ORIG_ARPT_CD = o.STN_CD
                      AND ofc.CNCT_DEST_ARPT_CD = d.STN_CD
                     -- AND TRUNC(ofc.FLT_LCL_ORIG_DT) = trunc(to_date('22-MAY-2007','DD-MON-YYYY'))
                      AND ofc.CARR_IATA_CD = 'UA'
                      AND ofc.FLT_NBR = '1218'
                      AND ofc.ORIG_ARPT_CD = upper('DEN')                AND ofc.DEST_ARPT_CD = upper('IAD')                  GROUP BY ofc.FLT_LCL_ORIG_DT
                           , ofc.CARR_IATA_CD
                           , ofc.FLT_NBR
                           , ofc.ORIG_ARPT_CD
                           , ofc.DEST_ARPT_CD ;And, the output look like this --
    FLT_LCL_O CARR FLT_N ORI DES BOOKED_CNCT_PSGR_CNT BOOKED_INTL_CNCT_PSGR_CNT   NEW_BCNT
    22-MAY-07 UA   1218  DEN IAD                    9                         0          0
    23-MAY-07 UA   1218  DEN IAD                    1                         0          0
    24-MAY-07 UA   1218  DEN IAD                    2                         1          1
    25-MAY-07 UA   1218  DEN IAD                    1                         0          0Thnaks in advance for reply.
    Regards.
    Satyaki De.
    #####

    2 ideas:
    1. Inline function to perform the CASE funcionaltity for you
    2. Piplelined function to generate the entire dataset
    Both will be slower than just using CASE in a query, but we're working around big constraints

  • What tools does Microsoft use to mock UI interfaces, flowchart, use cases, and UML diagrams?

    I have searched google, but was not able to find article or blogs to answer this question. The questions asked here are very old. So I think this is a very relevant question today.
    We are a .NET group and we to update how we storyboard our application development. What tools does Microsoft use to mock UI interfaces, flowcharts, and use cases? Specifically for projects that are either C# .NET MVC 5 and above (looking forward to
    vNext).
    In the past, power point was able to do some of these things, but it seems it has been deprecated? Does Visio use these things? Also, is Visual Studio's 2013 UML diagram any good or is there another tool in Microsoft's bag of goodies that has more options?
    I have read about blend, but it does not seem to be .NET MVC specific.  
    Again, this is asking about what tools Microsoft teams usually use to storyboard as our team would like to mimic the more contemporary processes. We are in the process of upgrading our .NET applications and feel it is time to update our workflow process
    as well.
    Any book recommendations on TFS 2013 and agile are welcomed as well.  

    hlyates,
    Sorry but you have posted to a forum that deals exclusively with questions/issues about Microsoft Project, a project management application.
    I suggest you delete this post and start with the following: http://social.technet.microsoft.com/Forums/projectserver/en-US/home?forum=whatforum
    John

  • Cannot Record Material Inspection Results as per wiki use case * SOLVED *

    === EDIT ===
    Playing around, I solved my issue.
    I did not realize that I needed to set both flags
    CloseIndicatorSpecified  = true;
    CloseIndicator = false;
    Adding that fixed it; I suspect I cannot set them to null even if the WSDL allows it.
    Michel.
    === ORIGINAL POST ===
    Hi,
    I have a project to integrate SAP and our LIMS using the SAP web services with the Material Inspection business object.
    In the Wiki, there are a few [use cases|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/ESpackages/IntegrationofQualityManagementSystems] on the subject.
    Following that, I successfully retrieve all the required data using the following web services:
    [Find Material Inspection Basic Data by Elements|https://wiki.sdn.sap.com/wiki/display/ESpackages/FindMaterialInspectionBasicDatabyElements]
    [Find Material Inspection Subset Operation by Elements|https://wiki.sdn.sap.com/wiki/display/ESpackages/FindMaterialInspectionSubsetOperationbyElements]
    [Find Subset Operation Inspection Activity Basic Data by Elements|https://wiki.sdn.sap.com/wiki/display/ESpackages/FindSubsetOperationInspectionActivityBasicDatabyElements]
    [Read Subset Operation Inspection Activity|https://wiki.sdn.sap.com/wiki/display/ESpackages/ReadSubsetOperationInspectionActivity]
    From there, I want to record results. According to the Wiki , I should use
    [Record Subset Operation Inspection Activity Result|https://wiki.sdn.sap.com/wiki/display/ESpackages/RecordSubsetOperationInspectionActivity+Result]
    I tried directly through the [WS Navigator|http://sr.esworkplace.sap.com/webdynpro/dispatcher/sap.com/tcesiespwsnavui/WSNavigator] to test web services. Whenever go through that tho, I get the following error:
    Conversion Error: Invalid Input Format (701 SFB)
    Obviously, I get the exact same error using c# (at least I'm consistent!)
    Below is the code (some is truncated because it is too long but I think you can get the idea).
    The question: Can anyone help me understand why I am getting that error? Maybe there is one or more property I don't understand... It would be practical if the actual failing property was identified in the LogItem, but it is not.
    Some things I tried (to no avail):
    1. Tried all sort of combination for actionCode
    2. Removed actionCode and set actionCodeSpecified = false
    3. Removed the Measure property
    4. Removed the Text property
    5. Removed the ChangeStateID
    Thanks in advance!
    Michel
    ...RequestMessage_sync messageIn = new ...RequestMessage_sync();
    messageIn.MaterialInspection = new u2026RequestMessage_syncMaterialInspection();
    messageIn.MaterialInspection.ID = new MaterialInspectionID();
    messageIn.MaterialInspection.ID.Value = "3265";
    messageIn.MaterialInspection.ChangeStateID = "1";
    messageIn.MaterialInspection.Subset = new u2026RequestMessage_syncMaterialInspectionSubset();
    messageIn.MaterialInspection.Subset.ID = new InspectionSubsetID();
    messageIn.MaterialInspection.Subset.ID.Value = "0";
    messageIn.MaterialInspection.Subset.Operation = new u2026RequestMessage_syncMaterialInspectionSubsetOperation();
    messageIn.MaterialInspection.Subset.Operation.ID = "0300";
    u2026RequestMessage_syncMaterialInspectionSubsetOperationInspectionActivity activity = new u2026RequestMessage_syncMaterialInspectionSubsetOperationInspectionActivity();
    activity.ID = "0010";
    activity.CloseIndicatorSpecified = false;
    activity.Result = new u2026RequestMessage_syncMaterialInspectionSubsetOperationInspectionActivityResult[1];
    activity.Result[0] = new u2026RequestMessage_syncMaterialInspectionSubsetOperationInspectionActivityResult();
    activity.Result[0].ID = "0001";
    activity.Result[0].AcceptanceStatusCodeSpecified = false;
    activity.Result[0].DefectNumberValueSpecified = false;
    activity.Result[0].ExceptionIndicatorSpecified = false;
    activity.Result[0].InspectedNumberValueSpecified = false;
    activity.Result[0].Comment = string.Empty;
    activity.Result[0].NonConformingUnitNumberValue = 0;
    activity.Result[0].Measure = new Measure();
    activity.Result[0].Measure.Value = decimal.Parse("4.15";);
    activity.Result[0].Measure.unitCode = "AMP";
    activity.Result[0].Text = new Text();
    activity.Result[0].Text.Value = "Some Text Here";
    activity.Result[0].actionCode = ActionCode.Item01 |ActionCode.Item02 | ActionCode.Item03;
    activity.Result[0].actionCodeSpecified = true;
    activity.CloseIndicatorSpecified = false;
    messageIn.MaterialInspection.Subset.Operation.InspectionActivity = activity;
    messageIn.MessageHeader = new BasicBusinessDocumentMessageHeader();
    messageIn.MessageHeader.ID = new BusinessDocumentMessageID();
    messageIn.MessageHeader.ID.Value = "starlims_update";
    try
          u2026ConfirmationMessage_sync messageOut = ws.MaterialInspectionSubsetOperationInspectionActivityResultRecordingRequestConfirmation_In(messageIn);
          if (messageOut.Log.Item != null)
                string message = String.Empty;
                foreach (LogItem item in messageOut.Log.Item)
                      message += (item.Note + "\n");
                MessageBox.Show(message);
    catch (Exception ex)
          MessageBox.Show(ex.Message);
    Edited by: Michel Roberge on Jul 16, 2008 2:38 PM

    See post for solution.

  • Use case export to text document

    In Jdeveloper you can export generated UML use case with scenarios, to HTML format, however is it possible to generate to say .txt or .doc type files?
    I am looking at a very good commercial product called Visual Use Case and wondered if JDeveloper's generated documentation has/can have similar features.
    Thank you

    Hi,
    there is SDE plugin for JDeveloper ( http://www.visual-paradigm.com/product/sde/jd/ ) but it only works with older - 10.1.2 version of JDev.
    Kuba

  • Use case for showing records in report view BAM based on version number

    Hi,
    I have a use case to update records based on version no. Let say I have a table or data object in BAM called 'Notes'. The Notes dataobject has three fields Id, Version, Description. The Notes data is displayed in a BAM report. I need to just display the latest version of the Notes. Say two records with one with Id as '124' and Version '4' and another with Id as '124' and version as '5'. The record related to version 5 should be dispalyed to user. How will I introduce this check in BAM reports for the latest version?
    Thanks
    Edited by: user5108636 on 28/06/2010 16:47

    That you see you're prints only means that your method outta called. The code creates a new row, but never inserts the row into the rowset. Then you call execute query which loses any connection to the new route which is not part of the rowset.
    First action would never to call insertRow(r1) on the view object.
    If you change data this way, only the model layer knows about it, the ui can't know about this (one of the disadvantages of using plsql or this construct you try). You have to tell the view controller to update it's data to. For this you can execute the iterator in the binding layer and/or ppr the container showing your data.
    Then I don't see any complicated plsql called do I question if a programmatic co is necessary.
    Timo

Maybe you are looking for