LSMW User define routine translation

hi gurus,
I'm trying to load assets using LSMW. Everything is working fine except a minor issue. I'm trying to upload the vendors' for assets by using translation. There are some valid vendor codes which I've maintained in translation table. However there are some invalid vendor codes from legacy system (the asset is very old and the company doesn't deal with the vendor no more). For these invalid codes I want to assign a constant value but since I've not maintained the translation for these codes, LSMW issues an error during conversion. How can I create a user defined routine to assign the invalid vendor codes that I haven't maintained in the table to a constant value. thanks

In the step u201CMaintain Field Mapping and Conversion Rulesu201D declare global variables in the
u201CGlobal Data Definitions and Declarationsu201D section after you select all the checkboxes in the Popup window u201CDetermine Layoutu201D from the menu path u201CExtras / Layoutu201D. 
Here is a example of the global data declaration :
__GLOBAL_DATA__
DATA: cTmp(250) TYPE C, iTmp TYPE I.
TYPES: BEGIN OF stBase.
  TYPES : MESSAGE(250) TYPE C,MESSAGET
          INCLUDE TYPE ZCAFSMMUPLDFMT.
  TYPES : EWFIELDS(2000) TYPE C.
TYPES: END OF stBase.
Then, at the bottom of the u201CDisplay Field Mapping and Conversion Rulesu201D  screen you can enter your User ABAP Routine within the u201CForm Routine (ABAP routines)u201D node.  Below is a example of a routine :
FORM urOutputE1MARCM CHANGING pOut.
  pOut = 0.
  CLEAR waTmpE1MARCM.  FREE itTmpE1MARCM.
  MOVE-CORRESPONDING E1MARCM TO waTmpE1MARCM.
  APPEND waTmpE1MARCM TO itTmpE1MARCM.
  iTmp = 0.
  iTmp = STRLEN( waTmpE1MARCM ).
  IF iTmp > 0.
    REPLACE ALL OCCURRENCES OF REGEX '/' IN TABLE itTmpE1MARCM WITH '
    iTmp = 0. CLEAR waTmpE1MARCM.
    MOVE-CORRESPONDING itTmpE1MARCM TO waTmpE1MARCM.
    LOOP AT itTmpE1MARCM INTO waTmpE1MARCM. ENDLOOP.
    iTmp = STRLEN( waTmpE1MARCM ).
    IF iTmp > 0.
      pOut = 1.
    ELSE.
      pOut = 0.
    ENDIF.
  ENDIF.
ENDFORM.
You can then call the routine within your mapping.  I used the example a in the u201C__END_OF_RECORD__u201D node of a IDoc Segment to control whether or not the Segment is to be outputted or not.
PERFORM urOutputE1MARCM CHANGING iTmp.
IF iTmp > 0.
   transfer_record.
ENDIF.
I hope this helps some.

Similar Messages

  • LSMW user-defined routine error

    Hi,
      I have a problem with the routines in the LSMW. This is want I am doing:
    1. created a project & subproject.
    2. copied 4-5 objects from another project
    3. copied all the user routines.
    4. ran the objects fine.
    After a few days I have copied a new object from the old project and used one of the routines. It gives out the message "HANDLE is not defined under DATA". As I know, this is an lsmw global variable so it should work. This variable can be found in one of the routines. I deleted all the routines and copied them again and it work.
    Today I needed a new object, copied it, and it gives again this error; recopied the subroutines...still, error persist.
    Please help,
    Thank you very much in advanced
    LE: Is there any way to adapt your conversion program, after you made modifications to the field mapping?
    Message was edited by:
            Daniel BALTA

    Hello Chris,
    I have already done that and I still get this error, but only for this object. I have never declared this data "handle", but here is how 2 conversion programs look like (same project/subproject):
    The program that works:
    Counters
    data:
      g_cnt_UPLOAD  type i.
    Counter ct_xxxxxxxxxx: number of transferred records
    data:
      ct_IBIPEQUI  type i,
      cs_IBIPEQUI  type i.
    Global data definitions and data declarations
    __GLOBAL_DATA__
    DATA: objnr LIKE equi-objnr.
    DATA: handle TYPE balloghndl.
    INCLUDE zpmxi_appl_log.
    DATA: BEGIN OF wa_tplnr OCCURS 0 ,
          tplnr(50),
          END OF wa_tplnr.
    parameters:
      p_filept no-display,
      p_trfcpt no-display,
      p_packge(5) type n no-display.
    Select-option for wildcard value in file names
    And the program that doesn't work:
    Counter ct_xxxxxxxxxx: number of transferred records
    data:
      ct_BIKSSK  type i,
      cs_BIKSSK  type i,
      ct_BIAUSP  type i,
      cs_BIAUSP  type i.
    parameters:
      p_filept no-display,
      p_trfcpt no-display,
      p_packge(5) type n no-display.
    Select-option for wildcard value in file names
    How do you explain this?

  • LSMW  - Maintain Fixed Values, Translations, User-Defined Routines

    Hi all,
    I know a little about LSMW.I can perform all the steps and I have uploaded from flatfile to standard tables for transaction XK01. I just want to know what we can perform in sixth step.If I want to write a user defined routine how can I do that ? Can anyone explain me with a simple example and detailed description.
    Regards,
    Vijay.

    hi, you means the 'Maintain fixed values, translations, user-defined routines'.
    You can definite some fixed values and translations rule in this step.
    And go back to the 'Maintain field mapping and conversion rules' steps.
    You can utility these pre-defined in the data mapping.
    E.G.
    You defined a fixed valued name 'BUKRS'
    Through click the button in the application bar in step 5,
    you can use a FV_BUKRS in data mapping.
    FV_BUKRS is the name of the fixed value name in data mapping.
    thanks

  • LSMW Fixed, Translations and User defined routines??????

    Hi Experts,
      I have another questions here.. I can see the step called Maintain Fixed values, Translation and User defined routines in LSM Workbench, why is it used, when its used and where???
    If its possible can someone give me examples for this particular step...
    Well, I wanted to award some points to experts like RICH, CHRISTIAN AND ZHENGLIU, but my screen is not showing the points radio button.  But I will award, as soon as possible.
    Thanks and waiting for your replies.
    Regards,
      -Ken C

    Also check http://help.sap.com/saphelp_erp2005/helpdata/en/7a/5e3d38faba11d1b40f006094b944c8/frameset.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/7a/5e3d38faba11d1b40f006094b944c8/frameset.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/7a/5e3d38faba11d1b40f006094b944c8/frameset.htm
    Hope you'll find your answers..
    Cheers !!!

  • User defined routines in lsmw

    hi all,
    Can anyone explain the significance of user defined routines in lswm. In which scenario we use user defined routines. Can anyone explain userdefined routines with an example.
    thanxs
    hari

    Hi,
         Go to the transaction code LSMW. Create a new object. In the "Maintain object attributes" part, you define what standard object routine that you want to use. Here are a few from 46c
    0001   Long texts         
    0010   GL a/c master record
    0020   Material master    
    0030   Material BOM       
    0035   LIFO Layer         
    0040   Vendor master      
    0050   Customer master    
    0060   Purchasing info rec.
    0070   Condition record   
    0080   Purchase requisition
    0085   Purchase Order     
    0090   Sales documents    
    0100   Financial documents
    0105   LockBox            
    0110   Goods movement     
    0120   Manual reservation 
    0130   Classification     
    0140   Class              
    0150   Characteristic     
    0160   Fixed assets       
    0170   Routing            
    0180   Planned indep.reqmts
    0190   Doc. purch. info re
    0210   Storage bin (WM)  
    0220   Warehouse stock (WM
    0240   Inspection plans(QM
    0250   Bank data         
    0260   Work center       
    0300   Rental unit       
    0310   Lease-Out         
    0320   Business entity   
    0330   Property          
    0400   Equipment          
    0410   Message (IH)       
    0420   Confirmation (IH)  
    0425   Measuring point    
    0430   Measuring document 
    0440   Functional location
    0450   Object link        
    0460   Maintenance plan   
    0470   Equipment task list
    0480   FnctnlLoc.TaskList 
    0490   Gen.task list      
    0555   HR master data     
    0600   PostCode,Loc.,St.,..
    0602   PostCode,Loc.,St.,..
    0610   Cities             
    0612   Locations          
    0620   Postal codes       
    0622   Postal codes       
    0630   Districts          
    0632   Districts          
    0640   Streets            
    0642   Streets            
    0650   P.O. boxes         
    0652   P.O. boxes         
    0777   Personnel Planning 
    0800   Do not use!        
    Each object has several methods under it, some for Batch input, or direct input, or some for Create, Change, Delete. It really depends on the object.
    refer the link:
    Lsmw
    <b>Reward points</b>
    Regards
    Message was edited by:
            skk

  • About user defined routine in lsmw

    Hi,
    When we create user defined routine in lsmw.
    it ask for input parameter and out put parameter.
    after that it will create one  subroutine.
    But how to map input parameter  of sub routine with source field.
    thanks,
    Jigar

    Hi Jigar,
    when you have selected a project and a subproject your first screen
    will be the personal menu of the LSMW. You will find here a step-by-step-wizard
    which you have to execute in sequence. If a step is executed the cursor is automatically positioned on the next step.
    Choose 'Maintain field mapping and conversion rules'.
    If the mapping is displayed set the cursor on the field you want to edit.
    Press the button 'Rule' on the button bar above the mapping.
    You will get a Popup where you can select 'User-defined routine (reusable)' (that is the last radio button).
    Regards,
    Ralf
    > But how to map input parameter  of sub routine with
    > source field.

  • Using user-defined transport recording routine with table maintenance view?

    Hi,
    I have  a table that is maintained through a maintenance view. I need to record the changes to a dedicated transport object (not TABU) with my own recording routine instead of teh standard recording routine.Could someone tell me which/how the events can be used to achieve this?
    Regards
    Rachana

    Hi Rajeev,
    I have changed TMG to choose the option - User defined routine. And I have created a new transport object in SOBJ for the table. Is this enough to record the object to the transport as the object i defined instead of TABU? Do I need to write some subroutine for any view event to achieve this? Do you mean to use the menu option to include the object to a request?
    I have a bigger problem where this view is actually part of a view cluster. Even in that case is teh above steps enough?
    Regards
    Rachana

  • Problem about user-defined resource in RAC

    i do what doc says ,to create user-defined resource ,
    [oracle@rac1 ~]$ crs_profile -create network1 -t application -a /opt/ora/product/10.2.0/crs_1/bin/usrvip -o oi=eth0,ov=192.168.40.221,on=255.255.255.0
    [oracle@rac1 ~]$ crs_register network1
    [root@rac1 bin]# ./crs_setperm network1 -o root
    [root@rac1 bin]# ./crs_setperm network1 -u user:oracle:r-x
    [oracle@rac1 ~]$ crs_start network1
    Attempting to start `network1` on member `rac2`
    Start of `network1` on member `rac2` succeeded.
    $ crs_profile -create chk_slp -t application -B /opt/action_chkslp -d "test for crs" -r
    network1 -l application2 -a /opt/chkslp.scr -o ci=5,ft=2,fi=12,ra=2
    the command do not create /opt/chkslp.scr file ,so when i run crs_register chk_slp ,it will fail
    [oracle@rac1 admin]$ crs_register chk_slp
    Action Script `/opt/chkslp.scr` does not exist!
    CRS-0213: Could not register resource 'chk_slp'.
    i do not know why,anyone can help

    Hi Jigar,
    when you have selected a project and a subproject your first screen
    will be the personal menu of the LSMW. You will find here a step-by-step-wizard
    which you have to execute in sequence. If a step is executed the cursor is automatically positioned on the next step.
    Choose 'Maintain field mapping and conversion rules'.
    If the mapping is displayed set the cursor on the field you want to edit.
    Press the button 'Rule' on the button bar above the mapping.
    You will get a Popup where you can select 'User-defined routine (reusable)' (that is the last radio button).
    Regards,
    Ralf
    > But how to map input parameter  of sub routine with
    > source field.

  • User-Defined Planning Layouts  - Translations

    Hi Experts,
    Custom Planning layouts have been created.
    I need to translate the form from English to Danish.
    This has to be done in the Development system then moved to Quality and Production.
    This is how I proceeded with the task:
    IMG Path: Project System  Costs  Planned Costs  Manual Cost Planning in WBS  Detailed Planning  Create User-Defined Planning Layouts for Detailed Planning.
    Select Change PS Planning Cost Element/Activity Input Layouts.
    Select Layout ZMY_LAYOUT  Planning Layout  Translate Form.
    Specify Source Lanaguage : EN, Target Language: DA --> Clcik on Translate Button.
    There is a prompt for including the request in a Transport Request. If clicked yes it asks for a workbench Request.
    I specified the workbench request number.
    Select Form --> Object List
    Select the line with form name, Source Text --> Click on Translate.
    Enter the translation -> Save and exit
    However, when I check my request in SE10, it has no objects???
    If I repeat the process, and select Transport form, it asks me for a customizing Request.
    How can I move  my transations from D to Q.
    Regards,
    Reema Shahbazkar.

    Hi,
    No it is NOT a unicode system.
    Regards,
    Reema

  • Can I translate user defined table into mulilanguages

    Can I translate a particular field of my own data field into foreign languages in SAP B1?
    Actually I want to print shipping label in different langauages. And I want that address and the details of the shipping label transleted in a text file in order to print from command prompt.
    Pls help me . its urgent
    Thanks in advance

    Im not sure, if I understand you correct.
    I understood that you want to transalte the description of user defined field - ok?
    If yes, the only way is to move the UDF inside the form and based of selected language show correct description in label.

  • What the best way to create User defined table with ADDON purpose

    Hi folks, how are you ?
    I´m beginner in development to business one, and I m studying to develop ISV addons.
    But, during my exercises and analisys, I learned that have two ways to create tables and fields in business one. One way is throght by wizard in business one using Tools Menu > Configuration Tools > User Defined Tables >
    Obs: I ´m using Business One Patch Level 9.
    Other way, is create the tables and fields using DI API
    But, my question is. When I develop one addon, or one UDO form that uses one set of user defined tables or used defined fields that where created by the first way (by wizard in B1), how I deploy this in other business one installation ? The package process will ensure the creation of this tables in another enviroment or I must implement the creation of user defined tables using DI API so that this code is called during the installation?
    If in cases of addon develop I must use DI API to create user defined tables, How can I use my classes with this responsibility in package process ?
    Thanks my friends.

    Hi Renan,
    You just need to put your logic in to the startup of your application, after you've established your connection to the UI API and DI API. All this will be triggered in the constructor of your main class.
    namespace MyNamespace
    public class MyAddon
      bool runAddon = true;
      bool initialised = false;
      const string ADDON_NAME = "My Addon";
      public static void Main()
            MyAddon addOn = new MyAddon();
            if(runAddon)
                  System.Windows.Forms.Application.Run();
            else
             Application.Exit();
      public MyAddon()
            // Connect to SBO session for UI
            if(!SetApplication()) runAddon = false;
      private bool SetApplication()
            // Code goes in here to establish UI API and DI API connections
            // See SDK samples for examples
            // You should also define and filter the UI API events your addon will trap at this stage and create any menus
            // Call your routine to check if the required UDFs/UDTs exist on this company
            initialised = CheckInitialisation();
            if (!initialised)
               //  AddOn not yet intialised on this company so prompt the user to run the intialisation process
              int iResponse = app.MessageBox("The " + ADDON_NAME + " addon will now create all required fields and tables."
                                             + System.Environment.NewLine + System.Environment.NewLine
                                             + "WARNING: It is strongly recommended that all other users are logged out of this company "
                                             + "before running this process. Are you sure you wish to continue?", 2, "Yes", "No", "");
              if (iResponse == 1) initialised = InitialiseAddOn(); // Call your routine to create the objects
            return true;
    Kind Regards,
    Owen

  • Is it possible to create user defined control in labview

    in .net we can create user defined contol in which i can put more then one control and,, can use it as single control when needed,, but,, how this possible in labview,,
    actually in my program i have a tab control and,, in that tab control there are 8 pages,, now there are 5 different kind option selection for each page lets say "a" "b" "c" "d" "e",,,,,.,. so,, when i select "a" configuration for tabpage 1 should show.. "a"(control collection)  on tabpage1....and,, same should b possible for all 8 pages............................. this can possible if its possible to create user defined contorl in labview
    while in .net its very easy task i m confused here,..,.
    i put these controls in another 5 different  VI,,,, and tried to call in subpanel but,, i dont find the solution,,,
    Attachments:
    tabcontrol.vi ‏1 KB

    Hi,
    I've tried to open you attachment but LabVIEW tells me it's not a vi... could you check it and repost please ?
    I'm not really sure of what you need but you CAN customize you control in LabVIEW, it is not hard, you just have to know how it works
    Sometimes being good at another programation language confuse you more than it helps because you try to do as you are used to... the difficulty it to "translate" functions from a language to another.
    I do know how frustrating it can be when you think "Damned, it would take me only 5 minutes to do that with language a and after 10 hours with language b it is still not working "
    You have to get in LabVIEW way of thinking, I wish you good luck !
    A quick exemple... this might not do exactly what you need but it may help you anyway.
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
    Attachments:
    exemple.vi ‏55 KB

  • User defined xquery function with index enabled

    If I use user defined xquery function, can the index be applied within the function?
    trados.xsd
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by () -->
    <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:tns="http://ecoit.hp.com/ecg/repository/trados" targetNamespace="http://ecoit.hp.com/ecg/repository/trados" elementFormDefault="qualified">
         <complexType name="entry">
              <sequence>
                   <element name="base" type="string"/>
                   <element name="translation" maxOccurs="unbounded">
                        <complexType>
                             <simpleContent>
                                  <extension base="string">
                                       <attribute name="lang"/>
                                  </extension>
                             </simpleContent>
                        </complexType>
                   </element>
              </sequence>
              <attribute name="xpath" type="string" use="required" xdb:SQLName="XPATH"/>
              <attribute name="locator" type="string" use="required"/>
         </complexType>
         <simpleType name="languages">
              <list itemType="string"/>
         </simpleType>
         <element name="trados" xdb:defaultTable="ECG_REP_TRADOS_TAB" xdb:tableProps="VARRAY XMLDATA.ENTRY STORE AS TABLE ECG_REP_TRADOS_ENTRY_TAB ((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$)) ORGANIZATION INDEX OVERFLOW)">
              <complexType>
                   <sequence>
                        <element name="entry" type="tns:entry" minOccurs="0" maxOccurs="unbounded" xdb:SQLName="ENTRY"/>
                   </sequence>
                   <attribute name="cid" type="string"/>
                   <attribute name="path" type="string"/>
                   <attribute name="lang" type="string"/>
                   <attribute name="langs" type="tns:languages"/>
                   <attribute name="oldversion" type="string"/>
              </complexType>
         </element>
    </schema>
    CREATE INDEX ECG_REP_ENTRY_XPATH_IDX ON ECG_REP_TRADOS_ENTRY_TAB ("XPATH", "NESTED_TABLE_ID")
    eco_category.xsd
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- edited with XMLSpy v2008 (http://www.altova.com) by Jan-Erik Pedersen (HEWLETT PACKARD) -->
    <!--W3C Schema generated by XMLSpy v2007 (http://www.altova.com) by Scott Dismukes (Hewlett Packard)-->
    <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:tns="http://ecoit.hp.com/ecg/repository/eco/category" xmlns:cns="http://ecoit.hp.com/ecg/repository/types" targetNamespace="http://ecoit.hp.com/ecg/repository/eco/category" elementFormDefault="qualified">
         <import namespace="http://ecoit.hp.com/ecg/repository/types" schemaLocation="../types.xsd"/>
         <complexType name="productFamilies">
              <sequence>
                   <element name="productFamily" type="tns:productFamily" minOccurs="0" maxOccurs="unbounded"/>
                   <element name="product" type="tns:product" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
              <attribute name="lang" use="required" xdb:SQLName="LANG">
                   <simpleType>
                        <restriction base="string">
                             <length value="5"/>
                        </restriction>
                   </simpleType>
              </attribute>
              <attribute name="version" use="required" xdb:SQLName="VERSION">
                   <simpleType>
                        <restriction base="string">
                             <maxLength value="100"/>
                        </restriction>
                   </simpleType>
              </attribute>
         </complexType>
         <complexType name="productCategory">
              <sequence>
                   <element name="label" type="cns:label"/>
                   <element name="productCategory" type="tns:productCategory" minOccurs="0" maxOccurs="unbounded" xdb:defaultTable="ECG_REP_ECO_CATALOG_PC_TAB"/>
                   <element name="product" type="tns:product" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
              <attribute name="id" type="cns:id" use="required"/>
         </complexType>
         <complexType name="productCategories">
              <sequence>
                   <element name="productCategory" type="tns:productCategory" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
         </complexType>
         <complexType name="column">
              <sequence>
                   <element name="label" type="cns:label"/>
              </sequence>
              <attribute name="id" type="cns:id" use="required"/>
         </complexType>
         <complexType name="product">
              <sequence>
                   <element name="label" type="cns:label"/>
                   <element name="column" type="tns:column" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
              <attribute name="id" type="cns:id" use="required"/>
         </complexType>
         <complexType name="productFamily">
              <sequence>
                   <element name="label" type="cns:label"/>
                   <element name="image" type="cns:image" minOccurs="0" maxOccurs="unbounded"/>
                   <element name="link" type="cns:link" minOccurs="0" maxOccurs="unbounded"/>
                   <element name="column" type="tns:column" minOccurs="0" maxOccurs="unbounded"/>
                   <element name="productCategories" type="tns:productCategories" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
              <attribute name="id" type="cns:id" use="required"/>
         </complexType>
         <element name="productFamilies" type="tns:productFamilies" xdb:defaultTable="ECG_REP_ECO_CATALOG_TAB"/>
    </schema>
    xquery
    xquery version "1.0";
    declare namespace typ = "http://ecoit.hp.com/ecg/repository/types";
    declare namespace c = "http://ecoit.hp.com/ecg/repository/eco/category";
    declare namespace t = "http://ecoit.hp.com/ecg/repository/trados";
    declare variable $c := $res/c:productFamilies;
    declare function local:pc($pc as element(c:productCategory), $x as xs:string) as element()
         <c:productCategory id="{$pc/@id}">
              <c:label>{data($es/t:entry[@xpath eq concat($x, "/label")]/t:translation)}</c:label>
              for $p in $pc/c:product
              return local:p($p, concat($x, "/product/[@id=", $p/@id, "]"))
              for $pcc in $pc/c:productCategory
              return local:pc($pcc, concat($x, "/productCategory[@id=", $pcc/@id, "]"))
         </c:productCategory>
    declare function local:p($p as element(c:product), $x as xs:string) as element()
         <c:product id="{$p/@id}">
              <c:label>{string($es/t:entry[@xpath eq concat($x, "/label")]/t:translation)}</c:label>
              for $col in $p/c:column
              return
              <c:column id="{$col/@id}">
                   <c:label>
                        let $e := $es/t:entry[@xpath eq concat($x, "/column[@id=", $col/@id, "]/label")]
                        return
                        if(exists($e)) then string($e/t:translation)
                        else $col/c:label/text()
                   </c:label>
              </c:column>
         </c:product>
    <c:productFamiles xsi:schemaLocation="http://ecoit.hp.com/ecg/repository/eco/category http://ecoit.hp.com/ecg/repository/eco/category.xsd http://ecoit.hp.com/ecg/repository/types http://ecoit.hp.com/ecg/repository/types.xsd" lang="{$lang/lang/text()}" version="{$c/@version}">
         for $pf in $c/c:productFamily
         let $x := concat("/productFamily[@id=", $pf/@id, "]")
         return
         <c:productFamily id="{$pf/@id}">
    (:xpath index can not be applied within function:)
              <c:label>{data($es/t:entry[@xpath eq concat($x, "/label")]/t:translation)}</c:label>
              for $img in $pf/c:image
              return $img
              for $link in $pf/c:link
              return $link
              for $col in $pf/c:column
              return
              <c:column id="{$col/@id}">
                   <c:label>{data($es/t:entry[@xpath eq concat($x, "/column[@id=", $col/@id, "]/label")]/t:translation)}</c:label>
              </c:column>
              for $pcs in $pf/c:productCategories
              return
              <c:productCategories>
                   for $pc in $pcs/c:productCategory
                   return local:pc($pc, concat($x, "/productCategories/productCategory[@id=", $pc/@id, "]"))
              </c:productCategories>
         </c:productFamily>
         for $p in $c/c:product
         return local:p($p, concat("/product[@id=", $p/@id, "]"))
    </c:productFamiles>
    Message was edited by:
    John Lee

    John
    Am i missing a bit of the Xquery
    In 11.1,0.6.0 I get
    Elapsed: 00:00:00.04
    SQL> set echo on
    SQL> spool testcase.log
    SQL> --
    SQL> connect sys/ as sysdba
    Enter password:
    Connected.
    SQL> set define on
    SQL> set timing on
    SQL> --
    SQL> define USERNAME = HPECO
    SQL> --
    SQL> def PASSWORD = HPECO
    SQL> --
    SQL> def USER_TABLESPACE = USERS
    SQL> --
    SQL> def TEMP_TABLESPACE = TEMP
    SQL> --
    SQL> drop user &USERNAME cascade
      2  /
    old   1: drop user &USERNAME cascade
    new   1: drop user HPECO cascade
    User dropped.
    Elapsed: 00:00:18.12
    SQL> grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSW
    ORD
      2  /
    old   1: grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &P
    ASSWORD
    new   1: grant create any directory, drop any directory, connect, resource, alter session, create view to HPECO identified by HPECO
    Grant succeeded.
    Elapsed: 00:00:00.03
    SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
      2  /
    old   1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
    new   1: alter user HPECO default tablespace USERS temporary tablespace TEMP
    User altered.
    Elapsed: 00:00:00.00
    SQL> connect &USERNAME/&PASSWORD
    Connected.
    SQL> --
    SQL> alter session set events ='19027 trace name context forever, level 0x800'
      2  /
    Session altered.
    Elapsed: 00:00:00.00
    SQL> --
    SQL> declare
      2    xmlschema xmltype := XMLTYPE(
      3  '<?xml version="1.0" encoding="UTF-8"?>
      4  <!-- edited with XMLSpy v2008 (http://www.altova.com) by Jan-Erik Pedersen (HEWLETT PACKARD) -->
      5  <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:tns="http://ecoit.hp.com/ecg/rep
    ository/types" targetNamespace="http://ecoit.hp.com/ecg/repository/types" elementFormDefault="qualified">
      6     <complexType name="item">
      7             <simpleContent>
      8                     <extension base="tns:content">
      9                             <attribute name="id" type="tns:id" use="required"/>
    10                     </extension>
    11             </simpleContent>
    12     </complexType>
    13     <complexType name="items">
    14             <sequence>
    15                     <element name="item" type="tns:item" maxOccurs="unbounded"/>
    16             </sequence>
    17             <attribute name="id" type="tns:id" use="required"/>
    18     </complexType>
    19     <complexType name="mappings">
    20             <sequence>
    21                     <element name="item" type="tns:item" minOccurs="0" maxOccurs="unbounded"/>
    22                     <element name="items" type="tns:items" minOccurs="0" maxOccurs="unbounded"/>
    23             </sequence>
    24     </complexType>
    25     <complexType name="local">
    26             <sequence>
    27                     <element name="common">
    28                             <complexType>
    29                                     <sequence>
    30                                             <element name="texts" type="tns:mappings"/>
    31                                             <element name="images" type="tns:mappings" minOccurs="0"/>
    32                                     </sequence>
    33                             </complexType>
    34                     </element>
    35                     <element name="section" minOccurs="0" maxOccurs="unbounded">
    36                             <complexType>
    37                                     <sequence>
    38                                             <element name="texts" type="tns:mappings"/>
    39                                             <element name="images" type="tns:mappings" minOccurs="0"/>
    40                                     </sequence>
    41                                     <attribute name="id" use="required">
    42                                             <simpleType>
    43                                                     <restriction base="string">
    44                                                             <maxLength value="32"/>
    45                                                     </restriction>
    46                                             </simpleType>
    47                                     </attribute>
    48                             </complexType>
    49                     </element>
    50             </sequence>
    51             <attribute name="lang" use="required" xdb:SQLName="LANG">
    52                     <simpleType>
    53                             <restriction base="string">
    54                                     <length value="5"/>
    55                             </restriction>
    56                     </simpleType>
    57             </attribute>
    58     </complexType>
    59     <complexType name="link">
    60             <sequence>
    61                     <element name="url" type="tns:url"/>
    62                     <element name="label" type="tns:label"/>
    63                     <element name="image" type="tns:image" minOccurs="0"/>
    64             </sequence>
    65             <attribute name="id" type="tns:id"/>
    66     </complexType>
    67     <complexType name="image">
    68             <sequence>
    69                     <element name="url" type="string"/>
    70                     <element name="label" type="tns:label" minOccurs="0"/>
    71             </sequence>
    72             <attribute name="id" type="tns:id" use="optional"/>
    73     </complexType>
    74     <simpleType name="id">
    75             <restriction base="string">
    76                     <maxLength value="100"/>
    77             </restriction>
    78     </simpleType>
    79     <simpleType name="label">
    80             <restriction base="string">
    81                     <maxLength value="200"/>
    82             </restriction>
    83     </simpleType>
    84     <simpleType name="content">
    85             <restriction base="string">
    86                     <maxLength value="4000"/>
    87             </restriction>
    88     </simpleType>
    89     <simpleType name="url">
    90             <restriction base="string">
    91                     <maxLength value="256"/>
    92             </restriction>
    93     </simpleType>
    94  </schema>');
    95  begin
    96    dbms_xmlschema.registerSchema
    97    (
    98        schemaurl => 'http://ecoit.hp.com/ecg/repository/types.xsd'
    99       ,schemadoc => xmlschema
    100       ,local     => TRUE
    101       ,genBean   => false
    102       ,genTypes  => TRUE
    103       ,genTables => TRUE
    104       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    105    );
    106  end;
    107  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:01.35
    SQL>
    SQL> declare
      2    xmlschema xmltype := XMLTYPE(
      3  '<?xml version="1.0" encoding="UTF-8"?>
      4  <!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by  () -->
      5  <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:tns="http://ecoit.hp.com/ecg/rep
    ository/trados" targetNamespace="http://ecoit.hp.com/ecg/repository/trados" elementFormDefault="qualified">
      6     <complexType name="entry">
      7             <sequence>
      8                     <element name="base" type="string"/>
      9                     <element name="translation" maxOccurs="unbounded">
    10                             <complexType>
    11                                     <simpleContent>
    12                                             <extension base="string">
    13                                                     <attribute name="lang"/>
    14                                             </extension>
    15                                     </simpleContent>
    16                             </complexType>
    17                     </element>
    18             </sequence>
    19             <attribute name="xpath" type="string" use="required" xdb:SQLName="XPATH"/>
    20             <attribute name="locator" type="string" use="required"/>
    21     </complexType>
    22     <simpleType name="languages">
    23             <list itemType="string"/>
    24     </simpleType>
    25     <element name="trados" xdb:defaultTable="ECG_REP_TRADOS_TAB" xdb:tableProps="VARRAY XMLDATA.ENTRY STORE AS TABLE ECG_REP_TRA
    DOS_ENTRY_TAB ((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$)) ORGANIZATION INDEX OVERFLOW)">
    26             <complexType>
    27                     <sequence>
    28                             <element name="entry" type="tns:entry" minOccurs="0" maxOccurs="unbounded" xdb:SQLName="ENTRY"/>
    29                     </sequence>
    30                     <attribute name="cid" type="string"/>
    31                     <attribute name="path" type="string"/>
    32                     <attribute name="lang" type="string"/>
    33                     <attribute name="langs" type="tns:languages"/>
    34                     <attribute name="oldversion" type="string"/>
    35             </complexType>
    36     </element>
    37  </schema>');
    38  begin
    39    dbms_xmlschema.registerSchema
    40    (
    41        schemaurl => 'http://ecoit.hp.com/ecg/repository/trados.xsd'
    42       ,schemadoc => xmlschema
    43       ,local     => TRUE
    44       ,genBean   => false
    45       ,genTypes  => TRUE
    46       ,genTables => TRUE
    47       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    48    );
    49  end;
    50  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.68
    SQL> declare
      2    xmlschema xmltype := XMLTYPE(
      3  '<?xml version="1.0" encoding="UTF-8"?>
      4  <!-- edited with XMLSpy v2008 (http://www.altova.com) by Jan-Erik Pedersen (HEWLETT PACKARD) -->
      5  <!--W3C Schema generated by XMLSpy v2007 (http://www.altova.com) by Scott Dismukes (Hewlett Packard)-->
      6  <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:tns="http://ecoit.hp.com/ecg/rep
    ository/eco/category" xmlns:cns="http://ecoit.hp.com/ecg/repository/types" targetNamespace="http://ecoit.hp.com/ecg/repository/eco/c
    ategory" elementFormDefault="qualified">
      7     <import namespace="http://ecoit.hp.com/ecg/repository/types" schemaLocation="http://ecoit.hp.com/ecg/repository/types.xsd"/>
      8     <complexType name="productFamilies">
      9             <sequence>
    10                     <element name="productFamily" type="tns:productFamily" minOccurs="0" maxOccurs="unbounded"/>
    11                     <element name="product" type="tns:product" minOccurs="0" maxOccurs="unbounded"/>
    12             </sequence>
    13             <attribute name="lang" use="required" xdb:SQLName="LANG">
    14                     <simpleType>
    15                             <restriction base="string">
    16                                     <length value="5"/>
    17                             </restriction>
    18                     </simpleType>
    19             </attribute>
    20             <attribute name="version" use="required" xdb:SQLName="VERSION">
    21                     <simpleType>
    22                             <restriction base="string">
    23                                     <maxLength value="100"/>
    24                             </restriction>
    25                     </simpleType>
    26             </attribute>
    27     </complexType>
    28     <complexType name="productCategory">
    29             <sequence>
    30                     <element name="label" type="cns:label"/>
    31                     <element name="productCategory" type="tns:productCategory" minOccurs="0" maxOccurs="unbounded" xdb:defaultTa
    ble="ECG_REP_ECO_CATALOG_PC_TAB"/>
    32                     <element name="product" type="tns:product" minOccurs="0" maxOccurs="unbounded"/>
    33             </sequence>
    34             <attribute name="id" type="cns:id" use="required"/>
    35     </complexType>
    36     <complexType name="productCategories">
    37             <sequence>
    38                     <element name="productCategory" type="tns:productCategory" minOccurs="0" maxOccurs="unbounded"/>
    39             </sequence>
    40     </complexType>
    41     <complexType name="column">
    42             <sequence>
    43                     <element name="label" type="cns:label"/>
    44             </sequence>
    45             <attribute name="id" type="cns:id" use="required"/>
    46     </complexType>
    47     <complexType name="product">
    48             <sequence>
    49                     <element name="label" type="cns:label"/>
    50                     <element name="column" type="tns:column" minOccurs="0" maxOccurs="unbounded"/>
    51             </sequence>
    52             <attribute name="id" type="cns:id" use="required"/>
    53     </complexType>
    54     <complexType name="productFamily">
    55             <sequence>
    56                     <element name="label" type="cns:label"/>
    57                     <element name="image" type="cns:image" minOccurs="0" maxOccurs="unbounded"/>
    58                     <element name="link" type="cns:link" minOccurs="0" maxOccurs="unbounded"/>
    59                     <element name="column" type="tns:column" minOccurs="0" maxOccurs="unbounded"/>
    60                     <element name="productCategories" type="tns:productCategories" minOccurs="0" maxOccurs="unbounded"/>
    61             </sequence>
    62             <attribute name="id" type="cns:id" use="required"/>
    63     </complexType>
    64     <element name="productFamilies" type="tns:productFamilies" xdb:defaultTable="ECG_REP_ECO_CATALOG_TAB"/>
    65  </schema>
    66  ');
    67  begin
    68    dbms_xmlschema.registerSchema
    69    (
    70        schemaurl => 'http://ecoit.hp.com/ecg/repository/eco/category.xsd'
    71       ,schemadoc => xmlschema
    72       ,local     => TRUE
    73       ,genBean   => false
    74       ,genTypes  => TRUE
    75       ,genTables => TRUE
    76       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    77    );
    78  end;
    79  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:01.65
    SQL> CREATE INDEX ECG_REP_ENTRY_XPATH_IDX ON ECG_REP_TRADOS_ENTRY_TAB ("XPATH", "NESTED_TABLE_ID")
      2  /
    Index created.
    Elapsed: 00:00:00.01
    SQL> set pages 0 lines 160
    SQL> set long 10000
    SQL> --
    SQL> set autotrace on explain
    SQL> --
    SQL> xquery
      2  xquery version "1.0";
      3
      4  declare namespace typ = "http://ecoit.hp.com/ecg/repository/types";
      5  declare namespace c = "http://ecoit.hp.com/ecg/repository/eco/category";
      6  declare namespace t = "http://ecoit.hp.com/ecg/repository/trados";
      7
      8  declare variable $c := $res/c:productFamilies;
      9
    10  declare function local:pc($pc as element(c:productCategory), $x as xs:string) as element() {
    11     <c:productCategory id="{$pc/@id}">
    12     {
    13             <c:label>{data($es/t:entry[@xpath eq concat($x, "/label")]/t:translation)}</c:label>
    14             ,
    15             for $p in $pc/c:product
    16             return local:p($p, concat($x, "/product/[@id=", $p/@id, "]"))
    17             ,
    18             for $pcc in $pc/c:productCategory
    19             return local:pc($pcc, concat($x, "/productCategory[@id=", $pcc/@id, "]"))
    20     }
    21     </c:productCategory>
    22  };
    23
    24  declare function local:p($p as element(c:product), $x as xs:string) as element() {
    25     <c:product id="{$p/@id}">
    26     {
    27             <c:label>{string($es/t:entry[@xpath eq concat($x, "/label")]/t:translation)}</c:label>
    28             ,
    29             for $col in $p/c:column
    30             return
    31             <c:column id="{$col/@id}">
    32                     <c:label>
    33                     {
    34                             let $e := $es/t:entry[@xpath eq concat($x, "/column[@id=", $col/@id, "]/label")]
    35                             return
    36                             if(exists($e)) then string($e/t:translation)
    37                             else $col/c:label/text()
    38                     }
    39                     </c:label>
    40             </c:column>
    41     }
    42     </c:product>
    43  };
    44
    45  <c:productFamiles xsi:schemaLocation="http://ecoit.hp.com/ecg/repository/eco/category http://ecoit.hp.com/ecg/repository/eco/ca
    tegory.xsd  http://ecoit.hp.com/ecg/repository/types  http://ecoit.hp.com/ecg/repository/types.xsd" lang="{$lang/lang/text()}" versi
    on="{$c/@version}"> {
    46     for $pf in $c/c:productFamily
    47     let $x := concat("/productFamily[@id=", $pf/@id, "]")
    48     return
    49     <c:productFamily id="{$pf/@id}">
    50     {
    51             (:xpath index can not be applied within function:)
    52             <c:label>{data($es/t:entry[@xpath eq concat($x, "/label")]/t:translation)}</c:label>
    53             ,
    54             for $img in $pf/c:image
    55             return $img
    56             ,
    57             for $link in $pf/c:link
    58             return $link
    59             ,
    60             for $col in $pf/c:column
    61             return
    62             <c:column id="{$col/@id}">
    63                     <c:label>{data($es/t:entry[@xpath eq concat($x, "/column[@id=", $col/@id, "]/label")]/t:translation)}</c:lab
    el>
    64             </c:column>
    65             ,
    66             for $pcs in $pf/c:productCategories
    67             return
    68             <c:productCategories>
    69             {
    70                     for $pc in $pcs/c:productCategory
    71                     return local:pc($pc, concat($x, "/productCategories/productCategory[@id=", $pc/@id, "]"))
    72             }
    73             </c:productCategories>
    74     }
    75     </c:productFamily>
    76     ,
    77     for $p in $c/c:product
    78     return local:p($p, concat("/product[@id=", $p/@id, "]")) } </c:productFamiles>
    79  /
    ERROR:
    ORA-19228: XPST0008 - undeclared identifier: prefix 'res' local-name ''
    Elapsed: 00:00:00.01
    SQL>

  • Issue in passing Oracle User Defined Types to PL SQL from Websphere Applica

    HI,
    I am facing an issue when trying to pass Oracle collection object(User Defined Types) from Java to PL SQL. The issue happens inside J2EE application which is running inside Websphere Application Server 6.x. My database is Oracle 10g and i am using ojdbc1.4.jar as thin driver.
    The issue is that when i pass the Oracle Object from java side, the attribute values of the collection objects at the Oracle PL SQL side is coming as empty. I have tried the same java code in a standalone application and it works fine. The issue happens only when the application is running inside WAS.
    Anybody has any idea how to pass Oracle User Defined Types from WAS 6.x server to Oracle PL SQL?

    Andy Bowes wrote:
    Hi
    I am using WebLogic 8.14 & Oracle 9i with thin JDBC driver.
    Our application needs to perform the same DB operation for every item in a Java Collection. I cannot acheive the required performance using the standard Prepare & Execute loop and so I am looking to push the whole collection to Oracle in a single invocation of a Stored Procedure and then loop on the database.
    Summary of Approach:
    In the Oracle database, we have defined a Object Type :
    CREATE OR REPLACE
    TYPE MYTYPE AS OBJECT
    TxnId VARCHAR2(40),
    Target VARCHAR2(20),
    Source VARCHAR2(20),
    Param1 VARCHAR2(2048),
    Param2 VARCHAR2(2048),
    Param3 VARCHAR2(2048),
    Param4 VARCHAR2(2048),
    Param5 VARCHAR2(2048),
    and we have defined a collection of these as:
    CREATE OR REPLACE
    TYPE MYTYPE_COLLECTION AS VARRAY (100) OF MYTYPE
    There is a stored procedure which takes one of these collections as an input parameter and I need to invoke these from within my code.
    I am having major problems when I attempt to get the ArrayDescriptor etc to allow me to create an Array to pass to the stored procedure. I think this is because the underlying Oracle connection is wrapped by WebLogic.
    Has anyone managed to pass an array to an Oracle Stored procedure on a pooled DB connection?
    Thanks
    AndyHi. Here's what I suggest: First please get the JDBC you want to work in a
    small standalone program that uses the Oracle thin driver directly. Once
    that works, show me the JDBC code, and I will see what translation if
    any is needed to make it work with WLS. Will your code be running in
    WebLogic, or in an external client talking to WebLogic?
    Also, have you tried the executeBatch() methods to see if you can
    get the performance you want via batches?
    Joe

  • Modifying .PRM file for user defined database functions

    Hi,
    Currently we have the BOXI 3.1.8 Universe in oracle database and we are planning to migrate to SQL server 2008.And the universe contains few oracle functions and user defined functions in the universe objects.
    In the way of migration we are planning to have both Oracle and SQL Server database connecting to single universe. To make the universe generic we have identified the objects using user defined functions and trying to push it to the database.
    Since there are a few differences in the way oracle and SQL Server functions are invoked, we have decided to edit the .PRM files available in the path D:\Business Objects\BusinessObjects Enterprise 12.0\win32_x86\dataAccess\connectionServer\jdbc , so that we have a common way of invoking the functions.
    Invoking functions:
    SQL Server : <SchemaName>.<function>
    Oracle: <function>
    1.Is there any problem if I edit the .PRM?
    2.Whether these changes will work fine?
    3.Whether the reports will run fine if I use those objects in the reports?
    Thanks,
    Lavanyaa

    Hi Lavanyaa,
    The PRM files actually state the functions that are normally available in a database, including the standard format.
    They are what drives the list of functions available when you build the SELECT definition or CONDITION definitions in Information designer... The fact that a function needs aggregation or/not is also determined in there.
    However:
    The SQL that you provide in the universe is what will be sent to the database and that must be 'understood' by the database.
    So it's not as simple as changing the PRM file and you will be able to speak 'universal' SQL in your universes.
    Fortunately:
    That complexity is taken away from you when you create a multisource database.
    You will speak 'data federator' SQL in the universe. Data federator will take care of translating it to the right syntax for each database. Notice you will probably need some customization to determine how a SQL will be handled when you need to query two databases, as the default is not automatically the best way performance wise.
    Hope this helps,
    Marianne

Maybe you are looking for

  • Facebook is not loading in Firefox

    facebook login page only loads part way. I have re-installed firefox . facebook will load in Explorer.

  • Facebook via browser

    I often go to FB via the browser & not the app because the app is poorly written & has even more limited features than when going via the browser. However, today I notice that the browser version is no longer working & that it's defaulting to https:/

  • Why does Mountain Lion stop downloading at 10mb?! HELP!

    I keep trying to update my operating system to Mountain Lion. Everytime I download it, it downloads up to 10mb and then restarts back to zero. It does this three times and then gives me this error: "The application could not be downloaded. Check your

  • Smart form footer issue in 2nd page - Horizontal line is not displayed

    Dear Experts, I am working on a smartform. Which has a table (Header, Main area, Footer), When there are more records and footer alone is printed in the 2nd page, i am not getting the first horizontal line for the footer and it does not look like a t

  • 10.4.11 to lion software?

    Can i download the new lion software if i still have the old 10.4.11?  I have a macbook pro from 2007 that has osx 10.4.11 wiht 2.2ghz intel core 2duo proc and 2gb of momory.  Also, will i loose anything during the update if its possible?  Anything e