How do you append to a "string" type field?
ABAPers,
I am trying to understand how to append values to a "string" data type in an efficient way. One way to append to a string is using "concatenate" feature.
data: myRetVal type string.
DO
CONCATENATE myRetVal ',' myNewData INTO myRetVal.
ENDDO.
However, CONCATENMATE is not efficient in this scenario. Each time you call it, myRetVal gets copied into myRetVal all over. As the string grows, this statement will execute slower and slower.
The other option I thought is to use offset mechanism.
MOVE myNewData to myRetVal+myRetValLen.
However, it appears "string" and "xstring" type fields do not support offset and length operations.
Is there a third choice that I am missing?
Thank you in advance for your help.
Pradeep
There is no such operator.
But if just using literals, you can use the &, like this.
data: string type string.
string = 'This is the first part ' & 'This is the second part'.
Again, this will not work with variables.
Regards,
Rich Heilman
Similar Messages
-
Re: How do you create and use "common" type classes?
Hi,
You have 2 potential solutions in your case :
1- Sub-class TextNullable class of Framework and add your methods in the
sub-class.
This is the way Domain class work. Only Nullable classes are sub-classable.
This is usefull for Data Dictionary.
The code will be located in any partition that uses or references the supplier
plan.
2- Put your add on code on a specific class and instanciate it in your user
classes (client or server).
You could also use interface for a better conception if needed. The code will
also be in any partition that uses or references the supplier plan where your
add on class is located.
If you don't want that code to be on each partition, you could use libraries :
configure as library the utility plan where is your add-on class.
You can find an example of the second case (using a QuickSort class,
GenericArray add-on) with the "QuickSort & List" sample on my personal site
http://perso.club-internet.fr/dnguyen/
Hope this helps,
Daniel Nguyen
Freelance Forte Consultant
http://perso.club-internet.fr/dnguyen/
Robinson, Richard a écrit:
I'm relatively new to forte and I'd like to know how can you handle utility
type classes that you want to use through out your application? Ideally
what I want is a static class with static methods.
Let's say that I have a StringUtil class that has a bunch of methods for
manipulating strings.
My problem is that we have code that runs on the client and code that runs
on the server. Both areas could use the StringUtil class, but from what I
understand, I have to create StringUtil in a plan and then create a server
object of type StringUtil. The server object will eventually get assigned
to a partition. That's not good since I really want the server object to
physically reside at the server end and at the client end. (Actually, I
don't want a server object, I just want to invoke a static method of a
static class).
Any clues on how to solve this problem would be appreciated.
Also, what is the url at Sage-it that has a summary of all emails that have
been posted to [email protected]? Perhaps this question has been
answered previously.
Thanks in advance
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>-
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>Hi Richard,
Your question about "utility classes" brings up a number of issues, all of
which are important to long-term success with Forte.
There is no such thing as a static method (method that is associated with a
class but without an implicit object reference - this/self/me "pointer") in
TOOL, nor is there such thing as a global method (method not associated
with a class at all). This is in contrast to C++, which has both, and
Java, which has static methods, but not global classes. Frequently, Forte
developers will write code like this:
result, num : double;
// get initial value for num....
tmpDoubleData : DoubleData = new;
tmpDoubleData.DoubleValue = num;
result = tmpDoubleData.Sqrt().DoubleValue;
tmpDoubleData = NIL; // send a hint to the garbage collector
in places where a C++ programmer would write:
double result, num;
// get initial value for num....
result = Math::Sqrt(num);
or a Java programmer would write:
double result, num;
// get initial value for num....
result = Math.sqrt(num);
The result of this is that you end up allocating an extra object now and
then. In practice, this is not a big deal memory-wise. If you have a
server that is getting a lot of hits, or if you are doing some intense
processing, then you could pre-allocate and reuse the data object. Note
that optimization has its own issues, so you should start by allocating
only when you need the object.
If you are looking for a StringUtil class, then you will want to use an
instance of TextData or TextNullable. If you are looking to add methods,
you could subclass from TextNullable, and add methods. Note that you will
still have to instantiate an object and call methods on that object.
The next issue you raise is where the object resides. As long as you do
not have an anchored object, you will always have a copy of an object on a
partition. If you do not pass the object in a call to another partition,
the object never leaves. If you pass the object to another partition, then
the other partition will have its own copy of the object. This means that
the client and the server will have their own copies, which is the effect
you are looking for.
Some developers new to Forte will try to get around the lack of global
methods in TOOL by creating a user-visible service object and then calling
methods on it. If you have a general utility, like string handling, this
is a bad idea, since a service object can reside only on a single
partition.
Summary:
* You may find everything you want in TextData.
* Unless you anchor the object, the instance will reside where you
intuitively expect it.
* To patch over the lack of static methods in TOOL, simply allocate an
instance when required.
Feel free to email me if you have more questions on this.
At the bottom of each message that goes through the mailing list server,
the address for the list archive is printed:
http://pinehurst.sageit.com/listarchive/.
Good Luck,
CSB
-----Original Message-----
From: Robinson, Richard
Sent: Tuesday, March 02, 1999 5:44 PM
To: '[email protected]'
Subject: How do you create and use "common" type classes?
I'm relatively new to forte and I'd like to know how can you handle utility
type classes that you want to use through out your application? Ideally
what I want is a static class with static methods.
Let's say that I have a StringUtil class that has a bunch of methods for
manipulating strings.
My problem is that we have code that runs on the client and code that runs
on the server. Both areas could use the StringUtil class, but from what I
understand, I have to create StringUtil in a plan and then create a server
object of type StringUtil. The server object will eventually get assigned
to a partition. That's not good since I really want the server object to
physically reside at the server end and at the client end. (Actually, I
don't want a server object, I just want to invoke a static method of a
static class).
Any clues on how to solve this problem would be appreciated.
Also, what is the url at Sage-it that has a summary of all emails that have
been posted to [email protected]? Perhaps this question has been
answered previously.
Thanks in advance -
How long charactors can stored in 'STRING' type?
HI
I'm just curious how long charactors can stored in 'string' type.
and if there is limit number to store what kind of type is unlimited length type?
and is it possible send a parameter page to page with 'form' 'post' way unlimited length of string?
and is there any type of DB field which is save last number of records automatically when one record is inserted like MANDT?
MANDT is client number though.
Regards.Here is what ABAP key word documentation says about string
The elementary data type STRING is similar to data type C and refers to a variable-length string. Accordingly, the elementary data type XSTRING is similar to data type X and refers to a variable-length byte sequence.
In contrast to a C or X field, the length of a string is not static but variable and adjusts itself to the current field content at runtime. Dynamic memory management is used internally. Strings can have any length.
The initial value of a string is an empty string with length 0. A structure containing a string is seen as deep. A deep structure cannot be used like a C field. Strings can be displayed in the ABAP Debugger and used in the ABAP Dictionary.
It is not yet possible to use strings in screens or database tables. However, strings can be stored in database tables as clusters using EXPORT and transferred using IMPORT.
As far as I know the limit is 4 Giga Byte which equals more or less no limit. I donnot expect that you will meet this limit in practice. Its very likely that will run out of memory before you reach this limit.
In short there is no limit to the data stored in STRING var but the system memory has a limit....
This can be proved with the below program:
For the program system dumps with mess.
"Unable to fulfil request for 127683972 bytes of memory space. "
here's the test prog.:
TABLES ekko.
DATA testmax TYPE string.
DATA z(16) TYPE i.
SELECT * FROM ekko.
CONCATENATE testmax ekko INTO testmax.
z = strlen( testmax ).
IF z = 63841496.
BREAK-POINT.
ENDIF.
ENDSELECT. -
String type field in datasouce from db connect system
i have create a datasouce from db connect witch connect to a oracle database.
and there is a field with type string.
when i active transfer rule between infosouce and datasouce
it return a error:
more than 3 sting type in rule
so i hide some field with sting type.
active again,it return a error
filed must be a flat structure.
so i have to delete all string type field
so my question is
is there any way to transfer string type field to my BI system?when you create the view can use to_char to format date and time type field to sap types eg:YYYYMMDD
but i also dont know how to convert string to char -
How do you get a line with MULTIPLE fields to WRAP ?
How do you get a line with MULTIPLE fields to WRAP ?
Good afternoon everyone...
THE PROBLEM: Why doesn’t a line with multiple fields WRAP?
HYPOTHETICAL EXAMPLE/WHAT I”D LIKE TO SEE
If I have 2 fields on a line (this is now a hypothetical example and nothing to do with my actual report)….let’s call them field A and field B. And if field A has values of all ‘X’ and field B has values of all ‘Y’…then….the normal case would be (ignore dots – only for spacing):
A……………………… B
XXXXXXXXXXXXXXXXXX YYYYYYYYYYYYYYYYY
But what if A is too long? I would want to see B wrap onto the next line like this:
A……………………………………………………B
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX YYYYYY
YYYYYYYYYYYYY
And similarly….if B is extra long, can the line print as:
A………………………. B
XXXXXXXXXXXXXXXXXXX YYYYYYYYYYYYYYYYYYYYYYYYYYY
YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
I don’t want the case where B is long and I get:
A………………… …B…
XXXXXXXXXXXXXXXXX YYYYYYYYYYYYYYYYYYYYYY
………………………..YYYYYYYYYYYYYYYYYYYYY
I can see how you can wrap an individual field like that…but how can you WRAP a line of[b] fields within the frame so it wraps to the BEGINNING of the frame on next line?
My SPECIFIC CASE
I have a report that I have stripped down to a simple structure for the purposes of this explanation.
My DATA MODEL has the main QUERY (for plant family and species data). The columns of the query are divided into 2 groups. The 1st GROUP contains the family data. Below that is the rest of the species data in a 2nd GROUP.
Linking from the 2nd species group (above) is a new QUERY to extract REGION data based on the common key field. Under this 2nd query is another group with all the REGION columns.
The LAYOUT MODEL has a group frame (the main , base one)
On top of this is a repeating frame based on the 1st group (family data).
On top of this is another repeating frame for the 2nd group (species data).
On top of this is 2 Frames on the same line line. The 1st frame contains columns from the species group .
The 2nd frame on this line is a repeating frame. The PRINT DIRECTION for this frame is ACROSS/DOWN. It repeats details of the REGION where the species is found. These columns come from this group come from the REGION QUERY and GROUP.
All fields on the report line have variable horizontal elasticity.
The problem is that when there is too much data on the line, it does NOT WRAP to the 2nd line.. It TRUNCATES.
Can the line be made to WRAP????..
In my current report, 1 of 2 things is happening:
1) All fields print on the line until it hits the page boundary and then it just stops. Truncated!
2) All fields print on the current line, then Oracle Reports throws a new page to print the REMAINDER of the long, input line
But I would like a LONG line to continue printing onto the following line of the same page.
I have tried all combinations of the elasticity fields and the ‘ADVANCED LAYOUT’ properties.
I have been focussing my attention with this problem on the frames .
We are using REPORT BUILDER V 6.0.8.26.0
Thankyou to anyone who may offer assistance.
Tony Calabrese.Steve,
you gain 1 thing, but you lose something else!
This thing is SO frustrating!
Hey Steve! Good afternoon.
I've done as you suggested....I have a long text boilerplate item - the only 1 on the line...and it has all the column in it.
So it looks like:
&col1 &col2 &col3 &col4 &col5 etc etc etc
And the line expands nicely to each field's requirements.
And when it gets to the right page boundary...it WRAPS to the next line! Beautiful!!!
The only thing is that...when I had individual fields across the line I was able to create format triggers for those fields. And in doing so I was able to reduce the font and change the justification. I had to do that because some of the fields had to appear superscripted.
So I wanted something like (ignore the dots):
...................................ppppp
AAAA BBBB CCCCC DDDD EEEE FFFFFF
So the field of 'ppppp' appeared slightly higher on the line than the other fields...
I can't see how I can do this with a single TEXT field containing all the &COL values.
Have you ever come across anything like this?
Thankyou again,
Tony Calabrese 12/4/2007 -
How do you make tabbing skip a disabled field?
Hi, how do you make tabbing skip a disabled field?
I have a checkbox. If it's checked, one radio button in a radio button group is disabled. However, user can still tab into this disabled radio button. Once it's in there, it cannot tab out or use up & down arrow to move out of the disabled radio button. It just gets stuck there.
I tried setting access="protected". But it makes no difference.
Is there a way to exclude a disabled field from receiving a tab in LiveCycle Designer?
Thanks.You may create your JTextField with the text i.e.
JTextField myTextField = new JTextField("text");
or anywhere in your program
myTextField.setText("text"); -
How do u append asterisks to a price field?
how do u append asterisks to a price field?
move price_var to charvar.
concatenate '*' charvar into charvar.
now use it,.....
Regards
vasu -
How do you copy an entire string of a text message?
How do you copy and paste and tire string of a text message from the iPhone five?
Press and hold on a message, tap More > Select the messages you want > Tap the arrow > copy everything out of the new message that appears
-
How would YOU retype these old XM08 types for use in an ABAP OO method?
The XM08 function group has the following type declarations:
TYPES: BEGIN OF mmcr_drseg_co.
INCLUDE STRUCTURE cobl_mrm_d.
TYPES: cr LIKE drseg_cr OCCURS 0,
unpl_refwr TYPE refwr,
END OF mmcr_drseg_co.
TYPES: mmcr_tdrseg TYPE mmcr_drseg OCCURS 0,
TYPES: BEGIN OF mmcr_drseg.
INCLUDE STRUCTURE drseg.
TYPES: cr LIKE drseg_cr OCCURS 0,
co TYPE mmcr_drseg_co OCCURS 0,
sm LIKE drseg_sm OCCURS 0,
charact TYPE rbcharact_instance OCCURS 3,
"instances of characteristics
uebgmat TYPE matnr,
uebrblgp TYPE rblgp,
selkz_db TYPE selkz,
rblgp_old TYPE rblgp, "rblgp before aggregation
END OF mmcr_drseg.
How would YOU redeclare these types so that they work in an ABAP Objects class?
Some of the "fixes" are easy, like replacing "LIKE" with "TYPE:".
But what about the "INCLUDE STRUCTURE" and the "occurs 0" specifications?
The reason I'm asking this is that I have to call a method from ZXM08U16 and I'd like to be able to pass this method exactly what XXM08U16 gets from SAP, i.e. the table E_TDRSEG of type MMCR_TDRSEGDavid,
I wonder it can be directly in ABAP (I would like to hear opinions from others as well!), I needed to use Data Dictionary as well:
TYPES: BEGIN OF mmcr_drseg_co.
INCLUDE STRUCTURE cobl_mrm_d.
TYPES: cr TYPE z_tt_drseg_cr,
unpl_refwr TYPE refwr,
END OF mmcr_drseg_co.
z_tt_drseg_cr is a table type created in SE11, based on structure drseg_cr.
the way to create internal table and work area, based on the above:
DATA : gt_... TYPE TABLE OF mmcr_drseg_co.
DATA : gw_... TYPE mmcr_drseg_co.
hope this helps some
ec
UPDATE : Rich is right, it is possible to do it only in ABAP with the DEFAULT KEY addition. -
How do you iterate through a string?
Hi! How do I loop through a string of characters. My program needs to iterate through a string in order to do some calculations. Here is an example:
<item>1</item>
<description>This is an example.</description>
How I iterate through description one character at a time.
Thanks for your help!<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
<xsl:template name="add-X">
<xsl:param name="string" select="." />
<xsl:if test="$string">
<xsl:text>X</xsl:text>
<xsl:value-of select="substring($string, 1,1)"/>
<xsl:call-template name="add-X">
<xsl:with-param name="string"
select="substring($string, 2)" />
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Create an file named TEST.xsl with the above code.
<aaaa>ABCDE</aaaa>
Create an file named TEST.XML with the above code.
Create an RTF template with form field valus as
<?import: file:///C:\Desktop\Sample RTF\TEST.xsl?>
Note : here you have to point the xsl path where your TEST.xsl is located.
Then create another form field with value
<xsl:call-template name="add-X"> <xsl:value-of select="." /> </xsl:call-template>
When you merge the xml and RTF , you will find the no of "X" equivalent to length of the string in <aaaa> tag in xml -
How do you enlarge the menu bar type on Macbook pro?
How do you enlarge the type in the menu bar on the macbookpro
Norman Jackson wrote:
Couple comments concerning this:
You cannot make it larger.
On My MacBook Pro it has a high resolution screen. 1152 x 720 resolution is not listed. if you think your type in the menu bar is small, you should see mine!
I personally would never recommend anyone orders on with Hi-Res.
No matter what resolution I use other than 1680 x 1050 ( max listed for my Notebook) the sharpness is not acceptable to me.
Wrote to apple concerning the menu display along with numerous others and have been totally ignored.
Norm
Hi Norm,
1. I've been researching, and, with a few exceptions which are not acceptable to me, I believe you are correct.
4. I really have no choice, I have to reduce the res to see text.
5. Apple does not reply to feedback, so don't feel ignored. I've also sent feedback and emailed Jobs, and maybe, someday, after enough of us do that, this will get "fixed." Meanwhile, I'm also often at 1152x720. -
Modifying the search form so it appends the '%' to String input fields
Hi guys,
How can I modify the search form to search for '%'sometext'%' instead of just sometext for input fields that take string type as input; not programmatically!Hi,
you would have to do this one way or the other. Either in the managed bean (which then passes the search input to the underlying model) or in the business services (ADF BC for example)
Frank -
How to Add Values in INVOICE SUB-TYPE field at the Invoice Header Forms
Hello,
Does any body knows how could I add/modify values in the INVOICE SUB-TYPE field at the Invoice Header Forms?. This values are related to the Globalization, in this case for the Chilean Localizations.
Thanks,
Alejandro R.It gives any error or just does nothing?
Have you tried making another simple form with just one block and one or two items?
You can do this type of testing in these conditions.
Which version of forms are you using? -
Autodetect text form fields-How do you get it to find all field areas?
I have 50 pages, all identical. I created in InDesign and its simply just a chart that is about 50 lines with 4 columns. It was created as a table also and very clean. I want each of those cells to be converted to text form fields in Acrobat. When I run the auto detect, it finds every one except the column on the far right and one of the cells on the very bottom with all 50 pages. I really need this to autodetect these or else I will have to do all those missing ones manually and that is a TON I will have to do and give unique names also which I really dont want to do! I have attached a screenshot of the form as is and another showing all the detected fields.
I don't think that there is a way to do, I think your only option is to add manually. If that column is the same size as last one on the right that it detected then you can copy>paste. But beware you may have to rename the field and double check your tabbing order when doing so.
If all your 50 pages have the exact same fields then get your 1st page setup. Then create page 2 and open your pdf with the correct fields, go to Document>Replaces Pages, and select page 2, so the same for all pages and then combine all pages into 1 pdf when finished (seems like a lot of steps but in my opinion faster then doing 50+ pages and however many fields). As long as your 1st page is the exact same field setup as all the rest this should prevent you from having to redo all 50 pages. -
How do you Append XML to an existing document?
Hi there, I need to to append an existing XML document to a new XML document. How is this done?
Is there an easy way of attaching one XML document to another?
If not, do I need to parse the existing XML and add it to the new document, element by element?
My existing XML is received as an input string and I need to include it in the new document.
Thanks in advance
MichaelHi there, I need to to append an existing XML document
to a new XML document. How is this done?
you can use JAXB to do this. unmarshall(), validate() and marshall() belonging to java intepretion of xml document.
To eloborate further, say u have xml document as
<book>
<author>...</author>
</book>
JAXB helps u to get java intepretion of xml document by converting it into Book class and Author class.
And, say u want to add new authors, u need to add Author objects to Book object and then pass Book object to marshall() method.
The xml document will be appended with the author u added.
Hope this helps.
Jatin
Maybe you are looking for
-
Hi, Can any one tell me What is the Busines Object for MIGO and How to find the Business object for a transaction ? answers will be rewarded. Thanks,
-
JMS Content Conversion - no CR/LF
has anyone been able to successfully use content conversion when there are not carriage returns/line feeds between the headers & lines? We are receive MQ messages that are continuous streams of data containing the header data and all the lines. The
-
Error: Object "MFModule" of type ApplicationModule is not found !!
Hi all ,,, Am facing a problem in my "MFApplication" that I developed using oracle jdeveloper 11g R2 all the screens is developed as a page fragments task flows and they are shown in an oracle dynamic shell tabs starting page All the task flows are t
-
Solaris custom environment variables in crontab
Hi everyone, I am searching a way to use custom variable on my crontab. In fact, I need to launch a binary file which will use the "swap" command, but the swap command is not in the PATH of the crontab. I know that on Linux it's possible to define di
-
Some swf's in page do not play on server
On page http://buddyroberts.com/Progressmeter/index.html there are 29 swf's but only 19 play when uploaded to Internet. All 29 play in Dreamweaver CC. If you look at source code you can see all. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transition