converting code to symbol - sql

I'm using system to control the process in my company and some of it has comment table, let us say it is Opr_comm. the content inside that attribute is various sometimes it contain "<", ">", "'" and so many symbols. here is the query.
SELECT
T1.Prod_No,
T1.Proc_CD,
T1.Opr_Comm
FROM
P110 T1
I have figure it out, when we input to system < it will turned to be &lt, when > it will be &gt. it happen when i retrieve it from database.
So, how can i convert that code to be symbol again?
Thank you very much for your help

If you're just looking to convert back to symbols when you are reading from the table, and not during the write process, you can use the REPLACE function
http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions134.htm
It's bulky, but if this is a limited issue it will work. You'd replace your code:
SELECT
T1.Prod_No,
T1.Proc_CD,
replace(replace(T1.Opr_Comm,"<","<"),">",">") AS Opr_Comm
From
P110 T1
Of course if you're able to prevent this encoding from happening in the first place, you'd be better off.

Related

Meaning of (052) at the end of text literal?

Really just a curious question.
Here are a few examples of the same concern that I have since they are being exported to the FM "REUSE_ALV_GRID_DISPLAY" for parameter "it_fieldcat".
ls_fieldcat-seltext_l = 'Material number'(052).
ls_fieldcat-seltext_m = 'Material'(053).
ls_fieldcat-seltext_s = 'Mat.'(054).
I tried removing the numbers on the right and executed the program but I didn't see any differences and I also tried to see what happens inside debug mode but it only fills the field with the string value, am I missing something or is there something that I wasn't able to notice?
I've been tasked to create a copy of a program which originally joins multiple tables and filters them according to the Parameters from the SELECTION-SCREEN and then shows the results in an ALV Grid Report, but for the use case of the copy it should instead populate a table in ECC that we will then be replicating to BW side. I have successfully copied and modified it accordingly but I can't seem to understand what the numbers beside the strings are doing.
Can someone please explain what their use is, would be very grateful to see a few examples.
Thanks!
The number in the brackets is a text symbol defined as a part of the text elements of the program. Using the syntax 'Literal'(idf) replaces these literals in the program if the symbol is in the currently loaded text pool.

How to determine Thousands Separator using Format in VBA

I would like to determine the Thousand Separator used while running a VBA Code on a target machine without resolving to calling system built-in functions such as (Separator = Application.ThousandsSeparator).
I am using the following simple code using 'Format':
ThousandSeparator = Mid(Format(1000, "#,#"), 2, 1)
The above seems to work fine, and would like to confirm if this is a safe method of doing it without resorting to system calls.
I would expect the result to be a single char string in the form of , or . or ' or a Space as applicable to the locale on the machine.
Please note that I want to only use a language statement such as Format or similar (no sys calls). Also this relates to Thousands Separator not Decimal Separator. This article Using VBA to detect which decimal sign the computer is using does not help or answer my question. Thanks
Thanks in advance.
The strict answer to whether it is safe to use Format to get the thousands separator is No.
E.g. on Windows, it is possible to enter up to three characters into the Thousands Separator field in the regional settings in the control panel.
Suppose you enter asd and click OK.
If you now call Format(1000, "#,#") it will give you 1a000. That is only the first letter of your thousands separator. You have failed to retrieve it correctly.
Reading the registry:
? CreateObject("WScript.Shell").RegRead("HKCU\Control Panel\International\sThousand")
you get back asd in full.
To be fair, the Excel international properties do not seem to be of much help either. Application.International(xlThousandsSeparator) in this situation will return the separator originally defined in your computer's locale, not the value you've overridden it to.
Having that said, the practical answer is Yes, because it would appear (and if you happen to know for sure, please post an answer here) that there is no culture with multi-char thousand separator (even in China where scary things like 1ε„„2345δΈ‡6789 or 1ε„„2345萬6789 exist, they happen to be represented with just one UTF-16 character), and you probably are happy to ignore the people who decided to play with their locale settings in that fashion.

Dynamic, Nested Replace

I'm using SQL Server 2008 and need to strip out quite a bit of data within a string. Because of the nature and variability of the string, I think I'm needing to use multiple, nested REPLACE commands. The problem is each REPLACE needs to build on the previous one. Here is a sample of what I'm looking at:
<Paragraph><Replacement Id="40B"><Le><Run Foreground="#FFFF0000">Treatment by </Run></Le><Op isFreeText="True"><Run Foreground="#FFFF0000">test</Run></Op><Tr><Run Foreground="#FFFF0000">. </Run></Tr></Replacement></Paragraph>
Essentially, I need it to return just the text outside of the <> brackets so for this example it would be:
Treatment by test.
Also, I wanted to mention that the strings inside the <> brackets can vary quite a bit for each row both by content and length, but it isn't relevant for what I'm needing other than making it more complex for replacing.
Here is what I've tried:
REPLACE(note,substring(note,patindex('<%>',note),CHARINDEX('>',note) - CHARINDEX('<',note) + 1),'')
And it returns:
<Replacement Id="40B"><Le><Run Foreground="#FFFF0000">Treatment by </Run></Le><Op isFreeText="True"><Run Foreground="#FFFF0000">test</Run></Op><Tr><Run Foreground="#FFFF0000">. </Run></Tr></Replacement></Paragraph>
Somehow I need to keep going with replacing each of the <> brackets but don't know how to proceed. Any help or guidance would be greatly appreciated!!!
Depending on how you have that string holding the HTML fragment available you could try to use something like:
SELECT convert(xml, '<Paragraph><Replacement Id="40B"><Le><Run Foreground="#FFFF0000">Treatment by </Run></Le><Op isFreeText="True"><Run Foreground="#FFFF0000">test</Run></Op><Tr><Run Foreground="#FFFF0000">. </Run></Tr></Replacement></Paragraph>').value('/', 'varchar(255)') as stripped
You convert it to XML and then use the built in xml parser function "value".

Preventing VB.NET's multiline/verbatim string from destroying your entire code file?

Let's say you have a module that's several hundreds of lines long. At the very top of your code file, you go to start up a string, so you type a quote. Total wreckage ensues as the string remains unterminated for a time, causing everything within your entire code file to be subject to erratic encapsulation by your string (see image for actual example of all the errors generated). No big deal, right? You just finish your string and all the errors will go away. While true, you may find the IDE has had its way with other strings in your document. For example, these lines...
oLog.writeLogFile("Starting System Update and Version Update ")
oLog.writeLogFile("Starting Script for Fetching Data from Source to Dest")
...get changed to this:
oLog.writeLogFile("Starting System Update And Version Update ")
oLog.writeLogFile("Starting Script For Fetching Data from Source To Dest")
Notice how and changes to And, for to For, and to to To. What's happening here is that, as other strings in the document become... eh... "destrung"... so some of the words that were once part of a string are now interpreted as keywords by the IDE. Because it's VB, it modifies capitalization automatically. When you finally terminate your string, all the other strings further down in the document become properly terminated as well, but the jarring effects still remain.
Is there a way to prevent this from occurring?
Why not first type a double ", then return in between them and start typing your string? I do it all the time to prevent this. I find that the short delay in between typing your first " and the moment the IDE starts capitalizing keywords is long enough for me to (remember to) type the second ".

Select Options Webdynpro abap no contain CP pattern

I have got the following issue.
I have implemented WDR_SELECT_OPTIONS and it works fine, but i need the CP(*) for searching data.
Someone know why is not there?
CP isn't showing up because it is only available for character-like data elements (things like C, N, or string).
My guess is that field is an integer.
manual page for these relational operators -
https://help.sap.com/abapdocu_740/en/abenlogexp_op.htm
It is not there, because it does not need to be there. If you type * or + in this field, then the system knows automatically that this is a pattern.
Here is a screenshot for selection options from a traditional Dynpro.