Field Symbol content to Data Content
Dear All,
Here is my scenario:
1. I have to create a Function module which should give the Output in the form of a table (Dynamic Internal Table content/ Field -symbol).
2. I have built a dynamic internal table inside this FM and the content is in the field-symbol of type table.
3. Now I want this table content to be the output of a Function Module.
4. In the FM interface, i have to create a Tables Paramter / Changing Parameter as of this dynamic content's structure.
How should I achieve this ?
Regards,
Deepu.K
Edited by: deepu k on Jun 8, 2010 4:59 PM
@ Naimesh:
Since you are calling the FM by passing the table parameter which doesn't have the structure, IT would take the structure of the program which calls this FM.
Actually my scenario is:
1. I will pass some export paramters and using these parameter values, I will build a dynamic internal table <fs_tab> inside my FM.
2. Now, I have to show this field symbol content as the output of my FM with the complete structure.
3. So, I need to convert the Field symbol data <fs_tab> into a internal table of static structure tabl.
FUNCTION ZTEST.
FIELD-SYMBOLS: <fs_line> TYPE ANY,
<fs_field> TYPE ANY.
APPEND INITIAL LINE TO tabl ASSIGNING <fs_line>.
ASSIGN COMPONENT 'MATNR' OF STRUCTURE <fs_line> TO <fs_field>.
ENDFUNCTION.
As per the above code, which you have mentioned,
I guess, you mean the following:
FIELD-SYMBOLS: <fs_line> TYPE ANY,
<fs_field> TYPE ANY.
data: gv_data type ref to data.
create data gv_data like line of <fs_tab>.
assign gv_data->* to <fs_line>.
Loop at <fs_tab> assigning <fs_line>.
Assign component 'F1' of structure <fs_line> to <fs_field>.
Insert <fs_line> into table tabl.
endloop.
Now, in <fs_field>, i'll have the value as '1' as per the coding which I have posted earlier.
So, after this, if I insert, it goes for a dump because the structure of tabl is not matching with <fs_line>.
Hello Vikranth,
I'll be giving the input with 2 parameters.
One will be the Number of Rows (eg. 5) and the other will be number of columns (eg. 4).
Now, using these values I'll build a dynamic internal table with 5 Rows and 4 Columns.
The content is the business logic which is not a concern in this post.
The concern is after I build the dynamic internal table, how should I pass it to the Tables parameter / Changing parameter of my FM.
Now, how to proceed ?
Regards,
Deepu.K
Similar Messages
-
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 -
How to use different field symbols to append data in a loop
Hi experts!
I have to loop over a itab and I want to save different into one table.
See my code below:
DATA: l_hours TYPE i,
grfk_ok_code TYPE sy-ucomm,
grfk_values TYPE TABLE OF GPRVAL WITH HEADER LINE,
grfk_coltxt TYPE TABLE OF GPRTXT WITH HEADER LINE,
wa_ztab TYPE zqm_chq_prueflos,
l_index TYPE n,
l_field TYPE string,
l_line_check TYPE string
FIELD-SYMBOLS:
<fs_0102> TYPE ANY,
<fs_0304> TYPE ANY,
<fs_0506> TYPE ANY,
<fs_grenze> TYPE ANY
REFRESH: grfk_values.
CLEAR: l_hours.
LOOP AT ztab INTO wa_ztab.
AT NEW qase_serialnr.
CLEAR: l_line_check.
IF wa_ztab-qase_serialnr CS '-01'
OR wa_ztab-qase_serialnr CS '-02'.
grfk_values-rowtxt = 'gelötet'.
l_line_check = '0102'.
ELSEIF wa_ztab-qase_serialnr CS '-03'
OR wa_ztab-qase_serialnr CS '-04'.
grfk_values-rowtxt = 'geglüht'.
l_line_check = '0304'.
ELSEIF wa_ztab-qase_serialnr CS '-05'
OR wa_ztab-qase_serialnr CS '-06'.
grfk_values-rowtxt = 'unbehandelt'.
l_line_check = '0506'.
ELSE.
grfk_values-rowtxt = 'serialnr_wrong'.
ENDIF.
ENDAT.
***---------------------------------------------------->
AT NEW qapp_usern1.
* X-axis: values are:0,50,100,...,400
grfk_coltxt-coltxt = wa_ztab-qapp_usern1.
SHIFT grfk_coltxt-coltxt LEFT DELETING LEADING '0'.
APPEND grfk_coltxt.
UNASSIGN <fs_grenze>.
CLEAR: l_index, l_field.
l_index = sy-tabix.
CONCATENATE 'grfk_values-val' l_index INTO l_field.
ASSIGN (l_field) TO <fs_grenze>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
<fs_grenze> = 10.
APPEND grfk_values.
ENDAT.
IF l_line_check = '0102'.
UNASSIGN <fs_0102>.
CLEAR: l_index, l_field.
l_index = sy-tabix.
CONCATENATE 'grfk_values-val' l_index INTO l_field.
ASSIGN (l_field) TO <fs_0102>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
<fs_0102> = wa_ztab-cf_dgp.
ELSEIF l_line_check = '0304'.
UNASSIGN <fs_0304>.
CLEAR: l_index, l_field.
l_index = sy-tabix.
CONCATENATE 'grfk_values-val' l_index INTO l_field.
ASSIGN (l_field) TO <fs_0304>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
<fs_0304> = wa_ztab-cf_dgp.
ELSEIF l_line_check = '0506'.
UNASSIGN <fs_0506>.
CLEAR: l_index, l_field.
l_index = sy-tabix.
CONCATENATE 'grfk_values-val' l_index INTO l_field.
ASSIGN (l_field) TO <fs_0506>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
<fs_0506> = wa_ztab-cf_dgp.
ENDIF.
ENDLOOP.
My goal should be to fill the graphic with 4 Lines:
1 is boarderline.
2-3 are the lines with the looped values in "ztab"
Do I have to use references to write the values in into different rows of internal table "grfk_values"????
With this code I want to fill the itab which I need for the GFW_PRES_SHOW function.
The table I have to commit has the following structure:
-rowtxt
-val1
-val2
-val31
EDIT:
My current output are 2 lines the first has value 0 for each point and the second shows the correct values... The boarder which always should have value 10 is completly not shown.hopen this will help
report zrich_0001 .
data: begin of itab1 occurs 0,
fld1(10) type c,
fld2(10) type c,
fld3(10) type c,
end of itab1.
data: begin of itab2 occurs 0,
flda(10) type c,
fldb(10) type c,
fldc(10) type c,
end of itab2.
field-symbols: <fs_table> type table,
<fs_wa>,
<fs>.
data: mod_field(10) type c.
itab1-fld1 = '1'. itab1-fld2 = '2'. itab1-fld3 = '3'. append itab1.
itab1-fld1 = '4'. itab1-fld2 = '5'. itab1-fld3 = '6'. append itab1.
itab2-flda = 'A'. itab2-fldb = 'B'. itab2-fldc = 'C'. append itab2.
itab2-flda = 'D'. itab2-fldb = 'E'. itab2-fldc = 'F'. append itab2.
assign itab1[] to <fs_table>.
assign itab1 to <fs_wa>.
mod_field = 'FLD2'.
perform modify_table.
perform write_table.
assign itab2[] to <fs_table>.
assign itab2 to <fs_wa>.
mod_field = 'FLDC'.
perform modify_table.
perform write_table.
FORM modify_table *
form modify_table.
loop at <fs_table> into <fs_wa>.
assign component mod_field of structure <fs_wa> to <fs>.
<fs> = 'Modified'.
modify <fs_table> from <fs_wa>.
endloop.
endform.
FORM write_table *
form write_table.
loop at <fs_table> into <fs_wa>.
do.
assign component sy-index of structure <fs_wa> to <fs>.
if sy-subrc <> 0.
exit.
endif.
if sy-index = 1.
write:/ <fs>.
else.
write: <fs>.
endif.
enddo.
endloop.
endform.
regards
navjot
reward points if helpfull -
Using Field symbol to fetch data from another program
I have a requirement where i need to fetch value of a field from one of the function pool so i have written a sample progam to check the logic but its doest seems to work its giving dump.
Basically i want to know how to use <programname><fieldname> with fieldsymbol.
REPORT ztest1.
DATA test(25) VALUE 'ggg'.
submit ztest.
report ztest.
constants: lv_memory(25) type c value '(ZTEST1)TEST'.
field-symbols: <fs2> type char25 .
assign (lv_memory) to <fs2>.
write : <fs2>.
I am getting same field symbol assignment dumpHi Rahul,
You can use this concept in between the FUNCTION MODULES where both are
under same FUNCTION GROUP ( as both the FM's have same global memory area ).
And also if you are calling an FM or method from your program ,you can have the data of the calling program in that called FM or METHOD.
Hope this may help you.
Regards,
Smart Varghese -
Hi, can a field symbol be global in a static class?
Hello Kenneth
Please refer to the answer of Klaus Ziegler in the following thread
Re: Field symbols as Class Attributes
Regards
Uwe -
Reg: Field Symbol and Data Reference
Hi,
What is the difference Between a FieldSymbol and Data Reference.
could anyone explain with an example the difference.
The Link I am Going Through ---> [SAP HELP|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/frameset.htm]
I couldnt get a clear idea
regardsHi,
In ABAP/4 programs, field symbols are placeholders for existing fields. A field symbol does not physically reserve space for a field, but points to a field, which is not known until runtime of the program. Field symbols are comparable to the concept of pointers as used in the programming language C. In ABAP/4, however, there is no real equivalent to pointers in the sense of variables, which contain a memory address and can be used without the content operator. You can only work with the data object to which a field symbol points.
uF076 Concept of Field Symbols
Sometimes you only know which field you want to process, and how you want to process it, at runtime.
For this purpose, you can create field symbols in your program. At runtime, you can assign real fields to such field symbols. All operations, which you have programmed with the field symbol, are then carried out with the assigned field. After successful assignment, there is no difference in ABAP/4 whether you reference the field symbol or the field itself.
Field symbols can point to any data object in ABAP/4 and to structures defined in the ABAP/4 Dictionary.
You can create field symbols either without or with type specifications. In the first case, the field symbol adopts all the attributes of the assigned field. In the second case, the system checks during the assignment process whether the assigned field matches the type of the field symbol. Whichever applies, you must first assign a field to your field symbol before you can work with it in your program.
Field symbols provide some features that make them very flexible:
uF071 You can specify the offset and length of the assigned field as variables.
uF071 You can assign field symbols to other field symbols and even specify offset and length there.
uF071 Assignments to field symbols may extend beyond field boundaries. This allows effective access to regularly stored data.
uF071 You can force a field symbol to be of a different type and to have a different number of decimal places than the assigned field.
uF071 Field symbols may have a structure that you can use to point to individual components of structures.
Since you can assign data objects to field symbols which may not be known 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. Therefore, you should use field symbols only in cases where you are absolutely sure of what you are doing, or if there are no other ABAP/4 statements you can use to solve your problem. The advantage of field symbols is that they can improve response times in some cases.
uF076 Defining Field Symbols
uF0D8 Defining Field Symbols for Internal Fields
To define a field symbol for an internal data object, use the FIELD-SYMBOLS statement as follows:
Syntax-
FIELD-SYMBOLS <FS> [<type>].
This statement defines a field symbol <FS>.
for data reference follow this link
http://help.sap.com/saphelp_nw04s/helpdata/en/14/11e70b0c5c11d3b9350000e8353423/frameset.htm
Regards,
Flavya -
Field symbols not working in data transfer VOFM routine
Hi,
I have been trying to set a value using field symbols, however for some reasons its not working. I am using a field symbol in a data transfer routine and the value which I am trying to set is a standard field outside the VOFM routine code.
I am trying to set a field gla_subrc which is actually a changing parameter.
The actual paramter is gn_subrc of type sy-subrc and within the form the name is gla_subrc. I need to set this changing parameter gla_subrc using the data transfer routine.
Is there a specific rule that field symbols dont work for changing paramters within subroutine or is there a specific syntax.
The syntax I am using is
ASSIGN ('(SAPLV50S)gla_subrc') to <fs>.
I also used the local program name instead of main program but still that does not work. Tried using the actual parameter as well.
Can someone please help me in this.
Thanks & Regards,
Naresh.I need to stop outbound delivery creation against STO using vl10b transaction. The only way to stop creation is using data transfer delivery VOFM routine.
If i give an error message MESSAGE E001, this will give a hard error which is not acceptable. To avoid this, i use a perform message statment with message id and certain parameters which can displayed in a log.
However to make sure this message is displayed in log, I am clearing a work area having specific data needed for delivery creation.
Because of this clear, my error message gets captured in log but along with this another fake message is displayed in log which caused by the clear message.
The user gets confused as he now sees 2 messages, 1 which is correct and other 1 which is fake and that confuses him.
Data transfer routine is not the best place to give messages in log but we have very few options. The only way the system can give 1 message is if i set gla_subrc to 1. This is a variable which will help the system understand that the delivery should not be created as there is something wrong because the value is 1. Hence it will stop the creation and instead display whatever message i had passed to the log.
I need to somehow set this variable to 1 based on lot of analysis that has been done in the past.
Please let me know if there is any way by which we can fix this.
Thanks & Regards,
Naresh. -
Hi Experts,
I have a requirement to transfer field symbol (defined as table) contents into my internal table in my program.
The requirement is like this:
Loop at xtab.
CALL FUNCTION 'ARCHIVE_READ_OBJECT_BY_HANDLE'
EXPORTING
iv_handle = lv_handle
iv_read_class_data = 'CONTEXT'
CHANGING
ct_obj_data = lt_tables
lt_tables has multiple records relatin to 2 specific tables. The structure of lt_tables is 1. tabname, 2. data
data will be stored in lt_tables as --> MARA | Standard Table[3x2(15)
VBAP | Standard Table[2x4(18) and so on.
I need to get the records of MARA and VBAP into separate itabs.
filed-symbols <gt_mara> type standard table.
IF ls_tables-tabname = 'MARA'.
ASSIGN ls_tables-tabref->* TO <gt_mara>.
IF sy-subrc = 0.
logic to move <gt_mara> data into i_final shud be here.
refresh <gt_mara>.
endif.
endif.
endloop.
The issue is how to get the contents of <gt_mara> into an i_final.
There are going to be multpile records each time. We need to loop the table <gt_mara>. The records shud be shown in ALV output.Hi
I don't know if I undesrtand what you need:
DATA: t_obj_data TYPE as_t_tablebuffer.
DATA: w_obj_data TYPE astablebuffer.
FIELD-SYMBOLS: <fs_itab> TYPE ANY TABLE.
CALL FUNCTION 'ARCHIVE_READ_OBJECT_BY_HANDLE'
EXPORTING
iv_handle = lv_handle
* IV_READ_CLASS_DATA = 'CONTEXT'
CHANGING
ct_obj_data = t_obj_data
EXCEPTIONS
end_of_object = 1
internal_error = 2
wrong_access_to_archive = 3
OTHERS = 4.
IF sy-subrc <> 0.
ENDIF.
LOOP AT t_obj_data INTO w_obj_data.
ASSIGN w_obj_data-tabref->* TO <fs_itab>.
CASE w_obj_data-tabname.
WHEN 'MARA'. APPEND LINES OF <fs_itab> TO it_mara.
WHEN 'VBAP'. APPEND LINES OF <fs_itab> TO it_vbap.
ENDCASE.
UNASSIGN <fs_itab>.
ENDLOOP.
Max -
How to handle field symbols internal table values?
HI all,
I declared field string as below.The below code is working fine.
Data : ITAB TYPE STANDARD TABLE OF YAPOPLN, (Custom table).
wa_itab like line of ITAB.
field-symbol : <fs> type ITAB.
ASSIGN PARAM TO <FS>
LOOP AT <FS> INTO WA_ITAB.
WRITE:/ 'ABC'.
ENDLOOP.
But my requirement is that I dont want all the fields of the table YAPOPLN.My output contains only 2 fields of the table YAPOPLN,which contains total 4 fields.According to my requirement only 2 fields will be getting into one parameter PARAM(this is function module parameter,which is from ALV classes) from the user entered output,which contains only 2 fields.So the above code is not working properly because wa_itab contains 4 fields and giving short dump.
If I am declaring the internal table with the required fields(only 2 fields) and referring that internal table to field symbol <FS>
Data : BEGIN OF ITAB1 OCCURS 0,
FIELD1 LIKE YAPOPLN-FIELD1,
FIELD2 LIKE YAPOPLN-FIELD2,
END OF ITAB1.
field-symbol : <fs> LIKE ITAB1 OR <FS> TYPE ANY.
DATA :WA_ITAB1 LIKE LINE OF ITAB1.
ASSIGN PARAM TO <FS>
LOOP AT <FS> INTO WA_ITAB.
WRITE:/ 'ABC'.
ENDLOOP.
But when I am compiling this code i am getting the below error.I am gettting the same below error when even <FS> is also declared as <FS> TYPE ANY.
.'FS' is not an internal table or defined in TABLES.
Can anyone help me in this regard?
Thanks,
BalajiHello,
Try this way:
If both the type of internal tables are same then you can directly assign dynamic internal table to static internal table.
itab = <itab>.
Suppose you have field symbol internal table <itab> which is different in structure from ITAB.
Now, you can create <wa> as follow:
FIELD-SYMBOLS <wa>.
DATA wa TYPE REF TO DATA.
CREATE DATA wa TYPE LINE OF <itab>.
ASSIGN wa->* to <wa>.
This way your work area is read.
Using [ASSIGN COMPONENT|http://help.sap.com/saphelp_nw04/helpdata/EN/fc/eb3923358411d1829f0000e829fbfe/content.htm] syntax you can read required component of <wa>.
Finally you can use that value to load static internal table.
You can also refer to my thread on [Dynamic table|Re: Creating Dynamic table].
Hope this helps!
Thanks,
Augustin.
Edited by: Augustarian on Aug 20, 2009 10:06 AM -
How to move field symbol internal table to internal table with header line?
Dear all,
hi...hereby i would like to ask how i can move field symbol internal table to a internal table?
as i know field symbol internal table is without header line..
so, may i know how to do this....to move field symbol internal table to internal table which consist of header line and field and record will same as field symbol internal table...in additional, my field symbol internal table is dynamic table mean everytime will have flexible columns..?
Please advise...
Thanks
Regard,
ToToRo.
Edited by: @ToToRo@ on Aug 20, 2009 6:16 AMHello,
Try this way:
If both the type of internal tables are same then you can directly assign dynamic internal table to static internal table.
itab = <itab>.
Suppose you have field symbol internal table <itab> which is different in structure from ITAB.
Now, you can create <wa> as follow:
FIELD-SYMBOLS <wa>.
DATA wa TYPE REF TO DATA.
CREATE DATA wa TYPE LINE OF <itab>.
ASSIGN wa->* to <wa>.
This way your work area is read.
Using [ASSIGN COMPONENT|http://help.sap.com/saphelp_nw04/helpdata/EN/fc/eb3923358411d1829f0000e829fbfe/content.htm] syntax you can read required component of <wa>.
Finally you can use that value to load static internal table.
You can also refer to my thread on [Dynamic table|Re: Creating Dynamic table].
Hope this helps!
Thanks,
Augustin.
Edited by: Augustarian on Aug 20, 2009 10:06 AM -
Field symbols and field groups
Hi friends plz send me the answer for this query:
What are field symbols and field groups.? what is the"component idx of structure" clause with field groups?Hi,
A field group combines several existing fields together under one name
like
FIELD-GROUPS: fg.
then you can use one insert statement to insert values in fields of field-group.
INSERT f1 f2 ... INTO fg.
Field symbols
If u have experience with 'C', then understand this to be similar to a pointer.
It is used to reference another variable dynamically. So this field symbol will simply point to some other variable. and this pointer can be changed at runtime.
FIELD-SYMBOLS <FS>.
DATA FIELD VALUE 'X'.
ASSIGN FIELD TO <FS>.
WRITE <FS>.
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 Groups:
A field group is a user-defined grouping of characteristics and basic key figures from the EC-EIS or EC-BP field catalog.
Use
The field catalog contains the fields that are used in the aspects. As the number of fields grows, the field catalog becomes very large and unclear. To simplify maintenance of the aspects, you can group fields in a field group. You can group the fields as you wish, for example, by subject area or responsibility area. A field may be included in several field groups.
When maintaining the data structure of an aspect, you can select the field group that contains the relevant characteristics and basic key figures. This way you limit the number of fields offered.
Field Groups / Extracts
http://help.sap.com/saphelp_46c/helpdata/EN/9f/db9ede35c111d1829f0000e829fbfe/frameset.htm
Field Symbols
http://help.sap.com/saphelp_46c/helpdata/EN/fc/eb387a358411d1829f0000e829fbfe/frameset.htm
Regards,
Priyanka. -
Difference between Field symbols and field group
Hi experts,
Can you please advice me what is the difference between field symbols and field groups.
Thanks in advance,
Logu.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 Groups:
A field group is a user-defined grouping of characteristics and basic key figures from the EC-EIS or EC-BP field catalog.
Use
The field catalog contains the fields that are used in the aspects. As the number of fields grows, the field catalog becomes very large and unclear. To simplify maintenance of the aspects, you can group fields in a field group. You can group the fields as you wish, for example, by subject area or responsibility area. A field may be included in several field groups.
When maintaining the data structure of an aspect, you can select the field group that contains the relevant characteristics and basic key figures. This way you limit the number of fields offered.
A field group combines several existing fields together under one name
like
FIELD-GROUPS: fg.
then you can use one insert statement to insert values in fields of field-group.
INSERT f1 f2 ... INTO fg.
Field symbols
If u have experience with 'C', then understand this to be similar to a pointer.
It is used to reference another variable dynamically. So this field symbol will simply point to some other variable. and this pointer can be changed at runtime.
FIELD-SYMBOLS <FS>.
DATA FIELD VALUE 'X'.
ASSIGN FIELD TO <FS>.
WRITE <FS>.
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 Groups:
A field group is a user-defined grouping of characteristics and basic key figures from the EC-EIS or EC-BP field catalog.
Use
The field catalog contains the fields that are used in the aspects. As the number of fields grows, the field catalog becomes very large and unclear. To simplify maintenance of the aspects, you can group fields in a field group. You can group the fields as you wish, for example, by subject area or responsibility area. A field may be included in several field groups.
When maintaining the data structure of an aspect, you can select the field group that contains the relevant characteristics and basic key figures. This way you limit the number of fields offered.
example :
DATA: BEGIN OF SPTAB OCCURS 0,
line(1000), " or type string
END OF SPTAB.
DATA: IDX LIKE SY-INDEX.
field-symbols <FS1>.
split tb_sip AT ';' INTO table sptab.
LOOP AT SPTAB.
IDX = IDX + 1.
ASSIGN COMPONENT IDX OF STRUCTURE tb_detsip TO <FS1>.
If sy-subrc = 0.
<FS1> = SPTAB-line.
Endif.
Endloop.
append tb_detsip.
clear idx.
Field Groups / Extracts
http://help.sap.com/saphelp_46c/helpdata/EN/9f/db9ede35c111d1829f0000e829fbfe/frameset.htm
Field Symbols
http://help.sap.com/saphelp_46c/helpdata/EN/fc/eb387a358411d1829f0000e829fbfe/frameset.htm
Reward points if useful. -
Difference between Field symbols and Field groups
<b>Hi Friends,
can you tell me the differences between Field symbols and Field groups? with any examples preferably?
Regards
Dinesh</b>Hi Dinesh,
A field group combines several existing fields together under one name
like
FIELD-GROUPS: fg.
then you can use one insert statement to insert values in fields of field-group.
INSERT f1 f2 ... INTO fg.
<b>Field symbols</b>
If u have experience with 'C', then understand this to be similar to a pointer.
It is used to reference another variable dynamically. So this field symbol will simply point to some other variable. and this pointer can be changed at runtime.
FIELD-SYMBOLS <FS>.
DATA FIELD VALUE 'X'.
ASSIGN FIELD TO <FS>.
WRITE <FS>.
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 Groups:
A field group is a user-defined grouping of characteristics and basic key figures from the EC-EIS or EC-BP field catalog.
Use
The field catalog contains the fields that are used in the aspects. As the number of fields grows, the field catalog becomes very large and unclear. To simplify maintenance of the aspects, you can group fields in a field group. You can group the fields as you wish, for example, by subject area or responsibility area. A field may be included in several field groups.
When maintaining the data structure of an aspect, you can select the field group that contains the relevant characteristics and basic key figures. This way you limit the number of fields offered.
Field Groups / Extracts
http://help.sap.com/saphelp_46c/helpdata/EN/9f/db9ede35c111d1829f0000e829fbfe/frameset.htm
Field Symbols
http://help.sap.com/saphelp_46c/helpdata/EN/fc/eb387a358411d1829f0000e829fbfe/frameset.htm
Reward points if helpful.
Regards,
Hemant -
What are field symbols and field groups.? Have you used "component idx of s
What are field symbols and field groups.? Have you used "component idx of structure"
Field Symbols and field groups
Field Groups / Extracts
http://help.sap.com/saphelp_46c/helpdata/EN/9f/db9ede35c111d1829f0000e829fbfe/frameset.htm
Field Symbols
http://help.sap.com/saphelp_46c/helpdata/EN/fc/eb387a358411d1829f0000e829fbfe/frameset.htm
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 Groups:
A field group is a user-defined grouping of characteristics and basic key figures from the EC-EIS or EC-BP field catalog.
Use
The field catalog contains the fields that are used in the aspects. As the number of fields grows, the field catalog becomes very large and unclear. To simplify maintenance of the aspects, you can group fields in a field group. You can group the fields as you wish, for example, by subject area or responsibility area. A field may be included in several field groups.
When maintaining the data structure of an aspect, you can select the field group that contains the relevant characteristics and basic key figures. This way you limit the number of fields offered.
A field group combines several existing fields together under one name
like
FIELD-GROUPS: fg.
then you can use one insert statement to insert values in fields of field-group.
INSERT f1 f2 ... INTO fg.
Field symbols
If u have experience with 'C', then understand this to be similar to a pointer.
It is used to reference another variable dynamically. So this field symbol will simply point to some other variable. and this pointer can be changed at runtime.
FIELD-SYMBOLS <FS>.
DATA FIELD VALUE 'X'.
ASSIGN FIELD TO <FS>.
WRITE <FS>.
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 Groups:
A field group is a user-defined grouping of characteristics and basic key figures from the EC-EIS or EC-BP field catalog.
Use
The field catalog contains the fields that are used in the aspects. As the number of fields grows, the field catalog becomes very large and unclear. To simplify maintenance of the aspects, you can group fields in a field group. You can group the fields as you wish, for example, by subject area or responsibility area. A field may be included in several field groups.
When maintaining the data structure of an aspect, you can select the field group that contains the relevant characteristics and basic key figures. This way you limit the number of fields offered.
Field Groups / Extracts
http://help.sap.com/saphelp_46c/helpdata/EN/9f/db9ede35c111d1829f0000e829fbfe/frameset.htm
Field Symbols
http://help.sap.com/saphelp_46c/helpdata/EN/fc/eb387a358411d1829f0000e829fbfe/frameset.htm -
Field Symbol to internal table
Hi all,
I need to fill in a table without konwing in advance its structure. The solution is to use a field symbol and assign its content and <b>that works</b>.
DATA : TAB_DATA TYPE REF TO DATA ...
FIELD-SYMBOLS: <fs> TYPE ANY TABLE ...
ASSIGN tab_data->* TO <fs> ...
OK, I can read the content of my table directly from <fs> and display it in the layout of my BSP.
<b>But Now</b> : I want to sort this table when a user click on the header column of my BSP.
The problem it's that I don't know the structure of my table and the following code :
SORT <fs> BY event->column_key DESCENDING.
gives me the following error :
The specified type has no structure and therefore no component called "EVENT".
Any idea to solve this problem ?
Regards.Allan,
I am assuming that somehow you will be able to know the name of the column on which the user has clicked at runtime.
See if you can use something like this, provided you can get the name of the column at runtime.
data : column(10) type c value 'Column name'.
sort t_data by (column) descending.
regards,
Ravi
Note : Please mark the helpful answers.
Message was edited by: Ravikumar Allampallam
Maybe you are looking for
-
Crystal Reports for Visual Studio 2008 - dbf
Hello, I use both Visual Studio 2005 and 2008 on same PC. I can not work with dbf files (format foxpro2x, dbase IV) in VS 2005 and VS 2008. Q1. Work Crystal Reports for Visual Studio 2008 with database files - dbf (version foxpro2x, dbaseIV)? I get e
-
LSMW : Unable to Specify Files . Logical path incorrect ?
Hi Guys, I am trying to upload Goods movement Using the Standard LSMW 0110 program RM07MMBL. When I try to execute the step Specify Files ,system displays an error message "No Logical Path specified." The Source File is in my Local PC . When I click
-
ENHANCEMENT QPAP0001 (User Exit 'EXIT_SAPLQPAP_001
HI all, We are Using Variant Configuration, for this we have linked MIC's to Class character, When The Inspection Lot is created the Lower & Upper Limit in the specification comes as the character Value.it does not takes in to consedration the tolera
-
I'm trying to read �r�nler aras�nda k�yaslama yapmak i�in se�iniz what i get is �?r��nler aras��nda k��yaslama yapmak i��in se��iniz I am using String class to read it using URL class from a turkish website using the following code String pagedata=""
-
Compiling Enterprise JavaBeans and Its Interfaces
I've downloaded j2sdk1.4.1_02 and can't compile any code that imports javax.servlet.* and javax.servlet.http.* The install ZIP file has a JAVAX directory but no SERVLET or SERVLET.HTTP subdirectory. What's the going on? Am I missing some isoteric poi