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: 

Displaying Message

Former Member
0 Kudos

Hi Guys i am doing a authority check for transaction ME51 validating the cost center.

i have created the message in se91 as

No authorization to Create PR with this Cost Center: ",

i want to display the cost center too with this message

like

No authorization to Create PR with this Cost Center:11148048

please advice

Thanks

Quavi

my code:

if l_ebkn-kostl is not initial.

AUTHORITY-CHECK OBJECT 'A_S_KOSTL'

ID 'BUKRS' dummy

ID 'KOSTL' FIELD l_ebkn-kostl.

if sy-subrc <> 0.

l_bapiret2-number = '010' .

l_bapiret2-type = 'E'.

l_BAPIRET2-id = 'ZMSG' ."WITH L_EBKN-KOSTL.

append l_BAPIRET2 to i_BAPIRET2.

endif.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Your structure i_bapiret2 will contain a field MESSAGE_V1, you need to pass the cost centre number to this.

Regards,

Nick

5 REPLIES 5

abdulazeez12
Active Contributor
0 Kudos

Hi Abdul

In SE91 when u create the message this way:

"No authorization to Create PR with this Cost Center: &". Say this message number is 001.

Then in program, call this mesage like this:

message i001 with '100100'.

Thanks

Former Member
0 Kudos

create your message in SE91 with a place holder and use ..

create as ..

'No authorization to Create PR with this Cost Center. &'

and use ..

message E000 with cost_center.

Former Member
0 Kudos

Hi,

If you want to display the error message then after checking the Sy-subrc write between the following

if l_ebkn-kostl is not initial.

AUTHORITY-CHECK OBJECT 'A_S_KOSTL'

ID 'BUKRS' dummy

ID 'KOSTL' FIELD l_ebkn-kostl.

if sy-subrc 0.

message e100 with &L_EBKN-KOSTL&.

endif.

Create the message that no authorization to create the PR after double clicking on the number(100).

This will give you the error message with the number from the runtime.

Thanks and reward points if useful,

C.Bharth Kumar

Former Member
0 Kudos

Hi,

give message in the message class as

'No authorization to Create PR with this Cost Center: &'

and

if l_ebkn-kostl is not initial.

AUTHORITY-CHECK OBJECT 'A_S_KOSTL'

ID 'BUKRS' dummy

ID 'KOSTL' FIELD l_ebkn-kostl.

if sy-subrc 0.

l_bapiret2-number = '010' .

l_bapiret2-type = 'E'.

l_bapiret2-MESSAGE_V1 = EBKN-KOSTL.

l_BAPIRET2-id = 'ZMSG' ."WITH L_EBKN-KOSTL.

append l_BAPIRET2 to i_BAPIRET2.

endif.

Reward points if helpful.......

Former Member
0 Kudos

Hi,

Your structure i_bapiret2 will contain a field MESSAGE_V1, you need to pass the cost centre number to this.

Regards,

Nick