Skip to Content

There are at least two ways to park a Logistics Invoice. One of them is by using BAPI_INCOMINGINVOICE_PARK. The other one makes use of the INVOIC IDoc and requires the OSS Note 501524 to be implemented. Unfortunately, both of those methods only allow creating a document with the document status “A” – Parked. The point is, this also causes follow-on documents (like financial posting document) being parked. Once developing one of my integration scenarios, I have met a requirement to park a Logistics Invoice in such a way that no follow-on documents were created. In particular, the financial posting document could not be created (yet) for some reason. As the solution appeared to be more complex and difficult than I initially expected, I decided to share it with you, as it might turn out useful for someone else.

Although my solution was based on the BAPI_INCOMINGINVOICE_PARK function module, both this BAPI and INVOIC IDoc use the same part of code, so you can use any of those methods. If you need further assistance in using this BAPI, please refer to its Documentation in transaction BAPI in your system. You will find an explanation of importing parameters, as well as examples of use in several scenarios there. I will not focus on the BAPI itself, because it is not the purpose of this blog.

As you might have already noticed, the BAPI I was using calls a form MRM_INVOICE_CREATE_CALL_N, passing the hardcoded C_RBSTAT_PARKED (equal ‘A’, which means Parked) as the expected status of the document to be created. It might seem that providing a new implementation to enhancement section:

     ENHANCEMENT-SECTION     BAPI_INCOMINGINVOICE_PARK_33 SPOTS ES_SAPLMRM_BAPI.

passing a different status could solve the problem. But in this case, some functionalities of the form form MRM_INVOICE_CREATE_CALL_N do not work correctly. Which means we need to go deeper in the code to find a workaround.

After a detailed analysis, I have found the function module MRM_INVOICE_PARK (used by both: INVOIC and BAPI…) which is the right place to put the enhancement that will change the document status. To make the case even more difficult, the parameter is passed by reference, so its value cannot be changed easily inside the FM, which makes the scenario even more complex approach.

Problem solution

Step 1

First of all, we will need a global field symbol in function group MRMH to change the value of the I_RBSTAT_NEW (Invoice document status) importing parameter of MRM_INVOICE_PARK function module. In order to do it, go to top include LMRMHTOP of function group’s main program SAPLMRMH, find the enhancement point:

     ENHANCEMENT-POINT lmrmhtop_03 SPOTS es_saplmrmh STATIC.

Create your own ehnancement implementation and declare a field symbol there:

     ENHANCEMENT 43  ZGG_DECLARE_FIELD_SYMBOL.

       FIELD-SYMBOLS: <tp_rbstat> TYPE rbstat.

     ENDENHANCEMENT.

Step 2

Secondly, we need to have the previously declared field symbol assigned to the variable that contains a value for I_RBSTAT_NEW. We will use an implicit enhancement implementation at the beginning of the function module MRM_INVOICE_CREATE for this purpose. Create an implementation with the following code:

     ENHANCEMENT 42  ZGG_ASSIGN_FIELD_SYMBOL.

       ASSIGN i_rbstat_new TO <tp_rbstat>.

     ENDENHANCEMENT.

Step 3

Finally, we need to put a new value to the parameter I_RBSTAT_NEW using our previously assigned field symbol. We will use an implicit enhancement implementation again, this time at the beginning of function module MRM_INVOICE_PARK. You should also perform some additional checks at the beginning, to make sure your code is only executed for your scenario.

     ENHANCEMENT 60  ZGG_INVOICE_PARK_STATUS_D.

       DATA: ltp_var_name TYPE char30 VALUE ‘(SAPLMRMH)<tp_rbstat>’.

       FIELD-SYMBOLS: <ltp_rbstat> TYPE rbstat.

       IF … “check your conditions here to make sure that it works only for your scenario

         ASSIGN (ltp_var_name) TO <ltp_rbstat>.

         IF sy-subrc = 0 AND <ltp_rbstat> IS ASSIGNED.

           <ltp_rbstat> = c_rbstat_saved_po. “Entered and held

         ENDIF.

       ENDIF.

     ENDENHANCEMENT.

Results

Finally we have made enough to have the document properly parked, or literally: “Entered and held”. Try testing your scenario again (execute BAPI_INCOMINGINVOICE_PARK or reprocess/send new INVOIC IDoc) to see the results.

The result, as you see it in the Overview of Invoice Documents in transaction MIR6, will be the following:

/wp-content/uploads/2012/01/20120107_01_121652.png

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

    1. Former Member Post author

      Hi Carlos,

      Unfortunately my blog hasn’t been fixed yet by the SCN team after migrating to the new platform and I don’t have any backup myself… I have alreay asked for fixing it in the dedicated Wiki Report Your Missing Blog Content , but I am still waiting for the solution. If your case is urgent, try contacting Oxana Noa Zubarev who seems to be the coordinator of that fix, and ask her to fix this particular blog ASAP.

      Regards,

      Greg

      (0) 
      1. Former Member

        Hi Grzegorz,

        Thank you for guiding Carlos to the correct document. Unfortunately some blogs (yours among them) were not fixed yet due to the system current capabilities. This issue should be solved in a short time.

        I apologize for the delay and any inconveniences caused.

        Thanks,

        Oxana

        (0) 
    2. Former Member

      Hi Carlos,

      Could you please submit your blog in Report Your Missing Blog Content document. I would be able to report the damage to the IT team and fix your blog. You shall be notified personally upon the change in order to confirm whether the changed content is correct or not.

      I apologizes for the inconvenience!

      Regards,

      Oxana


      (0) 

Leave a Reply