05-29-2008 8:01 AM
Hi Experts
I have reqwirement, Purchasing data, using data source 2LIS_02_SCL (Purchasing Data (Schedule Line Level)) fails frequently because it brings unassigned "#" values for the object ZQUOTNUM (Quotation number).
To eliminate the unassigned "#" values automatically write a routine at transfer rules leval.
I found out one function module SCP_REPLACE_STRANGE_CHARS but how to use this function module
Regards
Venkat Marneni
05-29-2008 8:07 AM
Hi,
you can use the "replace' statement
constants: c_char type char1 value '#',
w_text is the input text( purchasing data)
REPLACE ALL OCCURRENCES OF c_char IN w_text WITH c_colon.
c_colon is the replacement value.
Regards,
Sriram
05-29-2008 9:28 AM
Hi,
Just create a function with this code .... and assign the result parameter.
Remember you need to do only Result parameter..
Code follows...
FUNCTION Z_TO_CHANGE_SPECIAL_CHARS.
*"----
""Local Interface:
*"----
DATA: L_USER_ALLOWED_CHAR TYPE RSALLOWEDCHAR,
L_ALL_ALLOWED_CHAR(140) TYPE C,
L_RESULT_STR_LEN TYPE I,
L_STR_INCREMENT TYPE I.
CONSTANTS C_SAP_ALLOWED_CHAR(58) TYPE C VALUE
' !"%&''()*+,-./:;<=>?_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
IF L_ALL_ALLOWED_CHAR IS INITIAL.
SELECT SINGLE * FROM RSALLOWEDCHAR
INTO L_USER_ALLOWED_CHAR
WHERE ALLOWKEY = 'S'.
CONCATENATE C_SAP_ALLOWED_CHAR
L_USER_ALLOWED_CHAR-ALLOWCHAR
INTO L_ALL_ALLOWED_CHAR.
ENDIF.
RESULT = TRAN_STRUCTURE-ZZZ.
TRANSLATE RESULT TO UPPER CASE.
L_RESULT_STR_LEN = STRLEN( RESULT ).
L_STR_INCREMENT = 0.
WHILE L_STR_INCREMENT L_RESULT_STR_LEN.
IF NOT RESULT+L_STR_INCREMENT(1) CO L_ALL_ALLOWED_CHAR.
RESULT+L_STR_INCREMENT(1) = ' '.
ENDIF.
ADD 1 TO L_STR_INCREMENT.
ENDWHILE.
ENDFUNCTION.
Just add your table or structure to the RESULT parameter.
If you are writing a routine... You just copy the whole code and paste it between form ... end form... statments.
I hope that this works..
Regards
05-29-2008 9:50 AM
data:char(25) value '5#4#2#&1#&' .
replace all occurrences of '#' in char with space.
replace all occurrences of '&' in char with space .
write: char.
regards,
venkat