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

Assign message class to local class

h_senden2
Active Contributor
0 Likes
5,543

Hi,

i'm working on a local class, and I have a message class defined for this local class.

How can i assign this message class in the local class definition or implementation ?

with kind regards,
Hans

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
4,628

I suppose you want to add a message class like in attributes tab of a class (SEOCLASSDF-MSG_ID)

But wouldn’t that be redundant with the MESSAGE-ID associated to the REPORT or the FUNCTION POOL in which you wrote the class definition?

Regards,

Raymond

15 REPLIES 15
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
4,628

Hello Hans,

I'm not too sure if i understand your question.

Are you talking about assigning a Message class to a local class (something similar to the addition MESSAGE-ID for the REPORT statement). AFAIK there is no such corres. addition available for local classes - you've to use the long form to issue the message.

BR,

Suhas

Read only

0 Likes
4,628

Hi Hans,

or are you talking about exception classes?

You're right global exceptions classes have the feature to assign a message class, local exception classes don't as far as I know.

Maybe this can be implemented somehow using interface IF_T100_MESSAGE.

Regards,

Dirk

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
4,628

Hello Dirk,

Dirk Wittenberg wrote:

You're right global exceptions classes have the feature to assign a message class ...

I don't think you can assign a particular Message Class to an exception class. You've to explicitly mention the Message Class & number when defining the message texts for the exception class.

Please correct me if i'm wrong!

BR,

Suhas

PS: I'm currently working on an ECC6.0 EhP3 system.

Read only

0 Likes
4,627

Hi Suhas,

I was referring to the field "Message class" on the "Properties tab" in SE24:

But you're right, when implementing interface IF_T100_MESSAGE the type of the parameter TEXTID of the constructor changes to IF_T100_MESSAGE=>T100KEY which contains the message class also.

So what is this field in the general data for?

Regards,

Dirk

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
4,626

Hello Dirk,

This option is available for all class types (read: not restricted to Exception classes only).

When you specify a message class in this field, this behaves as the default message class (similar to the MESSAGE-ID addition).

BR,

Suhas

Read only

h_senden2
Active Contributor
0 Likes
4,626

Hi Dirk, i'm not talking about exception classes, but normal message classes (T100)

Read only

0 Likes
4,626

my mistake,

thanks for advice.

Regards,

Dirk

Read only

RaymondGiuseppi
Active Contributor
0 Likes
4,629

I suppose you want to add a message class like in attributes tab of a class (SEOCLASSDF-MSG_ID)

But wouldn’t that be redundant with the MESSAGE-ID associated to the REPORT or the FUNCTION POOL in which you wrote the class definition?

Regards,

Raymond

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
4,626

Hello Raymond,

A very valid point Raymond.

I would rather not say "redundant" in this case. I will rephrase it as, "cause conflict with the MESSAGE-ID associated with the REPORT/FUNCTION-POOL".

Cheers,

Suhas

Read only

0 Likes
4,626

Yes, Murphy's law applies.

Read only

0 Likes
4,626

yes, that is what i want. I'm not using the message-id of the report, because if i have 3 local classes (with 3 different message classes), i can assign a different message class to each local class.

Read only

h_senden2
Active Contributor
0 Likes
4,626

Hi all,

thanks for all your answers.

The best approach is probably to use the MESSAGE-ID of the REPORT/PROGRAM statement.

But i would prefer to add it to the local class itself between CLASS x DEFINITION. and ENDCLASS. With this solution i would be able to assign specific/different message classes (T100) to different local classes in my program.

with kind regards,
Hans

Read only

0 Likes
4,626

You could declare a constant in the declaration section of the class (so static attribute) message_id and use the me=>message_id in your message statements.

Regards,

Raymond

Read only

0 Likes
4,626

Hi Hans,

definining a message-id btw. class and endclass would be a nice feature but only necessary for local classes as global classes seem to have there own invisible program wrapping them ( classname==CP ).

And obviously the message-id option for this wrapping program is used to store the message class you can enter in global classes as this can neither be seen in the public, protected nor private section.

But anyway, what about posting this in the idea place here in the SCN?

Regards,

Dirk

Read only

h_senden2
Active Contributor
0 Likes
4,626

Dirk Wittenberg wrote:

But anyway, what about posting this in the idea place here in the SCN?

Yes, that's a good idea 😉

Done :

see https://cw.sdn.sap.com/cw/ideas/11246

Hans