Application Development 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: 

message class

Former Member
0 Kudos

in report you declare message class like that

report Z_XXx message-id xxx.

function module you can't put message-id please advise how to declare a generic message class

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

just go to any function module, go to its main program(function group) and see

you can specify message id here in the main program of function module.. it looks some thing like this..

FUNCTION-POOL ZXXXXXXXX  message-id zz.                  "MESSAGE-ID .

8 REPLIES 8

Former Member
0 Kudos

Hi,

You dont need to insert a message class in a program. Even without inserting it you can display your message. There are 2 scenarios

1. When you have to display an existing message from a message class.

Message e000(ZMC).

This is displays the message 000 of message class ZMC.

2. Without using a message class.

Message 'Message Text' type 'E'.

This will display an error message with the text 'Message text'.

Regards,

Pramod

Former Member
0 Kudos

hi ,

u cant use message id u can use exception and raise it where ever u need...

Regards,

Vikram.S

Former Member
0 Kudos

hi

you can define the message class

in transaction se91.

and there you can define the messages you want to display

Former Member
0 Kudos

Hello

Question not quite comprehensible, but try:

table T100

t-code SE91

May be it will help ...

naveen_inuganti2
Active Contributor
0 Kudos

Hi...

Say your message class name is MC.

In your function module..

PERFORM add_message USING 'message type' 'MC' 'message number' 'space' 'format'
                              'space' 'space' 'space' 'space' 'space'.

And maintain one include to handle this subroutine...

declare the variables:

data: xreturn like bapiret2 occurs 0 with header line.
form add_message  using  type
                          id
                          number
                          language
                          format
                          v1
                          v2
                          v3
                          v4
                          field.
  clear xreturn.
  move type     to   xreturn-type.
  move id       to   xreturn-id.
  move number   to   xreturn-number.

  call function 'BAPI_MESSAGE_GETDETAIL'
    exporting
      id                  = id
      number              = number
      language            = sy-langu
      textformat          = format
*        LINKPATTERN         = ''
      message_v1          = v1
      message_v2          = v2
      message_v3          = v3
      message_v4          = v4
    importing
      message             = xreturn-message
    exceptions
      others              = 4.

  if sy-subrc ne 0.
    clear xreturn-message.
  endif.
  move v1       to   xreturn-message_v1.
  move v2       to   xreturn-message_v2.
  move v3       to   xreturn-message_v3.
  move v4       to   xreturn-message_v4.
  move field    to   xreturn-field.
  append xreturn.
  clear xreturn.

endform.                    " add_message

You can use FORMAT_MESSAGE also to display the message...

Thanks,

Naveen.I

Former Member
0 Kudos

hi..

YOU can declare the message class in function group as

ex:

FUNCTION-POOL YYV_SYSF MESSAGE-ID YYMSG.

regards,

Padma

Former Member
0 Kudos

hi..

YOU can declare the message class in function group as

ex:

FUNCTION-POOL YYV_SYSF MESSAGE-ID YYMSG.

regards,

Padma

former_member188685
Active Contributor
0 Kudos

just go to any function module, go to its main program(function group) and see

you can specify message id here in the main program of function module.. it looks some thing like this..

FUNCTION-POOL ZXXXXXXXX  message-id zz.                  "MESSAGE-ID .