Skip to Content
Author's profile photo Aarif Baig

Interesting ME59 exit

Recently I got a requirement to write an exit where we wanted to club the PR for same storage location vendor and user id and create one PO for them, Program for ME59 is RM06BB30 within this program there is FM which is being called  MM_GROUP_REQUISITIONS and this is where it is decided how the PO has to be created.

I found an exit EXIT_SAPLME59_001 and it has got 2 tables parameters t_eban and t_ebanx as it was pretty simple requirement everything went well and testing was going quite smooth but on the later stage of testing we found that there are some issues, I started debugging the program and found that in the standard program RM06BB30 there is a problem, below is the code from program  RM06BB30 from sub routine  process_requisitions

LOOP AT imt_eban INTO ls_eban.

     IF sytabix GT 1.

       READ TABLE lt_ebanx WITH KEY banfn = ls_ebanbanfn

                                    bnfpo = ls_ebanbnfpo.

       IF sysubrc IS INITIAL AND NOT lt_ebanxnew_po IS INITIAL.

         PERFORM process_purchase_order USING    im_par


                                        CHANGING lt_eban


         CLEAR lt_eban.



     APPEND ls_eban TO lt_eban.


IF sy-tabix GT 1 it should process the order else not as we were chaning t_ebanx table and were making no changes in T_eban at times it behaved strange, problem with above code is that it assumes that both the tables are sorted in same sequence which i realized after some good debugging, next what i did is pretty evident i just sorted the other table t_eban and the problem was solved.

Not sure how many of you have gone through this problem but it might help.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.