Skip to Content
0
Dec 19, 2022 at 08:42 AM

How can I stop an automatic printing in MRRL?

55 Views

Hello,

When a purchase order is created in MRRL, it's automatically being printed and I need to prevent this.

The idea is I need SAP to decide whether the document needs to be printed or sent via an e-mail by checking the default communication type in XK03. If it's 'INT' - then it should take the e-mail address from the box above and send an e-mail. If it's not 'INT', then it should proceed with the printing.

I wrote this piece of code and I know it takes the correct data - if I change the vendor's data in XK02 and re-run these SELECTs in my test environment - everything works like a charm.

DATA: lv_adrnr_hol TYPE lfa1-adrnr,
lv_comm_type TYPE adrc-deflt_comm.
SELECT SINGLE adrnr
FROM lfa1
INTO lv_adrnr_hol
WHERE lifnr = 'PD666'.
SELECT SINGLE deflt_comm
FROM adrc
INTO lv_comm_type
WHERE addrnumber = lv_adrnr_hol.


My problem is I have no idea where I should implement that piece of code. I have so far:


- I've been debugging my way through MRRL's program (RMMR1MRS) for days and I can't, for the life of me, locate any place where it's decided the print is happening, so I don't even know where to possibly make the Enhancement.

- I've been checking NACE ---> MR ---> Outbound information --> ERS procedure --> ZRM08NAST (printing program). It is, I believe, our custom version of RM08NAST which has two curiously looking FORMs: ENTRY_ERS_SM (with a function module 'ZMRM_ENTRY_ERS_SM') and ENTRY_ERS_SM_MAIL (with a function module 'ZMRM_ENTRY_ERS_SM_MAIL').
I tried wrapping the logic of both of these FORMs in IF statements: "Check the vendor's master data and if the default communication is (or is not) 'INT' - proceed with the CALL FUNCTION(...)"

That seemed to have SOME effect... as the printing/e-mail sending is SOMEHOW affected by what I did, but the problem is, it seems to be completely bonkers and works randomly.
Thus I have no idea how to proceed. The debugger doesn't show me any connection between the RMMR1MRS (program for MRRL) and the printing program, but I am somewhat able to affect the behaviour by doing what I described above, BUT the same code that works perfectly in my test environment, works completely randomly in the actual printing program.

Thank you for your time.

Kind Regards,