Thursday, March 17, 2016

BAPI_HU_UNPACK clears LGN parameter or How to debug SPA-GPA memory parameters

BAPI_HU_UNPACK LGN parameter trap


Sometime standard function modules, BAPIs can cause a bit surprise. In my case it was BAPI_HU_UNPACK. Let's imagine we have a menu transaction which is sharing memory parameters across all called transactions. One of these SPA-GPA parameters was 'LGN' set by standard statement e.g.

    SET PARAMETER ID 'LGN'                 FIELD  gs_rfsuserpara-lgnum.

My task was to find a root cause why this parameter suddenly disappears from memory. At my surprise I found memory parameter 'LGN' is cleared by each run of BAPI_HU_UNPACK (My SAP is EHP6).

Here is the way how to track any SPA-GPA parameters


  1. Run debugger (suppose we have already set memory parameter by above statement), choose on the right side "New tool"

  2. From the tree menu choose, "Special Tools" and then "System Areas (Internal Only)"

  3. You will get the below screen

  4. Within the Cntnts tab fill Area field, type "SMEM" (for SPA-GPA parameters) and press Enter

  5. Now you can easily observe the values during the debug. Just scroll by arrows to wanted parameter and continue with debugging. Now it is easy to catch the responsible BAPI.