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
- Run debugger (suppose we have already set memory parameter by above statement), choose on the right side "New tool"
- From the tree menu choose, "Special Tools" and then "System Areas (Internal Only)"
- You will get the below screen
- Within the Cntnts tab fill Area field, type "SMEM" (for SPA-GPA parameters) and press Enter
- 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.