20 Comments

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

  1. Suhas Saha

    This particular usage of the ASSIGN statement has been debated upon N number of times in the forums. The key point to note here is that this construct is for “internal use” only.

    As an alternative, if you are on SAP release > ECC6.0, you can make use of an implicit enhancement to export the value of the required global data. This IMHO is a more cleaner approach.

    (0) 
    1. Ashish Singhal Post author

      Hi Suhas,

      Thanks for your comment. Appreciate your view.

      However, why burden the customer with maintaining these implicit enhancements and watching out for them in case of upgrades when there is no need, and the data is availaible to you at runtime always.

      Ashish

      (0) 
      1. Suhas Saha

        Ashish Singhal wrote:

        However, why burden the customer with maintaining these implicit enhancements and watching out for them in case of upgrades

        What do you mean by “watching out for them in case of upgrades”? Implicit enhancements are part of the Enhancement Framework (EhFW), which also include Enhancement Spots & Kernel BAdIs. So do you mean that by implementing elements of the EhFW we are “burdening” the customer?

        when there is no need, and the data is available to you at runtime always.

        From ABAP Keyword Documentation, i quote –

        For internal use only, the name in name can also have the form “(PROG)DOBJ” …

        That is a valid enough reason not to use it, when there are easy alternatives available.

        (0) 
        1. Ashish Singhal Post author

          Hi Suhas,

          The sole purpose of following this approach was to reuse something already existing in the memory rather than creating a enhancement.Well save some work for myself. πŸ™‚

          Ashish

          (0) 
          1. Matthew Billingham

            Saving some work for yourself is not a good reason to add risk to a project. Using anything that’s marked for internal use only means you’re doing so at your own risk. If it goes horribly wrong and you wreck your database, then you have zero comeback on SAP.

            I’ve been involved in SAP development for more than 15 years and have not once seen a scenario where this technique was necessary to meet a business requirement.

            (0) 
            1. Ashish Singhal Post author

              Hi Matt,

              My comment of “Saving some work for myself” was not because of laziness, but because of certain reasons as i have mentioned in one of the comments below. However individuals may differ in opinion. I myself have worked with SAP labs for 5 years in custom development team before moving on, and duely understand the complexity involved in handling the standard programs. I would never take a un-informed dicision.

              Ashish

              (0) 
            2. Jelena Perfiljeva

              I have seen this used (by a consultant) in a VOFM routine to get some values that were needed for the business logic but were not available in any of the parameters. No disrespect to the consultants, but unfortunately the “hired guns” would be more inclined to put stuff like that in our systems since usually they don’t need to deal with the consequences.

              Want to thank the moderators for adding the note on the top. Even I have perceived this “solution” as not great but somewhat benign and the comments here outline perfectly the risks as well as provide an alternative solution (an enhancement). Live and learn!

              (0) 
          2. Jānis B

            You’ll “save” some work, until such time SAP does change the internal implementation or behaviour (up to getting rid of the internal table entirely) and nobody during upgrade will have the slightest idea that there might be some customer logic relying on that behaviour or internal table. It’s virtually “invisible” dependency…

            If there would be an enhancement or modification doing normal assignment of POSTAB[] there would be syntax error if SAP has removed the internal table, and even if the there is no syntax error somebody would have to (hopefully) at least take a look during SPAU, whether or not the enhancement logic is still working.

            The way you have implemented access, the custom logic might fail silently after upgrade – which is the worst way for logic to fail.

            If it’s something critical, where we implicitly rely on SAP functionality being certain way (not even talking about grabbing some random SAP internal data out of memory), we sometimes add enhancements doing absolutely nothing other than documenting that we rely on this and that being this and that way. Just so someone has to look at the stuff during upgrade… That is trying to “save work” – the work needed to clean up mess left by custom logic failing silently, sometimes for months.

            cheers

            Janis

            (0) 
            1. Ashish Singhal Post author

              Hi Jaice,

              Thanks for your valuable comments.Appreciate it.

              By my remark “saving myself some work” i did not intend to be lazy to code something or not knowing how to implement implicit enhancement. The choice i made was intentional. Here are the reasons.

              – The whole SAP transaction F-32 is based on POSTAB[]. I am making this statement based on debug analysis. So till the time the transaction stays, the internal table will definately stay, unless there is a complete re implementation of the standard transaction. Please validate.

              – There is a explicit use of the field symbol and there is a underling advantage to this. The ASSIGN statement will assign the starting memory address of the internal table to the field system and thereafter the complete data stored in the memory area is moved into another internal table(as shown in the code screen shot). So if there is a enhancement of the table structure that is well coved.

              – There has been well emphasis laid on the fact while implementing the code, that there is no “playing around” with the assign statement which will hold the starting address of the internal table. Once the complete table is moved into a local table and then used only for read only purposes. Apologoies for not highlighting this piece of information above.

              However i totally understand, that there might be different opinions.

              – Also the above post is in relation to the substitution, in which the calling program SAPMV05A is still in the ABAP stack. I have pasted the screen shot of that as well. The amount of attention this blog has got, has forced me to search existing content on SCN, and here are some more links. Kindly refer to them as well.
              http://scn.sap.com/thread/1469530

              http://scn.sap.com/thread/1721038

              http://scn.sap.com/thread/103427

              http://scn.sap.com/thread/126545

              Ashish

              (0) 
              1. Jānis B

                I shouldn’t really be “pronouncing” anything on something so extensive as SAPMF05A (and the related code) after looking at it for 15 minutes, but, given these two choices to come up with clearing code that can be (easier) maintained and extended for the “next 20 years” for “Simple Finance”:


                a) trying to write the functionality from scratch;

                b) trying to refactor code;


                I’d choose b) without even thinking long about it. And the business logic then gets carved out of the module pool, and all the globals, other than those used directly in the dynpros, obviously must go  then. Starting from those used most often… F-32 can stay…

                (0) 
      1. Shai Sinai

        Hi,

        In short, you are referring to internal data, which you shouldn’t refer to.

        Moreover, as Ashish Singhal mentioned, the usage of this memory area isn’t documented anywhere and cannot be tracked down.

        I would prefer (as a last resort) a modification over it.

        The links you were referring to only explain about the technical usage of it, but says nothing about the consequences of it, which is the main issue here.

        (0) 
          1. Matthew Billingham

            Yes, because modifications are tracked and highlighted and there are tools for dealing with them during upgrade/patch applications.

            Modifications are definitely to be preferred over this kind of manipulation. They’re also to be preferred over copying a SAP program and modifying it for your own purposes – for exactly the same reason.

            Until you’ve had the pain of having to fix a cloned program, or dealing with a sudden loss of a variable due to SAP changes, you may not really understand why this is so important. But perhaps it’s a good idea to trust the knowledge and experience of developers with far more experience than you.

            (0) 
  2. Matthew Billingham

    This blog has been reported to me for moderation. It is fairly well written, and in my view meets the criteria for blogging on a technical issue from a personal perspective.

    However, the comments by Shai Sinai and Suhas Saha stand. This technique is not recommended. Therefore I’ve edited your blog. The notice MUST stay or I will be forced to reject the blog entirely.

    (0) 
    1. Ashish Singhal Post author

      Hi Matt,

      I totally appreciate your view point, and respect the hard work you are putting in order to make the SCN place a more collaborative platform.

      I would really be thankful to you if you can keep the complete remarks from everyone in view before adding the disclaimer. You are the best to decide.

      Kindly go through the above memtioned comments by me and the below links as well.

      http://scn.sap.com/thread/1469530 

      http://scn.sap.com/thread/1721038

      http://scn.sap.com/thread/103427

      http://scn.sap.com/thread/126545

      Best Regards,

      Ashish

      (0) 
      1. Jelena Perfiljeva

        Ashish, there is no need to copy-paste the same content in the comments – we can see all the comments as well as everyone who commented gets an email notification.

        From the threads you refer to the latest one is dated 2010. Lots of things happened since then, in particular we have much better awareness now about the enhancement framework (even the dinosaurs like me caught up! πŸ™‚ ). If something was said on SCN 4 years ago it does not mean that it’s still valid or a good practice today.

        Thank you.

        (0) 
  3. Eitan Rosenberg

    Hi,

    I am very happy to see this blog post but the real lesson comes from the debate that follows…. .

    A very good example of NOT to do .

    Few years back we had a BADI where “(PROG)DOBJ” addition was used. (I was raising hell about it…) .

    Later I found out that CALL FUNCTION ‘DYNP_VALUES_READ’ can replace the assign. (After fixing the code I slept better…) .

    One thing I learned from 41 years of bytes shuffling (yes I am not a kid…) : A system is like a mule you have to treat it with respect else you get:

    data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAADJCAMAAAA93N8MAAAAkFBMVEX///8AAAD39/f8/Pzz8/MTFBbw8PDd3d3r6+v29vba2tri4uLCwsLs7Oz6+vqurq65ubnLy8vV1dWIiIlJSUqgoKDIyMi0tLRbW1wtLi9mZmd0dHV+fn+Xl5cAAAY2NjdSUlNoaWk+P0CRkZKfn594eHkbHB6Cg4M6OjtGRkckJSYUFRdfYGCNjY0JCw4pKSqGTifLAAATv0lEQVR4nO1d55qyOhBmRAUFpQuIKNgr3v/dnYQaAiJYWPye8/7YZRFchkmmZ8Iw/6PTmLhXVyn/aNrvj9p9mFYhg+WswO7T53npugQMTxr+xXN9Hwrw4c9r/rS4BrhrkoIgeTAX/uTZvgyIqBqDSpyUANYEr/kzZDNiKPwj70HS4gPfTs+Nz7CjyDuCpkwmgumvojkwbu8Jv4YgoZEHKT66gcPTlykhxXCVMc090YZZa0/4LYxX6aEPLP41udgFlopncDeOD6f0jE4c/yi0bXrIwwb9HMKBvsY4L7joaHdLzqFR8P2H+y4CLju+ARJs9pa6QjYI+RcNDAT150nvkwRMYc7YUv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