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 sy–tabix GT 1.
READ TABLE lt_ebanx WITH KEY banfn = ls_eban–banfn
bnfpo = ls_eban–bnfpo.
IF sy–subrc IS INITIAL AND NOT lt_ebanx–new_po IS INITIAL.
PERFORM process_purchase_order USING im_par
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.