Está en la página 1de 5

CUSTOM.

pll
CUSTOM.pll is used to add extensions to Oracle's form Functionality. Some of the common scenario where CUSTOM.pll can be used are: !. "nablin#$%isablin# the fields &. Chan#in# the 'ist of (alues in a 'O( field at runtime. ). %efaultin# *alues +. ,dditional record le*el *alidations -. .a*i#ation to other screens. /. "nablin# Special Menu

Primarily there are two methods of extending Oracle Forms, and these are CUSTOM.pll FO0MS 1ersonali2ations 3n this article we will co*er the basics of usin# CUSTOM.pll for extendin# Oracle Forms

How and why does CUSTOM.pll wor ! "*ery form in Oracle ,pps is created usin# somethin# called as T"M1',T".fmb. 4ut some of the modules li5e 60MS ha*e their own 60 Specific Templates760T"M1'T.fmb8. These template files ha*e form le*el tri##ers that ma5e call to CUSTOM.pll. The tri##ers that can be trapped usin# CUSTOM.pll in 60MS screen can be different than those which can be trapped for other modules.

Commonly "sed e#ents that are trapped "sing CUSTOM.pll are$% 9OOM :6". .": FO0M 3.ST,.C" :6". .": 4'OC; 3.ST,.C" :6". .": 0"CO0% 3.ST,.C" :6". .": 3T"M 3.ST,.C" :6". (,'3%,T" 0"CO0%

Howe#er, for example in H&MS, yo" can also write code in CUSTOM.pll to trap 'elow listed e#ents $% 10" %"'"T" and 1OST %"'"T" 10" U1%,T" and 1OST U1%,T" 10" 3.S"0T and 1OST 3.S"0T 1OST FO0MS COMM3T :6". C0",T" 0"CO0% ;"< %"'0"C

How to identify which trigger is most s"ita'le for writing yo"r '"siness logic! <ou can either open the FM4 itself= and see the tri##ers which are callin# CUSTOM.pll. 6owe*er= there is a easier way to wor5 out the most suitable tri##ers. <ou can na*i#ate to 6elp$%ia#nostics$Custom Code$Show Custom "*ents

Once that radio button has been set= you will see the list of "*ents %isplayed on the screen.

(n some cases, the desired )H*+%+*)%,-OC.%(+ST/+C* or )H*+%+*)%(T*M%(+ST/+C* are not 'eing fired. )hat can ( do! 3t should always be possible to trap these e*ents in CUSTOM.pll . 4ut in some cases= the form mi#ht ha*e these tri##ers at bloc5$field le*el= with the tri##er property bein# O("003%". %ue to this= the correspondin# form le*el tri##ers7 to in*o5e CUSTOM.pll8 do not fire. 3n this case you must raise a bu# with Oracle on Metalin5.

Str"ct"re code code in CUSTOM.pll 3F e*ent>name ? ':6". .": FO0M 3.ST,.C"' T6". 3F form>name ? ',0@T:M,3' ,.% bloc5>name ? '3.(O3C">6",%"0' T6". xx>arxtwmai.default>customerA "'S3F form>name ? ',0@T:M,3' ,.% bloc5>name ? '3.(O3C">6",%"0' T6". ..... ".% 3FA "'S3F e*ent>name ? ':6". .": 4'OC; 3.ST,.C"' T6". ..... ".% 3F A

-ets ta e some scenario0s where CUSTOM.pll can 'e "sed 1. Change the la'el of a field app>item>property&.set>property B'4'OC;.F3"'%'=label='.ew 'abel'CA 2. 3efa"lt a #al"e copy BTO>C6,0 Bn>person>idC='1"0SO.>4'OC;.1"0SO.>3%' CA 4. /lter the S5- for -O6 5"ery 10OC"%U0" filter>customers>in>lo* 3S *>customer>#roup>id record#roupA n>temp>id .UM4"0A *>customer>lo* lo*A 4"D3. *>customer>#roup>id :? create>#roup>from>EueryB'@@>CUSTOM"0>D0OU1' ='select ... from h2>cust>accounts where ..your custom criteria here..'CA n>temp>id :? populate>#roupB*>customer>#roup>idCA *>customer>lo* :? find>lo*B'"@3ST3.D>'O(>.,M">6"0"'CA 3F #et>lo*>propertyB*>customer>lo*=#roup>nameC ? '"@3ST3.D>D0OU1>.,M">6"0"' T6". set>lo*>propertyB*>customer>lo*=#roup>name='@@>CUSTOM"0>D0OU1'CA ".% 3FA ".% filter>customers>in>lo*A

7. Ma e a field mandatory app>item>property&.set>property B'@@4'OC;>.,M".@@F3"'%>.,M"'=reEuired=property>trueCA Similarly you can enable or disable the fields too. 8. 9o" can display messages, for example F.%>M"SS,D".C'",0A fnd>messa#e.set>nameB',11'>S6O0T>.,M">6"0"'= 'MSD>.,M">6"0"'CA or fnd>messa#e.set>strin#B'messa#e text'CA fnd>messa#e.warn or fnd>messa#e.error or fnd>messa#e.

:. *na'le or 3isa'le Special Men" 10OC"%U0" mana#e>special>menu 3S mi>id menuitemA 4"D3. mi>id :? find>menu>itemB'S1"C3,'.S1"C3,'!-'CA 3F name>inB'system.cursor>bloc5'C ? '3.(O3C">6",%"0' T6". app>special&.instantiateB'S1"C3,'!-'= '1rint 3n*oice'CA set>menu>item>propertyBmi>id= displayed= property>trueCA set>menu>item>propertyBmi>id= enabled= property>trueCA "'S" set>menu>item>propertyBmi>id= displayed= property>falseCA ".% 3FA

".% mana#e>special>menuA

;. Handle the clic on Special Men" 3F e*ent>name ? 'S1"C3,'!-' T6". 3F form>name ? '3.(O3C">FO0M' T6". xx>in*oice>form.process>printin#A ".% 3FA 3F form>name ? 'SU11'3"0>FO0M' T6". xx>supplier>form.email>supplierA ".% 3FA ".% 3FA

<. /s "ser a ="estion, and ta e appropriate action *>to5en>*alue (,0C6,0&B!FFFCA n>button>selection 3.T"D"0A 4"D3. fnd>messa#e.set>nameB',11''= 'M"SS,D"'CA fnd>messa#e.set>to5enB'@@TO;".!'= *>to5en>*alueCA n>button>selection :? fnd>messa#e.EuestionB'"mail 3n*oice'= 'Fax 3n*oice'= ''= != &= 'Euestion'CA 3F n>button>selection ? ! T6". xx>call>in*oice>printA "'S" xx>fax>in*oiceA ".% 3FA >. Call /nother form f"nctionfnd>function."@"CUT"B function>name ?G '@@>FO0M>FU.CT3O.>.,M">6"0"' =open>fla# ?G '<' =session>fla# ?G 'S"SS3O.' =other>params ?G '1>3.(O3C">3% ? H' II n>in*oice>header>id II 'H' =acti*ate>fla# ?G '<'CA

1?. Ma e some segments of a .eyFlexfield 3isplay%Only depending "pon some conditionFor example to ma5e !st se#ment of a ;FF display only= we can use 3F *>chec5>result?'xy2' T6". F.%>;"<>F'"@.U1%,T">%"F3.3T3O.B 4'OC; ?G '4'OC;.,M"6"0"' =F3"'% ?G 'F'"@F3"'%.,M"' =".,4'"% ?G '<' =%3S1',<,4'" ?G !CA ".% 3F A

,s you may ha*e #athered by now= almost any form related tas5 can be done usin# CUSTOM.pll

Action Type in CUSTOM Opening SQL Cursors Executing pl/sql stored procedures Referencing fields using bind notation like :block.field Exception !anage!ent
For additional reading on CUSTOM.pll, please #isit 4est 1ractices for %e*elopment on CUSTOM.pll 1layin# with CUSTOM.pll

Allowed Yes Yes o Yes

Working with CUSTOM.pll


)hy is a 'est practice needed for CUSTOM.pll! 'ets say you ha*e different en*ironments in which different de*elopers are wor5in# for a sin#le instance 1roduction System. ,ssumin# they all want to wor5 upon CUSTOM.pll in parallel. 3n order to mana#e such situation efficiently= you need to ha*e some methodolo#y$rules when wor5in# on CUSTOM.pll First lets consider #ario"s options that we ha#e on ta'le 1. One de*eloper wor5s on CUSTOM.pll at a time= chec5s out from source control while wor5in#= so that no other de*eloper can wor5 upon it until !st de*elopers chan#es #o to production. 'imitation: <ou can impact timescales= as other proJect teams may reEuire to modify CUSTOM.pll at the same time. 2. 'et two de*elopers wor5 on CUSTOM.pll library and let their wor5 independently #o to 1roduction. -imitation: This is a painful process= as it will hurt when non tested code in CUSTOM.pll reaches production. This can happen if first de*eloper's chan#es to CUSTOM.pll F,3' U,T and second de*elopers chan#es 1,SS the U,T. The second de*eloper would ha*e included the CUSTOM.pll chan#es made by first de*eloper which is still under#oin# testin#. Second de*eloper needs to includes !st de*elopers chan#es too into CUSTOM.pll= to factor for a situation whereby both de*eloper's code were to succeed U,T. 4. Use CUSTOM.pll simply as a stub 74est 1ractice8. The actual e*ent handlin# ta5es place in a separate set of libraries 7pll8 which are attached to CUSTOM.pll. :hat does this meanK To explain this= lets consider a situation as below 'ets assume two de*elopers want to wor5 on CUSTOM.pll simultaneously GFirst de*eloper wants to wor5 on form named 1O@1O"1O.fmb 7*ia CUSTOM.pll8 'ets say= to ma5e a duplicate chec5 for Supplier .ame a#ainst an existin# company record in TC,= and warn user. GSecond de*eloper wants to wor5 on form named 1"0:SS11.fmb 7*ia CUSTOM.pll8 'ets say= to ma5e a duplicate chec5 for "mployee .ame a#ainst an existin# person record in TC,= and warn user. First de*eloper will do the steps below !. Create @@1O@1O"1O.pll 7 if does not already exist8 :ithin this= add a procedure as below within pac5a#e @@1O@1O"1O procedure chec5>warn>duplicate>supplier is be#in +U-- A end chec5>warn>duplicate>supplier A &. ,ttaches ,11CO0"2.pll and F.%SLF.pll to @@1O@1O"1O.pll ). Chec5s in @@1O@1O"1O.pll to Source Control +. ,ttaches @@1O@1O"1O.pll to CUSTOM.pll -. 3n CUSTOM.pll 3F form>name ? '1O@1O"1O' ,.% bloc5>name ? '@@@:6,T"("0' T6". @@1O@1O"1O.chec5>warn>duplicate>supplier A ".% 3FA /. Chec5s in CUSTOM.pll into source control.

+ote$% Second de*eloper will do exactly the same steps= but by usin# @@1"0:SS11.pll instead

,oth the de#elopers will ha#e their s eleton code chec ed into so"rce control, which does nothing at all @A"st +U-commandB.,lso= both the de*elopers will ha*e their respecti*e @@FORMNAME.pll files chec5ed into source control. )hat happens next! First de*eloper will chec5out his @@1O@1O"1O.pll and ma5e chan#es for *endor name *alidation. procedure chec5>warn>duplicate>supplier is be#in pseudo code below if duplicate T6". fnd>messa#e to warn to user end ifA end chec5>warn>duplicate>supplier A The de*eloper will not chec5 in these chan#es to source control= "ntil their changes ha#e s"cceeded U/T. Second de*eloper too= will ma5e their chan#es to @@1"0:SS11.pll= without chec5in# in @@1"0:SS11.pll into source control.

:hat we ha*e done here is that= as soon as abo*e steps are done= any other de*eloper can start wor5in# on CUSTOM.pll. "ffecti*ely this will allow multiple de*elopers to wor5 on CUSTOM.pll= with their chan#es bein# promoted to production independent of other de*elopers chan#es to CUSTOM.pll. This becomes possible= because each de*eloper will wor5 on the respecti*e @@FORMNAME.pll for their respecti*e form. ,ny new de*eloper= say third de*eloper= will pic5 up the CUSTOM.pll from source control= which will either call H.U''H procedures 7no effect8 or actual procedures= dependin# upon the pro#ress of code of other de*elopers. ,fter the successful U,T= a de*eloper must chec5 in chan#es to their @@FORMNAME.pll into source control.

/re there any catches! <ou need some procedures in the way code is released to production. 'ets say !st de*elopers patch #oes to production after &nd de*elopers patchK This can happen if !st de*elopers U,T happens after second de*elopers U,T. :ell... This situation can be a*oided= by releasin# patches to production in one bundle= whilst maintaining the sequence of the patching. 3f worst does happen= then you can re apply Hsecond de*elopersH patch a#ain to production...at least you do not ha*e to tin5er the source code directly within production.

9o" may as , why don0t we attach /PPCO&*.pll to CCFORMNAME.pll :e do this= to a*oid recursion= as is discussed in lin5 CUSTOM.pll commands. 6ence we attached ,110CO0"&.pll instead= which happens to be a sli#htly cut down *ersion of ,11CO0".pll .

También podría gustarte