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

Former Member
0 Likes
916

Hi Experts,

Can anybody please help me in writing the logic for "giving a message in a report".

code:

<b>data: l_field1 type c,

data: l_field2 type c,

data: l_field3 type c.</b>

in the report i have to give the message. <b>"Based on l_field1 l_field2 the value of l_field3 shoudl be ____".</b>

I hve to show the values of the 3 fields dynamically.

I hve to show the message like this:

<b>if sy-subrc = 0.

message iXXX(XX) with '----


'.</b>

plz advise.

Thanks for the help.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
884

HI

For your understanding of using message class.

Messsage class:ZZ

Message Number: 001

Message Text: Material & does not exist in Plant & and storage location &

In Program:

Supposing the values are:

l_matnr = 'A1234'.

l_werks = 'PL10'.

l_lgort = 'ST10'.

Now use message in program as:

message e001(ZZ) with l_matnr l_werks l_lgort.

Result: Material A1234 does not exist in Plant PL10 and storage location ST10

Each & will be substituted with values in sequence.

Kind Regards

Eswar

7 REPLIES 7
Read only

Laxmana_Appana_
Active Contributor
0 Likes
884

Hi,

check this :

Take a character variable with long length and concatenate your message with variable and

then call like

message iXXX(XX) with x_message.

data : x_message(500) type c.

concatenate 'Based on' l_field1 l_field2 'the value of' l_field3 'shoudl be' into x_message.

Regards

Appana

Read only

0 Likes
884

You might try something like this.



report zrich_0001.


data: l_field1(5) type c value 2,
      l_field2(5) type c value 2,
      l_field3(5) type c.
data: message type string.

l_field3 = l_field1 + l_field2.

concatenate 'Based on' l_field1 l_field2
        'the value of l_field3 should be'  into message
                      separated by space.


message i001(00) with message l_field3.

REgards,

Rich Heilman

Read only

0 Likes
884

Thnx guyz.

I'm sorry i mentioned it wrongly.

The only problem here is l_field2 is type DEC.

It's amount field. How can I make it?

Thnx.

Read only

0 Likes
884

First write it to a char field.

data:
  l_field2 type p decimals 2,
  l_field2_c(15) type c.

write l_field2 to l_field2_c.

* now concatenate using L_FIELD2_C.

Regards,

Rich Heilman

Read only

0 Likes
884

Thnx Eshwar.

It worked perfect.

Thanks a lot all.

Read only

0 Likes
884

Glad we could help you.

Kind Regards

Eswar

Read only

Former Member
0 Likes
885

HI

For your understanding of using message class.

Messsage class:ZZ

Message Number: 001

Message Text: Material & does not exist in Plant & and storage location &

In Program:

Supposing the values are:

l_matnr = 'A1234'.

l_werks = 'PL10'.

l_lgort = 'ST10'.

Now use message in program as:

message e001(ZZ) with l_matnr l_werks l_lgort.

Result: Material A1234 does not exist in Plant PL10 and storage location ST10

Each & will be substituted with values in sequence.

Kind Regards

Eswar