One of my first issues and actually one of the most common ones for those starting or even working for years in BW was the Invalid Characters errors.
I remember how frustrating it was and what a nightmare it became when I just started adding every single “invalid” character in RSKC (Permitted extra characters) to the point that it looked like a sentence written in some alien language and even then my loads kept failing and throwing the infamous error all over the place.
The main reason was, of course, that no conventions were forced in R/3 and users were permitted to input all kind of “garbage” characters, like we used to call them, and when BW tried to load them, well, you know…
So I started looking desperately for a permanent answer to this issue and it came as part of a comment from someone in a Forum in the form of a Function Module. Sorry I don’t have the original posting or name… It’s been several years!
Yes, a Function Module that have avoided me this headache since then. Following our name convention I named it “ZFM_ELIMINATE_INVALID_CHARACTERS”.
*” REFERENCE(I_INFOOBJECT) TYPE RSD_IOBJNM
DATA: length TYPE I,
index TYPE I,
current_char TYPE C,
result(60) TYPE C,
infoobject TYPE RSD_IOBJNM.
CLEAR: result, infoobject.
MOVE I_VALUE TO result.
MOVE I_INFOOBJECT TO infoobject.
TRANSLATE result TO UPPER CASE.
length = strlen( result ).
index = -1.
DO length TIMES.
index = index + 1.
current_char = result+index(1).
CALL FUNCTION ‘RSKC_CHAVL_OF_IOBJ_CHECK’
I_CHAVL = current_char
I_IOBJNM = infoobject
* I_S_COB_PRO =
* I_T_COB_PRO_CMP =
CHAVL_NOT_ALLOWED = 1.
IF SY-SUBRC <> 0.
MOVE ‘ ‘ TO result+index(1).
MOVE result TO O_VALUE.
The Function Module is very simple. It just checks every character in the received value string and validates wether it is part or not of the Valid Characters Set by calling “RSKC_CHAVL_OF_IOBJ_CHECK”.
If the function returns an error it means it is an Invalid Character and just replaces it with ” (empty).
Of course, you could change the code and just replace it with whatever value you’d like.
I normally call it in the Transfer Rules (BW 3.x), now in the Transformations (BW 7.x):
CALL FUNCTION ‘ZFM_ELIMINATE_INVALID_CHARS’
I_VALUE = SOURCE_FIELDS-INFOOBJECT_NAME
I_INFOOBJECT = ‘INFOOBJECT_NAME’
O_VALUE = RESULT.
It just calls the function passing as parameter the InfoObject value were I want to eliminate the invalid characters and then returns it without those characters.
Since I started using this, the only value in my RSKC input field is “ALL_CAPITAL”. And even though users are more “disciplined” now in terms of entering values and characters in their transactions I still get the occasional Invalid Character error coming from some field.
Some people like it, some don’t and, of course, I’m sure the function could be improved somehow. It just works for me… 🙂
- Easy to maintain and use
- No major impact in the performance of the load process
- Most of the time the issues with Invalid Characters are not found on Key fields (those are more restricted by the system when users enter the values) but fields like descriptions and other “secundary” text values, so very low risk of Key inconsistencies with the source
- Of course, one less headache