cancel
Showing results for 
Search instead for 
Did you mean: 

MIRO / F-53 in IDOC process

Former Member
0 Kudos

we have a requirement where in we need to post invoice using idoc_input_invoic_mrm FM (coming as INVOIC02 IDoc) and once posted successfully, immediately clear the document using F-53..

What is the best approach to do this?

1) clone IDOC FM and call BAPI to post F-53? Do we need to issue COmmit work before F-53 to ensure that invoice posting is commited?

Or this is not feasible?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi!

As far as document clearing logically is a part of inbound IDoc handling, this routine should be a part of inbound IDoc handler.

For this you don't have to clone standard FM - just create another one with the same interface, call idoc_input_invoic_mrm inside and do BAPI call for document clearing afterwards.

Hope it helps.

Regards,

Maxim.

Former Member
0 Kudos

Maxim, Thanks. I understood your approach where in we can eliminate cloning of std. SAP functionality.

but my question is when does SAP commit the invoice posting?

If you look at the function module IDOC_INPUT_INVOIC_MRM, it calls std FM MRM_INVOICE_CREATE, which will post the invoice. Then there is a subsequent FM MRM_FI_NUMBER_DISPLAY Which gets the FI document from memory.

Now can I call the BAPI for clearing invoice using the FI document created above ? or do I need to perform commit work before calling the BAPI?

Former Member
0 Kudos

Generally inbound IDocs handler FM is called by number of ALE layer FMs which manage also commit to data base.

The call stack for immediate IDoc processing:

- program RBDAPP01

- FM APPLICATION_IDOC_POST_IMMEDIAT

- IDOC_START_INBOUND

- IDOC_INPUT

-- form IDOCS_PROCESS (here customizing is resolved and actual IDoc handler FM is dynamically called)

--- FM TRANSACTION_END with actual COMMIT WORK

This is an example which shows that you have to do your own commit after calling IDOC_INPUT_INVOIC_MRM and before document clearing. In addition all "create" routines inside IDOC_INPUT_INVOIC_MRM are called with addition ON COMMIT - so actual commit is out of control of IDOC_INPUT_INVOIC_MRM.

Regards,

Maxim.

Former Member
0 Kudos

Thnx Max. If we decide to clone IDOC_INPUT_INVOIC_MRM, then I should probably do 'COMMIT WORK' after MRM_FI_NUMBER_DISPLAY FM? This way I can use std. SAP fm to get the document number and then issue commit work to store it to DB. And then call F-53 to do document clearing.

<i>In addition all "create" routines inside IDOC_INPUT_INVOIC_MRM are called with addition ON COMMIT - so actual commit is out of control of IDOC_INPUT_INVOIC_MRM

</i>

What do you mean by "so actual commit is out of control of IDOC_INPUT_INVOIC_MRM"?

Former Member
0 Kudos

Doesn't IDOC_INPUT_INVOIC_MRM return document number created in of its IDOC_STATUS messages? Then you haven't to clone it - just call it inside your own FM as I've previously suggest, commit, get document number from corresponding message record and do clearing.

By "so actual commit is out of control of IDOC_INPUT_INVOIC_MRM" I mean there is no COMMIT WORK inside IDOC_INPUT_INVOIC_MRM itself and this statement is issued upper in the call stack by ALE layer.

Regards,

Maxim.

Former Member
0 Kudos

Hi Krish.. i have to post he invoice using invoic01 and same FM u r using..can u please send me the data mapping sheet for the same in my id gopal.abap@gmail.com..

i have to post invoice against PO..i have done it for reference doc bu for PO its not wrking out for me..

plz help...

Answers (0)