Category structure in AFS

hI,
cAN U PLZ EXPLAIN THE FUNCTIONALITY OF CATEGORY STRUCTURE AND COVERAGE STRATEGY in AFS. Do not send me the link of help.sap.com

Dear Indranil,
In AFS Grids - we are having a limitations to use maximum of three dimension, and also if the customer asks for an article with particular(grid)  size - we can give only that (grid) size. To further categorize - AFS has CATEGORY STRUCTURE and COVERAGE STRATEGY.
Say you want to have the QUALITY of a material to categorize, and you have already used the three options avaiable in GRID.
Then you may use Category structure and coverage strategy.
Cateogry structure - two types:
Requirement categories - are those that are linked to sales documents (this one you can enter in the sale order)
Stock categories - can be used for any type of logical stock segmentation (if you enter a category structure and coverage starategy for a material then you can see this in MMBE(stock overview)).
In the category structure - we will assign the field values which forms this category structure.
Say - Product from Region A has Quality 1, and product from Region B has Quality 2.
Then in the category structure - I will enter the field Country under my category srtucture.
This means REGION can be used to cateogrize the product. You may include as many fields as you want in the category structure to categorize the products.
Coverage strategy:
Coverage strategy will link the requirement categories and stock categories.
If I maintain as below in the coverage strategy -
Req. category Level Stock category
Q1                   1       Q1
Q2                   2       Q2
I am having Q1 stock 50 and Q2 stock 50.
In the sale order if I order for 70 materials of Quality 1 (Q1) - the first 50 materials will be picked from the Q1 (as the available stock is only 50), and the remaining materials will be of quality 2 (Q2) (This is because, we have maintained in the coverage strategy if the Q1 material is not available - use the material Q2 (this is at level 2)).
This is how the system wroks. This is what I have understood, by working on this.
I am not working on AFS now, not able to explain you better screen by screen.. I hope this information may help you to understand the concept of category structure and coverage strategy. thanks!
Please do trial and error method on this. You will learn a lot.
Thanks,
Venkatesh

Similar Messages

  • Cange AFS category structure after using in material.

    Hi!
    We use AFS.
    Is it possible to add characteristics into category structure after assigning coverage strategy and using it in material?
    I have tried to do it few times and got different  results (ok/error) !!!
    I am going to use 2-4 characteristics but 2 of them are not defined completely.  And if it is possible I would like to include only 2 caracteristics into structure and add 1 or 2 in few mounth.
    Thank you for help.
    Andrey Garshin.

    Hello Andrey
    Once the Category Structure  is locked and used in Material Master, transactional data could exist in the system related to the category values. Modifying the Category Structure by adding new fields will lead to database inconsistencies. Hence it is not advisable to change the Category Structure once it is locked and used in materials.
    If the Category Structure is locked and is not used in any of the materials, there is no harm in modifying it. Still the Coverage Strategy  will have to be redefined for this new field to be part of the Coverage  strategy.
    Regards
    Sudha

  • Error while creating fields in the Category Structure Urgent

    Hii,
    I am getting the Error while creating the Category structure fields
    Error Message : Entry YF_COU   does not exist in CABN - check your entry
    Message no. 00058
    Diagnosis
    Input values must be defined in Table CABN. The value or values 'YF_COU ' are not specified in this table.
    Procedure
    Check whether the input is correct and correct if necessary.
    Procedure for System Administration
    If this is not an incorrect entry, check the system settings and change them if necessary.
    If there is a connection to the Customizing system, you can maintain the system settings by choosing Customizing in the Performance Assistant or Maintain Entries (F5) when displaying the help in a modal dialog box.
    Please help me in this error
    Regards,
    Kumar

    Hii,
    I have assigned the Characteristics group /AFS/SAP_C to the characteristics but still i am getting the error when i assign the Char Field under the Category Structure.
    I have manually created the Characteristics Group AFS characteristics for categories. Is this will automatically updated or while installing the Add On.
    Please explain of the Configuration related to the Category Structure.  
    Regards,
    Kumar

  • Coverage Strategy use multiple Category Structures

    Hi AFS Expert,
    In the same Coverage Strategy, does it allow to use multiple Category Structures to do the transfer from requirement category to stock category?
    E.g Category Structure: AA, BB
    "Category Structure AA --> Coverage Strategy CS1 --> Requirement category" transfer to "Category Structure BB --> Coverage Strategy CS1 --> Stock category"
    Is it possible to do?
    Looking forward your kind advise.
    Thanks,
    Mag

    Hello Mag,
    The coverage strategy is configured for a single category structure and it maps the category values of that category structure. We can define the sequence in which the stock categories map the requirement categories. We will not be able to map the requirement category to stock category across category structures.
    Hope this information helps.
    Regards
    Sudha
    >
    Mag Sai wrote:
    > Hi AFS Expert,
    >
    > In the same Coverage Strategy, does it allow to use multiple Category Structures to do the transfer from requirement category to stock category?
    >
    > E.g Category Structure: AA, BB
    >
    > "Category Structure AA --> Coverage Strategy CS1 --> Requirement category" transfer to "Category Structure BB --> Coverage Strategy CS1 --> Stock category"
    >
    > Is it possible to do?
    >
    > Looking forward your kind advise.
    >
    > Thanks,
    > Mag

  • Change Item Category Structure

    Hi All,
    Our client wants to change the existing Item category structure from 2 segments to 4. Can we modify the Item category Flex field (though system allows)?
    Can any one best possiblle way since we have 1000's of items.
    Also,what is the impact in doing this change .
    will the transaction & reports work normally?
    BR

    You should be able to do it.
    You will have to make sure that existing categories conform to the new category structure.
    If they don't, you will have to change them.
    If you can't change them, then you will have to disable those old categories. You will also have to change the item-category assignments for those 1000s of items and assign a new category.
    I recommend doing this in the 11i instance so that the change gets tested along with the regression testing you are doing for R12 upgrade.
    Sandeep Gandhi

  • Org Specific Purchasing Category Structure and Values

    Hi
    I have an instance with 2 separate organisations defined under 1 business group. Each organisation requires its own purchasing category structure and values.
    I cant seem to be able to achieve setting each org with its own values using a different category set, even when I configure the category set to be controlled by organisation. Let alone each org having its own flexfield segment configuration i.e one has 3 segments 1 has 4.
    Is there anyway to achieve this in my current org structure, or do i have to create a business group for each organisation and seperate them that way to achieve this?
    Thanks
    James

    Hi Sandeep
    I have setup 2 different category sets, each controlled at org level, and then assigned them as the default category set for purchasing. However when i set it for one org it overwrites whats configured for the other org?
    Do you know why i cant seperate them?
    Thanks
    James

  • How to define the category structure?

    Hello
    it is possible to import Picture and have the directory structure like 2011_07_15 i mean to have underlain?
    And it is possible to have the RAW files, Movie file  in a subcategorie?
    Thanks for feedback
    vincent

    When you Import, and you select "Copy" or "Move" for the Import, then over on the right is the Destination Tab, you can specify the folder you want the photos to wind up in, and also the format of the folder name.
    Yes, you could certainly put movies and RAW in different folders, but with Lightroom, there really is no need for this.

  • Category structure in market place

    One of the partners was asking for an overview of categories that will be available in the market place.
    In that way he wants to get new ideas of what kind of add-ons/applications he could develop later on.

    The bing mashup is of type "user specific mashup". All other mashups ar URL-, HTML- or Data-Mashups. I think it is a custom silverlight control.
    I`ve heard as well that it should be possible for partners to generate own mashups in further releases.
    Regards,
    Andreas

  • Error while updating AFS weights & measures material master data using BAPI

    Hello ABAP experts,
    Please help me in finding the right way in updating AFS weights & measures data (/AFS/MARM) data using BAPI /AFS/BAPI_MATERIAL_SAVE_DATA.
    I'm populating the following table parameters of the BAPI,
    1. SKUUNITSOFMEASURE with /AFS/MARM records
    s_bapi_marm-ALT_UNIT = 'EA'.
    s_bapi_marm-ALT_UNIT_ISO = 'EA'.
    s_bapi_marm-grid_value = 'XXXXS'.
    *s_bapi_marm-STOCK_CATEGORY = '01000'.
    s_bapi_marm-volume  = '10'.
    s_bapi_marm-GROSS_WT  = '10'.
    s_bapi_marm-NET_WEIGHT  = '10'.
    append s_bapi_marm to t_bapi_marm.
    2. UNITSOFMEASURE with MARM records
    s_bapi_uom-ALT_UNIT = 'EA'.
    s_bapi_uom-ALT_UNIT_ISO = 'EA'.
    s_bapi_uom-NUMERATOR = '1'.
    s_bapi_uom-DENOMINATR = '1'.
    s_bapi_uom-UNIT_OF_WT = 'KG'.
    s_bapi_uom-VOLUMEUNIT = 'CCM'.
    append s_bapi_uom to t_bapi_uom.
    But the BAPI returns me an error "Stock Category & is not valid in Category structure  &"
    Let me know if you have any inputs on this one.
    Thanks,
    Partha.

    Hi VAMSHI,
    I have your same error but I don't know how to solve it. We have active "material split valuation" and valuation type is mandatory field if using ACCOUNTING and COSTING views.
    Please, let me know.
    Thanks in advance.
    GB

  • Create Stock Category

    How can I create a new stock category?
    Right now we have 4 separate categories....
    1 - First
    2 - Second
    C - Closeouts
    S - Samples
    Where in SAP can I create a NEW category?  (example: "3 - Third")

    Yes I have, I've created multiple characteristics using the "Chars Group" "AFS characteristics for categories" under the Basic Data section of the Basic Data tab.
    Unfortunately, none of them show up under Category Structures or Coverage Strategies in SPRO.
    How exactly do I edit the settings of a coverage strategy in SPRO?  There does not appear to be any options availbale when a coverage strategy is selected.  Is this something that is taken care of under CT04?  Or am I not understanding how a coverage strategy works?  What is the difference between a Characteristic and a Catagory Structure and how can I edit or change the settings of a catagory structure?
    Edited by: Cameron on Dec 3, 2009 9:51 AM
    Edited by: Cameron on Dec 3, 2009 10:14 AM

  • Sap afs sd

    Scenario is as below:
    Our client is in apparels and footwears and have there overseas operation also:
    I am doing configuration with  the logic that as follows:
    Client is doing exports as according to the requirements from the
    overseas customers and also there are domestic customers.
    Now I am utilising the functionalities like season, material grids and
    category structure as below.
    SEASON: OFF SEASON,ON SEASON
    MATERIAL GRID: NL,XL,XXL  (NL NORMAL,,XL EXTRA LARGE,XXL : DOUBLE EXTRA LG)
    CATEGORY STRUCTURE : REQUIREMENT CATEGORIES,STOCK CATEGORIES
    Product A  off season (export-sale)  material grids whichever is
    applicable or demanded by client customers. As product is, off season
    I am using requirement categories and for allocation run i am using
    coverage stategy with characteristics as QUALITY,SEASON AND PRODUCT.
    I am using Make to order strategy for off season material which would
    be export sales ,and make to stock strategy for on season materials
    which would be domestic sales.
    (path:img-logistic general-afs categories-define coverage strategy)
    Now the problems I am facing is system is giving me message "invalid
    input" after  maintaining coverage strategy parameters ie: such like
    category value,allocation run requirements etc.
    Now if the above scenario perhaps clear to you,Could you please let me
    know where i am going against system(sap afs sd).
    Also if possible let me know certain config documents pertaining to
    order scheduling,allocation run,delivery and billing
    Thanks And Regards
    KAPIL MORE

    Kapil,
    goto define coverage stratergy ->Select your stratergy ->double click on coverage stratergy on left side it will display category structure ->again select the same and double click on Arun/MRP/... option on left side there you should mention Stock category and MRP-Mod tab.
    "The MRP module controls the assignment of the requirement categories to the stock categories. Module M1 uses a strategy where all batches of stock, purchase requisitions and purchase orders which are available on the requested delivery date (sales order) and assigned to the stock category, will be used to satisfy the requirement"
    and i would suggest you to check each and every tab in structure and stratergy both you might have missed something.
    try and revert.
    hope its helpful to you.
    Regards
    Ashwini

  • Reg.AFS user manual

    Dear Experts
    In our SAP R/3 ECC6 system,
    Customer creation
    Vendor creation
    Material creation
    Purchase requisition creation
    Purchase order creation
    Purchase release
    PO print out
    Goods receipt
    Quality check
    Goods issue
    similarly what is the flow and Tcode for AFS 6.3. Pls help me.
    Thanks
    Rajakumar.K

    Dear Raj,
    The MM flow is same in AFS as that of standard R/3.
    1. Create PR
    2. Create PO
    3. MIGO
    4. MIRO
    Only in SD, we do need to run ARun(specific to AFS) to allocate the stock to the requirements.
    For a material, lot of additional features have been covered in AFS.
    1. Grid
    2. Season
    3. Category structure and Coverage strategy, etc.
    and T-Codes are same as standard SAP R/3.
    Thanks,
    Venkatesh.S.P

  • Customize display of category group names in item regions (902)

    Multi-level categorization is inconsistent within different portal contexts. Flat category structures work fine but sub-categories do not.
    For example let's define a set of categories: foo, foo/bar, test, test/foo, abc, abc/bar
    where bar is a sub-category of foo and so forth.
    The additem wizard shows the category in the form: category/sub-category/sub-sub-category/etc which is the preferred approach.
    However, an item region having Group By Category and "Display Group By Banner" checked is not the same. Here the group-by-text only shows the end-category name (not the full category/sub-category); i.e., only shows the last group "category" without the context of the full category.
    Want to show items in following style:
         foo
              item1
         foo/bar
              item2
         test/foo
              item3
         abc/bar
              item4
    As opposed to:
         foo
              item1
         bar
              item2
         foo
              item3
         bar
              item4
    Likewise, in the Advanced search the list of categories to search for are:
         foo
         .bar
         test
         .foo
         abc
         .bar
    What are some best practices to customize the display of custom items with sub-categories showing the full category/sub-category in 9iAS 9.0.2?
    Explicitly creating a flat category structure with '/' in the names doesn't seem the best use of item categories.
    And it looks like the content area SDK won't be available for a little while.

    Hi Jason
    The only way to show the path of your nested categories in the display banner is to name the subcatgory with the path information (i.e. 'test/foo' not 'foo'). The problem with showing the full path is scalability - rendering a deeply nested tree in the display banner or as an attribute would cause real problems. It was a design decision to go with the way that it is. If you feel strongly that Development should reconsider this decision, please feel free to log an enhancement request at:
    http://ers.oracle.com
    Product: Portal
    Component: Portal UI

  • 11i Advanced Pricing Questions on usage of Item Category Segment Values

    Hi All,
    we are on 11i, i am trying to setup on modifiers using Item Categories. Customer has 4 segment category structure.
    Category structure= Vendor, Group, Style, Price code , here is how Data looks = 060.10.800.40
    In 11i, can we setup Modifiers on Segment1 & Segment 2 ( 060.10), so system picks up all values for segment3 and segment4.
    I understand R12 can do this as per Metalink Note: 746020.1. is this supported in 11i.? I am unable to accomplish this.
    regards
    girish

    Hi
    Please donot post more questions in a single thread. If you post it separately, you will get many responses and detailed explanations from more members.
    Regarding your queries.,
    1. Relevant for delivery field in Item Category is for TEXT Items and for others you should configure the field in Schedule lines.
    3. Shipping conditions will be defaulted from the CMR of SP. If a value exists in the sales document type (eg. OR) then it will have priority and will replace the value defaulted from CMR.
    5. The pricing applies to Item Level only. But you cannot determine different procedures for different line items.
    6. Header conditions will not have access sequence and you cannot create condition records for header conditions in VK11.
    7. In consignment process - the first two steps are mandatory i.e., Consignment fillup and consignment issue.
    The other two steps are required only if there are returns from the customer(not consignee) and if there are any unsold stocks at the consignee.
    Thanks,
    Ravi

  • Create Folder with a category definition?

    Hi,
    Is there any way to attach a CATEGORY_DEFINITION to a folder in a worskpace?. I have only seen CATEGORY_CONFIGURATION attached. What I am trying to say, is there is any way to assign category attribute information to subfolder in a worksapce. Thanks in advance,
    Igor.
    Mensaje editado por:
    user511556

    I also need to accomplish the task of setting metadata attributes at the folder level. I do not believe that it is impossible. The Collaboration Suite web interface appears to do this very thing. It may be impossible using the oracle.ifs.fdk API, but that's just a weakness in the high-level API in my opinion. The data is being stored somewhere, that much is for sure.
    If the oracle.ifs.fdk API is insufficient to handle this task, Oracle ought to support an alternate means to get the job done. This is a fundamental part of any useful document management system.
    When examining the CONTENT schema in the database, it is obvious that both documents and folders support category instances in one form or another. It is also obvious that these two types of PUBLICOBJECTs are dealt with very differently in the database.
    At the end of this post are given two PLSQL procedures and one function that will populate a document with a given ID with metadata for my own custom category called "File Metadata". The second procedure and the function are just helpers called by the first. You'll need to grant the CONTENT user select privileges on SYS.DBA_TAB_COLUMNS. This is how the procedure gets the names of the metadata attribute columns, which will be different for every custom category. Naturally, you will have to modify the parameters and procedure body to make it work for your own custom category, using the name of your category and your own metadata attribute names as well. If you run the SELECTs in a sql editor, you will see how the data is laid out in the CONTENT schema. Though the procedure does not indicate this, everything starts with the ODMV_PUBLICOBJECT view.
    This procedure will not work for folders because the database layout for folder category attributes is different. I have yet to fully map it out, though I am deep into it. I will post a solution here when I find it.
    If anybody already knows the solution, please don't hesitate to post it. This is a cry for help. The category structure for folders is very difficult to trace. The actual metadata values are very elusive. Here's what I have found thus far:
    Let's say I have a folder whose ID is 958609. Here's the folder object itself, and all its child objects:
    select *
    from odmv_publicobject
    where id = 958609
    or securingpublicobject = 958609;
    Some of these children are category override instances. In my system, category overrides are the rows with a CLASSID of 2646. If you look up this ID in ODMV_CLASSOBJECT, you will see that it is ADHOCCONFIGURATION. This is different from a document's category instance, which has a custom CLASSID which points to a custom category in the ODMV_METADATASCHEMACATEGORY view. We see a divergence between document and folder category implementation already at this point. This query gives me the "ad hoc" category instance for my folder:
    select *
    from odmv_publicobject
    where securingpublicobject = 958609
    and classid in (
    select id
    from odmv_classobject
    where name = 'ADHOCCONFIGURATION'
    Among the child objects of my folder lie some more interesting things. It appears that the metadata attributes themselves are to be found here. The following query finds them all. Note the similarity to the preceding query. The only thing that changed was the type of CLASSOBJECT we are looking for.
    select *
    from odmv_publicobject
    where securingpublicobject = 958609
    and classid in (
    select id
    from odmv_classobject
    where name = 'METADATACATEGORYATTRIBUTEOVERRIDE'
    order by id asc;
    Now that I have these objects, it would seem like an easy task to look them up in whatever table they are stored in, and change the attribute values. But I cannot find this table (yet). This is where I am stuck. Any suggestions, please?
    Another odd fact: if you change folder metadata, all subfolders will reflect the change. Documents, however, do not change. Folders appear to inherit parent folder category metadata unless it is explicitly changed. I think this behavior extends all the way up to the domain object itself. Perhaps the domain object holds a bit of the secret. The domain object is a PUBLICOBJECT just like folders, documents, users, etc.
    Anyway, once this metadata attribute override table is found, it will be an easy matter to write PLSQL that can read and write folder metadata attribute values. Forget about oracle.ifs.fdk; it will not serve us here. As you can see, the official word is that it cannot be done, even though we can all see it works in Collaboration Suite, and we can see some of the implementation in the database.
    The document metadata writing procedure:
    PROCEDURE update_file_metadata (
    p_docid IN NUMBER,
    p_folderid IN NUMBER,
    p_create_date IN NUMBER,
    p_footer_number IN VARCHAR2,
    p_to IN VARCHAR2,
    p_from IN VARCHAR2,
    p_entered_by IN VARCHAR2,
    p_hardcopy_available IN VARCHAR2,
    p_subject IN VARCHAR2,
    p_revision_number IN VARCHAR2,
    p_document_vendor IN VARCHAR2,
    p_drawing_number IN VARCHAR2,
    p_title IN VARCHAR2,
    p_drawing_revision IN VARCHAR2,
    p_drawing_sheet_number IN VARCHAR2,
    p_drawing_vendor IN VARCHAR2
    IS
    l_metadata_id NUMBER(20);
    l_category_id NUMBER(20);
    l_displayname VARCHAR2(500);
    l_query VARCHAR2(2000);
    BEGIN
    -- Get the category id for the named category
    SELECT associatedschemaobject
    INTO l_category_id
    FROM odm_schemacategory
    WHERE id IN (
    SELECT id
    FROM odm_metadataschemacategory
    WHERE displayname LIKE 'File Metadata'
    -- Find the metadata id.
    find_metadata_id('File Metadata', p_docid, l_metadata_id);
    -- Get the column names for the category metadata table.
    -- The column names are the key to the ODMV_MDATAATTRSCHEMACATEGORY view.
    l_query := '';
    FOR rec IN (
    SELECT column_name
    FROM sys.dba_tab_columns
    WHERE table_name = 'ODM_ECM_' || l_category_id
    AND column_name not like 'ID'
    ) LOOP
    -- Get the human-readable name of the attribute.
    SELECT displayname
    INTO l_displayname
    FROM ODMV_MDATAATTRSCHEMACATEGORY
    WHERE name = rec.column_name;
    IF(l_displayname = 'Created/Received Date' AND p_create_date IS NOT NULL) THEN
    l_query := l_query || rec.column_name || ' = ''' || escape_naughties(p_create_date) || ''',';
    END IF;
    IF(l_displayname = 'Footer Number' AND p_footer_number IS NOT NULL) THEN
    l_query := l_query || rec.column_name || ' = ''' || escape_naughties(p_footer_number) || ''',';
    END IF;
    IF(l_displayname = 'To' AND p_to IS NOT NULL) THEN
    l_query := l_query || rec.column_name || ' = ''' || escape_naughties(p_to) || ''',';
    END IF;
    IF(l_displayname = 'From' AND p_from IS NOT NULL) THEN
    l_query := l_query || rec.column_name || ' = ''' || escape_naughties(p_from) || ''',';
    END IF;
    IF(l_displayname = 'Entered By' AND p_entered_by IS NOT NULL) THEN
    l_query := l_query || rec.column_name || ' = ''' || escape_naughties(p_entered_by) || ''',';
    END IF;
    IF(l_displayname = 'Sealed Stamped Documents/Drawings Available' AND p_hardcopy_available IS NOT NULL) THEN
    l_query := l_query || rec.column_name || ' = ''' || escape_naughties(p_hardcopy_available) || ''',';
    END IF;
    IF(l_displayname = 'Subject' AND p_subject IS NOT NULL) THEN
    l_query := l_query || rec.column_name || ' = ''' || escape_naughties(p_subject) || ''',';
    END IF;
    IF(l_displayname = 'Revision Number' AND p_revision_number IS NOT NULL) THEN
    l_query := l_query || rec.column_name || ' = ''' || escape_naughties(p_revision_number) || ''',';
    END IF;
    IF(l_displayname = 'Document Vendor' AND p_document_vendor IS NOT NULL) THEN
    l_query := l_query || rec.column_name || ' = ''' || escape_naughties(p_document_vendor) || ''',';
    END IF;
    IF(l_displayname = 'Drawing Number' AND p_drawing_number IS NOT NULL) THEN
    l_query := l_query || rec.column_name || ' = ''' || escape_naughties(p_drawing_number) || ''',';
    END IF;
    IF(l_displayname = 'Title' AND p_title IS NOT NULL) THEN
    l_query := l_query || rec.column_name || ' = ''' || escape_naughties(p_title) || ''',';
    END IF;
    IF(l_displayname = 'Drawing Revision' AND p_drawing_revision IS NOT NULL) THEN
    l_query := l_query || rec.column_name || ' = ''' || escape_naughties(p_drawing_revision) || ''',';
    END IF;
    IF(l_displayname = 'Drawing Sheet Number' AND p_drawing_sheet_number IS NOT NULL) THEN
    l_query := l_query || rec.column_name || ' = ''' || escape_naughties(p_drawing_sheet_number) || ''',';
    END IF;
    IF(l_displayname = 'Drawing Vendor' AND p_drawing_vendor IS NOT NULL) THEN
    l_query := l_query || rec.column_name || ' = ''' || escape_naughties(p_drawing_vendor) || ''',';
    END IF;
    END LOOP;
    IF(l_query IS NOT NULL) THEN
    l_query := 'UPDATE ODM_ECM_' || l_category_id || ' SET ' || l_query;
    l_query := RTRIM(l_query, ',');
    l_query := l_query || ' WHERE ID = ''' || l_metadata_id || '''';
    -- DEBUG: Uncomment to see the query we have written.
    --RAISE_APPLICATION_ERROR(-20102, l_query);
    EXECUTE IMMEDIATE l_query;
    END IF;
    END;
    PROCEDURE find_metadata_id (
    p_category IN VARCHAR2,
    p_docid IN NUMBER,
    o_metadata_id OUT NUMBER
    IS
    BEGIN
    SELECT id
    INTO o_metadata_id
    FROM odm_publicobject
    WHERE securingpublicobject = p_docid
    AND classid IN (
    SELECT associatedschemaobject
    FROM odm_schemacategory
    WHERE id IN (
    SELECT id
    FROM odm_metadataschemacategory
    WHERE displayname LIKE p_category
    END;
    -- Basically analogous to a perl untaint.
    FUNCTION escape_naughties(
    p_badstring IN VARCHAR2
    ) RETURN VARCHAR2
    IS
    BEGIN
    RETURN REPLACE(p_badstring, '''', '''''');
    END;

Maybe you are looking for