Unpack a nested HU using FM: PROCESS_HU_INBOUND_DLVRY

Hello,
I have a question regarding the use of FM PROCESS_HU_INBOUND_DLVRY.
The FM has the following operations:
1.     Create new HU by material
2.     Add new material to existing HU
3.     Create  new nested HU
4.     Add HU to existing HU
5.     Unpack material from HU
6.     Unpack HU from existing HU
I have successfully implemented most of the above operations, but I have problems using operation 6. Unpack HU from existing HU.
I am always getting error HUFUNCTIONS E004 u201CHandling unit cannot be packed in itselfu201D.
I donu2019t want to pack anything u2013 I want to unpack a nested HU in inbound delivery using this FM.
Your response is greatly appreciated!
Thank you very much in advance.

Solved.
HUITEM_FROM was missing.

Similar Messages

  • How to write nested queries using DB Adapter?

    I want to write following nested query using DB Adapter can any one help...
    SELECT INVOICE_ID,FILE_NAME FROM  BILLING_INVOICE_PDF_V where FILE_ID =(
    (SELECT MAX(FILE_ID) FROM  BILLING_INVOICE_PDF_V WHERE  (INVOICE_ID = ‘12345’)));
    Thanks,
    Ram.

    Hi Ram,
    Most likely it is the semicolon at the end of the SQL statement that's causing the db adapter to throw the error; just enter the custom sql statement without a semicolon at the end.
    SELECT INVOICE_ID,FILE_NAME FROM  BILLING_INVOICE_PDF_V where FILE_ID = (SELECT MAX(FILE_ID) FROM  BILLING_INVOICE_PDF_V WHERE INVOICE_ID = '12345')

  • DML on nested tables using SQL

    Hello. Can anyone tell me what's wrong??
    SQL> create type mytype as table of varchar2(20);
    Type created
    real: 78
    SQL> declare
    2 c mytype;
    3 begin
    4 select table_name bulk collect into c from user_tables;
    5 delete from table(cast(c as mytype));
    6 end;
    7 /
    declare
    ERROR at line 1:
    ORA-06550: line 5, column 13:
    PL/SQL: ORA-00903: invalid table name
    ORA-06550: line 5, column 1:
    PL/SQL: SQL Statement ignored
    real: 31

    we cannot use variables in regular SQL. It has to be
    dynamic, viz
    begin
    for r in ( select table_name from user_tables )
    loop
    execute immediate ' delete from '||r.table_name;
    d loop;
    end;
    /Cheers, APCyes, but user_tables was only a example. I want to load some data into nested table using BULK COLLECT and then perform some operation on this pl/sql table.
    For example:
    SELECT col BULK COLLECT INTO c FROM a_table;
    SELECT * BULK COLLECT INTO d FROM TABLE(CAST (c AS sql_type));
    --After that c and d contain the same data
    --but for example
    UPDATE TABLE(CAST(c AS sql_type)) Set c.col=...;
    generates invalid table name.
    Why SELECT INTO works, and UPDATE doesn't (all of this was in PL/SQL context, not SQL).

  • Instanciation of nested class using Class.newInstance();

    I am having a problem to instanciate a nested class using Class
    new instance method. The problem is as follows:
    class A {
    public static class B {
    String xxx;
    class Instance {
    public static void main ( String args []) {
    String name = "A"
    Class name_class = Class.forName(name);
    Object name_object = name_class.newInstance();
    Class [] in_classes = name_class.getClasses();
    for (i =0; i < in_classes.length; i ++) {
    Class inner = in_classes ;
    System.out.println("class =" + inner.getName());
    Here: Object inner_object = inner.newInstance();
    An exception is thown at <Here> line where the newInstance is called
    on nested class.
    Anybody run into this problem, please help.
    Thanks

    Well, it seems to work for me :D
    public class Test {
         public static void main ( String args []) {
              try {
                   String name = "A";
                   Class name_class = Class.forName(name);
                   Object name_object = name_class.newInstance();
                   Class [] in_classes = name_class.getClasses();
                   for (int q =0; q < in_classes.length; ++q) {
                        Class inner = in_classes [q];
                        System.out.println("class =" + inner.getName());
                        A.B inner_object = (A.B) inner.newInstance();
                        System.out.println (inner_object.xxx);
              } catch (final Exception e) {
                   e.printStackTrace ();
                   System.out.println (e.getMessage ());
    class A {
         public static class B {
              public String xxx = "Hi";
    }

  • Problem while unpacking an handling unit using FM HU_PACKING_AND_UNPACKING

    Hi ,
    I want to unpack an HU from an outbound delivery and transfer to other storage location using FM 'HU_PACKING_AND_UNPACKING'.I could find out that only quantities are transferred but unpacking HU is not done.
    Below is the code  i am using for unpacking.
    CALL FUNCTION 'HU_GET_HUS'
            EXPORTING
              if_lock_hus = 'X'
              it_venum    = it_hu1
            IMPORTING
              et_header   = it_hdr1
              et_items    = it_item1
            EXCEPTIONS
              hus_locked  = 1
              no_hu_found = 2
              fatal_error = 3
              OTHERS      = 4.
          IF sy-subrc <> 0.
            l_error = 'X'.
            CLEAR: g_msgid, g_msgno, g_msgv1,g_msgv2, g_msgv3, g_msgv4.
            g_msgid = sy-msgid.
            g_msgno = sy-msgno.
            g_msgv1 = sy-msgv1.
            g_msgv2 = sy-msgv2.
            g_msgv3 = sy-msgv3.
            g_msgv4 = sy-msgv4.
            PERFORM message_scr USING g_msgid g_msgno g_msgv1 g_msgv2 g_msgv3 g_msgv4.
            EXIT.
          ENDIF.
          LOOP AT it_hu1 INTO wa_hu.
            CLEAR: wa_item1,l_error,l_post.
            READ TABLE it_hdr1  INTO wa_hdr1  WITH KEY venum = wa_hu-venum.
            CLEAR : g_venum, g_plant, g_sloc, g_whno, g_stype, g_sbin.
    *       get the warehouse details
              SELECT SINGLE lgnum lgtyp lgpla FROM lein INTO (g_whno,g_stype,g_sbin)
                WHERE lenum = wa_hdr1-exidv.
              IF sy-subrc EQ 0.
    * Get the plant and storage location for WM managed
                SELECT SINGLE werks lgort FROM lqua INTO (g_plant, g_sloc)
                                     WHERE lgnum = g_whno
                                       AND lgtyp = g_stype
                                       AND lgpla = g_sbin
                                       AND lenum = wa_hdr1-exidv.
              ELSE.
    * Get the Venum (Internal HU Number)
                SELECT SINGLE venum FROM vekp INTO g_venum
                WHERE exidv = wa_hdr1-exidv.
                IF sy-subrc EQ 0.
    * Get the plant and storage location for Non-WM managed
                  SELECT SINGLE werks lgort FROM vepo INTO (g_plant, g_sloc)
                    WHERE venum = wa_hu-venum.
                ENDIF.
              ENDIF.
              READ TABLE it_item1 INTO wa_item1 WITH KEY venum = wa_hu-venum.
              IF sy-subrc = 0.
                CLEAR :wa_pack_unpack.
                MOVE-CORRESPONDING wa_item1 TO wa_pack_unpack.
                wa_pack_unpack-venum = wa_item1-venum.
                wa_pack_unpack-vepos = wa_item1-vepos.
                wa_pack_unpack-velin = wa_item1-velin.
                wa_pack_unpack-belnr = wa_item1-vbeln.
                wa_pack_unpack-posnr = wa_item1-posnr.
                MOVE wa_item1-vemng TO l_vemng.
                CONCATENATE l_vemng '-' INTO l_vemng.
                CONDENSE l_vemng NO-GAPS.
                MOVE l_vemng TO wa_pack_unpack-quantity.
                wa_pack_unpack-altme = wa_item1-altme.
                wa_pack_unpack-matnr = wa_item1-matnr.
                wa_pack_unpack-charg = wa_item1-charg.
                wa_pack_unpack-werks = g_plant.
                wa_pack_unpack-lgort = g_sloc.
                wa_pack_unpack-wdatu = wa_item1-wdatu.
                wa_pack_unpack-vfdat = wa_item1-vfdat.
              ENDIF.
    *          *Find the partner location
              CLEAR: g_hu_managed, g_partner_sloc.
              CALL FUNCTION 'V51S_HU_LGORT'
                EXPORTING
                  if_lgort         = g_sloc
                  if_werks         = g_plant
                IMPORTING
                  ef_hu_managed    = g_hu_managed
                  ef_partner_lgort = g_partner_sloc
                EXCEPTIONS
                  lgort_not_exist  = 1
                  OTHERS           = 2.
              IF sy-subrc <> 0.
              ENDIF.
              IF g_hu_managed = 'X'.
                wa_pack_unpack-umlgo = g_partner_sloc.
              ENDIF.
              CALL FUNCTION 'HU_PACKING_AND_UNPACKING'
                EXPORTING
                  is_packing_request = wa_pack_unpack
                IMPORTING
                  es_p_request       = wa_pack_unpack
                EXCEPTIONS
                  missing_data       = 1
                  hu_not_changeable  = 2
                  not_possible       = 3
                  customizing        = 4
                  weight             = 5
                  volume             = 6
                  serial_nr          = 7
                  fatal_error        = 8
                  OTHERS             = 9.
              IF sy-subrc <> 0.
                l_error = 'X'.
              ELSE.
                l_post = 'X'.
              ENDIF.
              IF l_error IS INITIAL AND l_post EQ 'X'.
                CALL FUNCTION 'HU_POST'
                  EXPORTING
                    if_synchron = 'X'
                    if_commit   = 'X'
                  IMPORTING
                    et_messages = it_messages.
            ENDLOOP.
    Please help if any parameter need to be set for unpacking of HU.
    Please suggest.
    Thanks in advance.

    Hi Sailaja,
    I have similar requirements like this before with HU_PACKING_AND_UNPACKING FM. It was a tough debugging before I came up with the right solution. Unfortunately, I was not able to document that code..
    But here is what I have been doing.
    Youre on track with the solution below, never use BDC as it will only limit the Handling units that you wish to put into.
    The function modules that starts with V5_ plays important role as you need to initialize the global variables and table of this function group with values before calling HU_PACKING_AND_UNPACKING FM
    Debug inside the Function module, and look for the FM that returns SY-SUBRC <> 0 then set a breakpoint.
    Restart the program then debug inside that FM again (and I do not want to go further on the details, I give you the presumption of literacy)
    You will find some items that has no value, try to initialize everything by utilizing the FM for this function group V51S.
    Happy Debugging.

  • XML to Nested Itab using Simple Transformation

    Hi there is there any experts there who can show me an example of Transforming a XML to a Nested Internal Table using Simple Transformation?
    I have tried this the program from the blog by
    Tobias Trapp
    <a href="/people/tobias.trapp/blog/2005/05/04/xml-processing-in-abap-part-1:///people/tobias.trapp/blog/2005/05/04/xml-processing-in-abap-part-1
    but I have encountered this error
    Runtime Errors         ST_REF_ACCESS   
    Exception              CX_ST_REF_ACCESS
       1 <?sap.transform simple?>                                    
       2 <tt:transform template="temp1"                              
       3     xmlns:tt="http://www.sap.com/transformation-templates"> 
       4     <tt:root name="ROOT"/>                                  
       5     <tt:template name="temp1">                              
    >>>>       <tt:loop ref=".ROOT" name="a">                        
       7         <A>                                                 
       8            <name>                                           
       9              <tt:value ref="$a.name" />                     
      10            </name>                                          
      11            <ZLS>                                            
      12              <tt:loop ref="$a.zls" name="z">                
      13                <Z>                                          
      14                  <tt:value ref="$z.nummer" />               
      15                </Z>                                         
      16             </tt:loop>                                      
      17           </ZLS>                                            
      18         </A>                                                
      19       </tt:loop>                                            
      20     </tt:template>                                          
      21 </tt:transform>                                             
    Anyone knows whats wrong?

    I had to pass an XSLT program in the transformation statement.

  • Reading a multilevel list from MS Word Doc and converting it into an HTML nested list using C#

    I can achieve the above for a single level list as follows:
    foreach (Paragraph item in app.Selection.Range.ListParagraphs)
    item.Range.InsertBefore("<li>");
    item.Range.InsertAfter("</li>");
    Using C#, how can I programmatically convert a multilevel list (like the following) in a Word doc to a nested HTML list? Note: The bullet icons are not important. Thanks..Nam
    List from Word Doc:
    A
    B
    C
    D
    E
    F
    G
    H
    I

    Hi Nam,
    >>how can we programmatically determine the start and end elements of the sub-list with elements C,DE,F,G in the example of my original post? <<
    We can check the begin and end elements of the sub-list by the
    ListLevelNumber. For example, the sub-list's ListLevelNumber start at 2 by default. Here is the code to find the begin element for your reference:
    Sub FindBeginSubElement()
    For i = 1 To Selection.Range.ListParagraphs.Count
    If Selection.Range.ListParagraphs(i).Range.ListFormat.ListLevelNumber = 2 Then
    Debug.Print "begin sub element:" & Selection.Range.ListParagraphs(i).Range.Text
    Exit Sub
    End If
    Next i
    End Sub
    Also we can loop the selection in reverse order to find the end element for the sub-list.
    Hope it is helpful.
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Nested aggregation using time series functions

    Hi All,
    I have a requirement where i need to find the growth using below formula
    (A-B)/B
    A=PERIODROLLING(x,-3,0)
    B=PERIODROLLING(AGO(x,QUARTER,1),-3,0)
    where x is a measure
    I see that OBIEE doesn't support nested aggregates on time series function is there any other way this can be achieved
    Thanks in advance,
    KSS
    Edited by: K.S.S on Mar 19, 2013 2:53 AM
    Edited by: K.S.S on Mar 19, 2013 2:54 AM

    same functionality was achieved using below formula
    (A-B)/B
    A=PERIODROLLING(x,-3,0)
    B=PERIODROLLING(x,-4,-1)

  • OIA - Importing nested entitlements using XML file

    Hi,
    I am looking for some information on importing nested entitlements (like RACF information) into OIA. From what I gather sofar, looks like I have to use XML to import nested entitlements. But sofar, I have no luck finding any documentation on how to go about it.
    If anybody has any information that you can share, that would be great.
    Thank you
    -Kamal

    If you're saying that you have Reader 9 and Acrobat Pro 7 on the same machine, please be aware that this is not a recommended or supported configuration. Although it's possible, people have reported a number of problems with such a setup.
    George

  • Nested CFQuery Uses Wrong Datasource

    I'm using CF MX 7.0.2, and it's come to my attention that there is a problem with how CF handles nested queries. To illustrate it simply:
    <cfquery name="insert" datasource="one">
         <cfquery name="select" datasource="two">
           select * from table
         </cfquery>
         insert into test values('blah')
    </cfquery>
    This set of code will attempt to insert the 'blah' value into datasource "two"! Not the expected "one". While this seems like a terrible way to make things, consider a more common scenario:
    <cfquery name="insert" datasource="one">
       insert into test values('#myfunction()#')
    </cfquery>
    <cffunction name="myfunction">
      <cfquery name="select" datasource="two">
        select * from table
      </cfquery>
      <cfreturn "blah">
    </cffunction>
    Again, this will attempt to insert into datasource "two". Please tell me there's a hotfix I can't find for this...

    I'm not sure what you gain by nesting the queries and not keeping them separate but thought you'd might like to know that the two scenarios you described function the same in CF8 as you note for CF7.
    The following code works fine for me on both CF7 and 8:
    Opt 1:
    <cfquery name="q1" datasource="dsn1">
    select role from end_users
    </cfquery>
    <cfquery name="q2" datasource="dsn2">
    insert into role (id) values('#q1.role#')
    </cfquery>
    Opt 2:
    <cfscript>
    myStr = testFunc();
    </cfscript>
    <cfquery name="q1" datasource="dsn1">
    insert into role (id) values('#myStr#')
    </cfquery>
    <cffunction name="testFunc" returntype="string">
    <cfquery name="q2" datasource="dsn2">
    select role from end_users
    </cfquery>
    <cfreturn q2.role />
    </cffunction>
    Doesn't seem like either one would be a significant rewrite or movement of your code.
    Anyway, I thought you'd might like to know that both your scenarios work the same in 8 as 7 and, as a result, I don't think there would be a hotfix for CF7.

  • How do I change alphabetical element listing in xml to nested xml using xslt?

    Have an 'Bus Card Request' indd form exported to fillable form pdf (reader enabled etc). Have 'Bus Card Template' indd to receive the BC data from the returned filled pdf form.
    The tags & structure are identical on both indd docs.
    The xml exported from the pdf discards the structure (nesting) and provides all the elements in alphabetical order.
    I am a novice learning how to make an xslt that will transform the alphabetical listing back to the nested structure.
    I want to turn this:
    <?xml version="1.0" encoding="UTF-8"?>
    <fields xmlns:xfdf="http://ns.adobe.com/xfdf-transition/">
    <Address>1234 Take Wing</Address>
    <Cell_Number>619.321.6878</Cell_Number>
    <City>San Diego</City>
    <Clin_Sup_Lic_Number>SL00267</Clin_Sup_Lic_Number>
    <Clinical_Supervisor_Name>Jarmal Hincks</Clinical_Supervisor_Name>
    <ComboBox2 xfdf:original="Combo Box 2">sdyouthservices.org</ComboBox2>
    <Date_Signed_Loc_Dir>9/29/2014a</Date_Signed_Loc_Dir>
    <Date_Signed_Orig>9/29/2014</Date_Signed_Orig>
    <Degree>MA</Degree>
    <Email_Address>s.reeves</Email_Address>
    <Extension>1234</Extension>
    <Fax_Number>619.123.9876</Fax_Number>
    <Intern_Number>XX20</Intern_Number>
    <License_Number>YY20</License_Number>
    <Location>Point Loma Campus</Location>
    <Name>Steve Reeves</Name>
    <Notes_and_Comments>Make it a super duper bus card</Notes_and_Comments>
    <Program>Learning Curve</Program>
    <State>CA</State>
    <Telephone_Number>619.123.4567</Telephone_Number>
    <TextField27 xfdf:original="Text Field 27">www.sdyouthservices.org</TextField27>
    <Title>Superman</Title>
    <Zip>99999</Zip>
    </fields>
    into this:
    <BC_Order>
    <Group_Name>
       <Name></Name>
       <Degree></Degree>
       
<Title></Title>
       <Intern_Number></Intern_Number>
       <License_Number></License_Number>
    </Group_Name>
    <Group_Location>
       <Location></Location>
      
<Program></Program>
      
<Address></Address>

      <City></City>
      <State></State>
      <Zip></Zip>
    </Group_Location>
    <Group_Phone>
      <Telephone_Number></Telephone_Number>
      <Extension></Extension>

      <Fax_Number></Fax_Number>
      <Cell_Number></Cell_Number>
    </Group_Phone>
    <Group_Email-WS>
      <Email_Address></Email_Address>
      <eMail_Host></eMail_Host>

      <Website></Website>

      <Clinical_Supervisor_Name></Clinical_Supervisor_Name>
      <Clin_Sup_Lic_Number></Clin_Sup_Lic_Number>
    </Group_Email-WS>
    </BC_Order>
    Is this xslt code on the right track?
    (i've left out the usual header stuff)
    <BC_Order>
    <Group_Name>
    <Name><xsl:value-of select="Name"/></Name>
    <Degree><xsl:value-of select="Degree"/></Degree>
    <Title><xsl:value-of select="Title"/></Title>
    <Intern_Number><xsl:value-of select="Intern_Number"/></Intern_Number>
    <License_Number><xsl:value-of select="License_Number"/></License_Number>
    </Group_Name>
    </BC_Order>
    I'm just trying to figure out what the words are to make nesting occur in the resultant xml so it will match the nesting order in the Bus Card input template.
    Thanks!
    Paul

    Hi Paul,
    Is this xslt code on the right track?
    Yes, no...
    The root element in the XML from the form is "fields" without the quote marks. So the XSL needs the full path to the elements to include the "fields" root element. The select would therefore be "<xsl:value-of select="fields/Name" />"
    Note that because I like seeing the XML with line breaks, the "<xsl:text>&#xA;</xsl:text>" precedes each line. Without that, one gets a long string. But it isn't really needed and there are other means of accomplishing it.
    I think the below will do what you need.
    Take care, Mike
    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    <xsl:text>&#xA;</xsl:text><BC_Order>
    <xsl:text>&#xA;</xsl:text><Group_Name>
    <xsl:text>&#xA;</xsl:text><Name><xsl:value-of select="fields/Name" /></Name>
    <xsl:text>&#xA;</xsl:text><Degree><xsl:value-of select="fields/Degree" /></Degree>
    <xsl:text>&#xA;</xsl:text><Title><xsl:value-of select="fields/Title" /></Title>
    <xsl:text>&#xA;</xsl:text><Intern_Number><xsl:value-of select="fields/Intern_Number" /></Intern_Number>
    <xsl:text>&#xA;</xsl:text><License_Number><xsl:value-of select="fields/License_Number" /></License_Number>
    <xsl:text>&#xA;</xsl:text></Group_Name>
    <xsl:text>&#xA;</xsl:text><Group_Location>
    <xsl:text>&#xA;</xsl:text><Location><xsl:value-of select="fields/Location" /></Location>
    <xsl:text>&#xA;</xsl:text><Program><xsl:value-of select="fields/Program" /></Program>
    <xsl:text>&#xA;</xsl:text><Address><xsl:value-of select="fields/Address" /></Address>
    <xsl:text>&#xA;</xsl:text><City><xsl:value-of select="fields/City" /></City>
    <xsl:text>&#xA;</xsl:text><State><xsl:value-of select="fields/State" /></State>
    <xsl:text>&#xA;</xsl:text><Zip><xsl:value-of select="fields/Zip" /></Zip>
    <xsl:text>&#xA;</xsl:text></Group_Location>
    <xsl:text>&#xA;</xsl:text><Group_Phone>
    <xsl:text>&#xA;</xsl:text><Telephone_Number><xsl:value-of select="fields/Telephone_Number" /></Telephone_Number>
    <xsl:text>&#xA;</xsl:text><Extension><xsl:value-of select="fields/Extension" /></Extension>
    <xsl:text>&#xA;</xsl:text><Fax_Number><xsl:value-of select="fields/Fax_Number" /></Fax_Number>
    <xsl:text>&#xA;</xsl:text><Cell_Number><xsl:value-of select="fields/Cell_Number" /></Cell_Number>
    <xsl:text>&#xA;</xsl:text></Group_Phone>
    <xsl:text>&#xA;</xsl:text><Group_Email-WS>
    <xsl:text>&#xA;</xsl:text><Email_Address><xsl:value-of select="fields/Email_Address" /></Email_Address>
    <xsl:text>&#xA;</xsl:text><eMail_Host><xsl:value-of select="fields/ComboBox2" /></eMail_Host>
    <xsl:text>&#xA;</xsl:text><Website><xsl:value-of select="fields/TextField27" /></Website>
    <xsl:text>&#xA;</xsl:text><Clinical_Supervisor_Name><xsl:value-of select="fields/Clinical_Supervisor_Name" /></Clinical_Supervisor_Name>
    <xsl:text>&#xA;</xsl:text><Clin_Sup_Lic_Number><xsl:value-of select="fields/Clin_Sup_Lic_Number" /></Clin_Sup_Lic_Number>
    <xsl:text>&#xA;</xsl:text></Group_Email-WS>
    <xsl:text>&#xA;</xsl:text></BC_Order>
    </xsl:template>
    </xsl:stylesheet>

  • Is it possible to Grant Nested Roles using Data Pump Export?

    I'm on Oracle 10.2.0.5, trying various Data Pump Parameters to obtain an Export containing a statement like "GRANT ParentRole TO ChildRole;" .
    This is to Import to 11.2.0.2, on the Windows x64 Platform. I'm using SQLFILE= Parameter in an IMPDP to check the effect of various EXPDP Parameters.
    I can get the "CREATE ROLE" Statements with a Full EXPDP using FULL=Y and INCLUDE=ROLE:"IN('ParentRole','ChildRole')"
    I can get the Grants of Objects to Roles with a 2nd Schema EXPDP using SCHEMAS=('MySchema') - e.g. I get "GRANT SELECT ON MySchema.MyTable TO ParentRole;"
    But I can get the Parameters so that a Role Being Granted to Another Role is Exported.
    Is this possible?

    Can you give an example of the grants, a real example so I can try to create this here. I'm thinking it is a grant that you want, but not sure which grant. There are a bunch of different grants.
    Dean

  • Nested subquery, using items from other part of query

    Hi All,
    I have a tricky problem and I will try explain as best I can:
    DB version is 11.2.0.3.0
    create table product_list (product_id number,
                    project_name varchar2(30))
    create table products (product_id number,
                    project_desc varchar2(30))
    create table total_counts (product_id number,
                    total_count number,
                    project_name varchar2(30))
    create table fixed_counts (product_id number,
                    fixed_count number,
                    project_name varchar2(30).
                        fixed_date date)
    create table product_rating (product_id number,
                    rating number,
                    quarter_last_updated number)
    create table quarters (quarter_id number,
                    quarter_end_date date)
    insert into product_list values (1, 'Prod 1');
    insert into product_list values (2, 'Prod 2');
    insert into product_list values (3, 'Prod 3');
    insert into products values (1, 'Prod 1');
    insert into products values (2, 'Prod 2');
    insert into products values (3, 'Prod 3');
    insert into total_counts values (1, 2000, 'Prod 1');
    insert into total_counts values (2, 1000, 'Prod 2');
    insert into total_counts values (3, 500, 'Prod 3');
    insert into fixed_counts values (1, 1, 'Prod 1', to_date('01/01/2013','DD/MM/YYYY'));
    insert into fixed_counts values (1, 3, 'Prod 1', to_date('01/01/2013','DD/MM/YYYY'));
    insert into fixed_counts values (2, 50, 'Prod 2', to_date('01/01/2013','DD/MM/YYYY'));
    insert into fixed_counts values (2, 2, 'Prod 2', to_date('01/01/2013','DD/MM/YYYY'));
    insert into fixed_counts values (2, 3, 'Prod 2', to_date('01/01/2013','DD/MM/YYYY'));
    insert into fixed_counts values (2, 3, 'Prod 2', to_date('01/01/2013','DD/MM/YYYY'));
    insert into fixed_counts values (3, 8, 'Prod 3', to_date('01/01/2013','DD/MM/YYYY'));
    insert into fixed_counts values (3, 3, 'Prod 3', to_date('01/03/2013','DD/MM/YYYY'));
    insert into product_rating values (1, 1, 1);
    insert into product_rating values (3, 2, 2);
    insert into quarters values (1, to_date('01/10/2012','DD/MM/YYYY'));
    insert into quarters values (2, to_date('01/02/2013','DD/MM/YYYY'));My current query effectively joins 2 tables 'TOTAL_COUNTS' and 'FIXED_COUNTS'. The FIXED_COUNTS table is updated daily when one of the products has a fix made against it and the query outputs a list of all Products and their percentage "fixed" rate (used in an APEX Interactive report).
    select A.PRODUCT, A.TOTAL, B.FIXED, a.PROD_ID, round((FIXED/TOTAL) * 100,  2) percent
    from (
    select sum(a.total_count) TOTAL, a.product_id PROD_ID, d.Product_desc PRODUCT
    from total_counts a, product_list c, products d
    where a.product_id = c.product_id
    and lower(a.project_name) = lower(c.project_name)
    and c.product_id = d.product_id
    group by a.product_id, d.product_desc
    ) A
    JOIN
    select sum(b.fixed_count) FIXED, b.product_id PROD_ID, d.Product_desc PRODUCT
    from fixed_counts b, product_list c, products d
    where b.product_id = c.product_id
    and lower(b.project_name) = lower(c.project_name)
    and c.product_id = d.product_id
    group by b.product_id, d.product_desc
    ) B
    on A.PROD_ID = B.PROD_ID and A.PRODUCT = B.PRODUCT This gives me an output like:
    PRODUCT     TOTAL     FIXED     PROD_ID     percent
    Prod 1     2000     4     1     0.2
    Prod 2     1000     58     2     5.8
    Prod 2      500     11     3     2.2The query works fine and does exactly the job I require. However, I now have a requirement that when a product gets a "fixed" percentage rate over 1% the product gets a point added against it in a "product_rating" table and i have to recalculate the fixed percentage from the date the point was added (if no point added we take all "fixed").
    I have added 2 new tables for this: "product_rating" and "quarters". The "product_rating" table contains the Product_id and the points it has accumulated so far. It is updated once a quarter. The "quarters" table just holds the dates for us to use for the new calculations.
    So effectively I need to replace this:
    sum(b.fixed_count) FIXEDwith something like this:
    if a product has a point against it in the "product_rating" table then we just show fixes from the date the point was added i.e.
    select sum(b.fixed_count) from fixed_counts b, product_rating c, quarters d
    where b.product_id = c.product_id and c.quarter_last_updated = d.quarter_id
    and b.product_id = PROD_ID
    and b.fixed_date > (select quarter_end_date from quarters where quarter_id = the_last_quarter_updated)Based on the values in the tables above the percentages for 'Prod 3' should now be 0.6. This is because it received a product_rating on quarter 2 so the new calculation is based on all "fixes" after this date (only the last one on 01-MAR-13').
    I have tried numerous ways of embedding this in the current query but I cannot get it to work. Sorry for not adding the complete table info but the total_counts and fixed_counts tables have much more columns that I removed from the query so it would be easier to view. Thanks in advance for your help. If I can add anymore info please ask.
    Tom
    Edited by: TomH on May 14, 2013 8:54 AM
    Edited by: TomH on May 14, 2013 8:58 AM

    TomH wrote:
    of course youre right, thanks.
    I have added some table info and data that will hopefully make it a bit easier to understand.Okay, thanks ... in the future though please try and run the commands yourself to ensure they work. What you provided is close, but it didn't run straight away without some modifications.
    I'll start with expressing my concerns for your data model, it seems .... wrong, for lack of a better word. Even given that you said you stripped out a bunch of stuff to make the example. Do you have anyone you work with that can review the model for you?
    As for the query, this isn't pretty (I'm in a bit of a rush here) so you can probably clean it up considerably. I just tried to demonstrate the basics of what you're going to have to do.
    ME_XE? with base_data as
      2  (
      3     select
      4        b.fixed_date,
      5        b.fixed_count,
      6        b.product_id ,
      7        d.project_desc
      8     from fixed_counts b, product_list c, products d
      9     where b.product_id = c.product_id
    10     and lower(b.project_name) = lower(c.project_name)
    11     and c.product_id = d.product_id
    12  ),
    13     final_base_data as
    14  (
    15     select
    16        b.product_id      PROD_ID,
    17        b.project_desc    PRODUCT,
    18        sum
    19        (
    20           case
    21              when b.fixed_date >= stuff.quarter_end_date or stuff.quarter_end_date is null
    22              then
    23                 b.fixed_count
    24              else
    25                 0
    26           end
    27        )  as FIXED
    28     from base_data b
    29     left outer join
    30     (
    31        select
    32           pr.product_id,
    33           qr.quarter_end_date
    34        from product_rating pr , quarters qr
    35        where pr.quarter_last_updated = qr.quarter_id
    36     )  stuff
    37     on (stuff.product_id = b.product_id)
    38     group by b.product_id, b.project_desc
    39  )
    40  select A.PRODUCT, A.TOTAL, B.FIXED, a.PROD_ID, round((b.FIXED/a.TOTAL) * 100,  2) percent
    41  from
    42  (
    43     select sum(a.total_count) TOTAL, a.product_id PROD_ID, d.project_desc PRODUCT
    44     from total_counts a, product_list c, products d
    45     where a.product_id = c.product_id
    46     and lower(a.project_name) = lower(c.project_name)
    47     and c.product_id = d.product_id
    48     group by a.product_id, d.project_desc
    49  ) A
    50  JOIN final_base_data B
    51  on A.PROD_ID = B.PROD_ID and A.PRODUCT = B.PRODUCT
    52  ;
    PRODUCT                                     TOTAL              FIXED            PROD_ID            PERCENT
    Prod 1                                       2000                  4                  1                 .2
    Prod 2                                       1000                 58                  2                5.8
    Prod 3                                        500                  3                  3                 .6
    3 rows selected.Cheers,

  • Ceating nested table using data binding.

    Hi,
    My requirement is to create a table using ADF data binding where against a value in column 1, there are multiple rows ( in the same row ) in column 2 . Something similar to what we do in excel when we join the 2 horizontal cells.
    I am providing sample table layout below. I have created the backend model to match this but both table and tree not providing what i am looking for. Tree does navigate the model but present this in single column.
    ========================================================================
    Column1 Columns2 Column3
    ========================================================================
    ABC First Data31
    Second Data32
    Data33
    Should i use mange bean to render this ?
    Thanks & regards
    Pankaj.

    Hi Frank i have tried that , my requirement to have the data in different column . Somehow the sample table i put does not display the format correctly , but its like a normal table but the cell with multiple values are merged. I have tried the ADF tree which displays the data but the format is of Tree not of normal table .

  • Nested Dashboards using Panel Set component

    Hello,
    I am investigating the usage of the Panel Set component. Since it is capable of hosting a SWF (presumably one created by Xcelsius) - I thought I could try this out for creating nested dashboarss, of sorts. I was able to export my SWF file from another dashboard and get it to show properly in one of the child panels. The only thing I am wondering about is that I noticed that when you maximize the panel the SWF file doesn't scale like a Panel that hosts a JPG file... it shows at the same size in the maximized windows as the "normal" window. Is this by design, or is there a setting I am missing?

    Hmm. OK, maybe we have a terminology difference here. I took a Xcelsisus generated (exported) SWF file and HAVE SUCCESSFULLY put it into a panel set component. It is not being called out via a URL - it is sitting on my desktop. It does properly render in the Panel Set panel. What it doesn't do is resize when you maximize the panel.
    So, are we speaking the same language here? Are you implying that if I servet that same SWF file off of a web site that it will not only display (AS IT CURRENTLY DOES) but that it will also resize as all SWF files do on your samples page on your web site?

Maybe you are looking for

  • HT4191 upgraded to new itunes and no longer able to sync my notes in outlook with my iphone 4s

    I use outlook notes and in itunes 10 you could sync notes when you plugged in your iphone and opened itunes. after itunes 11, you cannot sync notes via usb so how can i sync notes from my desk top to iphone and vis versa? The only thing i have not tr

  • How to run the attached picture control

    How to run the vi in the attached zip file for picture control. It always report the input is invalid. Thanks. Solved! Go to Solution. Attachments: AH.zip ‏104 KB

  • Adhoc Step runtime excution process.

    Hi Friends,     I have a scenario where AdHoc step is being used. As per my knowledge till now this step is used for runtime selection of process (i.e. which work flow we want to continue at run time). And for selecting that wf we have to goto graphi

  • Max data pull from Virtual Cube - is this a setting?

    We have a user doing a query against a Remote cube in our BW system, and they're hitting a "maximum data" limit of data from this remote cube.  Is this a setting for this cube or globals, and can you modify it? Thanks, Ken Little RJ Reynolds Tobacco

  • Two Blackberries synch to one Outlook

    Hi I have just one Outlook on my pc. I also have two blackberries - one for personal use and one for my own business use. Both are BIS. I should like to synch my outlook calendar, address book, notes etc to both blackberries; they are all currently s