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

problem with EXIT_SAPLMEREQ_010

Former Member
4,474

Hi Experts,

I have created a restriction in me51n that if someone put "K" as account assignment type it should check a ztable and if not permitted it should throw a error message.

if i open existing pr it is working fine.

but when i create new then it is repeating the msg again and again .

the table IM_T_EBAN is not getting refreshed after the error message.

Can someone help on this.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,978

Hi Drahmule,

Hmmmm, if that error is persisting in that Function exit EXIT_SAPLMEREQ_010 then you can go for BADI :

ME_PROCESS_REQ_CUST

.

Write the code in method PROCESS_ITEM. Check the following Example code :


  DATA : L_ITEM TYPE MEREQ_ITEM.

  CALL METHOD IM_ITEM->GET_DATA
    RECEIVING
      RE_DATA = L_ITEM.

**-----------------------------------------------**
***Account Assignment Category based on ZTABLE***
**-----------------------------------------------**

    IF L_ITEM-KNTTP = 'K'.
*Check your Z table data and put your conditions here
   ENDIF.

Thanks & Regards,

Faheem.

26 REPLIES 26
Read only

Former Member
0 Likes
3,978

Try to refresh IM_T_EBAN explicitly befor throwing an error.

for eg.

Refresh IM_T_EBAN[].

message 'Error' type 'E'.

Read only

0 Likes
3,978

Hi,

Thanks for your reply.

but i am not able to refresh im_t_eban in exit,giving me error that it cant be changed.

where else can i refresh it?

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
3,978

Hi,

Account assignment category is respective to an item so what it does is correct.

Read only

0 Likes
3,978

What is the solution for this?

if the account assignment catagory "k" has no permission the user should be able to change it.

how can this be possible?

Read only

0 Likes
3,978

Hi,

instead of error message give termination message(Type A), so that if condition satisfies and error required than after message, screen will be terminated and will take user to easy access, from there user will have to go for transaction again.

Read only

0 Likes
3,978

Hi umang,

but the requirement is like that na that the use can only change in me51n only it should not have to login again in that transaction.

Read only

Former Member
0 Likes
3,979

Hi Drahmule,

Hmmmm, if that error is persisting in that Function exit EXIT_SAPLMEREQ_010 then you can go for BADI :

ME_PROCESS_REQ_CUST

.

Write the code in method PROCESS_ITEM. Check the following Example code :


  DATA : L_ITEM TYPE MEREQ_ITEM.

  CALL METHOD IM_ITEM->GET_DATA
    RECEIVING
      RE_DATA = L_ITEM.

**-----------------------------------------------**
***Account Assignment Category based on ZTABLE***
**-----------------------------------------------**

    IF L_ITEM-KNTTP = 'K'.
*Check your Z table data and put your conditions here
   ENDIF.

Thanks & Regards,

Faheem.

Read only

0 Likes
3,978

Hi Faheem,

Thanks for your reply.

I try that Badi but i am getting a error in it.

NOW I READ SOME DOCUMENTATION FOR MEREQ01 AND I THINK THAT I CAN USE EXIT_SAPLMEREQ_010,

CAN YOU TELL ME HOW TO FIND THE FIELD FOR KNTTP AND GL ACCOUNT NO IN THAT.

THANKS

RAHUL

Read only

0 Likes
3,978

Hi Drahulmore,

You can find G/L name in IM_T_EBKN-SAKTO for the corresponding line item of PR.

Thanks & Regards,

Faheem.

Read only

0 Likes
3,978

Sorry actually i want to say EXIT_SAPLMEREQ_005.

Thanks

Rahul

Read only

0 Likes
3,978

Hi Drahulmore,

Hmmm, I dont think you can get KNTTP and G/L account in EXIT_SAPLMEREQ_005. To get the required functionality,either you can use EXIT_SAPLMEREQ_010, where both the fields are available or you have to use BADI ME_PROCESS_REQ_CUST with IMPORT/EXPORT logic. Like in method PROCESS_ITEM you have to export the EBAN table with item no and KNTTP and import the same in method PROCESS_ACCOUNT(here you can get your G/L), and do the checking with KNTTP and G/L account fields.

Thanks & Regards,

Faheem.

Read only

0 Likes
3,978

Hi ,

I am getting the below error in badi.

"exception_cx_sy_no_handler triggered and while debugging it is "cx_sy_move_cast_error"

i am proceeding with your code logic only.

Thanks

Rahul

Read only

0 Likes
3,978

Hi,

Looks like some problem in your implementation. Check :

1)All the objects are active, like Z implementation of the class, there should be a class interface starting withZCL_IM_ with your implementation name.

2)Check the parameter types which you are passing.

3) Just check your code.

In the method PROCESS_ITEM :


  DATA : L_ITEM TYPE MEREQ_ITEM.

  CALL METHOD IM_ITEM->GET_DATA
    RECEIVING
      RE_DATA = L_ITEM.

*Export L_ITEM here

In the method PROCESS_ACCOUNT :


  DATA : L_ACCOUNT TYPE EXKN,
          L_ITEM TYPE MEREQ_ITEM.

  CALL METHOD IM_ACCOUNT->GET_EXKN
    RECEIVING
      RE_EXKN = L_ACCOUNT.

*Import L_ITEM here

If everything is fine. Then try delete the implementation and create a fresh implementation and write the code accordingly. You will get the desired result. I have tested here with the same code, I dont have any issues here.

Thanks & Regards,

Faheem.

Read only

0 Likes
3,978

Hi i have done as you said, i delete the previous implementation and created a new one. write code in process item activated it also the class to but when i execute it the same error come.

am i missing something,but i have activated everything.

Read only

0 Likes
3,978

thanks Faheem, its working but i am not able to get g/l account field in l_item .

can you help.

Read only

0 Likes
3,978

Hi,

G/L account will be available in L_ACCOUNT and KNTTP will be available in L_ITEM. And G/L you will get in method PROCESS_ACCOUNT and L_ITEM you have to get using IMPORT keyword.

Thanks & Regards,

Faheem.

Read only

0 Likes
3,978

Hi but i am not getting how to import knttp.

CAN YOU PROVIDE SAMPLE CODE FOR IMPORT.

THANKS

RAHUL

Read only

0 Likes
3,978

Hi Rahul,

If you don't export the data in PROCESS_ITEM how you will get through IMPORT in PROCESS_ACCOUNT. Just don't copy & paste, try to understand what that code is doing. Write the following in PROCESS_ITEM method


  DATA : L_ITEM TYPE MEREQ_ITEM.

  CALL METHOD IM_ITEM->GET_DATA
    RECEIVING
      RE_DATA = L_ITEM.

  EXPORT KNTTP FROM L_ITEM-KNTTP TO MEMORY ID '1234'.

Write the following in PROCESS_ACCOUNT :



  DATA : L_ACCOUNT TYPE EXKN.
  DATA : L_ITEM TYPE MEREQ_ITEM.

  CALL METHOD IM_ACCOUNT->GET_EXKN
    RECEIVING
      RE_EXKN = L_ACCOUNT.

  IMPORT KNTTP TO L_ITEM-KNTTP FROM MEMORY ID '1234'.

IF L_ITEM-KNTTP IS NOT INITIAL.

*Write code to check L_ITEM-KNTTP & L_ACCOUNT-SAKTO

ENDIF.

Thanks & Regards,

Faheem.

Read only

0 Likes
3,978

Hi faheem,

i write the code and put a breakpoint in process_item and process_account.

when i debug it comes to process_item but did not seem to go to process_account and also no msg is displayed.

my code in process_account is

"IMPORT KNTTP TO L_ITEM-KNTTP FROM MEMORY ID '1234'.

IF L_ITEM-KNTTP IS NOT INITIAL.

SELECT SINGLE * FROM zgldec INTO itab

WHERE SAKNR EQ L_ACCOUNT-SAKTO.

MESSAGE 'ERROR' TYPE 'E'.

ENDIF.

"

am i missing something.

Read only

0 Likes
3,978

Hi Faheem,

I am not able to prevent the pr to be saved after the error message.

how to use method check and post , i have tried with that but without sucess.

Read only

0 Likes
3,978

Hi Rahul,

1) PROCESS_ACCOUNT method will get triggered once you fill the field KNTTP, i.e Account Assignment Category . If it is not getting triggered that means you have not filled anything in KNTTP, i.e Account Assignment Category(Ex: K,Q).

2) Once you raise an error message, system will never ever allow you to save. I am using the same BADI and moreover I use same methods to check and raise error and system will not save the PR once you raise error.

Check thoroughly your code.

Thanks & Regards,

Faheem.

Read only

0 Likes
3,978

Thanks Faheem,

Thanks

Rahul

Edited by: drahulmore on Nov 12, 2010 9:02 AM

Read only

0 Likes
3,978

Hi faheem,

thanks for your help my project is mostly completed ,means it is showing error message and also not saving the record.

BUT THIS IS HAPPENING ONLY WHEN I TRY TO CREATE NEW PR BUT IF I WANT TO CHANGE EXISTING IT IS NOT SHOWING ANY ERROR, CAN YOU HELP.

it looks like when i try to change existing PR the control does not seem to go to process_account,is that so

Thanks

Rahul

Edited by: drahulmore on Nov 12, 2010 7:46 AM

Read only

0 Likes
3,978

Hi Rahul,

as I said earlier PROCESS_ACCOUNT method will get triggered once you fill the field KNTTP, i.e Account Assignment Category . If it is not getting triggered that means you have not filled anything in KNTTP, i.e Account Assignment Category(Ex: K,Q). System will never check whether it is a new PR/Old or whether you are creating or changing. Just goto change mode of any PR which has KNTTP filled, and change something like quantity, or change Material then that method will get triggered.

Thanks & Regards,

Faheem.

Read only

0 Likes
3,978

Hi drahulmore ,

Can use this method in your BAdi.

to clear/refresh error messages from buffer

INCLUDE mm_messages_mac.

DATA: l_hd TYPE REF TO cl_message_handler_mm.

CALL METHOD cl_message_handler_mm=>get_handler

IMPORTING

ex_handler = l_hd.

CALL METHOD l_hd->cleanup.

Srinu

Read only

0 Likes
3,978

Thanks faheem,

Great help from you ,this was my first experience with BAdi.

My problem is solved.

Thanks

Rahul

Edited by: drahulmore on Nov 15, 2010 4:26 AM