Wacth points on Field symbols
Hi Experts,
Is it possible to create a watch point on Field symbols?
If so please explain the procedure.
Ex:
LOOP AT p_c_t_data ASSIGNING <fs_c_t_data>.
ENDLOOP.
Iam trying to create watchpoint on KUNNR field of the internal table i.e <fs_c_t_data>-KUNNR, it is
showing wacth point created but when i press F8 it is not stopping at the specified value ( Value is there
in internal table).
Could you please help anyone on this.
Thanks in Advance
Shaik
Hi Shaik,
It is not possible to create watch point for field-symbols.Technically field symbol wont allocate any memory before assign in other words field symbols cannot be recognised unless the assign statement is triggered.
Thanks and Regards,
Srini...
Similar Messages
-
How to access the value of a field of a field symbol.
Hello All,
i need to access the value of a field in a field symbol. But when i am trying to get the value like <FS>-POSNR, it's showing that that the <FS> has no structure.
In my program, the field itself that i need to check should be dynamic. ie i'll get the field in a variable and i need to find the value of that field.
Am pasting my code below, please tell me what needs to be done.
here in my sample code i am moving the entry of the <FS> into a work area structure. But in my actual program, i gets the structure as a parameter. So is there any way i can declare a work area dynamically...
FUNCTION z_39181_dyn_fs_60758.
""Local interface:
*" IMPORTING
*" REFERENCE(PARAMETER) TYPE VBELN
*" TABLES
*" DATA_TAB
BREAK-POINT.
FIELD-SYMBOLS <fs> TYPE ANY.
FIELD-SYMBOLS <fs1> TYPE ANY.
FIELD-SYMBOLS <fstab> TYPE ANY TABLE.
DATA name(5) VALUE 'POSNR'.
FIELD-SYMBOLS <f> TYPE ANY.
DATA: dref TYPE REF TO data,
dref1 TYPE REF TO data,
dref2 TYPE REF TO data.
DATA: lv_lips TYPE string.
DATA: lv_lipsfld TYPE string,
lv_fld TYPE string,
lw_lips TYPE lips.
lv_lips = 'LIPS'.
lv_fld = 'LW_lips-POSNR'.
CREATE DATA dref1 TYPE (lv_lips).
CREATE DATA dref TYPE STANDARD TABLE OF (lv_lips).
CREATE DATA dref2 LIKE LINE OF data_tab.
ASSIGN dref->* TO <fstab>.
ASSIGN dref1->* TO <fs>.
assign dref2->* to <fs
<fstab> = data_tab[].
LOOP AT <fstab> INTO <fs>.
lw_lips = <fs>.
WRITE lw_lips-vbeln.
ASSIGN (lv_fld) TO <fs1>.
write <fs>
ENDLOOP.
Helpful answers will be rewarded...Use syntax
ASSIGN COMPONENT name OF STRUCTURE struc TO <fs>. -
Very Urgent: how to define field symbols in class using se24 Points assured
hi all
I am new to abap oo programming. I am using se24 to build a class
where some methods have code which involves working with field sybmols but i am not able to figure out way for how to define field symbols in the attributes section.
I tried defining like : fld_sym type ref to dbtab-fld
but in the method implementation if i try to use it like assign fld to <fld_sym> there it says fld_sym is not defined as a field symbol.
So can anyone please guide me how to define field symbols in se24.
Also what should be the general steps while creating a class using se24.
Points assured
thanksHi
Global classes are like Global fun modules in which the Methods and code is already written and is mainly used for Reusability purpose.
Goto SE24 tcode and see the std global classes like
CL_ABAP_CHAR_UTILITIES
see the links
chk out the links below:
General Tutorial for OOPS
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
Have a look at these links for OO ABAP.
http://www.sapgenie.com/abap/OO/
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
http://www.allsaplinks.com/
http://www.sapgenie.com/abap/controls/index.htm
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
SDN Series:
https://www.sdn.sap.com/irj/sdn/developerareas/abap?rid=/webcontent/uuid/35eaef9c-0b01-0010-dd8b-e3b0f9ed7ccb [original link is broken]
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf
Basic concepts of OOPS
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b6cae890-0201-0010-ef8b-f970a9c41d47
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1591ec90-0201-0010-3ba8-cdcd500b17cf
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
http://www.henrikfrank.dk/abapuk.html
http://www.erpgenie.com/abap/OO/
Reward oints if useful,
Aleem. -
Hi all,
I want to declare a field symbol <fs> in a class, & to use it in different methods of the same class.
But in attributes of the class, how i declare field symbol in a class.
I m not able to do this...
<b>Pleas assist me..& have ur points.</b>
Regards,
pradeep phogatPradeep,
See this thread. It gives details about field symbol used in a standard class. This should give you some idea.
Re: Field Symbol
ashish -
Using field symbols in OOPs programming...have ur points.
Hi all,
I want to use field symbols in OOPS programming like this...
But the system is giving me dump....help me.
START-OF-SELECTION.
CREATE OBJECT OBJ.
FIELD-SYMBOLS : <AB> TYPE ANY.
ASSIGN OBJ TO <AB>.
CALL METHOD <AB>->add
EXPORTING
a = 4
b = 6
changing
c = Z
WRITE : / Z.check the code below
TYPES: BEGIN OF t_struct,
col1 TYPE i,
col2 TYPE i,
END OF t_struct.
DATA: dref1 TYPE REF TO data,
dref2 TYPE REF TO data.
FIELD-SYMBOLS: <fs1> TYPE t_struct,
<fs2> TYPE i.
CREATE DATA dref1 TYPE t_struct.
ASSIGN dref1->* TO <fs1>.
<fs1>-col1 = 1.
<fs1>-col2 = 2.
dref2 = dref1.
ASSIGN dref2->* TO <fs2> CASTING.
WRITE / <fs2>.
GET REFERENCE OF <fs1>-col2 INTO dref2.
ASSIGN dref2->* TO <fs2>.
WRITE / <fs2>.
reward points if helpful......... -
FIELD-SYMBOLS as parameter subroutine that point to table
Hi everyone,i have question. We often send table through subroutine using keyword TABLE.
FORM f_xxx TABLES pt_xxx
Now my question is possible send this internal table through field symbols? If so, how to do this?
1. FORM f_xxx USING <fs_xxx> STRUCTURE ty_xxx or
2. FORM f_xxx CHANGING <fs_xxx> STRUCTURE .... or
3. FORM f_yyy TABLES <fs_yyy>
Thank you.
Regards,
SatriaHi everyone,i have question. We often send table through subroutine using keyword TABLE.
FORM f_xxx TABLES pt_xxx
Now my question is possible send this internal table through field symbols? If so, how to do this?
1. FORM f_xxx USING <fs_xxx> STRUCTURE ty_xxx or
2. FORM f_xxx CHANGING <fs_xxx> STRUCTURE .... or
3. FORM f_yyy TABLES <fs_yyy>
Thank you.
Regards,
Satria -
Field symbols and READ TABLE with system code 4
Hi,
I have a hashed table and I am using field symbols to point to it to retrieve the field content. I then use it in the READ TABLE statement in the following way:
Loop at x_data assign <fs>.
ASSIGN COMPONENT 'xxx' OF STRUCTURE <fs> TO <c1>.
ASSIGN COMPONENT 'xxx' OF STRUCTURE <fs> TO <c2>.
READ TABLE ZZZZ assign <fs> with table key a1 = <c1>
a2 = <c2>.
If sy-subrc = 0.
endif.
I ran the debugger and I keep getting a 4. I am not able to get the value from a1 and a2 to see what it is and why it is causing a 4 sy-subrc. I know the value from the hashed table and the values c1 and c2 are the same, so the sy-subrc should be 0.
How would I read a hashed table using field symbols? I know that usig a standard table, I have to sort the table on the key fields() before I actually can do the READ TABLE using the binary search.
Please advise. Thanks
RTHai Rob
Go through the following Code
Field-Symbols are place holders for existing fields.
A Field-Symbol does not physically reserve space for a field but points to a field, which is not known until run time of the program.
Field-Symbols are like Pointers in Programming language C .
Syntax check is not effective.
Syntax :
Data : v1(4) value abcd.
Field-symbols <fs>.
Assign v1 to <fs>.
Write:/ <fs>.
DATA: BEGIN OF LINE,
COL1 TYPE I,
COL2 TYPE I,
END OF LINE.
DATA ITAB LIKE SORTED TABLE OF LINE WITH UNIQUE KEY COL1.
FIELD-SYMBOLS <FS> LIKE LINE OF ITAB.
DO 4 TIMES.
LINE-COL1 = SY-INDEX.
LINE-COL2 = SY-INDEX ** 2.
APPEND LINE TO ITAB.
ENDDO.
READ TABLE ITAB WITH TABLE KEY COL1 = 2 ASSIGNING <FS>.
<FS>-COL2 = 100.
READ TABLE ITAB WITH TABLE KEY COL1 = 3 ASSIGNING <FS>.
DELETE ITAB INDEX 3.
IF <FS> IS ASSIGNED.
WRITE '<FS> is assigned!'.
ENDIF.
LOOP AT ITAB ASSIGNING <FS>.
WRITE: / <FS>-COL1, <FS>-COL2.
ENDLOOP.
The output is:
1 1
2 100
4 16
Thanks & regards
Sreenivasulu P -
Loop at field-symbol (any table) into string ?
Hi Everyone,
I need little help, I have a requirement to extract table content with columns names as the header.
After doing some search I figured out the best way to this since table name will be only avaialbe at runtime through
a selection field . my problem is to loop through field-symbol and convert a structure to string value so that I can
write to the file.
REPORT zlab_tbl_export.
DATA table_name(30) VALUE 'ZSMARTTS_HTML'.
DATA v_file(100) VALUE 'c:\sap_export.txt'.
DATA line(1000).
DATA: o_data TYPE REF TO data.
CREATE DATA o_data TYPE TABLE OF (table_name).
FIELD-SYMBOLS: <table> TYPE ANY TABLE.
ASSIGN o_data->* TO <table>.
SELECT * UP TO 100 ROWS FROM (table_name) INTO TABLE <table>.
OPEN DATASET v_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
>>>>>>> LOOP at <table> into line. >>>>>>>>>>>> " Here the code breaks and fail
TRANSFER line to v_file.
WRITE :/ line.
ENDLOOP.
CLOSE DATASET v_file.
Exception Message
|Error analysis |
| You attempted to move one data object to another. |
| This is not possible here because the conversion of a data object |
| of type "v" to type "C" is not supported. |
| |
| List of internal ABAP types: |
| |
| C Text (Character) |
| N Numerical text |
| D Date (YYYYMMDD) |
| T Time (HHMMSS) |
| X Hexadecimal |
| I Integer |
| P Packed number |
| F Floating point number |
| |
| h Internal table |
| r Object reference |
| l Data reference |
| g String of type C |
| y String of type X |
| s 2-byte integer with plus/minus sign |
| b 1-byte integer without plus/minus sign |
| u Structure (flat structure) |
| v Structure (deep structure) |Hi Everyone, I need little help, I have a requirement to extract table content with columns names as the header. After doing some search I figured out the best way to this since table name will be only avaialbe at runtime through a selection field . my problem is to loop through field-symbol and convert a structure to string value so that I can write to the file.
thie is the code
REPORT zlab_tbl_export.
DATA table_name(30) VALUE 'ZSMARTTS_HTML'.
DATA v_file(100) VALUE 'c:\sap_export.txt'.
DATA line(1000).
DATA: o_data TYPE REF TO data.
CREATE DATA o_data TYPE TABLE OF (table_name).
FIELD-SYMBOLS: <table> TYPE ANY TABLE.
ASSIGN o_data->* TO <table>.
SELECT * UP TO 100 ROWS FROM (table_name) INTO TABLE <table>.
OPEN DATASET v_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP at <table> into line. " Fail here
TRANSFER line to v_file.
WRITE :/ line.
ENDLOOP.
CLOSE DATASET v_file.
and this is the exception:
Error analysis
You attempted to move one data object to another.
This is not possible here because the conversion of a data object
of type v to type C is not supported.
Edited by: Misbah on Jan 7, 2010 11:50 PM -
Field symbol has not yet been assigned. ???
Dear Experts ,
W hen i tried to execute my program this error appears :
Short text
Field symbol has not yet been assigned.
What happened?
Error in the ABAP Application Program
The current ABAP program "SAPLSLVC" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
You attempted to access an unassigned field symbol
(data segment 32821).
This error may occur if
- You address a typed field symbol before it has been set with
ASSIGN
- You address a field symbol that pointed to the line of an
internal table that was deleted
- You address a field symbol that was previously reset using
UNASSIGN or that pointed to a local field that no
longer exists
- You address a global function interface, although the
respective function module is not active - that is, is
not in the list of active calls. The list of active calls
can be taken from this short dump.
and Here is my CODE :
*& Report ZPO
Report ZPO1.
type-pools slis.
PARAMETERS : PO_Doc like EKBE-EBELN DEFAULT '4800000007'.
PARAMETERS : Plant TYPE WERKS DEFAULT '1000'.
PARAMETERS : PO_ORG TYPE EKORG DEFAULT ''.
data TtlS type mara-wesch .
data TtlH type mara-wesch .
data Ttl type mara-wesch .
data ZEKBE type TABLE OF EKBE.
data ZEKBER type EKBE.
data ZEKPO type TABLE OF EKPO.
data ZEKPOR type EKPO.
data ZEKKOR TYPE EKKO.
data ZNAME1F type LFA1-LIFNR.
data ZWGBEZF TYPE T023T-WGBEZ.
data i type n.
data counter type n.
types : begin of SBAGDS,
Serial Type n, "Purchase Order
EBELN like EKKO-EBELN, "Purchase Order
MATNR like EKPO-MATNR, "Material
TXZ01 like EKPO-TXZ01, "Short Text
MATKL like EKPO-MATKL, "Material Group
WGBEZ like T023T-WGBEZ, "Material Group Desc"
SUBMI like EKKO-SUBMI, "GPM
CHARG like EKBE-CHARG, "Batch
LIFNR like EKKO-LIFNR, "Vendor
NAME1 like LFA1-NAME1, "Vendor Name
RECV like mara-wesch, "Received Quantity
REVR like mara-wesch, "Reversed Quantity
DELV like mara-wesch, "Delivered Quantity
end of SBAGDS .
DATA : BAGDS TYPE SBAGDS OCCURS 0 WITH HEADER LINE.
data Struc like BAGDS.
data: gr_table like BAGDS OCCURS 0 WITH HEADER LINE.
data: gt_fieldcat type slis_t_fieldcat_alv, gt_outtab type SBAGDS occurs 0 with header line.
INITIALIZATION.
i = 0.
counter = 0 .
perform field_cat_init using gt_fieldcat[].
FORM field_cat_init using rt_fieldcat type slis_t_fieldcat_alv.
data: ls_fieldcat type slis_fieldcat_alv,
pos type i value 1.
clear LS_FIELDCAT.
*Column 1
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'Serial'.
ls_fieldcat-SELTEXT_L = 'Serial'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 2
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'EBELN'.
ls_fieldcat-SELTEXT_L = 'Purchase Order'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 3
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'MATNR'.
ls_fieldcat-SELTEXT_L = 'Material'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 4
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'TXZ01'.
ls_fieldcat-SELTEXT_L = 'Short Text'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 5
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'MATKL'.
ls_fieldcat-SELTEXT_L = 'Material Group'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 6
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'WGBEZ'.
ls_fieldcat-SELTEXT_L = 'Material Group Desc'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 7
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'SUBMI'.
ls_fieldcat-SELTEXT_L = 'GPM'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 8
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'CHARG'.
ls_fieldcat-SELTEXT_L = 'Batch'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 9
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'LIFNR'.
ls_fieldcat-SELTEXT_L = 'Vendor'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 10
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'NAME1'.
ls_fieldcat-SELTEXT_L = 'Vendor Name'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 11
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'RECV'.
ls_fieldcat-SELTEXT_L = 'Received Quantity'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 12
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'REVR'.
ls_fieldcat-SELTEXT_L = 'Reversed Quantity'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
*Column 13
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'DELV'.
ls_fieldcat-SELTEXT_L = 'Delivered Quantity'.
ls_fieldcat-DDICTXT = 'L'.
append ls_fieldcat to rt_fieldcat.
clear ls_fieldcat.
pos = pos + 1.
endform.
START-OF-SELECTION.
select SINGLE * from EKKO into ZEKKOR where EBELN = PO_DOC.
select SINGLE * from EKPO into ZEKPOR where EBELN = PO_DOC.
select SINGLE NAME1 from LFA1 into ZNAME1F where LIFNR = ZEKKOR-LIFNR.
* ' Buliding Structure
Struc-EBELN = ZEKPOR-EBELN.
Struc-SUBMI = ZEKKOR-SUBMI.
Struc-LIFNR = ZEKKOR-LIFNR.
Struc-Name1 = ZNAME1F.
select * from EKPO into TABLE ZEKPO where EBELN = PO_Doc and WERKS = plant.
LOOP at ZEKPO into ZEKPOR.
select SINGLE WGBEZ from T023T into ZWGBEZF WHERE MATKL = ZEKPOR-MATKL .
counter = counter + 1.
* ' Buliding Structure
Struc-Serial = counter.
Struc-MATNR = ZEKPOR-MATNR.
Struc-TXZ01 = ZEKPOR-TXZ01.
Struc-MATKL = ZEKPOR-MATKL.
Struc-WGBEZ = ZWGBEZF.
* Calcualting Debit transactions from PO History
select * from EKBE into table ZEKBE where EBELN = PO_Doc and MATNR = ZEKPOR-MATNR and EBELP = ZEKPOR-EBELP and BWART NOT LIKE '' and SHKZG = 'S'.
LOOP AT ZEKBE INTO ZEKBER.
TtlS = TtlS + ZEKBER-MENGE.
ENDLOOP.
* ' Buliding Structure
Struc-CHARG = ZEKBER-CHARG.
Struc-RECV = TtlS.
Ttl = TtlS.
clear TtlS.
* Calcualting Credit transactions from PO History
select * from EKBE into table ZEKBE where EBELN = PO_Doc and MATNR = ZEKPOR-MATNR and EBELP = ZEKPOR-EBELP and BWART NOT LIKE '' and SHKZG = 'H'.
LOOP AT ZEKBE INTO ZEKBER.
TtlH = TtlH + ZEKBER-MENGE.
ENDLOOP.
* ' Buliding Structure
Struc-REVR = TtlH.
* Calculating Total Delivered
Ttl = Ttl - TtlH.
clear TtlH.
* ' Buliding Structure
Struc-DELV = Ttl.
clear Ttl.
* Writtng ITAB
APPEND Struc to BAGDS.
ENDLOOP.
* Reading ITAB
* WRITE : / , 'ITAB Begin : ' .
* loop at BAGDS into Struc.
* counter = counter + 1.
* write : /,'Serial : ',counter.
* write : / ,'PO : ',Struc-EBELN.
* write : / ,'Vendor : ',Struc-LIFNR.
* write : / ,'Vendor Name : ',Struc-NAME1.
* write : / ,'Material : ',Struc-MATNR.
* write : /,'Short Text: ',Struc-TXZ01.
* write : / ,'Model : ',Struc-MATKL.
* write : / ,'Model Desc : ',Struc-WGBEZ.
* write : /,'GPM : ',Struc-SUBMI.
* write : /,'Lot : ',Struc-CHARG.
* write : /,'Received : ',Struc-RECV.
* write : /,'Reversed : ',Struc-REVR.
* write : /,'Delivered : ',Struc-DELV,/,/,/.
* ENDLOOP.
* Call ALV Grid Viewer
*BREAK-POINT.
gr_Table[] = BAGDS[].
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'SBAGDS'
IT_FIELDCAT = gt_fieldcat[]
TABLES
T_OUTTAB = gr_Table.
Please Advise
Edited by: Sap Sap on Jul 27, 2009 12:18 PM
Edited by: Sap Sap on Jul 27, 2009 12:22 PM
Edited by: Sap Sap on Jul 27, 2009 12:22 PMHi,
The problem seems to be in your ALV grid display.
The reason must be your field catalog.
Just check your fieldcatalog.
The value in the fieldname field of the fieldcatalog should be same as the fieldname in your internal table and should be in capital letters.
Probably you must have mistyped some field.
Kinldy check.
Regards,
Ankur Parab -
Field-symbols v/s Object references in OO-ABAP
Hi,
can anyone please tell me what is the difference between using field-symbols and object references in OO ABAP? Is there a specific need for field-symbols now that we have references?
Thanks.
Shakul.Hi ,
Please note that both Field symbols & Object References are different .
You can use Field symbols during the following situations
1) When you want to modify the value of internal table, the field symbol would be useful since you do not have to use any Modify statement as in case of work area. The Field symbol works as a pointer and any changes to the field symbol will directly affect the value of the internal table
2) Make sure that you do not reassign the field symbol within a Loop iteration
3) Field symbols are useful when you work with dynamic internal tables ( tables whose structure is determined during run time)
4) After Read an internal table ( Read itab...) into a Field symbol, make sure you do a Sy-subrc check or check if the field symbol is assigned.IF not this will give you a run time error
You can use Object References while creating an object to a class. They are instances of a class.
Thanks,
Chakram Govindarajan -
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 -
RUn time error while saving po Field symbol has not yet been assigned.
Hi Experts,
I am getting abap dump while saving PO in ME21N plz seee the below dump plzzzzzzzzzzzzzzzzzzzzz help me
Runtime Errors GETWA_NOT_ASSIGNED
Date and Time 19.06.2009 11:24:46
Short dump has not been completely stored (too big)
Short text
Field symbol has not yet been assigned.
What happened?
Error in the ABAP Application Program
The current ABAP program "SAPLKKBL" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
What can you do?
Note down which actions and inputs caused the error.
To process the problem further, contact you SAP system
administrator.
Using Transaction ST22 for ABAP Dump Analysis, you can look
at and manage termination messages, and you can also
keep them for a long time.
Error analysis
You attempted to access an unassigned field symbol
(data segment 106).
This error may occur if
- You address a typed field symbol before it has been set with
ASSIGN
- You address a field symbol that pointed to the line of an
internal table that was deleted
- You address a field symbol that was previously reset using
UNASSIGN or that pointed to a local field that no
longer exists
- You address a global function interface, although the
respective function module is not active - that is, is
not in the list of active calls. The list of active calls
can be taken from this short dump.
How to correct the error
If the error occures in a non-modified SAP program, you may be able to
find an interim solution in an SAP Note.
If you have access to SAP Notes, carry out a search with the following
keywords:
"GETWA_NOT_ASSIGNED" " "
"SAPLKKBL" or "LKKBLF99"
"GEN_FIELD_OUT2"
If you cannot solve the problem yourself and want to send an error
notification to SAP, include the following information:
1. The description of the current problem (short dump)
To save the description, choose "System->List->Save->Local File
(Unconverted)".
2. Corresponding system log
Display the system log by calling transaction SM21.
Restrict the time interval to 10 minutes before and five minutes
after the short dump. Then choose "System->List->Save->Local File
(Unconverted)".
3. If the problem occurs in a problem of your own or a modified SAP
program: The source code of the program
In the editor, choose "Utilities->More
Utilities->Upload/Download->Download".
4. Details about the conditions under which the error occurred or which
actions and input led to the error.
em environment
SAP-Release 700
Application server... "gplqty"
Network address...... "128.12.0.19"
Operating system..... "Windows NT"
Release.............. "5.2"
Hardware type........ "8x AMD64 Level"
Character length.... 16 Bits
Pointer length....... 64 Bits
Work process number.. 0
Shortdump setting.... "full"
Database server... "GPLQTY"
Database type..... "MSSQL"
Database name..... "GPQ"
Database user ID.. "gpq"
Char.set.... "C"
SAP kernel....... 700
created (date)... "Aug 4 2008 02:33:25"
create on........ "NT 5.2 3790 Service Pack 1 x86 MS VC++ 14.00"
Database version. "SQL_Server_8.00 "
Patch level. 172
Patch text.. " "
Database............. "MSSQL 7.00.699 or higher, MSSQL 8.00.194"
SAP database version. 700
Operating system..... "Windows NT 5.0, Windows NT 5.1, Windows NT 5.2, Windows
NT 6.0"
Memory consumption
Roll.... 16192
EM...... 16759360
Heap.... 0
Page.... 237568
MM Used. 12036016
MM Free. 530432
er and Transaction
Client.............. 410
User................ "SAP_SUPPORT"
Language key........ "E"
Transaction......... "ME21N "
Transactions ID..... "9E955CDE97CBF1648B4C001A64C7B85A"
Program............. "SAPLKKBL"
Screen.............. "SAPLKKBL 0500"
Screen line......... 3
Information on where terminated
Termination occurred in the ABAP program "SAPLKKBL" - in "GEN_FIELD_OUT2".
The main program was "RM_MEPO_GUI ".
In the source code you have the termination point in line 2908
of the (Include) program "LKKBLF99".
Source Code Extract
Line SourceCde
2878 else.
2879 assign <fs11> to <field>.
2880 gs_fc = gs_sfc11.
2881 endif.
2882 when 012.
2883 if gs_out_flags-slave ne 'X'.
2884 assign <fm12> to <field>.
2885 gs_fc = gs_mfc12.
2886 else.
2887 assign <fs12> to <field>.
2888 gs_fc = gs_sfc12.
2889 endif.
2890 when 013.
2891 if gs_out_flags-slave ne 'X'.
2892 assign <fm13> to <field>.
2893 gs_fc = gs_mfc13.
2894 else.
2895 assign <fs13> to <field>.
2896 gs_fc = gs_sfc13.
2897 endif.
2898 when 014.
2899 if gs_out_flags-slave ne 'X'.Hi,
this error occurs when you try to address a field-symbol before it has been assigned to a field or
the assignment has failed.
Use following code to remove this dump
Assign <mara-matnr> to <fs>.
if sy-subrc <> 0.
Error Message.
Endif.
Hope it helps,
Raj -
Assigning a value to a field-symbol (workarea of type any)
Dear forumers,
I'm having a bit of difficulty in assigning a value to a field-symbol (it should be treated as a workarea of type any), but I'm given a syntax error instead:-
The data object "<LFS_WORKAREA>" has no structure and therefore no component called "LFMON".
What could have gone wrong and how may I resolve this (I must have missed something out)? I will still need <LFS_WORKAREA> to be defined as TYPE ANY.
Please help. I'd appreciate any inputs at all. Thanks.
*& Form FORMAT_POST_PERIOD
* Subroutine to format the posting period data
* --> PI_MBEW Material valuation data (internal table)
FORM format_post_period CHANGING pi_mbew TYPE ANY TABLE.
" Create local field symbols
FIELD-SYMBOLS:
<lfs_workarea> TYPE ANY,
<lfs_lfmon> TYPE ckmlcr-poper.
" Create local variables
DATA: lv_index TYPE sy-tabix.
DATA: lv_lfmon TYPE ckmlcr-poper.
" Format posting periods
LOOP AT pi_mbew ASSIGNING <lfs_workarea>.
lv_index = sy-tabix.
ASSIGN COMPONENT 'LFMON' OF STRUCTURE <lfs_workarea> TO <lfs_lfmon>.
PERFORM convert_lfmon USING <lfs_lfmon>
CHANGING lv_lfmon.
MOVE lv_lfmon TO <lfs_workarea>-lfmon. " the syntax error occurs here :(
MODIFY pi_mbew FROM <lfs_workarea>
INDEX lv_index
TRANSPORTING lfmon.
CLEAR: <lfs_workarea>,
<lfs_lfmon>
lv_lfmon,
lv_index.
ENDLOOP.
ENDFORM. " FORMAT_POST_PERIODMost of us aren't in it for the points in any case...
For your solution you've redundant code:
*& Form FORMAT_POST_PERIOD
* Subroutine to format the posting period data
* --> PI_MBEW Material valuation data (internal table)
FORM format_post_period CHANGING pi_mbew TYPE ANY TABLE.
FIELD-SYMBOLS:
<lfs_workarea> TYPE ANY,
<lfs_lfmon> TYPE ckmlcr-poper.
DATA: lv_lfmon TYPE ckmlcr-poper.
* DATA: lo_workarea TYPE REF TO data. "<--Not needed, because the LOOP AT ASSIGNING below does the work
* CREATE DATA lo_workarea LIKE LINE OF pi_mbew.
* ASSIGN lo_workarea->* TO <lfs_workarea>.
LOOP AT pi_mbew ASSIGNING <lfs_workarea>.
ASSIGN COMPONENT 'LFMON' OF STRUCTURE <lfs_workarea> TO <lfs_lfmon>.
PERFORM convert_lfmon USING <lfs_lfmon>
CHANGING lv_lfmon.
<lfs_lfmon> = lv_lfmon.
CLEAR lv_lfmon.
ENDLOOP.
ENDFORM. " FORMAT_POST_PERIOD
Here's a couple of more efficient solutions, using LOOP AT INTO.
FORM format_post_period CHANGING pi_mbew TYPE INDEX TABLE. " <-- Table type a little more specific
"<--now you can use index operations
FIELD-SYMBOLS:
<lfs_workarea> TYPE ANY,
<lfs_lfmon> TYPE ckmlcr-poper.
DATA: lv_lfmon TYPE ckmlcr-poper,
lv_index TYPE sytabix.
DATA: lo_workarea TYPE REF TO data.
CREATE DATA lo_workarea LIKE LINE OF pi_mbew.
ASSIGN lo_workarea->* TO <lfs_workarea>.
ASSIGN COMPONENT 'LFMON' OF STRUCTURE <lfs_workarea> TO <lfs_lfmon>.
LOOP AT pi_mbew INTO <lfs_workarea>.
lv_index = sy-tabix.
PERFORM convert_lfmon USING <lfs_lfmon>
CHANGING lv_lfmon.
<lfs_lfmon> = lv_lfmon.
MODIFY pi_mbew FROM <lfs_workarea>
INDEX lv_index. " <--INDEX TABLE, so this is permitted.
CLEAR lv_lfmon.
ENDLOOP.
ENDFORM. " FORMAT_POST_PERIOD -
Assigning value to Field - Symbol ( which is type of internal table field )
Hi All,
I am facing problem to assign the value to a field symbol. My requirement is creating a dynamic internal table and populate values into that internal table, so that i can display the values .
I am having a structure with fields like status , Plant1 name , Plant2 name.....Plant n .
So i declared an internal table it_tab with this structure.
I am having one more table which having number of records for Plant1 ,Plant 2 ,....Plant n based on some condition.
I need to count the number of records for Plant1 and i need to put in the internal table it_tab.
For this i created field-symbol .
Here, t_deployment table will have the plants 1,2,3...and
t_devobject will have some records for these plants.
LOOP AT T_DEPLOYMENT.
clear w_count.
LOOP AT T_DEVOBJECT WHERE ZDEPLOYMENT = T_DEPLOYMENT-DOMVALUE_L AND
ZADSTATUS = '10'.
w_count = w_count + 1.
ENDLOOP.
concatenate 'it_tab-' t_deployment-domvalue_l into var_bet_name.
assign var_bet_name to <bet_var_name>.
now my internal table field i.e. it_tab-plant1 came into <bet_var_name> . But i want to assign a value for it.
at last what i need is it_tab-plant1 = w_count.
whaterver the w_count has value that needs to assign to it_tab-plant1. But i don't want to assign directly it it_tab-plant1. I want to assign dynamically. Because tommorrow some more plants added to t_deployments , i don't want to make changes to my program. It should take care....w/o changing the program.
I tried the following statement.
(<bet_var_name>) = w_count. But its not working.
Please let me know how i can get this.
Thanks in Advance.
Pavan.Hi pavan,
As ur requirement is creating a dynamic internal table,
try the following way,
remember the fieldcat should be of type LVC not SLIS.
BUILD LT_LVCFIELDCAT in a way that, the value from the internal table becomes the fieldname
ex:-
loop at it_models INTO WA_MODELS.
LS_LVCFIELDCAT-FIELDNAME = WA_models-MODEL.
LS_LVCFIELDCAT-SELTEXT = WA_models-MODEL.
append ls_lvcfieldcat to lt_lvcfieldcat.
endloop.
DATA: DREF TYPE REF TO DATA,WA_REF TYPE REF TO DATA.
FIELD-SYMBOLS: <TEMP_TAB> TYPE TABLE, <TEMP_WA> TYPE ANY.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = LT_LVCFIELDCAT
IMPORTING
EP_TABLE = DREF.
ASSIGN dref->* TO <TEMP_TAB>.
now basing on the fieldcatalog <temp_tab> is build.
NOW FILL <TEMP_TAB>.
WHILE FILLING, ASSIGN COMPONENT IDX/NAME.....
this statement will be very usefull.
i hope this will be help full.
pls reward the points if it helps u.
regards
Hyma -
Dynnamic Field Symbol returning short dump ASSIGN_TYPE_CONFLICT
Hi everyone,
I have a RFC FM and make a dynamic access via SYMBOL FIELD, declared as ANY TABLE. The problem is that sometimes I can get a structure instead of a table and then the error occurs. How do I handle this error if the check IS ASSIGN not work? How do I capture and return an error message?
I tryed this:
FIELD-SYMBOLS: <fs_tabela> TYPE ANY TABLE.
TRY.
ASSIGN (st_b2b_text-tabname) TO <fs_tabela>. <<<<----
DUMP HERE!
CATCH cx_root INTO v_erro.
v_text = v_erro->get_text( ).
MOVE v_text TO st_return-message.
APPEND st_return TO t_return.
PERFORM f_return_error_pi USING event.
ENDTRY.
IF <fs_tabela> IS ASSIGNED.
CONCATENATE 'S' st_b2b_text-tabname INTO vl_wkarea.
CONDENSE vl_wkarea NO-GAPS.
ASSIGN (vl_wkarea) TO <fs_wkarea>.
IF <fs_wkarea> IS ASSIGNED.
LOOP AT <fs_tabela> ASSIGNING <fs_wkarea>.
ASSIGN COMPONENT c_posnr
OF STRUCTURE <fs_wkarea> TO <fs_posnr>.
Does anyone have any tips?
Tnks,
Marco Antonio
from BrazilI solved with this test that I did:
TABLES: vbak.
TYPES: BEGIN OF ty_ctrlimo,
equnr TYPE equnr,
anln1 TYPE anln1,
anln2 TYPE anln2,
aufnr TYPE aufnr,
bukrs TYPE bukrs,
zanln1_andam TYPE anln1,
zanln2_andam TYPE anln2,
END OF ty_ctrlimo.
DATA: estrutura TYPE ty_ctrlimo,
tabela TYPE STANDARD TABLE OF ty_ctrlimo
INITIAL SIZE 0 WITH HEADER LINE,
tabela2 TYPE TABLE OF ty_ctrlimo,
variavel TYPE char30.
DATA: is_tabela.
Evento: START-OF-SELECTION ***
START-OF-SELECTION.
BREAK-POINT.
PERFORM f_check_is_tabela USING 'TABELA' CHANGING is_tabela.
WRITE: / '1 ', 'TABELA =', is_tabela.
SKIP 1.
PERFORM f_check_is_tabela USING 'TABELA2' CHANGING is_tabela.
WRITE: / '2 ', 'TABELA2 =', is_tabela.
SKIP 1.
PERFORM f_check_is_tabela USING 'ESTRUTURA' CHANGING is_tabela.
WRITE: / '3 ', 'ESTRUTURA =', is_tabela.
SKIP 1.
PERFORM f_check_is_tabela USING 'VARIAVEL' CHANGING is_tabela.
WRITE: / '4 ', 'VARIAVEL =', is_tabela.
SKIP 1.
PERFORM f_check_is_tabela USING 'VBAK' CHANGING is_tabela.
WRITE: / '5 ', 'VBAK =', is_tabela.
SKIP 1.
*& Form F_CHECK_IS_TABELA
FORM f_check_is_tabela USING value(p_nome_tabela_estrutura)
CHANGING p_is_tabela.
FIELD-SYMBOLS <check> TYPE ANY.
DATA: lcls_strdscr TYPE REF TO cl_abap_structdescr,
lcls_typdscr TYPE REF TO cl_abap_typedescr.
CLEAR: p_is_tabela.
ASSIGN (p_nome_tabela_estrutura) TO <check>.
lcls_typdscr ?= cl_abap_structdescr=>describe_by_data( <check> ).
IF lcls_typdscr->type_kind = cl_abap_structdescr=>typekind_table.
p_is_tabela = cl_abap_structdescr=>true.
ENDIF.
WRITE: / 'tipo data: ', lcls_typdscr->type_kind.
ENDFORM. " F_CHECK_IS_TABELA
Maybe you are looking for
-
How to get total number of result count for particular key on cluster
Hi- My application requirement is client side require only limited number of data for 'Search Key' form total records found in cluster. Also i need 'total number of result count' for that key present on the custer. To get subset of record i'm using I
-
Preflight Convert Color Problem
Hello everyone. I work in the preprint division of a printing press. We have recently upgraded all our systems to x Acrobat Pro 10. We run the preflight utility on most of our files that we get in from our customers. However, to knock out a lot of 4
-
Table SelectionModel with Forte
Is there a way to set the SelectionModel in Sun's Forte 4 ? I use this code by interting it with Post-Init Option. datesTable.getSelectionModel().setSelectionModeListSelectionModel.SINGLE_SELECTION); The problem is, if you change the name of the tabl
-
"set deadlock_priority" not effective in SQL Server 2012?
I am trying to control which of two sessions is chosen as the deadlock victim in SQL Server 2012. I have set up a test that induces a deadlock by updating two tables in opposite order with a "waitfor" in between the updates. I can consistently repro
-
When I run disk utility I'm told there is a hardware problem with my hard drive and the S.M.A.R.T. status is listed as "Failing". Anyone have any suggestions other than to take the machine to an Apple Store?