Run Time: type conflicts in field symbol
In this statement i am getting run time error : assign component.
type conflicts in field symbol
FIELD-SYMBOLS:
<fs_tab> TYPE ANY table,
<wa_tab> TYPE ANY,
<fs_field> type crmd_orderadm_h.
DATA: w_data TYPE REF TO data.
CREATE DATA w_data TYPE STANDARD TABLE OF (c_tabname) WITH NON- UNIQUE DEFAULT KEY.
ASSIGN w_data->* TO <fs_tab>.
SELECT * FROM (c_tabname)
INTO CORRESPONDING FIELDS OF TABLE <fs_tab>
LOOP AT <fs_tab> ASSIGNING <wa_tab>.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <wa_tab> TO <fs_field>.
*Writeing: fs_field here*
Enddo.
FIELD-SYMBOLS: <fs_field> type crmd_orderadm_h.
<fs_field> type any.
i cannot pass "
lv_header_guid = <fs_field>-guid.
complete code as follows.
LOOP AT <fs_tab> ASSIGNING <wa_tab>.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <wa_tab> TO <fs_field>.
*i am assining fs_field-guid here. Thats why i am taking this field symbol as type "crmd_orderadm_h"*
*bold* * <fs_field>-guid.*bold**
lv_header_guid = <fs_field>-guid.
iv_header_guid = lv_header_guid.
REFRESH: lt_header_guid.
INSERT iv_header_guid INTO TABLE lt_header_guid.
REFRESH: im_orderadm_h,im_text.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = lt_header_guid
IMPORTING
et_orderadm_h = im_orderadm_h
et_text = im_text
EXCEPTIONS
document_not_found = 1
error_occurred = 2
document_locked = 3
no_change_authority = 4
no_display_authority = 5
no_change_allowed = 6
OTHERS = 7.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDDO.
Similar Messages
-
Hi All,
We were doing a report to read all major infotypes and displaying the relevant data. It was working fine until we included Personal data (Infotype 0002).
We used a field symbol of type any and pnnnn type prelp. It was working fine. But when we included details from PA0002, it is throwing a runtime error stating type conflict between field symbol and pnnnn. (We used pnnnn[] = <f>.
Note: We are using ECC 6.0 and the program is Unicode enabled
Kind Regards
Hari Sankar MHi Prince,
Yes. You need to change the declaration as follows.
Field symbols:<wa_ext> TYPE ANY,
<f_zname> TYPE any.
Data: lv_zname type sname.
ASSIGN COMPONENT 86 OF STRUCTURE <wa_ext> TO <f_zname>.
lv_zname = <f_zname>.
Try the above mentioned code. I think this should work.
Best Regards,
Ram. -
Assign Type conflict with field symbols
I have two tables tab1 & tab2, want to assign field values from tab1 to tab2 suing field symbols. Deatils are :
TYPES: BEGIN OF ty_tab1,
item1 TYPE char20,
item2 TYPE char20,
val1 type i,
val2 type i,
END OF ty_tab1,
BEGIN OF ty_tab2,
item1 TYPE char20,
item2 TYPE char20,
END OF ty_tab2.
DATA: it_tab1 TYPE TABLE OF ty_tab1,
it_tab2 TYPE TABLE OF ty_tab2.
FIELD-SYMBOLS <fs_tab1> TYPE ty_tab1.
<fs_tab2t> type ty_tab2.
LOOP AT it_tab1 assigning <fs_tab1>.
READ TABLE it_tab2 assigning <fs_tab2> WITH KEY item1 = <fs_tab1>-item1
item2 = <fs_tab1>-item2.
IF sy-subrc EQ 0.
ASSIGN COMPONENT 'ITEM1' OF STRUCTURE <fs_tab1> TO <fs_tab2>.
ASSIGN COMPONENT 'ITEM2' OF STRUCTURE <fs_tab1> TO <fs_tab2>.
endif.
endloop.
Getting error msg
You attempted to assign a field to a typed field symbol, but the field does not have the required type.
whats the reason of error.
Edited by: Matt on May 27, 2011 8:59 AM - added tagsTaken from example dump
A new value is to be assigned to the field "...", although this field is
entirely or partly protected against changes.
The following are protected against changes:
- Character literals or numeric literals
- Constants (CONSTANTS)
- Parameters of the category IMPORTING REFERENCE for functions and
methods
- Untyped field symbols not yet assigned a field using ASSIGN
- TABLES parameters if the actual parameter is protected against changes
- USING reference parameters and CHANGING parameters for FORMs, if the
actual parameter is protected against changes and
- Accesses using field symbols if the field assigned using ASSIGN is
protected (or partially protected, e.g. key components of an internal
table with the type SORTED or HASHED TABLE) against changes
- Accesses using references, if the field bound to the reference is
protected (or partially protected) against changes
- External write accesses to READ-ONLY attributes,
- Content of a shared object area instance accessed using a shared lock
(ATTACH_FOR_READ).
You likely fall in one of these cases. Check each and if still unsure please share your code so we can reproduce the error.
Regards
Marcin -
How to check data type of the field symbol at run time
Hi,
My code is as following:
LOOP AT <fs> ASSIGNING <wa_covp_ext>.
ASSIGN COMPONENT 86 OF STRUCTURE <wa_covp_ext> TO <f_zzname>.
IF sy-subrc = 0.
ASSIGN COMPONENT 158 OF STRUCTURE <wa_covp_ext> TO <f_pernr>.
IF sy-subrc = 0.
SELECT SINGLE sname INTO <f_zzname> FROM pa0001
WHERE pernr = <f_pernr>
AND endda GE sy-datum
AND begda LE sy-datum.
ENDIF.
ENDIF.
ENDLOOP.
This query is giving dump when <f_zzname> is type P length 8 and decimals 2, because it tries to put PA0001-sname into it which is type C length 30. So I want to check the type of <f_zzname> before the select statement. If it is character 30, then I will write the select statement else not.
How to check data type of the field symbol at run time? If it's not possible, then can somebody suggest a workaround? Thanks.check this ...
write describe statement ...
field-symbols : <f_zzname> .
data : sname like pa0001-sname,
typ(10).
assign sname to <f_zzname>.
describe field <f_zzname> type typ.
write : typ. <-- typ contains character type in this case ..
U can check if typ is of character(C) if so .. write the select statement ... -
Determining the type of a field-symbol
Hi!
I want to create a logical expression that determines the type of field-symbol that was passed in to a function.
i want to do something like this:
IF imported_fieldsymbol IS OF TYPE some_type
ENDIF
how do you create such an expression in ABAP?
regardsHi,
You can use the RTTS - Run Time Type Service.
Try the sample code
TYPES my_type TYPE i.
DATA: my_data TYPE my_type,
descr_ref TYPE ref to cl_abap_typedescr.
START-OF-SELECTION.
descr_ref = cl_abap_typedescr=>describe_by_data( my_data ).
The hierarchy of RTTS classes are as follows,
CL_ABAP_TYPEDESCR
|
|--CL_ABAP_DATADESCR
| |
| |-- CL_ABAP_ELEMDESCR
| |--CL_ABAP_REFDESCR
| |--CL_ABAP_COMPLEXDESCR
| |
| |--CL_ABAP_STRUCTDESCR
| |--CL_ABAP_TABLEDESCR
|
|--CL_ABAP_OBJECTDESCR
|
|--CL_ABAP_CLASSDESCR
|--CL_ABAP_INTFDESCR
Regards,
Mustajab -
Access to run time type information
Hi,
I am looking for some information on how I can enumerate run time type information (lists of properties and methods) from within LabVIEW. For instance, I would like to be able to generate a list of controls on a front panel (this I figgured out), and then dynamically generate a list of properties for a selected control. Anyone know how to do this one?
Thanks,
-10Thanks Ankita. I might poke around a bit more. Most languages have hooks into run-time type information for controls and components (like an activeX control) you can query it to get this information and then display it in a property-setting dialog box. There is most likely something like this in LabVIEW too.
-10 -
Compare query ZY/SD Functional area ZREP:Type conflict for field MARC-DISPO
Hi,
Iam in 3.1i system, trying to load fUser group SD and Query ZY for the Functional area ZREP from text file.
Iam getting error log as : Compare query ZY/SD functional area ZREP : TYPE conflict for field MARC-DISPO
Could anybody please provide the solution.
Thanks, Krishna
Edited by: Krishnama Raju Samunuri on Jun 20, 2008 8:37 PMHi DST
This is a great effort and gesture. thank you on behalf of all the newbies.
PJ -
How to dynamically assign type to a field-symbol?
Hi,
I have two fields in one table, one for field name and one for table name. These can be fields in different
tables. I need to fetch value of this field in that table. So the type of this variable can change dynamically.
I am trying to assign type of this field dynamically to a field-symbol. I have to use this field symbol in a
select statement. Currently it is showing a dumb, as the field type is dec7. For some other types it is
working fine.
Regards,
SunilHi all,
I have the same problem.
I tried with your helps but i can't fix them.
A message is raised "Field <fs_bet> unknown" when i used code below
FIELD-SYMBOLS: <fs_bet> TYPE any.
DATA: c_bet TYPE string.
DATA it_0008 type STANDARD TABLE OF pa0008 WITH HEADER LINE.
DO 40 TIMES.
CONCATENATE 'BET0' index into c_bet.
ASSIGN (c_bet) to <fs_bet> CASTING TYPE pad_amt7s .
select * from pa0008 into it_0008
where <fs_bet> = '1000'
and pernr = 32.
append it_0008.
ENDSELECT.
ENDDO.
Please help me to solve it.
Thanks so much,
Sophie Tran -
Run-Time Type Identification question
Let's say I have a class Chart and 2 subclasses BarChart. and LineChart. I have a method that takes in the type of chart to create as a parameter and then creates the appropriate chart. Something like:
public void createChart(int type){
Chart ch = ChartFactory.getChart(type); //type could be Chart.LINE or Chart.BAR
//Line x
Now, at Line x above, if I want to call a method that is specific to BarChart such as getBarWidth(), how would I go about it?
Thanks.You're only going to call getBarWidth() in a context that knows it's dealing with a BarChart. The question is how to get your design in such a form so it doesn't have to say "If this is a BarChart then call getBarWidth()". I don't exactly know how you would do that but I suggest it should be your desire to do that.
Let me give a crude example that may or may not have anything to do with your project.
You display a chart and you want to give the user a panel of controls so they can tinker with the way it looks. Controls like the width of the bars in a bar chart, whether or not one of the pieces is offset from the others in a pie chart, the dottedness of the line in a line chart, and so on.
In this case the factory should have a method that takes a chart type (or maybe a chart) and returns a panel of suitable controls. This panel will have only the controls that are suitable for that chart type, and it will be given a reference to a chart that it assumes is of that type.
And similarly. Each time you feel like using instanceof, go back and see if you can't get the factory to do the work. -
Getting run time value on form field by sql query and function
Hi All,
we have below requirement -
create a form with fields as below -
KRA_Type Grade Weightage Start Date End date
Functinal E2 30 1-Jan-2010 1-jan-2011
Organizational E2 70 1-jan-2010 1-jan-2011
lov of kra_type has 2 values (Functinal, Organizational). requirement is to validate Weightage field such that for same grade :- Fuctional Weightage + Organizational Weightage = 100.
please suggest on how to approch this.
Thanks,
Sam Dthis is not related to FORMS at all......
1) create a database function which take grade parameter and return the total weightage.
2) use it on when-validate-item trigger to validate
create or replace function get_grade_weightage(p_grade varchar2)
return number
is
v_grade number;
begin
select sum(Weightage)
into v_weightage
from mytable
where grade = p_grade;
exception when no_data_found then
return 0;
end;
select get_grade_weightage(:grade) into v_weigtage from dual;
if :current_weigth < v_weightage then
-- do something
else
--do something
end if;Hope it helps
plz mark the answer as correct or helpful if it is -
when a run time error occurs using field symbols of structures to data objects corresponds to alignment.?
please explain with an example.I think it would be better for you to explain what you are doing and what the runtime error is all about.
Because: 'field symbols of structures to data objects corresponds to alignment' doesn't ring a bell for any of us obviously. -
Hi
how can i change the data type of a field symbol at run time..(say Packed to char)
may be it can have a field data or structure data..
please help me ..........
Regards
alberthi
thank you for your reply
i am trying to do as follows but i am not getting the expected output
where do i go wrong.............
*"*"Local Interface:
*" TABLES
*" IT_OUT STRUCTURE THENV OPTIONAL
DATA: v_date type sy-datum,
mytype type C.
FIELD-SYMBOLS: <fs>,
<fs1>.
v_date = sy-datum.
ASSIGN v_date TO <fs>.
append <fs> to it_out.
WRITE / <fs>. " ---------------->20.09.2011
ASSIGN v_date TO <fs1> casting TYPE C.
append <fs1> to it_out.
WRITE / <fs1>. " --------------->20110920
LT_OUT is having the data as 20110920
20110920
but i expect in date format 20.09.2011
20.09.2011 -
Findind Data type of a variable in Run Time
Hi Experts,
I am trying to find the data type of variable in runtime with "DESCRIBE FIELD" statement.
but it always shows data type C by default. i have written this code.....
DATA: w_value TYPE d.
DESCRIBE FIELD p_value TYPE w_value.
My requirement is that if i pass a variable of any type(like date, time , char, Integer , Decimal etc.) from selection screen i will give the correct data type of variable.
Please let me know how to acheive this problem.
Regards,
ShriHey Raj,
In this code it always ask a date type variable.
Still my problem i snot getting solve.
check the below one which might give u a fair idea
DATA: Desc_object TYPE ref to cl_abap_typedescr.
Parameters: p_char TYPE char10 ,
p_date TYPE d,
p_int type i.
Field-symbols : <any_type> type any.
START-OF-SELECTION.
If p_char is not initial.
assign p_char to <any_type>.
elseIf p_date is not initial.
assign p_date to <any_type>.
elseif p_int is not initial.
assign p_int to <any_type>.
endif.
IF <any_type> is assigned.
desc_object = cl_abap_typedescr=>describe_by_data( <any_type> ).
WRITE: / desc_object->absolute_name.
WRITE: / desc_object->type_kind.
ENDIF.
The Catch lies in assigning the variables to field symbol. I think you already have that part of code
Edited by: A J Raj on Dec 9, 2009 7:12 PM -
Error while trying to run Bex Query -------- Field symbol is not assigned.
Hello Every body,
I am facing the following error after giving some value in Selection screen and trying to run the Bex Query
ERROR : Field symbol is not assigned.
Thanks in advance,
Praveencan u plz give details of variables, what it is build on and the value u r inputing,
also is thr any dump.
double click on the error message it shows u. it will give u the detailed error message. post that too -
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
Maybe you are looking for
-
Why do lyrics not show up on remote computer using iTunes 12.0.1.26?
My music is stored on my iMac. Since iTunes 12.0.1.26 was installed, when I go to the "shared library" on my Mac Air, select a track and click on "Get info", the lyrics no longer appear. They do appear on the iMac. And all the other data associated w
-
FLV Players with multiple playlists.
Both the LA Times http://www.latimes.com and the Chicago Tribune http://www.chicagotribune.com as well as other newspapers have a nifty multi-playlist FLV player on their front page. The Player comes with a playlist that shows thumbnails for a list o
-
Hello. How should I install a 10.2 standalone server over ASM disks to be managed under Clusterware 11.2.0.2 in a 2 node cluster ? I mean, should I make 2 independent software/local installations and 1 database creation or is there a way to install o
-
Hi everyone, I've had ZERO issues with Adobe CC up until this past weekend. I built a new PC (i7 5960x, X99 Deluxe MOBO, 16 GB DDR4 Ram, Windows 8.1) and I'm having strange issues while exporting from Adobe Premiere. The export box comes up fine but
-
Bug report: Crash when reconnecting files and Suggestion
I installed PSE 10.0 and my files had moved from D: to C:. I attempted the Reconnect Missing Files, and the program would consistently crash. It did however connect files before crashing, so I was able to keep restarting and getting the job done. I h