- Create a new dynamic/derived record MY_TST_FUNCS
- Add a field related to the function(s) you wish to included AMOUNT
- Right click on the field and edit the Peoplecode
- Make sure you write your code in the Field Formula of the field.
e.g.
/****************************************************** Function : doubleAmount Purpose : Double the amount given Parameters : &AMOUNT Returns : Number ******************************************************/ Function doubleAmount(&AMOUNT) Returns number; Local number &newAmount; &newAmount = &AMOUNT + &AMOUNT; Return &newAmount; End-Function;
- Using the function you just need to Declare it at the top of you block of code
e.g./* Functions */ Declare Function doubleAmount PeopleCode MY_TST_FUNCS.AMOUNT FieldFormula; Local number &amt, &doubled; &amt = 2; &doubled = doubleAmount(&amt);
NOTE: Values are passed by reference so if you change a value in the function it will have changed the original after you have returned from that function.
No comments:
Post a Comment