Using field-symbols giving dump " the output area is too small. "
Hi All,
Good Afternoon.
I am creating a report using field-symbols. The purpose is :
"This development involves extracting all the fields and the entire data, of any SAP table, and download it as a ; seperator file."
For this I wrote following code:
*& Report ZTOOL
REPORT ztool1.
Tables***************************************
DATA : i_tab TYPE TABLE OF dfies WITH HEADER LINE.
Variables***************************************
DATA dref TYPE REF TO data.
FIELD-SYMBOLS <ft> TYPE ANY TABLE." with header line.
FIELD-SYMBOLS <fs> TYPE ANY .
DATA: w_heading(5000),
w_line(5000).
CONSTANTS sep TYPE c VALUE ';'.
Selection Screen*********************************
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS : p_tab LIKE dfies-tabname OBLIGATORY.
PARAMETERS : p_file(100) TYPE c .
PARAMETERS : p_lfile(100) TYPE c .
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
CALL FUNCTION 'GET_FIELDTAB'
EXPORTING
langu = sy-langu
ONLY = ' '
tabname = p_tab
WITHTEXT = 'X'
IMPORTING
HEADER =
RC =
TABLES
fieldtab = i_tab
EXCEPTIONS
internal_error = 1
no_texts_found = 2
table_has_no_fields = 3
table_not_activ = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
SELECT * FROM (p_tab) INTO <fs> .
endselect.
CREATE DATA dref TYPE STANDARD TABLE OF (p_tab).
ENDSELECT.
assign dref to <fs> casting.
ASSIGN dref->* TO <ft>.
SELECT & FROM (p_tab) INTO table <ft>.
OPEN DATASET p_lfile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT i_tab.
IF sy-index = 1.
w_heading = i_tab-fieldname.
ELSE.
CONCATENATE w_heading i_tab-fieldname INTO w_heading SEPARATED BY sep.
ENDIF.
ENDLOOP.
TRANSFER w_heading TO p_lfile.
LOOP AT <ft> into <ft>.
clear w_line.
LOOP AT i_tab.
ASSIGN COMPONENT i_tab-fieldname OF STRUCTURE <ft> TO <fs>.
IF sy-index = 1.
w_line = <fs> .
ELSE.
CONCATENATE w_line <fs> into w_line SEPARATED BY sep.
ENDIF.
ENDLOOP.
TRANSFER w_line TO p_file.
ENDLOOP.
The program is executed well till the statement :
SELECT * FROM (p_tab) INTO <fs> .
endselect.
But here it gives the following dump :
"Error analysis
In an Open SQL select, the output area used t
records must be at least as wide as the datab
records are being read.
In this particular case, the database table i
but the output area is only 2 bytes wide."
Can you please help me solve this problem.
Thanks in advance.
Hi Abhii,
Both are having the same number of fields.
The only problem is with the data and time (in my scenario). Here, actual length of date is 8 and maximum length is 10. and for time the actual length is 6 and maximum length is 8.
So, my work area it is taking only the actual length but not the maximum length because of this it is going to dump.
Can i have any thing which also considers the maximum length of any field at a domain level so that by work area bytes should match according to the db table byte length.
Thanks
rohith
Similar Messages
-
Err. E:"TRANSPORTING NO FIELDS" will not fill the output area.
Dear all,
Below are my codes and i keep getting this error
E:"TRANSPORTING NO FIELDS" will not fill the output area. The addition does not make sense here.
Any idea how to fix this?
The first bit...
TABLES: /BI0/MWBS_ELEMT.
DATA: I_MWBS_ELEMT LIKE /BI0/MWBS_ELEMT OCCURS 0 WITH HEADER LINE.
DATA: W_MWBS_ELEMT LIKE LINE OF I_MWBS_ELEMT.
Then second bit...
READ TABLE I_MWBS_ELEMT WITH KEY WBS_ELEMT = SOURCE_FIELDS-POSID TRANSPORTING NO FIELDS INTO W_MWBS_ELEMT.
IF SY-SUBRC IS INITIAL.
RESULT = W_MWBS_ELEMT-RESP_CCTR.
RETURNCODE = 0.
ELSE.
SELECT SINGLE * FROM /BI0/MWBS_ELEMT INTO W_MWBS_ELEMT
WHERE WBS_ELEMT = SOURCE_FIELDS-POSID
AND OBJVERS = 'A'.
IF SY-SUBRC IS INITIAL.
APPEND W_MWBS_ELEMT TO W_MWBS_ELEMT SORTED BY RESP_CCTR.
RESULT = W_MWBS_ELEMT-RESP_CCTR.
ELSE.
CLEAR RESULT.
ENDIF.
ENDIF.Hi
The error is here
READ TABLE I_MWBS_ELEMT WITH KEY WBS_ELEMT = SOURCE_FIELDS-POSID TRANSPORTING NO FIELDS INTO W_MWBS_ELEMT.
The addtion TRANSPORTING NO FIELDS is in conflit with addition INTO:
TRANSPORTING NO FIELDS means not to fill the work are
INTO mean fill a work area
So or u need to fill a work area or u don't need to fill a work area, but (from the code you've pasted) it seems u need to fill the work area W_MWBS_ELEMT, so your code should be:
READ TABLE I_MWBS_ELEMT INTO W_MWBS_ELEMT WITH KEY WBS_ELEMT = SOURCE_FIELDS-POSID.
IF SY-SUBRC IS INITIAL.
RESULT = W_MWBS_ELEMT-RESP_CCTR.
RETURNCODE = 0.
ELSE.
SELECT SINGLE * FROM /BI0/MWBS_ELEMT INTO W_MWBS_ELEMT
WHERE WBS_ELEMT = SOURCE_FIELDS-POSID
AND OBJVERS = 'A'.
IF SY-SUBRC IS INITIAL.
APPEND W_MWBS_ELEMT TO W_MWBS_ELEMT SORTED BY RESP_CCTR.
RESULT = W_MWBS_ELEMT-RESP_CCTR.
ELSE.
CLEAR RESULT.
ENDIF.
ENDIF.
Max -
The photos are far too small on Ipad ?
I need to find out why the photos are way too small on the Ipad. I used a filter on a photo then sent it to a friend . Way to small to use for any purpose.
any way to make larger?I have the same problem and cannot tackle it down yet. Using handbrake and itunes to sync movies and the subtitles are very small.
Hope someone could help. -
Just downloaded ios7 on my iPad2. Hate that I cannot see the items in my calendar. The letters are way too small and are grey in color. I need the fonts to be dark and very defined...I have health issues-poor vision.
Settings>General>Accessibility>Increase Contrast
Settings>General>Accessibility>Bold Text
are some settings that may help.
There are other settings there ...they may not be to your liking but try them all anyways.
But that's about all you can do for now...except to voice your opinion to Apple here:
http://www.apple.com/feedback/ipad.html -
I want to know why the Adobe Audition CS 5.5 loads on my new Lenovo Yoga 2 Pro with Windows 8, but the application window fonts are too small to read.
The device is probably equipped with a High DPI display. The most recent releases of Audition CC (7.1 and above) support High DPI displays, but older editions do not. You can reduce your resolution or adjust how fonts and text are scaled at your current resolution in the Windows Display Settings control panel to help improve this, but the need for multi-resolution assets and text support did not exist when Audition CS5.5 was released.
-
Fonts on the Guide are Way too small. How can I enlarge them?
We need to change the font for the guide so they are readable easier. How can we do that? Rosalene Walker
Sorry Ms. Walker but there are no adjustments nor have any been mentioned by Comcast. That being said, this issue is discussed quite often in this forum. If you use the search function at the top of the page you will find plenty of reading material on this issue.
We are hoping Comcast may add some color to the guide at some point but changing the font size is not likely.
Walker6300 wrote:
We need to change the font for the guide so they are readable easier. How can we do that? Rosalene Walker -
Going for dump while using field symbols
Hi all,
I am using field symbols in my program. Program is going dump for some company codes and working fine for some company codes.
I am confused. Please check this code where the error is shown.
LOOP AT i_final ASSIGNING <fs_final>.
AT NEW belnr.
if <fs_final>-wt_withcd = 'SF' or <fs_final>-wt_withcd = 'XF' OR <fs_final>- wt_withcd = 'WF'.
MOVE <fs_final> TO wa_final1.
g_qsatz = wa_final1-qsatz.
APPEND wa_final1 TO i_final1.
CLEAR wa_final1.
ENDIF.
ENDAT.
READ TABLE i_final1 ASSIGNING <fs_final1> WITH KEY belnr = <fs_final>-belnr.
IF <fs_final>-wt_withcd = 'SF'.
<fs_final1>-wt_withcd1 = <fs_final>-wt_withcd.
<fs_final1>-wt_qbshb1 = <fs_final>-wt_qbshb.
<fs_final1>-qsatz = <fs_final1>-qsatz + <fs_final>-qsatz.
ENDIF.
IF <fs_final>-wt_withcd = 'XF'.
<fs_final1>-wt_withcd2 = <fs_final>-wt_withcd.
<fs_final1>-wt_qbshb2 = <fs_final>-wt_qbshb.
<fs_final1>-qsatz = <fs_final1>-qsatz + <fs_final>-qsatz.
ENDIF.
IF <fs_final>-wt_withcd = 'WF'.
<fs_final1>-wt_withcd = <fs_final>-wt_withcd.
<fs_final1>-wt_qbshb = <fs_final>-wt_qbshb.
<fs_final1>-qsatz = <fs_final1>-qsatz + <fs_final>-qsatz.
ENDIF.
AT END OF belnr.
<fs_final1>-qsatz = <fs_final1>-qsatz - g_qsatz.
clear g_qsatz.
ENDAT.
ENDLOOP.
Please check the code and help me.
Thanks in advance,
ShalemHI Shalem
Please check this code:
LOOP AT i_final ASSIGNING <fs_final>.
AT NEW belnr.
if <fs_final>-wt_withcd = 'SF' or
<fs_final>-wt_withcd = 'XF' OR
<fs_final>- wt_withcd = 'WF'.
MOVE <fs_final> TO wa_final1.
g_qsatz = wa_final1-qsatz.
APPEND wa_final1 TO i_final1.
CLEAR wa_final1.
ENDIF.
ENDAT.
READ TABLE i_final1 ASSIGNING <fs_final1> WITH KEY belnr = <fs_final>-belnr.
IF sy-subrc EQ 0.
CASE <fs_final>-wt_withcd.
WHEN 'SF'.
<fs_final1>-wt_withcd1 = <fs_final>-wt_withcd.
<fs_final1>-wt_qbshb1 = <fs_final>-wt_qbshb.
WHEN 'XF'.
<fs_final1>-wt_withcd2 = <fs_final>-wt_withcd.
<fs_final1>-wt_qbshb2 = <fs_final>-wt_qbshb.
WHEN 'WF'.
<fs_final1>-wt_withcd = <fs_final>-wt_withcd.
<fs_final1>-wt_qbshb = <fs_final>-wt_qbshb.
ENDCASE.
<fs_final1>-qsatz = <fs_final1>-qsatz + <fs_final>-qsatz.
AT END OF belnr.
<fs_final1>-qsatz = <fs_final1>-qsatz - g_qsatz.
clear g_qsatz.
ENDAT.
ENDIF.
ENDLOOP.
Kind Regards
Eswar -
Using Field-Symbols in a user exit to change the importing parameter
Please don't ask why but I need to use a user exit, changing the importing parameter. I decided that I could do this using field-symbols.
Please excuse my ignorance but I have never used field symbols for something such as this.
Here is my goal: Loop through an internal table (im_document-item). When I find what I need I want to make a change to this line (not so hard if I am looping into a field symbol) and also append a line to the end of the table im_document-item.
I have the following so far:
DATA: wa_item TYPE accit,
wa_item_out type ACCIT_SUB.
FIELD-SYMBOLS: <document> type acc_document,
<accit> TYPE ACCIT.
LOOP AT im_document-item ASSIGNING <accit> where saknr = '0000211000'.
* Modify the curent line
wa_item = <accit>
* Append a new line into table im_document-item.
ENDLOOP.
How can I use field-symbols to append a line to this table? Please note that the table in question (im_document-item) is an importing only parameter.
Regards,
Davisthat will allow me to append an initial line with <accit> pointing to the line. Therefore I just have to modify <accit> and the new line will then have my changes?
Yep, that is exactly it. So after the APPEND statement, simply fill the fields of the <accit>.
append initial line to im_document-item ASSIGNING <accit>.
<accit>-field1 = 'Blah'.
<accit>-field2 = 'Blah'.
Regards,
Rich Heilman -
What r the benefit of using field symbols
hi all
what is the benefit of using field symbols and when is recommended to use it?
regardsIt Just assign the values directly to fieldsymbol and no need to used append.
It increases the performance of the program.
also check this
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/frameset.htm
Reward points if useful
Regards,
Vimal -
How can i write the bellow code using field symbols
data : it_mara type table of mara.
select * from mara
into it_mara.
delete it_mara where matnr = '100-100'
and meins = 'KG'.
if i do the same by using field symbols
i am getting data into <it_mara>
but
delete <it_mara> where matnr = '100-100'
and meins = 'KG'.
is showing syntax error
how to correct the error ?I think, DELETE does not allows to dynamically define the logical expression for the WHERE clausule.
Have you tried by filtering data in SELECT statement??
Something like:
if dataBase = 'MARA'.
append 'MATNR <> '100-100'' to Itab_Where[].
append 'AND MEINS <> 'KG'' to Itab_Where[].
endIf.
select * from (dataBase) where (Itab_Where) into table <my_table>.
this is possible, but I don't know if this fits your requirements. -
Perform setting OOP ALV for multiple reports using Field Symbols
Hi, Abapers ... i try to write a programme which using ONE oop ALV but 2 different structure internal table. the last result should be 2 radio button. first button is r_wbs and 2ns r_kpi. r_wbs will display 4 column answer and r_kpi will display 10 columns answer with different column name. i successfully implemented using FIELDS SYMBOLS but the problems i failed to perform customized setting forALV (report's tittle, column name, different layout etc) for 2 different reports. this is the programme. Please Give Opinion, simple example will be more helpful. Thanks You Very Much
*&this report experimental how to print into ONE alv
*&with 2 diffrent structure internal table
REPORT zfiroopalv.
SELECTION-SCREEN BEGIN OF BLOCK mode WITH FRAME TITLE text-002.
PARAMETERS r_wbs RADIOBUTTON GROUP mode DEFAULT 'X'.
PARAMETERS r_kpi RADIOBUTTON GROUP mode.
SELECTION-SCREEN END OF BLOCK mode.
CLASS lcl_main DEFINITION.
PUBLIC SECTION.
CLASS-DATA: md_wbs TYPE c LENGTH 1.
METHODS: process,
write.
DATA: mdo_data TYPE REF TO data.
TYPES: BEGIN OF st_wbs,
rsnum TYPE zmeime002a-rsnum,
rspos TYPE zmeime002a-rspos,
a TYPE zmmgitab01-menge,
b TYPE zmeime002a-bdmng,
c TYPE zmeime002a-bdmng,
d TYPE zmeime002a-bdmng,
e TYPE zmeime002a-bdmng,
f TYPE zmmgitab01-menge,
g TYPE zmmgitab01-menge,
END OF st_wbs.
TYPES: BEGIN OF st_kpi,
regio TYPE zmeime002a-regio,
gsber TYPE zmeime002a-gsber,
gtext TYPE zmeime002a-gtext,
x TYPE zmmgitab01-menge,
y TYPE zmmgitab01-menge,
z TYPE zmmgitab01-menge,
END OF st_kpi.
CLASS-DATA: it_wbs TYPE TABLE OF st_wbs,
wa_wbs LIKE LINE OF it_wbs.
CLASS-DATA: it_kpi TYPE TABLE OF st_kpi,
wa_kpi LIKE LINE OF it_kpi.
PRIVATE SECTION.
DATA: set_display_setting TYPE REF TO cl_salv_table.
DATA: display_settings TYPE REF TO cl_salv_display_settings.
DATA: salv_table TYPE REF TO cl_salv_table.
DATA: error TYPE REF TO cx_root.
DATA: errtext TYPE string.
ENDCLASS.
CLASS lcl_kpi DEFINITION INHERITING FROM lcl_main.
PUBLIC SECTION.
METHODS: process_kpi.
PRIVATE SECTION.
ENDCLASS.
* C.L.A.S.S lcl_main D.E.F.I.N.I.T.I.O.N
CLASS lcl_wbs DEFINITION INHERITING FROM lcl_main.
PUBLIC SECTION.
METHODS: process_wbs.
PRIVATE SECTION.
ENDCLASS.
* m.a.i.n. .p.r.o.g.r.a.m.
START-OF-SELECTION.
DATA: o_main TYPE REF TO lcl_main.
DATA: p_wbs TYPE c.
CREATE OBJECT o_main.
CASE 'X'.
WHEN r_wbs.
o_main->md_wbs = 'X'.
WHEN r_kpi.
o_main->md_wbs = ' '.
ENDCASE.
o_main->process( ).
o_main->write( ).
CLASS lcl_main IMPLEMENTATION.
*ENDMETHOD.
METHOD process. " NOTE: public method
DATA: o_main TYPE REF TO lcl_main,
o_wbs TYPE REF TO lcl_wbs,
o_kpi TYPE REF TO lcl_kpi.
CREATE OBJECT: o_wbs,o_kpi.
IF ( me->md_wbs = 'X' ).
CALL METHOD o_wbs->process_wbs( ). " NOTE: private method
GET REFERENCE OF me->it_wbs INTO me->mdo_data.
ELSE.
CALL METHOD o_kpi->process_kpi( ). " NOTE: private method
GET REFERENCE OF me->it_kpi INTO me->mdo_data.
ENDIF.
ENDMETHOD.
METHOD write.
FIELD-SYMBOLS:
<lt_outtab> TYPE table.
ASSIGN me->mdo_data->* TO <lt_outtab>.
cl_salv_table=>factory(
EXPORTING
list_display = if_salv_c_bool_sap=>false
IMPORTING
r_salv_table = salv_table
CHANGING
t_table = <lt_outtab>
salv_table->display( ).
ENDMETHOD.
ENDCLASS.
CLASS lcl_kpi IMPLEMENTATION.
METHOD process_kpi.
*********** run some select statement into it_kpi*******
ENDMETHOD.
ENDCLASS.
CLASS lcl_wbs IMPLEMENTATION.
METHOD process_wbs.
*********** run some select statement into it_wbs*******
ENDMETHOD.
ENDCLASS.Hi,
I had similar requirement wherein I was supposed to display different data using 2 different internal tables on a subscreen area.
The screen consists of two parts: 1) selection-screen with few input fields and two buttons 2) Subscreen area where the report need to be displayed. This report is displayed based on the button that the user is selecting. For this I have done the following things:
1. Capture the sy-ucomm when user is clicking on any of the two buttons in PAI. Then perform data fetch operation.
MODULE USER_COMMAND_9003 INPUT.
CASE OK_CODE.
WHEN 'DETAIL'.
GV_RPT = OK_CODE.
PERFORM F_GET_DETAIL_DATA.
WHEN 'REPORT'.
GV_RPT = OK_CODE.
PERFORM F_GET_REPT_DATA.
ENDCASE.
ENDMODULE. " USER_COMMAND_9003 INPUT
2. Declare two different ALV's with the fieldcat similar to 2 internal tables respectively. Use the above sy-ucomm PBO to call appropriate ALV.
MODULE DISPLAY_ALV OUTPUT.
IF GV_RPT EQ 'DETAIL'.
PERFORM F_FIELDCAT_DETAIL.
PERFORM F_LAYOUT_DETAIL.
PERFORM F_EXCLUDE_TOOLBAR_DETAIL.
PERFORM F_DISPLAY_ALV_DETAIL.
ELSEIF GV_RPT EQ 'REPORT'.
PERFORM F_FIELDCAT_REPT.
PERFORM F_LAYOUT_REPT.
PERFORM F_EXCLUDE_TOOLBAR_REPT.
PERFORM F_DISPLAY_ALV_REPT.
ENDIF.
ENDMODULE. " DISPLAY_ALV OUTPUT
3. Before displaying ALV you need to free the container and ALV.
FORM F_DISPLAY_ALV_DETAIL .
IF GC_CONTAINER_ES IS NOT INITIAL.
CALL METHOD GC_CONTAINER_ES->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
IF GC_ALV_GRID_ES IS NOT INITIAL.
CALL METHOD GC_ALV_GRID_ES->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
IF GC_CONTAINER_TB IS NOT INITIAL.
CALL METHOD GC_CONTAINER_TB->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
IF GC_ALV_GRID_TB IS NOT INITIAL.
CALL METHOD GC_ALV_GRID_TB->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
CREATE OBJECT GC_CONTAINER_ES
EXPORTING
CONTAINER_NAME = 'CC_9003'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6.
CREATE OBJECT GC_ALV_GRID_ES
EXPORTING
I_PARENT = GC_CONTAINER_ES
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5.
CALL METHOD GC_ALV_GRID_ES->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = GS_LAYOUT_ES
IT_TOOLBAR_EXCLUDING = GT_TOOLBAR_ES
CHANGING
IT_OUTTAB = GT_ES_REPT
IT_FIELDCATALOG = GT_FIELDCAT_ES
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
ENDFORM. " F_DISPLAY_ALV_DETAIL
Similarly define the FORM F_DISPLAY_ALV_REPT.
Hope this will be useful for you. If you have any more queries let me know. -
can anyone tell me how to use field symbols. What effect it has on performance of a program?
what r its avantages?
iam working on a report where iam facing a lot of problems in performance issue. can anyone tell how field symbols are useful in this regard?
thanx to allCheck the below links
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm
FIELD-SYMBOLS
Basic form
FIELD-SYMBOLS <fs>.
Additions
1. ... STRUCTURE s DEFAULT wa
2. ... TYPE t
3. ... TYPE LINE OF t
4. ... LIKE s
5. ... LIKE LINE OF s
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>.
TABLES SFLIGHT.
ASSIGN SFLIGHT-PLANETYPE TO <PT>.
WRITE <PT>.
Addition 1
... STRUCTURE s DEFAULT wa
Effect
Assigns any (internal) field string or structure to the field symbol from the ABAP/4 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.
Addition 2
... TYPE t
Addition 3
... TYPE LINE OF t
Addition 4
... LIKE s
Addition 5
... LIKE LINE OF s
Effect
You can use additions 2 to 5 to type field symbols in the same way as FORM parameters (see also Type assignment of subroutine parameters). ASSIGN performs the same type checks as with USING parameters of FORM s. -
How to use field symbol in select
Hi,
CONCATENATE 'WTG0' LV_MON INTO LV_FNAME.
ASSIGN (LV_FNAME) TO <FS>.
SELECT SINGLE <FS> FROM COSP INTO LV_SAPRST
WHERE OBJNR = LV_OBJ AND GJAHR = LV_YEAR AND WRTTP = '4' AND KSTAR = GT_INOUT-SAKNR
Error message : Unknown column name "<FS>" . field list. . field list. field list.
actually , if i use if command, i can do, but i want to use simple code by fieldsymbol.
is it possible in select command?
Thanks in advance
BenjaminHi
Hope it will help you.
reward if help.
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.
Related
ASSIGN, DATA
Additional help
Declaring Field Symbols -
How to use field symbols in program
how to use field symbols can any one explain with example please..
Regards,
venki...Hi
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.
<b>Reward points for useful Answers</b>
Regards
Anji -
How to use Field-symbol with dynamic select query
Can anybody tell me, how to use field-symbols in the dynamic select query.
FIELD-SYMBOLS <fs> { typing | STRUCTURE struc DEFAULT dobj }.
1. ... typing
2. ... STRUCTURE struc DEFAULT dobj
The FIELD-SYMBOLS statement declares a field symbol <fs>. The name conventions apply to the name fs. The angle brackets of the field symbols indicate the difference to data objects and are obligatory. You can declare field symbols in any procedure and in the global declaration section of an ABAP program, but not in the declaration section of a class or an interface. You can use a field symbol in any operand position in which it is visible and which match the typing defined using typing.
After its declaration, a field symbol is initial - that is, it does not reference a memory area. You have to assign a memory area to it (normally using the ASSIGN statement) before you can use it as an operand. Otherwise an exception will be triggered.
eg.
FIELD-SYMBOLS <fs> TYPE ANY.
DATA: BEGIN OF line,
string1(10) VALUE '0123456789',
string2(10) VALUE 'abcdefghij',
END OF line.
WRITE / line-string1+5.
ASSIGN line-string1+5(*) TO <fs>.
WRITE / <fs>.
output:
56789
56789
reward if helpful
anju
Maybe you are looking for
-
I cannot figure out why my templates do not show up in Outlook, when I manually update the AD RMS task scheduler to run the templates get pulled and placed into the C:\Users\%%\AppData\Local\Microsoft\DRM\Templates but when I launch outlook they are
-
I have raised a question in OTN yesterday "https://forums.oracle.com/forums/message.jspa?messageID=10798738#10798738" but stil i am not able to get the connection working.. I need some more clarifications in it. can some one suggest Regards Vivekk Ed
-
We would like to enable PDF file scanning from our graphing tool, but need Adobe to provide a 64 bit version of nppdf32.dll for browser support. We provide this scanning functionality from the 32 bit versions of Ansys Simplorer and Ansys Maxwell, bu
-
Urgent : Sizing MDI Window for Forms running on Web
Hi, I am using Developer 6.0 and deploying forms on Web. I use SEPERATE_FRAME = YES in my HTML so that the form appears outside the browser in a seperate Window. The problem I am facing is the initial size of the MDI Window is very small compared to
-
Can I use my new imac bought in US in europe? 230V?
hi, do you know if I can use my new imac (latest model) bought in US in europe? 230V?