wridgeu

the type of the database table and work area (or internal table) are not unicode convertible

While troubleshooting our company internal EWM sandbox, I encountered an interesting issue worth sharing.

But what was the error and its cause? Could it be related to an SAP Note?

error analysis & resolution

The error occurred in one of the core handling unit selection implementations in an EWM system, the function module /SCWM/HU_SELECT, causing system-wide dumps, across most EWM functionalities.

The dump itself didn't say a lot, aside from mentioning a syntax error. But a syntax error in SAP standard code? Was that maybe an SAP Note that was implemented wrong?

dump-syntax-error-hu-select

Note: see the mention of ET_HUHDR? It'll be important.

So let us check out this "syntax error" in the function module!

syntax-error-hu-select

The type of the database table and work area (or internal table) "ET_HUHDR" are not Unicode convertible.

A Unicode issue? Does that make sense? My intuition said no, so let's investigate!

The key observation was that all syntax errors were pointing to various SELECT statements from the /SCWM/HUHDR table. None of which had any INTO CORRESPONDING FIELDS OF. This suggested checking: are the source and target identical or do we have a type mismatch?

Comparing the database table /SCWM/HUHDR with the target table type /SCWM/TT_HUHDR_INT (of the variable ET_HUHDR) revealed a manually added .APPEND structure in table /SCWM/HUHDR but in the wrong location.

If you want to add custom fields to the database table /SCWM/HUHDR, then you'd generally go into the corresponding .INCLUDE structure /SCWM/S_HUHDR. In there you will find another .INCLUDE structure named /SCWM/INCL_EEW_S_HUHDR and this is generally the place in which you would want to add your custom fields for the handling unit header. In doing so, you essentially add it in multiple places at once, preventing exactly this type of error. That is because the .INCLUDE structure is reused (or added) by SAP in several places so that you only have to add a custom field once but the field itself is actually applied to the entire business object (or application) in all the relevant places.

So the solution, as you might've figured out by now, was to simply remove the .APPEND structure in the database table and - if required - add the fields from it back to the correct .INCLUDE structure (you could also add the .APPEND itself into the .INCLUDE).

short excurse: EEW

EEW? Here's the (very) short version of a long story: historically in the SCM context some custom fields were added using the Easy Enhancement Workbench or in short EEW. The EEW naming convention was carried over and is still used, although the transaction itself is mostly obsolete nowadays (historically grown).

In modern S/4 systems you'll also see two variations of this .INCLUDE struct where one of them is marked as obsolete in its long text and the other has a suffix of _S4 and should be used instead.

conclusion

While the root cause itself can be a rather common mistake. It was really the bad error message (or its wording) of the syntax error that can be easily misleading. I hope this little blog post can help other developers in the future.


Some helpful links both from SAP itself and the SAP Community which I found after the fact and wanted to mention.

References/Links

#ewm #hu_select #quick tip #sap