DATA_OFFSET_TOO_LARGE dump for field symbol assignment/offset
Hi,
I am getting a DATA_OFFSET_TOO_LARGE dump for field symbol assignment/offset.
Dump says, 'In the running program "ZTEST", the field "<WA_FINAL>" of the type "u" and length 2174 was to be accessed with the offset 2204. However, subfield accesses with an offset specification that is not smaller than the field length are not permitted.'
Here <WA_FINAL> have to be 'TYPE any' to avoid assignment conflicts later in the logic.
It's basically dumping at <WA_FINAL>+V_LEN(V_OFF) = WA_DATA-FIELD1.
Here V_LEN LIKE DD03L-LENG & V_OFF LIKE DD03L-LENG.
Please suggest how to get rid of this dump.
Regards,
Ritesh.
The dump is very clear, your field is smaller than the offset.
The problem is most likely how you are calculating v_len and v_off.
You could change that, but there is probably an easier and faster way to do what you are trying there. Is <wa_final> something like a line from a file or what?
Similar Messages
-
Header Line Logic for Field Symbols??
Hi Experts,
I have the logic
DATA: Itab TYPE REF TO DATA.
FIELD-SYMBOLS: <itab> TYPE STANDARD TABLE.
CREATE DATA Itab TYPE STANDARD TABLE OF (TABLE_NAME).
ASSIGN Itab->* TO <itab>.
Her I had done the dynamic logic
select (LT_FIELDS)
into corresponding fields of table <itab>
from (TABLE_NAME)
up to 100 rows
WHERE (LT_WHERE).
Now I am having all information in <itab>.
Now I want to take this headerline information of <itab> and populate the same to other structure??
How to take the <itab> as header line information by looping??Hi
see this and use
Field Symbols
Field symbols are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to each field symbol before you can address the latter in programs.
Field symbols are similar to dereferenced pointers in C (that is, pointers to which the content operator * is applied). However, the only real equivalent of pointers in ABAP, that is, variables that contain a memory address (reference) and that can be used without the contents operator, are reference variables in ABAP Objects.
All operations programmed with field symbols are applied to the field assigned to it. For example, a MOVE statement between two field symbols moves the contents of the field assigned to the first field symbol to the field assigned to the second field symbol. The field symbols themselves point to the same fields after the MOVE statement as they did before.
You can create field symbols either without or with type specifications. If you do not specify a type, the field symbol inherits all of the technical attributes of the field assigned to it. If you do specify a type, the system checks the compatibility of the field symbol and the field you are assigning to it during the ASSIGN statement.
Field symbols provide greater flexibility when you address data objects:
If you want to process sections of fields, you can specify the offset and length of the field dynamically.
You can assign one field symbol to another, which allows you to address parts of fields.
Assignments to field symbols may extend beyond field boundaries. This allows you to address regular sequences of fields in memory efficiently.
You can also force a field symbol to take different technical attributes from those of the field assigned to it.
The flexibility of field symbols provides elegant solutions to certain problems. On the other hand, it does mean that errors can easily occur. Since fields are not assigned to field symbols until runtime, the effectiveness of syntax and security checks is very limited for operations involving field symbols. This can lead to runtime errors or incorrect data assignments.
While runtime errors indicate an obvious problem, incorrect data assignments are dangerous because they can be very difficult to detect. For this reason, you should only use field symbols if you cannot achieve the same result using other ABAP statements.
For example, you may want to process part of a string where the offset and length depend on the contents of the field. You could use field symbols in this case. However, since the MOVE statement also supports variable offset and length specifications, you should use it instead. The MOVE statement (with your own auxiliary variables if required) is much safer than using field symbols, since it cannot address memory beyond the boundary of a field. However, field symbols may improve performance in some cases.
check the below links u will get the answers for your questions
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_sy.htm
http://searchsap.techtarget.com/tip/1,289483,sid21_gci920484,00.html
Syntax Diagram
FIELD-SYMBOLS
Basic form
FIELD-SYMBOLS <fs>.
Extras:
1. ... TYPE type
2. ... TYPE REF TO cif
3. ... TYPE REF TO DATA
4. ... TYPE LINE OF type
5. ... LIKE s
6. ... LIKE LINE OF s
7. ... TYPE tabkind
8. ... STRUCTURE s DEFAULT wa
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Cannot Use Untyped Field Symbols ad Cannot Use Field Symbols as Components of Classes.
Effect
This statement declares a symbolic field called <fs>. At runtime, you can assign a concrete field to the field symbol using ASSIGN. All operations performed with the field symbol then directly affect the field assigned to it.
You can only use one of the additions.
Example
Output aircraft type from the table SFLIGHT using a field symbol:
FIELD-SYMBOLS <PT> TYPE ANY.
DATA SFLIGHT_WA TYPE SFLIGHT.
ASSIGN SFLIGHT_WA-PLANETYPE TO <PT>.
WRITE <PT>.
Addition 1
... TYPE type
Addition 2
... TYPE REF TO cif
Addition 3
... TYPE REF TO DATA
Addition 4
... TYPE LINE OF type
Addition 5
... LIKE s
Addition 6
... LIKE LINE OF s
Addition 7
... TYPE tabkind
Effect
You can define the type of the field symbol using additions 2 to 7 (just as you can for FORM parameters (compare Defining the Type of Subroutine Parameters). When you use the ASSIGN statement, the system carries out the same type checks as for USING parameters of FORMs.
This addition is not allowed in an ABAP Objects context. See Cannot Use Obsolete Casting for FIELD SYMBOLS.
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. See Defining Types Using STRUCTURE.
Effect
Assigns any (internal) field string or structure to the field symbol from the ABAP Dictionary (s). All fields of the structure can be addressed by name: <fs>-fieldname. The structured field symbol points initially to the work area wa specified after DEFAULT.
The work area wa must be at least as long as the structure s. If s contains fields of the type I or F, wa should have the structure s or at least begin in that way, since otherwise alignment problems may occur.
Example
Address components of the flight bookings table SBOOK using a field symbol:
DATA SBOOK_WA LIKE SBOOK.
FIELD-SYMBOLS <SB> STRUCTURE SBOOK
DEFAULT SBOOK_WA.
WRITE: <SB>-BOOKID, <SB>-FLDATE.
Regards
ANJI -
Hi,
I have a doubt regarding the field symbol assignment.
In my program, I have logic as below.
<b> W_1STCNTFLD = 'E_INV_AGING_STRU-PDISCCNTP1'.
W_2NDCNTFLD = 'E_INV_AGING_STRU-PDISCCNTP2'.
ASSIGN (W_1STCNTFLD) TO <FS1>.
ASSIGN (W_2NDCNTFLD) TO <FS2>.</b>
While debugging, when I see the values of the Field Symbols <b><FS1></b> and <b><FS2></b> after assignment, they are <b>0, 0</b>. Why is it like that..?
In general, what does a Field Symbol hold..? the value of the variable being assigned or the Memory location of that variable..?
When I remove the paranthesis while assigning like below,
<b>ASSIGN W_1STCNTFLD TO <FS1>.</b>
it is storing the value of the variable(<b>E_INV_AGING_STRU-PDISCCNTP1</b>) to <b><FS1></b> instead of '0'.
And what is the difference between <b>ASSIGN (W_1STCNTFLD) TO <FS1></b> and <b>ASSIGN W_1STCNTFLD TO <FS1></b>..? I mean, when we put paranthesis to the variable and when we remove the paranthesis.
Please clarify my doubts. Thanks in advance.
Thanks & Regards,
Paddu.when you use the paranthesis,(W_1STCNTFLD) actually equals to ('E_INV_AGING_STRU-PDISCCNTP1'),and the 'E_INV_AGING_STRU-PDISCCNTP1' must be the label of a data object,it can't be a string!
please refer to the following document(coming from sap abap keywords document):
Alternative 2
... [TABLE FIELD] (name)
Alternative 3
... oref->(attr_name)
Alternative 4
... {class|(class_name)}=>{attr|(attr_name)}
Effect
There are three dynamic variants for mem_area, where the storage area is not specified directly, but as the content of character/type data objects enclosed within parentheses.
In the first variant (name), the label in name is built exacltly like the direct specification. When the statement is executed, the content of name must be the label of a data object that can contain offset/length specifications, strucuture component selectors, and component selectors for the assignment of attributes in classes or objects (since Release 6.10). The content of name must be specified in uppercase letters.
The optional addition TABLE FIELD before (name) is only possible outside of classes. This addition limits the search area - where the data object specified in (name) is searched for (see below) - to the interface work areas for the current program group declared using TABLES. If TABLE FIELD is specified, casting_spec and range_spec cannot be specified explicitly.
If the label in name is a field symbol or a form parameter with an unstructured type, components can be addressed, as of Release 6.10, through structure component selectors. The components must exist when the statement is executed.
The second variant oref->(attr_name) is a special case of the first variant for the assignment of an instance attribute to a field symbol - where the object reference variable oref is specified statically. The label of the attribute is specified dynamically in the character-type field attr_name and must not be specified in uppercase letters.
The third variant {class|(class_name)}=>{name|(attr_name)} is a special case of the first variant for the assignment of a static attribute to a field symbol where the class name class and the name of the attribute name can be specified both directly and dynamically in character-type fields class_name or attr_name. The contents of attr_name and class_name do not have to be in uppercase letters. If the class name is specified dynamically and the attribute is specified directly, no offset/length specifications can be made for the attribute.
If a data object is specified dynamically, this is searched for in accordance with the following hierarchy.
Within the local data objects of the current procedure
Within the attributes, visible in a method, of the actual class, where , in instance methods, the self reference me-> is set explicitly before the label
Within the global data of the current program
Within the interface work areas of the main program of the current program group declared with TABLES
Within the attributes of the object to which oref refers, if the label has the expression oref-> (as of Release 6.10)
Note
Only for internal use can the label in name also have the form (PROG)DOBJ, whereby PROG is the name of an ABAP program and DOBJ is the name of a global data object of this program. If the program PROG is loaded during execution of the statement ASSIGN in the same internal mode as the current program is loaded, the data object (PROG)DOBJ in this program is searched for and the field symbol points to this data object after successful assignment.
Example
Dynamic access to an attribute of an object (Dynamic Access) through a field symbol.
CLASS c1 DEFINITION.
PUBLIC SECTION.
METHODS m1 IMPORTING oref TYPE REF TO object
attr TYPE string.
ENDCLASS.
CLASS c1 IMPLEMENTATION.
METHOD m1.
FIELD-SYMBOLS <attr> TYPE ANY.
ASSIGN oref->(attr) TO <attr>.
WRITE <attr> ...
ENDMETHOD.
ENDCLASS. -
Sample program for field symbol
hi,
I am fresher. I want sample program(code) for field symbol.http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_sy.htm
TYPES: BEGIN OF line,
col1 TYPE c,
col2 TYPE c,
END OF line.
DATA: wa TYPE line,
itab TYPE HASHED TABLE OF line WITH UNIQUE KEY col1,
key(4) TYPE c VALUE 'COL1'.
FIELD-SYMBOLS <fs> TYPE ANY TABLE.
ASSIGN itab TO <fs>.
READ TABLE <fs> WITH TABLE KEY (key) = 'X' INTO wa.
The internal table ITAB is assigned to the generic field symbol <FS>, after which it is possible to address the table key of the field symbol dynamically. However, the static address
READ TABLE <fs> WITH TABLE KEY col1 = 'X' INTO wa.
is not possible syntactically, since the field symbol does not adopt the key of table ITAB until runtime. In the program, the type specification ANY TABLE only indicates that <FS> is a table. If the type had been ANY (or no type had been specified at all), even the specific internal table statement READ TABLE <FS> would not have been possible.
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb387a358411d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb387a358411d1829f0000e829fbfe/content.htm -
Short dump GETWA_NOT_ASSIGNED - Field symbol FS_ENVDLIST not assigned
Hi Experts,
I need your help. Currently i am getting a short in CIC0 transaction.
Please find steps executed which result in short dump.
Search for a BP with BD display as the active tab. This search will be successful.
Press u2018End Contactu2019 Now search for 2nd BP with BD display as the active tab.
This will result in a dump.
Now if I again execute the t-code CIC0 & enter the same BP it will be successful
On debugging, I found out that the program cannot identify the data environment since the field symbol <fs_envdlist> does not get assigned when BD_DISPLAY tab is active. But the program still continues to use this field symbol which results in a dump
CRM Version - 4.0 - Patch level 10
Please let me know if the below link is not accessible
[http://imageshack.us/photo/my-images/685/page3uk.jpg/]
[http://imageshack.us/photo/my-images/338/page2dr.jpg]
[http://imageshack.us/photo/my-images/510/page1up.jpg/]
[http://imageshack.us/photo/my-images/140/page4fa.jpg/]
[http://imageshack.us/photo/my-images/845/screenshotsxq.jpg/]Hi Andrei,
Thank you for the reply, but both this note are applicable to me
1144076 u2013 Talks about dump when too many hits are returned - I do not have any such message
996915 u2013 Talks about searching for the premise for a point of delivery without entering any search parameters - again in my scenario, input data is always provided.
Is there any solution, i did get note 1254404 which is closest to my issue, but its valid from crm 5.0 and we are on CRM 4.0 -
Dynamic Field-Symbol assignment - Short Dump
Create three programs as mentioned:
REPORT zforms.
*& Form form_fs_assign
* text
FORM form_fs_assign.
FIELD-SYMBOLS <fs> TYPE table.
DATA: fs_itab LIKE STANDARD TABLE OF tab_matnr WITH HEADER LINE.
break-point.
ASSIGN ('(ZPROGRAM1)ITAB[]') TO <fs>.
IF sy-subrc EQ 0.
fs_itab[] = <fs>[].
LOOP AT fs_itab.
WRITE / fs_itab-matnr.
ENDLOOP.
ELSE.
Write:/ sy-repid, 'field-symbol not assigned'.
ENDIF.
ENDFORM. "form_fs_assign
REPORT zprogram1.
DATA: itab LIKE STANDARD TABLE OF tab_matnr WITH HEADER LINE.
itab-matnr = '1111'.
APPEND itab.
itab-matnr = '2222'.
APPEND itab.
WRITE:/ sy-repid.
PERFORM form_fs_assign IN PROGRAM zforms.
SUBMIT zprogram2.
REPORT zprogram2.
break-point.
*-- enter (ZPROGRAM1)ITAB[] in the variable and press enter
* the yellow icon stating that it doesn't exist appears
* but when the following form is called, it does checks
* the <fs> assign and doesnt gives any runtime error
* while in Pricing routine, the similar situation
* does gives the error
PERFORM form_fs_assign IN PROGRAM zforms.
*Execute zprogram1 and debug, works fine..*
*Execute zprogram2, (ZPROGRAM1)ITAB[] doesn't exist, still it doesn't leads to short dump*
*BUT, a very similar situation in a Pricing Requirment Routine leads to a short dump:*
*Runtime Error GETWA_NOT_ASSIGNED*
*ShrtText Field symbol has not yet been assigned.*
*Pricing Routine Code Snippet:*
*-- {3. -
determine qualifying prior invoices in memory----
FIELD-SYMBOLS: <fs_vbrk> TYPE table.
FIELD-SYMBOLS: <fs_vbpa> TYPE table.
FIELD-SYMBOLS: <fs_komv> TYPE table.
DATA g_it_vbrk LIKE STANDARD TABLE OF vbrkvb WITH HEADER LINE.
DATA g_it_vbpa LIKE STANDARD TABLE OF vbpavb WITH HEADER LINE.
DATA g_it_komv LIKE STANDARD TABLE OF konv WITH HEADER LINE.
DATA: l_vbrk_lines TYPE i.
ASSIGN ('(SAPLV60A)XVBRK[]') TO <fs_vbrk>. <- "Error occurs here
ASSIGN ('(SAPLV60A)XVBPA[]') TO <fs_vbpa>.
ASSIGN ('(SAPLV60A)XKOMV[]') TO <fs_komv>.
g_it_vbrk[] = <fs_vbrk>.
g_it_vbpa[] = <fs_vbpa>.
g_it_komv[] = <fs_komv>.
DESCRIBE TABLE g_it_vbrk LINES l_vbrk_lines.
READ TABLE g_it_vbrk INDEX l_vbrk_lines.
** remember to make vkorg and vtweg check for vbrk invoices
DELETE g_it_vbrk WHERE vbeln = g_it_vbrk-vbeln.
DELETE g_it_vbpa WHERE vbeln = g_it_vbrk-vbeln OR parvw <> 'WE'.
DELETE g_it_komv WHERE knumv = g_it_vbrk-vbeln OR kschl <> 'ZF02' OR kbetr = 0.Hello friends,
Rich,
The piece of code you suggested didn't work, and still led to the short dump.
Naimesh,
I agree that XVBRK is not declared globally, and if it is a Table, and declared as global work area using Tables, we could have used it directly using ASSIGN (VBRK)...
But, since its not the case, I am not able to do so...
Still, my requirement remains the same. I have to get the invoices created (in memory) but not saved during a collective billing run.
And the required data is available in the (SAPLV60A)XVBRK internal table, from which I am able to retrieve it for the first time, but clicking on the conditions tab in the item details leads to this short dump, becs (SAPLV60A)XVBRK[] isn't available at that moment. Still, if it is not available I suppose it should just set the sy-subrc to 4 instead of ending into a short-dump.
Jürgen Hartwig,
I know ZPROGRAM 1 can't work in ZPROGRAM 2, but it doesnt leads to the short dump either, does it? But in case of pricing it gives the run time error, this is exception I want to handle!
XVBRK is not declared globally, but since SAPLV60A calls a perform in SAPLV61A, it remains in the ABAP stack and we can access it using (SAPLV60A)XVBRK[] kind of assignment.
When the same is called during Item Conditions display, its PBO is in the stack but not other forms (in which it might have defined).
Rich, is there a way to get all the variables available in scope at any instance during runtime?
Well, Jürgen, I though it Germany it was called "schmutzig zuweisen" :-)... by the way, the same method has been used at several places in standard SAP programs with the sy-subrc check.
Reference Data:
when the assignment happens successfully, the ABAP Stack looks similar to:
Call | Program | Subroutine
10 | SAPLV61A | some_subrountine
09 | SAPLV61A | some_subrountine
08 | SAPLV61A | some_subrountine
07 | SAPLV60A | some_subrountine
06 | SAPLV60A | some_subrountine
05 | SAPLV60A | some_subrountine
04 | SAPLV60A | some_subrountine
03 | SAPLV60A | some_subrountine
02 | SAPLV60A | some_XKOMV_AUBE..subrountine
01 | SAPLV60A | PAI_some_subrountine
when the assignment doesnt happens, the ABAP Stack looks similar to:
04 | SAPLV61A | some_subrountine
03 | SAPLV61A | some_subrountine
02 | SAPLV61A | some_subrountine
01 | SAPLV60A | PBO_some_subrountine -
Short dump GETWA_NOT_ASSIGNED field symbol not been assigned
Hi Gurus,
I am calling a RFC BAPI_PBSRVAPS_CHANGEKEYFIGVAL2 from R/3 sytem to SCM 5.0.
Acutally this FM BAPI_PBSRVAPS_CHANGEKEYFIGVAL2 not available in R/3 system.
So i am using scm destination and calling above FM directly from R/3 but i am getting the short dump
in SCM system as GETWA_NOT_ASSIGNED field symbol not been assigned.
Can you pls check and advise.
Best Regards,
Radhakrishna.Hi Radhakrishna,
It looks like you have a discrepancy in the planning area with respect to keyfigure. Some thing like the key figure description is not synchronized between live cache and db.
I suggest you log onto your SCM system, run the program /SAPAPO/TS_LCM_CONS_CHECK on your planning area with correct error option.
Please let me know if this works. -
Field Symbol - Assign type conflict.
Hi, i active successfully my program. This is the code:
DATA ls_g_oref_appl(21) TYPE C.
FIELD-SYMBOLS: <fs_appl> TYPE REF TO cl_ftr_mj_appl.
ls_g_oref_appl = '(SAPLTB4E)g_oref_appl'.
ASSIGN (ls_g_oref_appl) TO <fs_appl>.
But when i execute it, i get a dump with this message:
"ASSIGN_TYPE_CONFLICT : You attempted to assign a field to a typed field symbol,but the field does not have the required type. "
Also, i get sy-subrc = 0, so the field symbol <fs_appl> has a value assign.
Any suggestions? I tried by changing the type of the field to ANY, but it didnt compile.
Thanks for the help,
KarlaHi Daniel, I verified again the type of g_oref_appl, and it is : cl_ftr_mj_appl. I check the top of the include and g_oref_appl is there :
' DATA g_oref_appl TYPE REF TO cl_ftr_mj_appl. '
Hi, Naren, also i tried with the TYPE ANY, but it doesnt compile.
I notice this:
CLASS cl_ftr_mj_appl DEFINITION ABSTRACT.
Is there a problem with field symbols and abstracts class???
Thanks for all your help,
Karla.
Edited by: Karla Tinoco on Mar 5, 2008 11:46 PM -
Field Symbols Assign Type Conflict
Hi,
I am working on a BAdi Implementation and have the following code.
<b>method IF_EX_DPR_ATTRIBUTES~SET_DEFAULTS_UPON_CREATION .
FIELD-SYMBOLS:
<ls_attributes> TYPE dpr_ts_project_ext.
ASSIGN cs_attributes TO <ls_attributes> .
CASE flt_val.
WHEN cl_dpr_co=>sc_ot_project.
<ls_attributes>-extended_attributes-ZZSOL_PRJ_ID = 'C0001'.
ENDCASE.
ENDMETHOD.</b>
This is the sample implementation code provided by SAP. However, when I implement the above code, the system dumps at the statement
<i> ASSIGN cs_attributes TO <ls_attributes> .</i>
and cs_attributes is of type any.
I tried the same code by adding "CASTING" at the end of above line. But, it still gives the dump. Below, is the dump message.
Note
The following error text was processed in the system BS3 : Error in ASSIGN in the program ZCL_IM_DPR_ATTRIBUTES=========CP .
The error occurred on the application server acequad_BS3_30 and in the work process 0 .
The termination type was: RABAX_STATE
The ABAP call stack was:
Form: IF_EX_DPR_ATTRIBUTES~SET_DEFAULTS_UPON_CREATION of program ZCL_IM_DPR_ATTRIBUTES=========CP
Form: IF_EX_DPR_ATTRIBUTES~SET_DEFAULTS_UPON_CREATION of program CL_EX_DPR_ATTRIBUTES==========CP
Form: ATTRIBUTES_DEFLTS_UPON_ACTION of program CL_DPR_BADI_SERVICES==========CP
Form: ATTRIBUTES_DEFAULTS_UPON_CREA of program CL_DPR_BADI_SERVICES==========CP
Form: SET_DEFAULTS_UPON_CREATION of program CL_DPR_PROJECT================CP
Form: SET_DEFAULTS_UPON_CREATION of program CL_DPR_PROJECT_O==============CP
Form: CONSTRUCTOR of program CL_DPR_PROJECT_O==============CP
Form: IF_DPR_APPL_OBJECT_FACTORY~CREATE_PROJECT of program CL_DPR_APPL_OBJECT_FACTORY====CP
Form: CREATE of program CL_DPR_BSP_APPLICATION========CP
Form: DO_HANDLE_EVENT of program CL_DPR_BSP_C_TOOLS============CP
Any ideas on how to use field symbols in the above context??
Thanks,
RajeshHi Rajesh,
The reason it is dumping is because the actually type of the variable passed in CS_ATTRIBUTES is not fixed this is why they have specified it's type as type any.
The sample code in this regard is not correct, you should fist check the value of FLT_VAL to determine what type of variable CS_ATTRIBUTES actually is.
In the BADI documentation there is a list of values for field FLT_VALUE and the corresponding data type of CS_ATTRIBUTES for that value (According to the documentation the data type for FLT_VAL sc_ot_project is DPR_TS_PROJECT_INT).
method IF_EX_DPR_ATTRIBUTES~SET_DEFAULTS_UPON_CREATION .
FIELD-SYMBOLS:
<ls_attributes> TYPE dpr_ts_project_int.
<i><b>* ASSIGN cs_attributes TO <ls_attributes> .</b></i>
CASE flt_val.
WHEN cl_dpr_co=>sc_ot_project.
<i><b>ASSIGN cs_attributes TO <ls_attributes> .</b></i>
<ls_attributes>-extended_attributes-ZZSOL_PRJ_ID
= 'C0001'.
ENDCASE.
ENDMETHOD.
In this example you will ultimately end up with multiple field symbols for representing the CS_ATTRIBUTES parameter, one field symbol for each filter value you intend handling.
From
De Wildt -
Hi ,
i try to do this statement and i have dump
BEGIN OF tt_agr ,
agr_name TYPE agr_name,
text TYPE agr_title,
END OF tt_agr .
FIELD-SYMBOLS: <ls_retr_txt1> TYPE tt_agr.
LOOP AT lt_help ASSIGNING <ls_help_value>.
SPLIT <ls_help_value> AT space INTO ls_agr-agr_name ls_agr-text.
SHIFT ls_agr-text LEFT DELETING LEADING space.
READ TABLE It_retr_roles ASSIGNING <ls_retr_txt1> WITH KEY agr_name = ls_agr-agr_name.
IF sy-subrc = 0.
<ls_retr_txt1>-text = ls_agr-text . "<- here the dump occuer
ENDIF.
ENDLOOP.
this is the dump analysis what i miss here ?
Error analysis
A new value is to be assigned to the field "<LS_RETR_TXT1>", although this
field is
entirely or partly protected against changes.
The following are protected from change:
- Character literals or numerical literals.
- CONSTANTS.
- Parameters of the category IMPORTING REFERENCE in functions and
methods.
- untyped field symbols, that have not been assigned a field using
ASSIGN.
- TABLES parameters, if the actual parameter is protected against
changes.
- USING reference parameters and CHANGING parameters in FORMs,
if the actual parameter is protected against changes.
- Access using field symbols if the field assigned using ASSIGN is
partly or completely protected (for example key components of internal
table of the type SORTED or HASHED TABLE).
- Access using field symbols if the field assigned using ASSIGN contains
components of a secondary key that is currently in use in a
higher-level LOOP statement.
- Access using references if the field bound to the reference is
(partly) protected against changes.
- Write access from outside to READ-ONLY attributes.
- Content of a shared objects area instance accessed using a shared lock
(ATTACH_FOR_READ.
- Rows or fields of a table that are currently being serialized by a
Simple Transformation.
Regards
JoyHi,
if It_retr_roles is defined as CHANGING (which is against naming rules, should be Ct_retr_roles), then the table is defined as SORTED OR HASHED and field TEXT is part of the key. Key fields may never be changed.
You may build a new local internal table and replace the original at end of method.
Regards,
Clemens -
Hi ,
Please find below code when I tried in version 4.6 code works correctly . but in 6.0 it gives short dump..
Here.
FIELD-SYMBOLS : <fs_table> TYPE ANY TABLE.
FIELD-SYMBOLS : <fs_work_area> TYPE yatsdzz00.
ASSIGN pr_data_changed->mp_mod_rows->* TO <fs_table>.
LOOP AT <fs_table> ASSIGNING <fs_work_area>. (In there system gives short dump)
Thanks in advance.Hai,
Use CASTING or CASTING TYPE (mytype) after LOOP AT <fs_table> ASSIGNING <fs_work_area>.
ie:
FIELD-SYMBOLS : <fs_table> TYPE ANY TABLE.
FIELD-SYMBOLS : <fs_work_area> TYPE yatsdzz00.
ASSIGN pr_data_changed->mp_mod_rows->* TO <fs_table>.
LOOP AT <fs_table> ASSIGNING <fs_work_area> <b>CASTING or CASTING TYPE (mytype).</b>
For more information click the below link:
http://help.sap.com/saphelp_46c/helpdata/EN/fc/eb35de358411d1829f0000e829fbfe/frameset.htm
I hope it helps you.
Reward points if it helps you.
Regds,
Rama chary.Pammi -
Problem with slis_t_specialcol_alv Field Symbol Assignment
I have created a dynamic internal table (runtime determined number of columns) to contain data to be displayed in an ALV. Ive also made ensured that the last column of the dynamic itab is of type <b>'slis_t_specialcol_alv'</b> and named <b>CINFO</b> to contain color information for that particular row. In the code below the dynamic itab is pointed to by field symbol <dyn_table> while the work area for it would be <dyn_wa>.
Somewhere down the line I attempt to assign the CINFO component of the current row of the itab to a field symbol called <fs_cinfo> typed as slist_t_specialcol_alv (Same as CINFO).
I used the code:
ASSIGN COMPONENT 'CINFO' OF STRUCTURE <dyn_wa> TO <fs_cinfo>.
This gives me the runtime error:
<i>Type conflict in the ASSIGN statement in the program "ZHRR001_TEMMATRIX".
You attempted to assign a field to a typed field symbol,
but the field does not have the required type. </i>
I am unsure why this happens as both the component CINFO and FS <fs_cinfo> are of type slist_t_specialcol_alv.
For some odd reason though during debugging, I took a look at the <dyn_wa> structure and the component type of CINFO was displayed as C???
Here is the relevant portion of code (creation of dynamic itab and attempting to assign <fs_cinfo>)
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
<dyn_wa>.
FIELD-SYMBOLS: <fs_cinfo> TYPE slist_t_specialcol_alv.
DATA: lw_cinfo TYPE slis_specialcol_alv.
DATA: li_fldcat TYPE lvc_t_fcat,
lw_fldcat TYPE lvc_s_fcat.
*Create internal table fields (they will be called Field1, Field2, etc)
*Last column will be named 'CINFO' to contain row color information
DO l_alvcolumncount TIMES.
index = sy-index.
IF index <> l_alvcolumncount.
CLEAR lw_fldcat.
CONCATENATE 'Field' index INTO lw_fldcat-fieldname .
CONDENSE lw_fldcat-fieldname NO-GAPS.
lw_fldcat-datatype = 'STRING'.
* lw_fldcat-intlen = 5.
APPEND lw_fldcat TO li_fldcat .
ELSE.
CLEAR lw_fldcat.
lw_fldcat-fieldname = 'CINFO'.
CONDENSE lw_fldcat-fieldname NO-GAPS.
lw_fldcat-datatype = 'slis_t_specialcol_alv'.
APPEND lw_fldcat TO li_fldcat.
ENDIF.
ENDDO.
* Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = li_fldcat
IMPORTING
ep_table = new_table.
ASSIGN new_table->* TO <dyn_table>.
*Create dynamic work area and assign to FS
CREATE DATA new_line LIKE LINE OF <dyn_table>.
ASSIGN new_line->* TO <dyn_wa>.
ASSIGN COMPONENT 'CINFO' OF STRUCTURE <dyn_wa> TO <fs_cinfo>.
* Color this cell
lw_cinfo-fieldname = fieldname.
lw_cinfo-color-col = 6.
APPEND lw_cinfo TO <fs_cinfo>.
Message was edited by: Sow Yong WongHello Sow
There is a big problem in the program: you are mixing types used for FM-based ALV (SLIS_...) and ABAP-OO based ALV (LVC_...).
For ABAP-OO based row colouring you have to define your itab like this:
TYPES: ty_s_outtab.
INCLUDE TYPE kna1. " just an example
TYPES: rowcolor(4) TYPE c.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE of ty_s_outtab
WITH DEFAULT KEY.
In the layout (LVC_S_LAYO) you have to set <b>ls_layout-info_fname = 'ROWCOLOR'</b>.
ROWCOLOR has to be filled according to <b>Cxyz</b> whereas
- x = color
- y = inverse on/off
- z = intensified on/off
For documentation please refer to <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907">An Easy Reference to ALV Grid Control</a>
Regards
Uwe -
Hi All,
I want to apply field symbol technique in my report. actually i have one internal table say i_itab.
it contains fileds like address1 address2 address3 address4 upto address5 . insted of writting each field i want to use field symbol which will increment the counter for field durine runtime. actually i want ot apply this logic for one of my finance report for calculation of periods values hsl01 to hsl16.
can any one give me the solution for how to do this?
thanks in advance
vinod p.Hello Vinod,
If you are trying like this:
CONCATENATE 'wa_remittance_dt-suppl_addr_line' l_cnt2 into l_v_field. " --> Incorrect
ASSIGN l_v_field to <l_v_fields>. " --> Incorrect
You are not assigning the memory area of wa_remittance_dt-suppl_addr_line1 to <l_v_fields>. You are assigning the memory area of l_v_field to <l_v_fields>. Because of this you are getting the blank value.
But if you try like this:
CONCATENATE 'suppl_addr_line' l_cnt2 into l_v_field. "Add this line
ASSIGN COMPONENT l_v_field OF STRUCTURE wa_remittance_dt TO <l_v_fields>.
You are assigning memory area of wa_remittance_dt-suppl_addr_line1 to <l_v_fields>. And after
<l_v_fields> = wa_i_address-l_addr
the value in wa_remittance_dt-suppl_addr_line1 will be changed to that in wa_i_address-l_addr.
I think this should be clear to you.
BR,
Suhas -
Delete Reference for field symbol
Hi
i have thes code
FUNCTION Z_DEMO.
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(INCLUDE_STRUCTURE) TYPE TABNAM
*" TABLES
*" DATA_PACKAGE_TA
DATA: it_data TYPE REF TO data.
FIELD-SYMBOLS: <fs_itab> TYPE STANDARD TABLE.
CREATE DATA it_data TYPE STANDARD TABLE OF (INCLUDE_STRUCTURE).
ASSIGN it_data->* TO <fs_itab>.
assign DATA_PACKAGE_TA[] to <fs_it_dp>.
sort <fs_itab> by ('COSTCENTER') ('CALMONTH') ('CURRENCY').
delete adjacent duplicates
from <fs_itab>
comparing ('COSTCENTER') ('CALMONTH') ('CURRENCY').
(1) Its workes good but it delete lines from DATA_PACKAGE_TA also how i can delete just from
the field symbol <fs_itab> and keep the itab without change ????
(2) How I can build an another itab like DATA_PACKAGE_TA ??????
Thanks and regardes .hi!
instead of:
assign DATA_PACKAGE_TA[] to <fs_itab>.
just do like this:
<fs_itab>[] = DATA_PACKAGE_TA[].
then you can delete from <fs_itab> without deleting the other internal table.
Bye,
Andrew83.
Hope this help you. -
Error in Field symbol assignment
What is wrong in following code ???
At line --> (Bold) I am gettin sy-subrc 4.
field-symbols: <F> type any,
<FSVALUE> type any.
SPLIT P_QUOTATION_TEXT-TEXT_LINE AT CRLF INTO TABLE I_SPLIT.
IF NOT I_SPLIT[] IS INITIAL.
LOOP AT I_SPLIT ASSIGNING <F>.
--> ASSIGN COMPONENT SY-TABIX OF STRUCTURE <F> TO <FSVALUE>.
IF SY-SUBRC = 0.
WA_TEXT-ITM_NUMBER = P_QUOTATION_TEXT-ITM_NUMBER.
WA_TEXT-TEXT_ID = C_HEADERTEXT.
WA_TEXT-LANGU = 'EN'.
WA_TEXT-FORMAT_COL = '*'.
WA_TEXT-TEXT_LINE = <FSVALUE>.
APPEND WA_TEXT TO I_TEXT.
CLEAR WA_TEXT.
ENDIF.
ENDLOOP.I'll try to get clearer
SPLIT P_QUOTATION_TEXT-TEXT_LINE AT CRLF INTO TABLE I_SPLIT.
You are splitting at CRLF, fine. I_split has only one field or none if you want to get more thecnical.
LOOP AT I_SPLIT ASSIGNING <F>.
Here you are starting to loop at each entry of i_split, assigning each entry to , again only one field
ASSIGN COMPONENT SY-TABIX OF STRUCTURE <F> TO <FSVALUE>.
Again, this will never work because as you are declaring it i_split doesn't have an structure, also doesn´t have an structure only one field
It doesn't make any sense that you are assigning the same field to another field-symbol when you already have one.
And even if you used the type I told you, it would only work in the first pass because only in the first pass you can assign the component 1 of the structure because the structure only has one field, there would not be any component 2,3... etc.
Again I don't understand what you are trying to do, if you want to assign that loop pass text to a table, just pass the field-symbol you already have
Maybe you are looking for
-
Deactivating the automatic setup for creation of batch numbers in GR
Hello, The user wants to key in the batch number for material purchased while creating GR. But the batch number gets created automatically. Could you please help and letme know how can the user deactivate this? Is it activated in master-data or cust
-
I'm trying to update iPhoto 7.1.5 on my old iMac (running 10.9.5) to current versions so I can get my photos onto iCloud to access from my iPad. I can't seem to find an upgrade route that will work? Any suggestions?
-
Can I add an ssd hard drive to my pavillion m7-1015dx
What do I need to do to add a ssd drive to my HP Pavillion M7-1015dx currently on windows 7 64 bit, but planning to upgrade to windows 8 64 bit This question was solved. View Solution.
-
How to use Edition Based Redefinition in APEX?
Hello, This might be my first question on this forum ;-) I am trying to get 11gR2 Edition Based Redefinition to work within APEX. But for testing purposes (before altering the database to use the new edition as the default) I have to set the edition
-
How to get a doc//literal web service with JWSDP1.3
I can build a rpc/encoded service (based the tutorial), but I need a doc/literal. Because I have a J2ME client. How can I do it? thanks