‎2008 Jul 11 5:41 AM
Hi Frnds,
I am using read_text functional module to read PR line item text.
i am getting text like this : " Brass Flareless compression tube fittings### ".
i dont want '###'. so i used below code.
LOOP AT it_tline.
REPLACE ALL OCCURRENCES OF REGEX '#' IN it_tline-tdline WITH ' '.
CONCATENATE p_v_text it_tline-tdline INTO p_v_text SEPARATED BY space.
ENDLOOP.
no changes in text. It is not removing ###. I used below statement also... no result i got.
replace all occurrences of CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
in it_tline-tdline with ' '.
Can any body tel me what may be the problem.
‎2008 Jul 11 5:55 AM
Hi Kumar,
Just remove REGEX in your replace statement and try it
regards
padma
Edited by: Padmavathi Palli on Jul 11, 2008 6:55 AM
‎2008 Jul 11 5:55 AM
Hello Kumar,
First try with Just remove REGEX in your replace statement and try it. It still not works then Instead of "CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB" try removing the Carrage feed constant variable in the same class.
Thanks,
Greetson
‎2008 Jul 11 5:56 AM
REPLACE ALL OCCURRENCES OF '#' IN it_tline-tdline WITH ' '.
wats regex there in that replace statement???
regards,
madhu
‎2008 Jul 11 5:59 AM
Try to use '#' directly in the replace statement like:
LOOP AT it_tline.
REPLACE ALL OCCURRENCES OF '#' IN it_tline-tdline WITH ' '
IN CHARACTER MODE.
CONCATENATE p_v_text it_tline-tdline INTO p_v_text SEPARATED BY space.
ENDLOOP.
Regards,
Joy.
‎2008 Jul 11 6:09 AM
Hi all,
I tried all u r suggestions, it is not working.
if i used in sample report (where we do small practice ) it is working.
like
data : p_v_text type string.
p_v_text = 'Brass Flareless compression tube fittings### '.
REPLACE ALL OCCURRENCES OF '#' IN p_v_text WITH ''.
write : p_v_text.
but in my main report it is not working, I think the text coming from READ_TEXT functional module.
@ greetson can u tell me how can i use: " try removing the Carrage feed constant variable in the same class."
Thanks,
Kumar
‎2008 Jul 11 6:11 AM
Hello Kumar,
There is a attribute in the class "CL_ABAP_CHAR_UTILITIES=>" for carriage feed. Check that variabe and use that attribute in your logic.
Thanks,
Greetson
‎2008 Jul 11 6:17 AM
HI,
As per my knowledge Replace and Transalate will work based on the text Environment. So before using this statement please apply the below code. So that it will set the text environemt.
SET LOCALE LANGUAGE lang [COUNTRY cntry].
i hope this will solves your probelm.
Many Thanks,
Raghu.
‎2008 Jul 11 6:23 AM
Hi Grretson,
There is no that type of attribute. i tried with other one FORM_FEED no use.
Can any body give sol. here is my code:
FORM item_text USING p_v_objname
p_c_a07
p_c_ekpo
CHANGING p_v_text.
intarnal table declaration
DATA : it_tline TYPE TABLE OF tline WITH HEADER LINE.
CLEAR : p_v_text,
it_tline.
REFRESH it_tline.
Reading RFQ texts according to text id.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = p_c_a07
language = sy-langu
name = p_v_objname
object = p_c_ekpo
TABLES
lines = it_tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc = 0 AND it_tline[] IS NOT INITIAL.
LOOP AT it_tline.
replace all occurrences of CL_ABAP_CHAR_UTILITIES=>FORM_FEED
in it_tline-tdline with ' '.
REPLACE ALL OCCURRENCES OF '#' IN it_tline-tdline WITH '' IN CHARACTER MODE.
CONCATENATE p_v_text it_tline-tdline INTO p_v_text SEPARATED BY space.
REPLACE ALL OCCURRENCES OF REGEX '#' IN p_v_text WITH ''.
ENDLOOP.
ENDIF.
ENDFORM.
‎2008 Jul 11 6:29 AM
Hello Kumar,
Try the attribute "CR_LF" ... My mistake in my previous replies.
Thanks,
Greetson
‎2008 Jul 11 6:30 AM
‎2008 Jul 11 6:44 AM
If u r getting '#' for every line in table it_tline then u can try this
FORM item_text USING p_v_objname
p_c_a07
p_c_ekpo
CHANGING p_v_text.
intarnal table declaration
DATA : it_tline TYPE TABLE OF tline WITH HEADER LINE.
data: len type i.
CLEAR : p_v_text,
it_tline.
REFRESH it_tline.
Reading RFQ texts according to text id.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = p_c_a07
language = sy-langu
name = p_v_objname
object = p_c_ekpo
TABLES
lines = it_tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc = 0 AND it_tline[] IS NOT INITIAL.
LOOP AT it_tline.
len = strlen( it_tline-tdline ).
Say for last 3 char u r getting '#'
len = len - 3.
if len > 0.
CONCATENATE p_v_text it_tline-tdline+0(len) INTO p_v_text SEPARATED BY space.
endif.
clear len.
ENDLOOP.
ENDIF.
ENDFORM.
Also u can split the char string into an internal table based on '#' and then only consider string that have char other than '#'.
Regards,
Joy.
‎2008 Jul 11 6:57 AM
Hi Joyjit,
I tried split. but text is not splitting. It seems not working.
Any way this text will not come every time like this.
This is the first time happend in this year.
Any way how can i read that text have the '#' charecter so that if that particular char is there i will execute your code.
Regards,
Kumar
‎2008 Jul 11 7:15 AM
Hay thanks to allll.
Actually problem in Uploading programe.
There is three spaces in the text file which is Uploaded as PR. That is the reason READ_TEXT giving '###'. that means there is 3 tab spaces in the text.
Any way still i have question why i am not able remove that symbols (###) from text line wich is given READ_TEXT functional module.
If i fnd the sol.. i will post here.... If any body have the answer plz tel me, it will help further..
Thanks,
Kumar
‎2024 Nov 22 12:07 PM
Hi Team,
Did anyone found any solution to this issue. This issue is happening with me as well till now.
‎2008 Jul 11 6:56 AM
Hi try this code..
DATA : t_hex(2) TYPE c.
DATA :y TYPE x VALUE '0D'.
CONCATENATE y ':' INTO t_hex.
TRANSLATE pv_text USING t_hex .
TRANSLATE pv_text USING ': '.