Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Business Object Builder

Former Member
0 Likes
529

Hi All,

I am programming a Zbusiness Object.

The problem I am facing is that, no matter what garbage value I give to my Object Key field to instantiate it, it get instantiated.

Instead I want it to thorw me a message showing "Object Not Found".

How shall I go for it ?

Dev

Hi All,

I am programming a Zbusiness Object.

The problem I am facing is that, no matter what garbage value I give to my Object Key field to instantiate it, it get instantiated.

Instead I want it to thorw me a message showing "Object Not Found".

How shall I go for it ?

Dev

3 REPLIES 3
Read only

Sougata
Active Contributor
0 Likes
502

the method/constructor needs to have a parameter for the output of message.

Read only

Former Member
0 Likes
502

Which method or constructor you are talking about ??

Read only

Sougata
Active Contributor
0 Likes
502

when you instantiate an object its Constructor (main method) is called first unless the class its pointing to also has a Class Constructor; in that case the Class Constructor is called before the Constructor.

In the Constructor of the class your object is pointing to (TYPE REF TO) requires to have the necessary coding to catch, handle & raise the exception when you try to instantiate the object with "junk" data. it is recommended to code this in a "TRY...CATCH...ENDTRY" block. if your requirment is to output an error message then this has to be done either via an appropriate parameter of the Constructor of the object or coding your own error message when you handle/raise the exception.

Reward points if useful.

Regards.