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

message class

Former Member
0 Likes
3,167

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
Read only

Former Member
0 Likes
1,786

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
Read only

Former Member
0 Likes
1,786

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

Read only

Former Member
0 Likes
1,786

hi ,

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

Regards,

Vikram.S

Read only

Former Member
0 Likes
1,786

hi

you can define the message class

in transaction se91.

and there you can define the messages you want to display

Read only

Former Member
0 Likes
1,786

Hello

Question not quite comprehensible, but try:

table T100

t-code SE91

May be it will help ...

Read only

naveen_inuganti2
Active Contributor
0 Likes
1,786

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

Read only

Former Member
0 Likes
1,786

hi..

YOU can declare the message class in function group as

ex:

FUNCTION-POOL YYV_SYSF MESSAGE-ID YYMSG.

regards,

Padma

Read only

Former Member
0 Likes
1,786

hi..

YOU can declare the message class in function group as

ex:

FUNCTION-POOL YYV_SYSF MESSAGE-ID YYMSG.

regards,

Padma

Read only

Former Member
0 Likes
1,787

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 .