18 Mar 2010

Custom Fields in Oracle BRM

Oracle BRM 13 Comments
Oracle Communications Billing and Revenue Management (Oracle BRM \ formally known as Portal Infranet) offers two methods for creating, editing and deleting custom fields and storable classes. One approach is by using Storable Class Editor, part of the Developer Center application, and the other is by using SDK opcodes. For a number of reasons, I prefer the latter choice, and in this post I will address manipulating custom fields with SDK opcodes.

Before beginning, one change needs to be made first: making the data dictionary writable. Here’s how to do it:
1. Open the Oracle DM or Microsoft SQL Server DM configuration file (BRM_HOME/sys/dm_oracle/pin.conf or BRM_HOME/sys/dm_odbc/pin.conf) in a text editor.
2. Enable field manipulation in the data dictionary, by setting the following entry to 1:- dm dd_write_enable_fields 1

Our objectives are as follows:
1. To create a custom field
2. To edit the custom field description
3. To delete the custom field from the database
4. To make the custom field available to BRM

Creating a New Custom Field

Creating a new custom field and committing it to the database can be accomplished with SDK opcodes or with a pin deploy utility. As developers know, SDK opcodes provide a more flexible way to create, edit, and delete custom fields at the development stage. The pin deploy utility, on the other hand, uses PODL (Portal Object Definition Language) to export and import  field and storable class definitions. This is more useful, especially at the administrative level, because the process can be streamlined by putting field definitions into source code management and thus lower any possibility of damaging the Oracle BRM production database data dictionary.

The following SDK opcodes can be used to manage field specifications:
1. PCM_OP_SDK_SET_FLD_SPECS – create or modify a field,
2. PCM_OP_SDK_GET_FLD_SPECS – retrieve a field specs,
3. PCM_OP_SDK_DEL_FLD_SPECS – delete a field.

To create a field, it’s necessary to write an input flist for PCM_OP_SDK_SET_FLD_SPECS opcode:
0 PIN_FLD_POID          POID [0] 0.0.0.1 /dd/fields 0 0
0 PIN_FLD_FIELD      ARRAY [0]
1    PIN_FLD_DESCR          STR [0] “custom field for holding a VAT number”
1    PIN_FLD_FIELD_NAME      STR [0] “C_FLD_VAT_NUMBER”
1    PIN_FLD_FIELD_NUM      ENUM [0] 10000
1    PIN_FLD_FIELD_TYPE      INT [0] 5

Now, verify that the field created exists in the database data dictionary by feeding the following input flist to PCM_OP_SDK_GET_FLD_SPECS opcode:
0 PIN_FLD_POID      POID [0] 0.0.0.1 /dd/objects 0 0
0 PIN_FLD_FIELD    ARRAY [0]
1    PIN_FLD_FIELD_NAME    STR [0] “C_FLD_VAT_NUMBER”

Editing the Custom Field Description

Now, having confirmed that the new custom field exists, the description can be altered by calling PCM_OP_SDK_SET_FLD_SPECS opcode with the following input flist:
0 PIN_FLD_POID          POID [0] 0.0.0.1 /dd/fields 0 0
0 PIN_FLD_FIELD      ARRAY [0]
1    PIN_FLD_DESCR          STR [0] “custom field – VAT number”
1    PIN_FLD_FIELD_NAME      STR [0] “C_FLD_VAT_NUMBER”
1    PIN_FLD_FIELD_NUM      ENUM [0] 10000
1    PIN_FLD_FIELD_TYPE      INT [0] 5

Again, the field’s specifications can be retrieved so as to verify that the change has been accomplished.

After that, delete the custom field from the database.
Finally, assume a mistake has been made, and it’s necessary to delete a field. Provide the following input flist to PCM_OP_SDK_DEL_FLD_SPECS opcode, deletes the field:
0 PIN_FLD_POID        POID [0] 0.0.0.1 /dd/fields 0 0
0 PIN_FLD_FIELD      ARRAY [0]
1    PIN_FLD_FIELD_NAME      STR [0] “C_FLD_VAT_NUMBER”

If the opcode for retrieving the field’s specifications returns an empty flist (only POID obj),then that signifies the field was not found in the database data dictionary.

Making the Custom Fields Available to BRM

Standard practice dictates that everything custom developed goes into the BRM_HOME/custom directory, and since, in this case, BRM_HOME/include/pin_flds.h, is being extended, a new custom header file BRM_HOME/custom/include/custom_flds.h. needs to be created
Now, the new custom field can be introduced by appending the following line to custom_flds.h:

#define C_FLD_VAT_NUMBER PIN_MAKE_FLD(PIN_FLDT_STR, 10000)

The line above defines a custom field named “C_FLD_VAT_NUMBER” (mind the naming practice,
PIN_* for BRM fields and C_* for custom fields) with data type “PIN_FLDT_STR” (STR stands for string)
and unique identifier “10000” (in regards to BRM_HOME/include/pin_flds.h). Data types are static,
and defined by the BRM version you are running; please see BRM_HOME/include/pcm.h for definitions.

Next, run the parse_custom_ops_fields.pl perl script on the custom_flds.h using this command:
$BRM_HOME/bin/parse_custom_ops_fields.pl -L pcmc -I custom_flds.h -O $BRM_HOME/custom/include/custom_mapping.m

And finally, include the following line to every pin.conf where it’s desired that these field be seen: – – ops_fields_extension_file ${BRM_HOME}/custom/include/custom_mapping.m

NOTE: When introducing new functionalities using custom fields, it is necessary to include the custom_flds.h header file in the FMs that use these fields

13 Responses to “Custom Fields in Oracle BRM”

  1. Kermit Verwers says:

    Thanks for good information that comes out to read.

  2. Tyler Kronberg says:

    Thanks for the great insight. I was curious about this particular niche. Great article.

  3. Lezlie Ramler says:

    excellent post.

  4. school grants says:

    Great site. A lot of useful information here. I’m sending it to some friends!

  5. Neoma Bilagody says:

    I read your blog frequently and I just thought I’d say keep up the amazing work!

  6. Shawanda Shellabarger says:

    this is what the internet is about. Awesome post.

  7. MarkSpizer says:

    great post as usual!

  8. tiffany says:

    Really nice and impressive blog i found today.

  9. Satya Krishna says:

    Thanks for it. Can u post one more article for opcode customization? Please feel free to contact me on this..

  10. Soila Hipsher says:

    Brilliant This really is one of the best websites I’ve ever browsed on this subject.

  11. Leela Pratyush says:

    Very very useful info ..can u also give examples for following please :
    1.Creating a new product with all the time zone and rate plan configuration and associating it with a service
    2.Creating a discount product and associating it for a particular service(or) service calss and then using it in iScripts to reject or discount them.
    3. Small example for writing a new MTA code

  12. Karl says:

    This is a really good blog. Good work!…

  13. Panupong Chongkolratanaporn says:

    I have been reading your blog, \’Custom Fields in Oracle BRM\’ written in 18/03/2010.
    It is very useful indeed, but i got a few question about to it and I wish you could help me out.

    Currently, my work involves creating new field in Oracle BRM, so far so good as I followed the instructions I read from your blog.
    But when I am trying to export an XML invoice, my custom fields\’s tag in XML file is missing.
    It shown as 12345. So I try exporting invoice in pin_flist instead, and find that BRM already knew my custom field.

    Therefore I thought I added the line \”- – ops_fields_extension_file ${BRM_HOME}/custom/include/custom_mapping.m\” in the wrong pin.conf.
    So far I add the line in 1.${BRM_HOME}/bin/pin.conf 2.${BRM_HOME}/apps/pin_billd/pin.conf 3.${BRM_HOME}/apps/pin_inv/pin.conf 4.${BRM_HOME}/sys/cm/pin.conf

    I also tried adding the Infranet.Property file in ${BRM_HOME}/bin and ${BRM_HOME}/apps/storable_class_to_xml.

    But none of these helps, so I decided to write this message to you hoping it is possible for you to help.
    Did I really add the \’ops_fields_extension_file\’ in the wrong pin.conf or did I screwed something else.

    Thank you

Leave a Reply