Data Type syntax colour
Why can't Flex hilight data types?
Like in:
var foo:String = "bar";
String won't colorize.
Is this possible to set somewhere (not in the syntax color preferences)?
checking with different options, found that the issue was related to "ORA-01727: numeric precision specifier is out of range (1 to 38)".
We change the Column numeric length to 8 and this solved the problem.
Thanks for your suggestions.
Similar Messages
-
Hi All,
I want to store some floating (decimal points) values in Active directory on which I can perform search filter. is there any datatype syntax which will provide support to store this values?
If know how I can achieve this functionality?Hello,
adding custom attributes
http://social.technet.microsoft.com/wiki/contents/articles/20319.how-to-create-a-custom-attribute-in-active-directory.aspx
http://blogs.technet.com/b/isingh/archive/2007/02/18/adding-custom-attributes-in-active-directory.aspx
http://social.technet.microsoft.com/Forums/windowsserver/en-US/195bfce4-619b-4ad0-8043-36378733bc46/add-a-custome-attribute-in-windows-2008-r2-active-directory?forum=winserverDS
Keep in mind that this steps should be tested in a lab BEFORE doing this on production domains and if you start modifying the schema you may crash the entire forest if something went wrong.
Best regards
Meinolf Weber
MVP, MCP, MCTS
Microsoft MVP - Directory Services
My Blog: http://blogs.msmvps.com/MWeber
Disclaimer: This posting is provided AS IS with no warranties or guarantees and confers no rights.
Twitter: -
Data type of Crystal syntax formula
Post Author: gpeters
CA Forum: General
How do you control the data type a Crystal formula returns? I'm relatively new to Crystal. I'm developing a formula, and initially I'm having it return Boolean values. However, my intent is to have it eventually return a string value. Now, it seems that no matter what I do, this formula is determined to only return a Boolean value. Should I have used Basic syntex instead? Very frustrating to be fighting syntax stuff.Post Author: CoolTowers
CA Forum: General
Generally strings are used with text such as address blocks, names, etc. Crystal interprets anything in quote marks as a string; then you just add them together.
You can try the ToText function to convert other data types to a string data. For example:
"Thanks for purchasing" + ToText({lastyear.sales}) + "in parts last year".
Look under the Function Tree box under Strings, then ToText for ways to use the function. -
ABAP in SapScript : syntax, data types, ... ?
Hello,
Can someone tell me what are the biggest differences between regular ABAP and ABAP in SapScript? Like syntax rules, possible data types, and so on.
Thanks!Ok, thanks for the answers.
Just one more question
Is it then also possible to create a SmartForm form (or Adobe Form) from within SapScript? I am looking for a workaround solution for correspondence in Training and Event Management. Only SapScript forms are possible, but if it is possible to create other forms with ABAP code in the SapScript, it could work, I think? -
Return data type in Crystal syntax formula
Post Author: gpeters
CA Forum: Formula
How do you control the data type a Crystal formula returns? I'm relatively new to Crystal. I'm developing a formula, and initially I'm having it return Boolean values. However, my intent is to have it eventually return a string value. Now, it seems that no matter what I do, this formula is determined to only return a Boolean value. Should I have used Basic syntex instead? Very frustrating to be fighting syntax stuff.Post Author: SKodidine
CA Forum: Formula
If you could copy your formula here then it would paint a better picture to help you out. In general, you can change the data type to string (totext) and also to number (tonumber) in a formula. It all depends on what you are trying to accomplish. -
How do I Change the plot waveform colour on a Dynamic Data type Graph?
I have multiple different plots on different graphs, and I want to set the colours of the different waveforms.
In order to display the waveforms on different graphs, I switched to Dynamic data type and then split the wire
according to how many channels I have.
I can set the graph background colour with a property node, and create cursors of different colours no problem
using the array of references that I have created, so there is nothing wrong with my array of references or the property node.
As soon as I try and wire a colour box into the Plot>Plot Colour control, I get error 1055 out of the property node.
I was wondering if it was an error between the keyboard and the chair, but now I am thinking it is someting more sinister.
The Error box pops up and can't be dismissed remaining the focus until I run TASKKILL on LabVIEW and terminate it.
Any ideas on how to achieve my goal would be appreciated.
(LabVIEW 8.6)
Solved!
Go to Solution.Hi Sheela,
It's 1 plot per graph, up to 4 graphs displayed on different tabs.
Here are some screenshots
Attachments:
graph_display.JPG 135 KB
set_Plot_colour.JPG 79 KB -
Problem with pl/sql table data type
hai friends,
i have one procedure it has some in parameters and one out parameter which fetches values to front end.
But the out parameter will be pl/sql table data type.
if it is ref cursor
then i declared as
var x refcursor;
exec procedure_name(1,:x);
it is ok.
but for pl/sql table data type is out parameter then what i will do in the prompt .
give me syntax and clarify my doubt.
advanced thanks...
madhavaThe SQL*Plus VARIABLE statement does not support user-defined types, hence it cannot support nested tables. It can support cursors because they can be weakly typed (so we can use the one SQL*Plus VAR to hold any shape of resultset). Nested tables are strongly typed; SQL*Plus is a relatively stupid interface and cannot be expected to understand UDT.
So, it you want to use nested tables as output you'll need to code a wrapping procedure that can understand your nested table type and handle it accordingly.
Sorry.
Cheers, APC -
Hi everyone,
With the next release (to go out on Monday) we're adding proper date format support in liquid for all modules. Besides all the improvements and additions made available with this release, one important note, which requires you to do some updates after the release, is that we're breaking backwards compatibility for liquid date tags by outputting the dates in ISO 8601 format ("yyyy-MM-ddTHH:mm:ss") instead of current format(“yyyy-MM-dd”).
Here is a brief overview of the changes:
All module fields which represent date or date times are now passed to Liquid as date time objects (previously they were passed as strings). This brings the following benefits:
Comparison between date time objects works correctly
It is possible to compute the difference between two date time objects using the minus filter. Example: {% assign dateDiff = Globals.Site.DateNow| minus: myDate %}
We added the means for obtaining the current date time: Globals.site.dateNow. The returned date is in the site’s time zone.
By default, when no filter is applied, all date variables will be output in the following ISO 8601 format: “yyyy-MM-ddTHH:mm:ss”. For example {{ myDate }} would output something similar to: “2014-12-12T07:19:49”. (Note: this is a backwards compatibility breaking change, as previously we outputted dates using the following format: “yyyy-MM-dd”. The breaking change only affects Liquid tags). Following the release, you should update your sites using the provided date filters to format the dates as you need.
The output of date time variables can be formatted using the following filters:
date (with no parameters)– displays a nice to read string representing just the date part from the date time variable. The date is formatted in the site’s culture. This compatible with the way older BC tags display dates. For example {{ myDate | date }}, in the English US culture will output a string similar to: “12-Dec-2014”.
datetime (new filter) – displays a nice to read string of the date time variable using the site’s culture. This compatible with the way older BC tags display date time. For example {{ myDate | datetime }}, in the English US culture will output a string similar to: “12-Dec-2014”.
date “format” (existing filter, nothing updated, mentioned here just for consistency) – displays the date in the site’s culture using a format specified by the format variable. The list with the available formats is available here: http://msdn.microsoft.com/en-us/library/8kb3ddd4%28v=vs.110%29.aspx. Note that the date filter can also be used to format objects that result as a difference between two date time objects, however, in this case the format string will respect a different set of rules as defined here: http://msdn.microsoft.com/en-us/library/ee372287%28v=vs.110%29.aspx. The following example demonstrates how to display just the number of days in the difference between two dates: {{ Globals.Site.DateNow| minus: myDate| date: "%d" }}
We added the Convert filter which can be used for converting variables to a certain type. The syntax is: variable | convert: “type”. Below are the values supported by the type parameter:
“date” – converts a variable to a date time instance. We only support the following formats for strings that are converted to date time: “yyyy-MM-ddTHH:mm:ss” and “yyyy-MM-dd”.
“number” – converts a variable to a number instance. If converting from string, only period “.” is supported as a decimal separator. This filter will probably be most useful when trying to convert GET query parameters: {% assign pageNumber = Globals.get.pageNumber | convert: “number” %}. The previous example assumes that URL that loaded the page contains a parameter named pageNumber. The convert numeric filter is an alternative to the rather hack-ish approach of converting to numbers using mathematical operators: {% assign myNumber = variable | plus: 0 }. Please note that it is not recommended to use the convert numeric filter just to assign numeric constants. For example, this approach is not recommended: {% assign myNumber = “3.14” | convert: “number” %}. Use the following approach instead: {% assign myNumber = 3.14 %} (note the lack of quotes around 3.14 in the second example).
“boolean” – converts a variable to a boolean instance. Please note, that just as it is the case with numerics, it is not recommended to use the “boolean” filter for declaring a boolean constant. For example this is not recommended: {% assign myBool = “false” | convert: “boolean” %}. Use the following syntax instead: {% assign myBool = false %}
“string” – converts a variable to its string representation.
We added implicit casting to the most relevant type in comparisons and inside filters representing mathematical operations (plus, minus, times, divide, modulo). With implicit casting, if one of the two operands is of type string and the other is of a different type (for example numeric or date time), we will attempt to convert the string operand to the type of the other. The conversion will fail if the string is not in an appropriate format for the type it is converted to (same rules as in the Convert filter are applied). In comparisons, if the implicit casting fails, the comparison is made with both operands converted to strings. Additional notes:
Implicit casting allows using date time literals directly in comparisons if the other operand is of date time type. For example, this will work correctly since "2015-01"15" will automatically be converted to date time before making the comparison: {% if myDate > "2015-01-15" %}Some message{% endif %}
Date parts obtained using the date filter can be used directly in comparisons with numerics. For example:
{% assign daysDiff = Globals.Site.DateNow| minus: myDate| date: "%d" %}
{% if daysDiff < 10 %}
A message
{% endif %}
With the implementation of implicit casting we also fixed some rather funny bugs related to comparisons and mathematical operations. For example, previously, 5 < 5.5 was evaluated as false, but 5.5 > 5 was evaluated as true. Also the result of 5| plus: 5.5 was 10, but the result of 5.5| plus: 5 was 10.5 (now 10.5 is the result of both operations, as expected).
As a potential caveat, note that implicit casting will bring the operands to the relevant type only if one of them is actually of that type. If both operands are of type string, the comparison is made as of between strings. This means that following condition is evaluated as false {% if "3" < "15" %}, because as a string "15" is smaller than "3".
Implicit casting from string to numeric only works if the string represents just a numeric. If the string contains additional characters, like a currency symbol, the conversion will fail. For example, this will not work correctly {% "$15" < 20 %}. Our goal, in the next releases, is to update all modules containing price related tags to have them in plain numeric format.
We added the following filters for easily formatting numeric values representing prices.
number - displays numbers with a fixed number of two decimals using the decimal separator appropriate to the site's culture. For example, in the English US culture, {{ 99| number }} will display 99.00
currency - displays numbers in the same way as number but also inserts the currency symbol at the beginning of the returned value. The currency symbol respects the site's culture. For example, in the English US culture, {{ 99| currency }} will display $99.00
In the next release or releases, we're going to focus on fixing the remaining data types for modules.
CristinelLiam, the server date isn't helpful for converting timezones. We would need a direct date filter. With a filter for UTC and one for the user we should be able to do quite a bit from there.
The most powerful things that could be implemented for date time are the following:
• moment.js and Moment Timezone built into the filters.
• the ability to add time info into date time fields
But I know that's a tall order. -
Unicode Migration using National Characterset data types - Best Practice ?
I know that Oracle discourages the use of the national characterset and national characterset data types(NCHAR, NVARCHAR) but that is the route my company has decide to take and I would like to know what is the best practice regarding this specifically in relation to stored procedures.
The database schema is being converted by changing all CHAR, VARCHAR and CLOB data types to NCHAR, NVARCHAR and NCLOB data types respectively and I would appreciate any suggestions regarding the changes that need to be made to stored procedures and if there are any hard and fast rules that need to be followed.
Specific questions that I have are :
1. Do CHAR and VARCHAR parameters need to be changed to NCHAR and NVARCHAR types ?
2. Do CHAR and VARCHAR variables need to be changed to NCHAR and NVARCHAR types ?
3. Do string literals need to be prefixed with 'N' in all cases ? e.g.
in variable assignments - v_module_name := N'ABCD'
in variable comparisons - IF v_sp_access_mode = N'DL'
in calls to other procedures passing string parameters - proc_xyz(v_module_name, N'String Parameter')
in database column comparisons - WHERE COLUMN_XYZ = N'ABCD'
If anybody has been through a similar exercise, please share your experience and point out any additional changes that may be required in other areas.
Database details are as follows and the application is written in COBOL and this is also being changed to be Unicode compliant:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
NLS_CHARACTERSET = WE8MSWIN1252
NLS_NCHAR_CHARACTERSET = AL16UTF16##1. while doing a test convertion I discovered that VARCHAR paramaters need to be changed to NVARCHAR2 and not VARCHAR2, same for VARCHAR variables.
VARCHAR columns/parameters/variables should not by used as Oracle reserves the right to change their semantics in the future. You should use VARCHAR2/NVARCHAR2.
##3. Not sure I understand, are you saying that unicode columns(NVARCHAR2, NCHAR) in the database will only be able to store character strings made up from WE8MSWIN1252 characters ?
No, I meant literals. You cannot include non-WE8MSWIN1252 characters into a literal. Actually, you can include them under certain conditions but they will be transformed to an escaped form. See also the UNISTR function.
## Reason given for going down this route is that our application works with SQL Server and Oracle and this was the best option
## to keep the code/schemas consistent between the two databases
First, you have to keep two sets of scripts anyway because syntax of DDL is different between SQL Server and Oracle. There is therefore little benefit of just keeping the data type names the same while so many things need to be different. If I designed your system, I would use a DB-agnostic object repository and a script generator to produce either SQL Server or Oracle scripts with the appropriate data types or at least I would use some placeholder syntax to replace placeholders with appropriate data types per target system in the application installer.
## I don't know if it is possible to create a database in SQL Server with a Unicode characterset/collation like you can in Oracle, that would have been the better option.
I am not an SQL Server expert but I think VARCHAR data types are restricted to Windows ANSI code pages and those do not include Unicode.
-- Sergiusz -
Unicode - "DMBTR" must be a character-type field (data type C,N,D or T)
Greetings Experts!
I am trying to convert legacy code to Unicode for a current ERP6.0 reinstallation and have encountered the syntax error "DMBTR" must be a character-type field (data type C,N,D or T)
The field is part of a structure and the fields attributes are as follows:
COMPONENT = DMBTR
COMPONENT TYPE = DMBTR
DATA TYPE = CURR
LENGTH = 13
DECIMALS = 2
DESCRIPTION = Amount in Local Currency
The code in question is as follows:-
macro Move_Zoned.
Converts a numeric variable to zoned format and moves it to a
target variable.
DEFINE move_zoned.
&1 - source variable
&2 - Number of Decimal Places
&3 - 'To'
&4 - Target Variable.
write &1 to w_zoned no-grouping decimals &2.
condense w_zoned.
Remove the Decimal Points.
search w_zoned for '...'.
while sy-subrc = 0.
move sy-fdpos to w_to_point.
if w_to_point = 0.
w_to_point = 1.
endif.
compute w_from_point = sy-fdpos + 1.
concatenate w_zoned+0(w_to_point)
w_zoned+w_from_point
into w_zoned.
search w_zoned for '...'.
endwhile.
shift w_zoned right deleting trailing space.
translate w_zoned using ' 0'.
call function 'Z_TRANSLATE_ZONED_DECIMALS'
exporting
i_input = w_zoned
importing
i_output = w_zoned
exceptions
x_invalid_zoned_char = c_invalid_zoned_char
x_numeric_info_lost = c_numeric_info_lost
others = c_other_zoned_error.
Get the length of the recipient field so we don't truncate the
numbers....
describe field &4 length w_flength in character mode.
describe field &4 type w_type.
describe field w_zoned length w_zoned_len in character mode.
if w_zoned_len <= w_flength.
move w_zoned to &4.
shift &4 right deleting trailing space.
translate &4 using ' 0'.
else.
Get the start position....
If it's a packed field allow for values up to 6 figures
compute w_zoned_len = w_zoned_len - w_flength.
if w_type = 'P'.
subtract 2 from w_zoned_len.
clear w_type.
endif.
move w_zoned+w_zoned_len &3 &4.
endif.
END-OF-DEFINITION. "Move_zoned
LOOP AT t_single_kunnr.
move_zoned t_single_kunnr-postamt 2
to t_single_kunnr-dmbtr.
DIVIDE t_single_kunnr-dmbtr BY 100.
MODIFY t_single_kunnr.
ENDLOOP.
Is there a solution to get past this syntax error as I would rather not change the datatype of the field in the structure.
Much Obliged
Elphick.Type X is not allowed in Unicode. When a field is declared as Type X with Value u201809u2019 or any other value, it can be resolved by using classes.
Before Unicode
CONSTANTS: c_hex TYPE x VALUE '09'.
Resolution:
Itu2019s work for any value of x.
First a temporary field of Type c should declare. Following class will convert Type x variable into type c.
Example:
CONSTANTS: c_hex TYPE x VALUE '09'.
DATA: LV_TEMP TYPE STRING.
DATA: LV_TMP TYPE C.
TRY.
CALL METHOD CL_ABAP_CONV_IN_CE=>UCCP
EXPORTING
UCCP = c_hex
RECEIVING
CHAR = LV_TMP .
CATCH CX_SY_CONVERSION_CODEPAGE.
CATCH CX_PARAMETER_INVALID_TYPE.
CATCH CX_SY_CODEPAGE_CONVERTER_INIT.
ENDTRY.
CONCATENATE I_OUTPUT-BKTXT I_OUTPUT-BVORG
I_OUTPUT-BUDAT I_OUTPUT-MESSAGE INTO
SEPARATED BY LV_TMP.
I_BUFFER = LV_TEMP.
CLEAR LV_TEMP.
CLEAR LV_TMP.
OR
Note: It works only for type x value 09.
CLASS cl_abap_char_utilities DEFINITION LOAD.
CONSTANTS: c_hex TYPE c VALUE
abap_char_utilities=>HORIZONTAL_TAB. -
Passing Session variable of DATE data type to opaque view filter
Hi Everyone,
Can you guys please help me in passing session variable of DATE data type in RPD's physical layer 'opaque view' filter for Oracle database
I tried following syntax, syntax wise I didn't got getting any error, but at the same time this opaque view is not fetching any records as well. my session variable is "END_DATE" and its value is 1998/12/31:00:00:00(as shown in RPD session windows, datatype is DATETIME)
SELECT AMOUNT_SOLD, CHANNEL_ID, CUST_ID, PROD_ID, PROMO_ID, QUANTITY_SOLD, TIME_ID FROM SH.SALES
WHERE TIME_ID =TO_DATE( 'VALUEOF(NQ_SESSION.END_DATE)','MM/DD/YYYY')
SELECT AMOUNT_SOLD, CHANNEL_ID, CUST_ID, PROD_ID, PROMO_ID, QUANTITY_SOLD, TIME_ID FROM SH.SALES
WHERE TIME_ID = TO_DATE( 'VALUEOF(NQ_SESSION."END_DATE")','MM/DD/YYYY')
SELECT AMOUNT_SOLD, CHANNEL_ID, CUST_ID, PROD_ID, PROMO_ID, QUANTITY_SOLD, TIME_ID FROM SH.SALES
WHERE TRUNC(TIME_ID) = TO_DATE( 'VALUEOF(NQ_SESSION."END_DATE")','MM/DD/YYYY')
In past, I was able to pass a session variable into a opaque view filter using DATEOF function, but that was in DB2.
I appreciate your time and helpFinally, I got right format. here it is
to_date(substr('valueof(NQ_SESSION.END_DATE)',1,10), 'yyyy-mm-dd')
and here is the source from where I got this information
Using OBIEE Session Variables in Select Tables in the Physical Layer -
Error when insert data in Sql Server table(DateTime data type)
Hello all,
I have created a database link in oracle 11g to SQL Server 2008 using Sqlserver gateway for oracle,Oracle run on Linux and SQL Server run on Windows platform.
I have queried a table and it fetches rows from the target table.
I am using this syntax for insert a row in Sql Server table.
Insert into Prod@sqlserver (NUMITEMCODE, NUMPREOPENSTOCK, NUMQNTY, NUMNEWOPENSTOCK, DATPRODDATE , TXTCOMPANYCODE, "bolstatus", NUMRESQNTY )
Values (1118 , 1390.0 , 100.0 ,1490 , '2012-06-23 12:37:58.000','SFP' ,0 , 0 );
but it give me error on DATPRODDATE,The data type of DATPRODDATE column in Sql Server is DATETIME.
My Question is how can i pass the date values in INSERT statement for Sql Server DateTime data type.
RegardsJust as with Oracle, you have to specify the date using the to_date() function or use the native date format for the target database (if you can figure out what that is). This is good practice anyway and a good habit to get into.
-
Issue with Oracle LONG RAW data type
Hi All,
I am facing some issues with Oracle LONG RAW DATA Type.
We are using Oracle 9IR2 Database.
I got a table having LONG RAW column and I need to transfer the same into another table having LONG RAW column.
When I tried using INSERT INTO SELECT * command (or) CREATE TABLE as select * , it is throwing ORA-00997: illegal use of LONG datatype.
I have gone through some docs and found we should not use LONG RAW using these operations.
So I did some basic PLSQL block given below and I was able to insert most of the records. But records where the LONG RAW file is like 7O kb, the inserting is faliling.
I tried to convert LONG RAW to BLOB and again for the record where the LONG RAW is big in size I am getting (ORA-06502: PL/SQL: numeric or value error) error.
Appreciate if anyone can help me out here.
DECLARE
Y LONG RAW;
BEGIN
FOR REC IN (SELECT * FROM TRU_INT.TERRITORY WHERE TERRITORYSEQ=488480 ORDER BY TERRITORYSEQ ) LOOP
INSERT INTO TRU_CMP.TERRITORY
BUSINESSUNITSEQ, COMPELEMENTLIFETIMEID, COMPONENTIMAGE, DESCRIPTION, ENDPERIOD, GENERATION, NAME, STARTPERIOD, TERRITORYSEQ
VALUES
REC.BUSINESSUNITSEQ, REC.COMPELEMENTLIFETIMEID, REC.COMPONENTIMAGE, REC.DESCRIPTION, REC.ENDPERIOD, REC.GENERATION, REC.NAME,
REC.STARTPERIOD, REC.TERRITORYSEQ
END LOOP;
END;
/Maddy wrote:
Hi All,
I am facing some issues with Oracle LONG RAW DATA Type.
We are using Oracle 9IR2 Database.
I got a table having LONG RAW column and I need to transfer the same into another table having LONG RAW column.
When I tried using INSERT INTO SELECT * command (or) CREATE TABLE as select * , it is throwing ORA-00997: illegal use of LONG datatype.
I have gone through some docs and found we should not use LONG RAW using these operations.
So I did some basic PLSQL block given below and I was able to insert most of the records. But records where the LONG RAW file is like 7O kb, the inserting is faliling.
I tried to convert LONG RAW to BLOB and again for the record where the LONG RAW is big in size I am getting (ORA-06502: PL/SQL: numeric or value error) error.
Appreciate if anyone can help me out here.
DECLARE
Y LONG RAW;
BEGIN
FOR REC IN (SELECT * FROM TRU_INT.TERRITORY WHERE TERRITORYSEQ=488480 ORDER BY TERRITORYSEQ ) LOOP
INSERT INTO TRU_CMP.TERRITORY
BUSINESSUNITSEQ, COMPELEMENTLIFETIMEID, COMPONENTIMAGE, DESCRIPTION, ENDPERIOD, GENERATION, NAME, STARTPERIOD, TERRITORYSEQ
VALUES
REC.BUSINESSUNITSEQ, REC.COMPELEMENTLIFETIMEID, REC.COMPONENTIMAGE, REC.DESCRIPTION, REC.ENDPERIOD, REC.GENERATION, REC.NAME,
REC.STARTPERIOD, REC.TERRITORYSEQ
END LOOP;
END;
/below might work
12:06:23 SQL> help copy
COPY
Copies data from a query to a table in the same or another
database. COPY supports CHAR, DATE, LONG, NUMBER and VARCHAR2.
COPY {FROM database | TO database | FROM database TO database}
{APPEND|CREATE|INSERT|REPLACE} destination_table
[(column, column, column, ...)] USING query
where database has the following syntax:
username[/password]@connect_identifier -
The difference between FIELD-SYMBOL and normal DATA TYPE
Dear experts,
Please see the example below, both are output the same result.
DATA: EXTERNAL_RECORD(4000),
POSITION TYPE I,
LENGTH TYPE N,
ENTRY TYPE STRING.
EXTERNAL_RECORD = '0005Smith0007Edwards0005Young'.
DO.
LENGTH = EXTERNAL_RECORD+POSITION(4).
IF LENGTH = 0.
EXIT.
ENDIF.
ADD 4 TO POSITION.
MOVE EXTERNAL_RECORD+POSITION(LENGTH) TO ENTRY.
WRITE ENTRY.
ADD LENGTH TO POSITION.
IF POSITION >= 4000.
EXIT.
ENDIF.
ENDDO.
--OR It can be written as--
DATA: EXTERNAL_RECORD(4000),
POSITION TYPE I,
LENGTH TYPE N.
FIELD-SYMBOLS <ENTRY>.
EXTERNAL_RECORD = '0005Smith0007Edwards0005Young'.
DO.
LENGTH = EXTERNAL_RECORD+POSITION(4).
IF LENGTH = 0.
EXIT.
ENDIF.
ADD 4 TO POSITION.
ASSIGN EXTERNAL_RECORD+POSITION(LENGTH) TO <ENTRY>.
WRITE <ENTRY>.
ADD LENGTH TO POSITION.
IF POSITION >= 4000.
EXIT.
ENDIF.
ENDDO.
Is there any special circumstances we need to use FIELD-SYMBOL?
Why is FIELD-SYMBOL is introduce in the first place?
Kindly advice with example.
Thanks in advance for those who can help me on this.HI,
You can use field symbols to make the program more dynamic. In this example the name of a table control is substituted by a field symbol. Thus you cal call the form with any internal table, using the name of the table control as a parameter.
Example
form insert_row
using p_tc_name.
field-symbols <tc> type cxtab_control. "Table control
assign (p_tc_name) to <tc>.
insert 100 lines in table control
<tc>-lines = 100.
Field symbols allow you to:
** Assign an alias to a data object(for example, a shortened
name for data objects structured through several hierarchies
- <fs>-f instead of rec1-rec2-rec3-f)
** Set the offset and length for a string variably at runtime
** Set a pointer to a data object that you determine at runtime (dynamic ASSIGN)
** Adopt or change the type of a field dynamically at runtime
** Access components of a structure
** (from Release 4.5A) Point to lines of an internal table
(process internal tables without a separate work area)
Field symbols in ABAP are similar to pointers in other programming
languages. However, pointers (as used in PASCAL or C) differ from ABAP
field symbols in their reference syntax.
The statement ASSIGN f to <fs> assigns the field f to field
symbol <fs>. The field symbol <fs> then "points" to the
contents of field f at runtime. This means that all changes to the
contents of f are visible in <fs> and vice versa. You declare
the field symbol <fs> using the statement FIELD-SYMBOLS: <fs>.
Reference syntax
Programming languages such as PASCAL and C use a dereferencing symbol
to indicate the difference between a reference and the object to which
it refers; so PASCAL would use p^ for a pointer instead of p, C would
use *p instead of p. ABAP does not have any such dereferencing symbol.
** In PASCAL or C, if you assign a pointer p1 to a pointer p2,
you force p1 to point to the object to which p2 refers (reference semantics).
** In ABAP, if you assign a field symbol <fs1> to a field
symbol <fs2>, <fs1> takes the value of the data object to
which <fs2> refers (value semantics).
** Field symbols in ABAP are always dereferenced, that is,
they always access the referenced data object. If you want to
change the reference yourself in ABAP, you can use the ASSIGN statement
to assign field symbol <fs1> to field symbol <fs2>.
Using field symbols
You declare field symbols using the FIELD-SYMBOLS statement.
They may be declared either with or without a specific type.
At runtime you assign a field to the field symbol using the ASSIGN
statement. All of the operations on the field symbol act on the field
assigned to it.
When you assign a field to an untyped field symbol, the field symbol
adopts the type of the field. If, on the other hand, you want to assign
a field to a typed field symbol, the type of the field and that of the
field symbol must be compatible.
A field symbol can point to any data object and from Release 4.5A,
they can also point to lines of internal tables.
The brackets (<>) are part of the syntax.
Use the expression <fs> IS ASSIGNED to find out whether the field
symbol <fs> is assigned to a field.
The statement UNASSIGN <fs> sets the field symbol <fs> so
that it points to nothing. The logical expression <fs>
IS ASSIGNED is then false. The corresponding negative expression
is IF NOT <fs> IS ASSIGNED.
An unassigned field symbol <fs> behaves as a constant with
type C(1) and initial value SPACE.
MOVE <fs>
TO dest Transfers the initial value SPACE to the variable dest
MOVE 'A' to <fs>
Not possible, since <fs> is a constant
(runtime error).
To lift a type restriction, use the CASTING addition in the
ASSIGN statement. The data object is then interpreted as though
it had the data type of the field symbol. You can also do this
with untyped field symbols using the CASTING TYPE <type> addition.
The danger with pointers is that they may point to invalid areas.
This danger is not so acute in ABAP, because the language does not
use address arithmetic (for example, in other languages, pointer p
might point to address 1024. After the statement p = p + 10, it would
point to the address 1034). However, the danger does still exist, and
memory protection violations lead to runtime errors.
A pointer in ABAP may not point beyond a segment boundary. ABAP does
not have one large address space, but rather a set of segments.
Each of the following has its own segment:
* All global data
* All local data
* Each table work area (TABLES)
* Each COMMON PART
You should only let field symbols move within an elementary field or
structure where ABAP allows you to assign both within the global data
and beyond a field boundary.
Rgds
Umakanth -
What's the data type when defining a KF to show an integer with a sign?
We want show some days difference which should be an integer with either a positive or negative sign. I used to design a KF with type of Number with "DEC - Counter or amount field with comma and sign" as the Data Type, but find it shows 25.000 if the day difference is 25 days. We want to show it as 25 other than 25.000. Then what type would we pick when defining the KF? Use Integer as the type? But we also want it to show the sign symbol.
The type field is dimmed as long as the InfoObj. is activated that I have to remove this field. I've delete all the data loaded in ODS, PSA and etc., and I have successfully remove this KF from InfoSource, but when I try to remove it from the ODS, always get the msg "Can't move/delete locked InfoObjects" even if the InfoObject is not locked (I've tried SM12 to delete all locked entries and also tried relog on, but not helpful). If someone gives any idea, I would be very appreciated on how to remove this KF from ODS and also let me what type should I use when creating a new KF which only shows integer with a sign!
Thankshey Siggi,
Now after I right click the ODS and select "Delete Data", the KF eventually gets removed from the ODS without any error, then I continue to delete this InfoObj.
However, when I run the InfoPackage to load data to the ODS, get a msg (see below in between two dashed lines):
Syntax error in GP_ERR_RSDRO_UPDATE, row 1,210 (-> long text)
Message no. RG102
Diagnosis
The data object "I_S_OLDDATA" does not have a component called "/BIC/Z_field".
Where Z_field is the InfoObject we deleted. With this error, that's even worse since that stops any data coming in! How to get rid of this error that we can continue to load data?
Thanks
Maybe you are looking for
-
Why does iTunes always crash and freeze on my iPad?
Every time I access iTunes and try to select music or search, for example, it freezes and then crashes. I have restored the iPad and it was ok for a few minutes then did the same thing. Is there anything I can do as I would like to be able to downloa
-
Inclusion of line items before previous document due date passed
Hi All, I am having below mentioned scenario: 1. I am invoicing a consumer in Aug-14 with periodic billing order. Document is having due date of 10-Sep. 2. Further I am doing interim billing and invoicing (before previous document due date expired) w
-
Get UID of Paragraph Style that is edited in Paragraph Style Options dialog
Paragraph styles can be edited in the "Paragraph Style Options" selectable dialog. I am adding an addition style option panel to this dialog. How can I retrieve the UID of the paragraph style that is currently being displayed in this "Paragraph Style
-
Program to collect user u2013 transaction execution data for past period
Hi Experts We are developing a program to collect user u2013 transaction execution data for past period ( 3 months-1 year ). We are getting required User and Tcode output but unable to find exact count per tcode ( executed by respective user). We hav
-
Workflow in Solution Manager for approval and notification
hi@ll i want to know if there is a function or customizing feature for implmenting these two kinds of workflows in the solman: -for notification: if the status value of a document in the SOLAR01/02 will change, can automatocalliy be sent an email? -f