replace
IF cs_orderadm_h_badi-description = gc_hex_char.
with
if cs_order_adm_h_badi-description CO gc_hex_char.
Frage
I have a description
description with tab in it
ABAP converts this tab into # so its displayed as
description with#tab in it
I want this to be replaced with SPACE so I am writing a check for valid characters and anything that is invalid is replaced with space.
I have the code below however it doesn't do the check for all the characters.
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab
IN cs_orderadm_h_badi-description WITH ` `.
I have thought of using constant an writing out every valid character as a constant but i need a better way to do this.
Any help or advise is appreciated. Keep in mind that this is a conversion specific to SAP ABAP. Thanks
Lösung 3
replace
IF cs_orderadm_h_badi-description = gc_hex_char.
with
if cs_order_adm_h_badi-description CO gc_hex_char.
Andere Tipps
Almost duplicate of Looking for Non-Printable characters inside internal table ABAP
REPLACE ALL OCCURRENCES OF REGEX '[^[:print:]]+$'
IN cs_orderadm_h_badi-description WITH ''
IGNORING CASE.
WRITE cs_orderadm_h_badi-description TO lw_hash_desc.
REPLACE ALL OCCURRENCES OF '#' IN lw_hash_desc WITH ` `.
cs_orderadm_h_badi-description = lw_hash_desc.
Will work for all special characters but will also replaces existing hashes. If you expect these in your strings you will first need to replace these with something unique and replace this with the hashes after the above code.