on 08-01-2017 7:04 PM
Hi!
I'm traying to validate a field string, it needs to accept valid characters in BW and the transacction RSKC so if those characters aren't allowed then replace them for "-"(hyphen).
The procedure I'm developing is an implementation of ABAP function (SCP_REPLACE_STRANGE_CHAR) within transformation routine... It returns the strange chars replaced, but it doesn't respect all characters in RSKC added (ÁÉÍÓÚÜÑ)...
What can I do to all the characters in BW and RSKC to be accepted?
Try to use FM RSKC_CHAVL_OF_IOBJ_CHECK as in this old sample (I used to call it in an old custom service class executed in some of my Transfer Routine for InfoObject (Mainly when Info Objects came from user input fields without check/rule in ECC)
" translate result to upper case. " removed
length = strlen( result ).
do length times.
index = sy-index - 1.
current_char = result+index(1).
call function 'RSKC_CHAVL_OF_IOBJ_CHECK'
exporting
i_chavl = current_char
i_iobjnm = infoobject
exceptions
chavl_not_allowed = 1
others = 2.
if sy-subrc <> 0.
move ' ' to result+index(1).
endif.
enddo.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for help me guys!
I resolved my problem, I used the FM 'RSKC_ALLOWED_CHAR_GET' and I used the next code:
DATA: g_allowed_char(200) TYPE C.
IF g_allowed_char is INITIAL.
CALL FUNCTION 'RSKC_ALLOWED_CHAR_GET' IMPORTING
e_allowed_char = g_allowed_char.
ENDIF.
RESULT = SOURCE_FIELDS-TXZ01.
CHECK g_allowed_char NE 'ALL_CAPITAL'.
DO.
IF not RESULT CO g_allowed_char.
result+sy-fdpos(1) = '-'.
ELSE.
exit.
ENDIF.
ENDDO.
Regards!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
RSKC setting should be ALL_CAPITAL_PLUS_HEX only. Do not add any other characters, othwerwise the parameter is ignored.
If the problem still occurs, this article will help : https://blogs.sap.com/2017/06/28/removing-invalid-characters-from-bw-load/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chris,
Please use below code. It should work.
We take a text string with all the valid characters accepted by BW and check the input string character by character. If anything is invalid, it is replaced by hyphen (-).
DATA: txtstring TYPE c LENGTH 000050.
DATA: l_len TYPE i,
l_time TYPE i.
MOVE source_fields-sgtxt TO txtstring.
TRANSLATE txtstring TO UPPER CASE.
l_len = strlen( txtstring ).
DO l_len TIMES.
IF txtstring+l_time(1) CN ',<>?/\:;"''ABCDEFGHI JKLMNOPQRSTUVWXYZ!%^&*()__+=1234567890' .
txtstring+l_time(1) = '-'.
ENDIF.
l_time = l_time + 1.
ENDDO.
result = txtstring.
Now you may like to replace '-' with blank or space.
REPLACE ALL OCCURRENCES OF '!' IN txtstring WITH space.
condense txtstring. "remove all spaces
result = txtstring.
Thanks
Mohit Agrawal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.