06-02-2008 12:03 PM
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.
06-02-2008 12:15 PM
Hi,
Your structure i_bapiret2 will contain a field MESSAGE_V1, you need to pass the cost centre number to this.
Regards,
Nick
06-02-2008 12:08 PM
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
06-02-2008 12:09 PM
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.
06-02-2008 12:12 PM
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
06-02-2008 12:14 PM
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.......
06-02-2008 12:15 PM
Hi,
Your structure i_bapiret2 will contain a field MESSAGE_V1, you need to pass the cost centre number to this.
Regards,
Nick