‎2008 Apr 23 12:06 AM
I am calling function SO_OBJECT_READ and it is returning to me a table called OBJCONT which has one field which is a 255 char field. This is the message content of the SBWP email. It seems to split each line using two # like this:
This is my first line of text.##This is my second line of text.##This is my third line of text.
I am trying to process this string by finding the # symbol in the field. I have tried the following but nothing works:
FIND '#' IN OBJCONT-LINE.
IF OBJCONT-LINE CS '#'.
VAR-POS = SY-FDPOS.
ENDIF.
SPLIT OBJCONT-LINE AT '#' INTO TABLE OBJECT_CONTENTS.
None of the above examples seem to process the '#' characters. It is almost like it is a placeholder for a Carriage return or Line Feed? Has anyone come across this problem before? If I declare another field within my program I can process '#' fine using exact same examples described above.
EG.
DATA: VAR-TEST(10) TYPE C.
VAR-TEST = '123###456'.
FIND '#' IN VAR-TEST MATCH OFFSET VAR-POS.
So why does it not work for the table that I have returned from SO_OBJECT_READ?
‎2008 Apr 23 12:17 AM
when ever the person hits an enter in the text field there the # is triggered in the field.. which is called a line field as u suspected.
I had a scenario where I had a # at the end so I found the string length and removed the last character..
If I remember there is some alternative like decelaring the # like
data: c_feed type X value '/OD'.
this doesn't work for a unicode system though.
‎2008 Apr 23 12:26 AM
The problem is that the ## is repeated throughout the string just not at the end. I can not change the results that the standard SAP function gives me so I need to somehow process the two ##'s?
‎2008 Apr 23 3:16 AM
Hi Brad,
Just remove ## using the following code. It just replaces with space. Try it . It works i believe.
Regards,
Venkat.O
DATA objcont LIKE soli OCCURS 0 WITH HEADER LINE.
objcont-line = 'This ##is my 1 line##'.
APPEND objcont.
CLEAR objcont.
objcont-line = 'This ##is my 2 line##'.
APPEND objcont.
CLEAR objcont.
objcont-line = 'This ##is my 3 line##'.
APPEND objcont.
CLEAR objcont.
objcont-line = 'This ##is my 4 line##'.
APPEND objcont.
CLEAR objcont.
objcont-line = 'This ##is my 5 line##'.
APPEND objcont.
CLEAR objcont.
REPLACE ALL OCCURRENCES OF REGEX '##'
IN TABLE objcont WITH space.
LOOP AT objcont .
WRITE / objcont.
ENDLOOP.
‎2008 Apr 23 3:56 AM
Hi Venkat
That was a good suggestion, I tried your REGEX command but it said "the word regex is reserved"..?
I then tried:
REPLACE ALL OCCURENCES OF '##' IN OBJCONT-LINE WITH SPACE. This gave me SY-SUBRC of 4.
I then tried:
TRANSLATE OBJCONT-LINE USING '# '. This did not return errors but it did not change the contents of the line at all. This is definitely not a normal # symbol we are dealing with...
‎2008 Apr 23 4:16 AM
Hi Brad, "the word regex is reserved" ..Is this syntax error or what ? I am able to do in ECC 6.0 . Regards, Venkat.O
‎2008 Apr 23 4:19 AM
‎2009 Jan 05 1:27 AM
‎2010 Oct 04 8:03 AM
This will work.
is Line Feed Character
REPLACE ALL OCCURRENCES OF CL_ABAP_CHAR_UTILITIES=>CR_LF IN wa_objcont-line WITH ' '.
‎2008 Apr 23 4:11 AM
Also just to clarify other things I have tried...
I thought it may have something to do with the character field being 255 characters. So I took the first 72 characters and placed in another temporary field and tried to remove the '#' symbols from the new 72 character field. Still no success...
Declaring new fields with # symbol works fine though and allows removal.
‎2008 Apr 23 9:19 PM
Anyone else have any ideas?
Would be greatly appreciated.
Thanks...
‎2008 Apr 24 3:24 AM
Hi Brad,
Try this. It is working.
regards,
Venkat..O
REPORT zvenkat_notepad2.
DATA objcont LIKE soli OCCURS 0 WITH HEADER LINE.
objcont-line = 'This ##is my 1 line##'.
APPEND objcont.
CLEAR objcont.
objcont-line = 'This ##is my 2 line##'.
APPEND objcont.
CLEAR objcont.
objcont-line = 'This ##is my 3 line##'.
APPEND objcont.
CLEAR objcont.
objcont-line = 'This ##is my 4 line##'.
APPEND objcont.
CLEAR objcont.
objcont-line = 'This ##is my 5 line##'.
APPEND objcont.
CLEAR objcont.
DATA: offset TYPE i.
LOOP AT objcont .
REPLACE ALL OCCURRENCES OF '##' IN SECTION LENGTH 255 OF objcont WITH ''.
MODIFY objcont INDEX sy-tabix.
CLEAR objcont.
ENDLOOP.
LOOP AT objcont .
WRITE / objcont.
ENDLOOP.
‎2008 Apr 27 11:39 PM
Hi Venkat
This didn't work for me either, I am thinking this is a special character passed from the SO_OBJECT_READ function. However I have managed to get a temporary solution working, the problem is I can not determine where the new line begins as no commands are processing the ## symbols.
‎2008 May 05 1:42 AM
I have also found that if I write to my ZTABLE and try to select from the ZTABLE using ## as my selection criteria it does not find the records.
This raises a new question.. What does ## mean when coming from the Database? Is this some sort of Unicode conversion? I think it is just a placeholder for a CRLF.
‎2008 Sep 08 4:42 AM
I ended up processing it by writing the character to db table then referencing it. I think that it was a hex character and their is a class which can process this character but I didn't research any further.