Total Length of Field Symbol
Hi,
I need to know the length of total field symbol, not the value entered in it but its total length.
Like below
<ls_field_tmp> it has Range structure,
suppose =
SIGN (1) = 'I'
OPTION( 2 ) = 'BT'
LOW (4) = '10'
HIGH (4) = '20'
so if we use
lv_length = STRLEN( <ls_field_tmp> ) then it will give value 7.
i need to get length of all data type : means 1 + 2 + 4 + 4 = 11 , total length .
How i will get this length , please suggest?
LOOP AT <lt_selection> ASSIGNING <ls_field_tmp>.
CLEAR : lv_length, lv_offset.
ls_item-field_name = ls_sel_fields-m_id.
ls_item-relid = lv_number.
ls_item-counter = sy-tabix.
lv_length = STRLEN( <ls_field_tmp> ) .
ENDLOOP.
I am using Field Symbol
<ls_field_tmp> TYPE ANY.
After Assignment its structure will become like :-
<ls_field_tmp>-sign
<ls_field_tmp>option
<ls_field_tmp>low
<ls_field_tmp>high
Now Sign and option fields are OK because they have fixed data type but LOW and HIGH will depend upon the assignment.
This statement below is working fine for charter or NUMC type fields
DESCRIBE FIELD <ls_field_tmp> LENGTH lv_length IN CHARACTER MODE.
But if the Data type is Decimal or Currency , then it is not working fine.
Firstly the problem is I have to put offset for determining field
<ls_field_tmp>+0(1) = <ls_field_tmp>-sign. like this one ,
if the LOW and HIGH data type is decimal then 1st two field is Char and last two decimal.
So how to know the total length of structure.
OR
Can i assign <ls_field_tmp> to any data type , is it possible ? if yes how ?
Thanks
Ankesh
Similar Messages
-
Accessing the variable in field symbol of nested internal table
Hi,
I am unable to access the variable in field symbol.
The data in field symbol has nested structure. We need to access a variable in nested structure.
Please find the code below:
LOOP AT <i_fincorp> into <fs_fincorp>.
l_madefor = <FS_FINCORP>-data_UI-ZZ0010.
ENDLOOP.
datatype of <i_fincorp> is type any table and <fs_fincorp> is type any.
there is a structure 'data_ui' in <i_fincorp> and we need value of field 'ZZ0010' in data_ui structure.
But, we are getting syntax error for statement in loop stating "There is no component like 'data_ui' in <fs_fincorp>".
Can anyone please help me solving this issue.
Regards,
SantoshSo simply access it dynamically
data: nested_field type c length 50.
field-symbols <nested_field> type any.
"build the nested field name dynamically
concatenate
'DATA_UI' "first give structure name
'ZZ0010' "then give field name (all in uppercase!)
into nested_field
separated by '-'. "now you have DATA_UI-ZZ0010
"so assing this nested field
LOOP AT <i_fincorp> into <fs_fincorp>.
assign component (nested_field) of structure <fs_fincorp> into <nested_field>.
ENDLOOP.
Regards
Marcin -
How to check the length of a field symbol value
hi all,
i have a problem with string function, i have assined table fields to a field symbol in a loop i want check the length of the assigned fields symbol value in every loop . i have written like ,,,,,len = strlen( <fs>). then i am getting the length of the field label what i ahve assigned to fiels symbol not the field value lenght ,
please advise me on this,
thanks,
sreI think you're on the right track. This should work:
data: len type i.
data: begin of itab OCCURS 1,
a type string value '1',
b type string value '12',
c type string value '123',
end of itab.
FIELD-SYMBOLS: <fs> type ANY.
do 3 times.
assign component sy-index of STRUCTURE itab to <fs>.
len = strlen( <fs> ).
enddo. -
Where is error about field-symbols?
I wrote a short program about field-symbols , but when I build it, I had issues with "WA is too short for <F1>." I don't know what is happen.
REPORT ZSKY061901.
data : wa(100) value '0123456789'.
data : begin of line1,
co1(6),
co2(4),
co3(5),
end of line1.
data : begin of line2,
co1 type i value 1,
co2 type i value 2,
end of line2.
data line3 like line2.
data itab like line2 occurs 10 with header line.
line3-co1 = 11.
line3-co2 = 22.
field-symbols:
<F1> structure sbook default wa,
<F2> structure line1 default wa,
<F3> structure itab default line3.
write: / <F1>-mandt,<F1>-carrid,<F1>-connid,<F1>-fldate,
/ <F2>-co1,<F2>-co2,<F2>-co3,
/ <F3>-co1,<F3>-co2.Hi,
field-symbols:
<F1> structure sbook default wa,
<F2> structure line1 default wa,
<F3> structure itab default line3.
Lets take <F1>, here the Structure is SBOOK, so SBOOK will have some fields in it, count the total length of the fields in the SBOOK, it may come around 200 lenght, then the WA length should be 200....
Regards
Sudheer -
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 -
Not allowing totaling of a field in alv output
hi,
I had made a ALV in which i have to hide 1 field for getting it totaling.
i.e. if somebody try to make total of it ,it should not be allowed on dat field . is dere any solution for this problem?
plzz provide me guidelines for it.Please please it this. I made the total for every field other than RACCT and SUM_COMM.
*& Form sub_prepare_display_output
Display output
--> No Parameter
FORM sub_prepare_display_output .
Local variables
DATA: l_lead_col TYPE char25, " Lead column
l_progname TYPE sy-repid, " Program name
Local internal tables
l_oref_layout TYPE REF TO cl_salv_layout, "Layout
Local work area
l_wa_key TYPE salv_s_layout_key, "Work area for key
l_except1 TYPE REF TO cx_salv_msg,"Exception
l_text1 TYPE string. "Exception msg
If profit center is checked
IF p_prfctr = c_check.
l_lead_col = 'Profit Center'(041).
If product catagory is checked
ELSEIF p_prodc = c_check.
l_lead_col = 'Product Category'(042).
If material is checked
ELSEIF p_smatnr = c_check.
l_lead_col = 'Material No.'(043).
ENDIF.
Create ALV instance with class-method cl_salv_table=>factory
TRY.
CALL METHOD cl_salv_table=>factory
EXPORTING
list_display = if_salv_c_bool_sap=>false
IMPORTING
r_salv_table = v_oref_table
CHANGING
t_table = i_final.
CATCH cx_salv_msg INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
Make header of the report
PERFORM sub_header_report USING v_oref_table.
Get the toolbar
v_oref_functions = v_oref_table->get_functions( ).
For activating application toolbar
v_oref_functions->set_all( abap_true ).
v_oref_columns = v_oref_table->get_columns( ).
It populate the key fields which are always displayed
PERFORM sub_fill_fields_of_fcatalog USING:
'SUM_COMM' l_lead_col ' ',
'RACCT' 'Account Number'(035) ' ',
'FOBAC' 'FOB Acrual'(023) 'X',
'EXCESS' 'Excess'(024) 'X',
'OBSOLE' 'Obsolescence'(025) 'X',
'PPV' 'Puchachse Price Var'(026) 'X',
'FR_VAR' 'Freight Variance'(027) 'X',
'PROD_OR_VAR' 'Produc Ord Var'(028) 'X',
'DEP_VAR' 'Dept. Variance'(029) 'X',
'OTH_PROD_VAR' 'Other Prod Var'(030) 'X',
'PR_OR_SCRP_VAR' 'Scrap Variance'(031) 'X',
'COST_OF_ACC' 'Cost of Sales Accnt'(032) 'X',
'INV_ACC' 'Inventory Account'(033) 'X'.
Optimize the columns
v_oref_columns->set_optimize( value = 'X' ).
Setting the layout
get the LAYOUT object
l_oref_layout = v_oref_table->get_layout( ).
set the layout key
l_progname = sy-repid.
l_wa_key-report = l_progname.
l_oref_layout->set_key( value = l_wa_key ).
set save restriction:
none / only user-dependent / only user-independent
l_oref_layout->set_save_restriction(
value = if_salv_c_layout=>restrict_none ).
set: setting of default layout is allowed / isnu2019t allowed
l_oref_layout->set_default( value = 'X' ).
Dispaly the output
v_oref_table->display( ).
ENDFORM. " sub_prepare_display_output
*& Form sub_header_report
Create the header of the report
-->P_v_oref_TABLE table name
FORM sub_header_report USING p_v_oref_table TYPE REF TO
cl_salv_table .
DATA : l_oref_grid TYPE REF TO cl_salv_form_layout_grid.
CREATE OBJECT l_oref_grid.
Add text items for top of page
l_oref_grid->create_text( row = 1 column = 1 text = 'Program'(022)
l_oref_grid->create_text( row = 1 column = 2 text = sy-repid ).
l_oref_grid->create_text( row = 2 column = 1
text = 'User Name'(021) ).
l_oref_grid->create_text( row = 2 column = 2 text = sy-uname ).
l_oref_grid->create_text( row = 3 column = 1 text = 'Date'(020) ).
l_oref_grid->create_text( row = 3 column = 2 text = sy-datum ).
l_oref_grid->create_text( row = 3 column = 3 text = 'Time'(019) ).
l_oref_grid->create_text( row = 3 column = 4 text = sy-uzeit ).
l_oref_grid->create_text( row = 4 column = 1 text = 'System'(018) ).
l_oref_grid->create_text( row = 4 column = 2 text = sy-sysid ).
l_oref_grid->create_text( row = 4 column = 3 text = 'Client'(017) ).
l_oref_grid->create_text( row = 4 column = 4 text = sy-mandt ).
Declare grid as header of list
p_v_oref_table->set_top_of_list( value = l_oref_grid ).
ENDFORM. " sub_header_report
*& Form sub_fill_fields_of_fcatalog
This subroutine populates the field catalog excluding
period fields
-->P_FIELDNAME Table field name
-->P_NAME Field description
-->P_DEC Decimal value flag
FORM sub_fill_fields_of_fcatalog USING p_fieldname TYPE lvc_fname
p_name TYPE c
p_dec TYPE c.
DATA: l_char_l TYPE scrtext_l, "For short text
l_char_m TYPE scrtext_m, "For medium text
l_char_s TYPE scrtext_s, "For long text
l_except1 TYPE REF TO cx_salv_not_found,"Exception
l_text1 TYPE string, "Exception msg
l_orf_aggregs TYPE REF TO cl_salv_aggregations.
Getting the text long/short/medium into variables
l_char_l = p_name.
l_char_m = p_name.
l_char_s = p_name.
Setting the long/short/medium text and fix the key fileds
TRY.
CALL METHOD v_oref_columns->get_column
EXPORTING
columnname = p_fieldname
RECEIVING
value = v_oref_column1.
CATCH cx_salv_not_found INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
v_oref_column ?= v_oref_column1.
v_oref_column->set_long_text( l_char_l ).
v_oref_column->set_medium_text( l_char_m ).
v_oref_column->set_short_text( l_char_s ).
v_oref_column->set_key( value = 'X' ).
v_oref_columns->set_key_fixation( value = 'X' ).
Set the decimal length
IF p_dec = 'X'.
v_oref_column->set_decimals( value = '2' ).
ENDIF.
IF p_fieldname = 'RACCT' AND p_gl <> c_check.
v_oref_column->set_visible( value = space ).
ENDIF.
IF p_gl = c_check.
v_oref_columns->set_column_position( columnname = 'RACCT'
position = 2 ).
ENDIF.
IF p_fieldname NE 'RACCT' AND p_fieldname NE 'SUM_COMM'.
l_orf_aggregs = v_oref_table->get_aggregations( ).
l_orf_aggregs->add_aggregation( columnname = p_fieldname
aggregation = if_salv_c_aggregation=>total ).
ENDIF.
ENDFORM. " sub_fill_fields_of_fcatalog -
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 -
Sum for Dynamic Fields in a Dynamic Table with Field Symbol
Hi All,
I currently have an report which I am looking to update with some totals. The information is currently output in an ALV which is fed data from a dynamic table defined with a field symbol. The modification that needs to be applied is a summation per currency code where each of the fields to be summed is a dynamically named field at runtime. I am now just looking to see if anyone has any recommendations on how to obtain these totals it would be appreciated. I have no problem doing the leg work in piecing the solution together but am just stuck on which approach I should be investigating here. I have looked into several options but do to the fact that the totals are for dynamic fields in a dynamic table and it is a field symbol I am having some difficulties thinking of the easiest approach to obtain these totals.
Below is a simple sample of what the report currently looks like and what we are looking to add.
====================================================================================
As-Is Report:
DETAILED DATA ALV
Company Code | Plant | 2006 Total | 2007 Total | 2008 Total | CURRENCY
0001 | ABCD | 1,500 | 1,200 | 1,700 | USD
0001 | BCDE | 2,300 | 4,100 | 3,600 | GBP
0003 | DBCA | 3,200 | 1,600 | 6,200 | USD
Addition 1:
TOTALS PER CURRENCY
Currency | 2006 Total | 2007 Total | 2008 Total |
USD | 4,700 | 2,800 | 7,900 |
GBP | 2,300 | 4,100 | 3,600 |
Addition 2:
CONVERSIONS TO USD
| 2006 Curr | 2006 USD | 2008 Curr | 2006 USD |
USD | 4,700 USD | 4,700 USD | 7,900 USD | 7,900 USD |
GBP (1.5GBP/1 USD) | 2,300 GBP | 1,150 USD | 2,300 GBP | 1,800 USD |
====================================================================================
Any recommendations will be appreciated.Hi,
We cannot use the key word SUM in the loop at assigning statement.
The way i see is
When you are creating the first dynamic internal table , create one more with the structure below:
Currency | 2006 Total | 2007 Total | 2008 Total |
Then while populating the data into first itab,also move the contents to the second itab using collect statement. -
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 populate values of field symbols?
HI,
I need to pass values into a field-symbol (defined as a dynamic Work Area) and append the values later on into another field-symbol (defined as a dynamic Table) by inserting the work area to the table. The insert statement in the screen shot below is syntetically correct but when I uncomment
* <gw_itab>-tplnr = 'TPLNR'.
* <gw_itab>-pmsog = 'PMSOG'.
* <gw_itab>-k_pro = 'K_PRO'.
I get a syntax error. During debugging if I pass the values of the work area, they are properly appended into the table.
Could somebody show me the code on how to atain this programatically?
Thanks for your help
CarlFrom the short dump:
"<GT_ITAB> has line type "v" and the length 24, but the work area has line type "g" and the length 8".
The code you included in your first screenshot is not the code that it dumped on... Looking at the shortdump here's what you have.
lv_fieldname = '<GW_ITAB>-TPLNR'.
assign (lv_fieldname) to <gw_itab>.
<gw_itab> = 'TPLNR'.
insert <gw_itab> into table <gt_itab>.
This code doesn't make any sense...
What you're saying is:
<gw_itab> points to <gw_itab>-tplnr. So now it points to just a field of the structure, not the whole structure.... Then you say that field is set to 'TPLNR'. So you set the field of the original structure called TPLNR to be the string "TPLNR"...
If that's really what you're trying to do then try changing it to:
field-symbols: <field> type any.
lv_fieldname = '<GW_ITAB>-TPLNR'.
assign (lv_fieldname) to <field>.
<field> = 'TPLNR'.
insert <gw_itab> into table <gt_itab>. -
Better alternative to header lines, use of logical database, field-symbols
Hello experts,
I am wondering if theres a better and faster alternative than declaring a header line for an itab. are work areas faster?
What is the use of logical database? can you please give me an example on how to use it in reports.
how do I use field-symbols? I am confused on how it works.
P.S. I recently installed SAP netweaver preview abap edition
in my home PC and I am wondering if I could practice BDC, user exits, etc. If so, how?
Again, thanks for all your help since I'm kinda new to ABAP.I always use this...It uses header lines, but at least is smaller -:)
<b>DATA: BEGIN OF MY_TAB TYPE STANDARD TABLE OF BKPF WITH HEADER LINE.</b>
For logical databases, you can check my blog...I always use LDB for HR programs -:)
<a href="/people/alvaro.tejadagalindo/blog/2006/02/19/how-to-deal-with-hr-payroll-reports:///people/alvaro.tejadagalindo/blog/2006/02/19/how-to-deal-with-hr-payroll-reports
LDB's provides a lot of information, because they gather it from a lot of different tables...
A Field-Symbols is like a pointer in C++, like an alias for a variable...Here's a small example...
REPORT Z_ATG_DUMMY.
FIELD-SYMBOLS: <F1>, <F2> TYPE I.
DATA: TEXT(20) TYPE C VALUE 'Hello, how are you?',
NUM TYPE I VALUE 5,
BEGIN OF LINE1,
COL1 TYPE F VALUE '1.1e+10',
COL2 TYPE I VALUE '1234',
END OF LINE1,
LINE2 LIKE LINE1.
ASSIGN TEXT TO <F1>.
ASSIGN NUM TO <F2>.
DESCRIBE FIELD <F1> LENGTH <F2>.
TEXT = 'CHAU'.
WRITE: / <F1>, 'has length', NUM.
WRITE: / TEXT, 'has length', NUM.
ASSIGN LINE1 TO <F1>.
ASSIGN LINE2-COL2 TO <F2>.
MOVE <F1> TO LINE2.
ASSIGN 'LINE2-COL2 =' TO <F1>.
I just can't install SAPNWSP...I only got MiniSap...But I got all the development enviorment...Don't know about the User-Exits...Actually I don't think so...Because those "mini" systems doesn't come with any functional module.
Greetings,
Blag. -
Passing unassigned field symbols to a method
Hello Gurus,
I work with a field symbol in a method and after the work is finished i have to use it i my program that i call the method from.
The problem is that the field symbol gets assigned only in the method so i can`t get the field symbol as a changing parameter in my method because it is not assigned yet.
I thought that i can return the field symbol from the method after it has been assigned, but i don`t know how. The <fs> is a dynamic itab that i created within the method.
Can anyone help please ??Although already answered this code snippet might make it clearer
my_line is your data structure typically an itab structure.
For example
TYPES: BEGIN OF s_elements,
tabname type DD02L-tabname,
tabclass type dd02l-tabclass,
as4user type dd02L-as4user,
as4date type dd02l-as4date,
as4time type DD02l-as4time,
viewed(1) type c.
TYPES: END OF s_elements.
Data: my_line TYPE s_elements.
1) get the structure of your itab automatically so you can build an FCAT simply for any structure without the horrendous usual coding to manipulate and create FCATS.
CALL METHOD me->return_structure
EXPORTING
my_line = my_line.
You need to make a table ZOGT data available in the class definition either as an attribute if you are using the class builder SE24 or as DATA in the relevant class section.
data:
zog LIKE LINE OF lr_rtti_struc->components .
data:
zogt LIKE TABLE OF zog .
method RETURN_STRUCTURE.
lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( my_line ).
zogt[] = lr_rtti_struc->components.
endmethod.
Your structure details are now in table zogt.
Use this to build an FCAT.
CALL METHOD me->create_dynamic_fcat
IMPORTING
it_fldcat = it_fldcat.
method CREATE_DYNAMIC_FCAT.
LOOP AT zogt INTO zog.
CLEAR wa_it_fldcat.
wa_it_fldcat-fieldname = zog-name .
wa_it_fldcat-datatype = zog-type_kind.
wa_it_fldcat-inttype = zog-type_kind.
wa_it_fldcat-intlen = zog-length.
wa_it_fldcat-decimals = zog-decimals.
wa_it_fldcat-coltext = zog-name.
wa_it_fldcat-lowercase = 'X'.
APPEND wa_it_fldcat TO it_fldcat .
ENDLOOP.
endmethod.
Now having got your FCAT you can build your dynamic table.
CALL METHOD me->create_dynamic_table
EXPORTING
it_fldcat = it_fldcat
IMPORTING
dy_table = dy_table.
(dy_table is defined as ref to data)
method CREATE_DYNAMIC_TABLE.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fldcat
IMPORTING
ep_table = dy_table.
endmethod.
Now populate your dynamic table as per sample code here
field_symbols:
<dyn_table> TYPE STANDARD TABLE.
<dyn_wa>.
data: dy_line TYPE REF TO data.
FORM populate_dynamic_itab.
ASSIGN dy_table->* TO <dyn_table>.
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
SELECT *
FROM DD02L
INTO CORRESPONDING FIELDS OF TABLE <dyn_table>
WHERE TABNAME LIKE 'ZHR%'.
ENDFORM.
Now you can display your grid and process your data.
CALL METHOD z_object->display_grid
EXPORTING
g_outtab = <dyn_table>
g_fldcat = it_fldcat
i_gridtitle = i_gridtitle
i_edit = i_edit
i_zebra = i_zebra
CHANGING
it_fldcat = it_fldcat
gt_outtab = <dyn_table>.
In the Method
method DISPLAY_GRID.
GET REFERENCE OF g_outtab INTO g_outtab1.
GET REFERENCE OF g_fldcat INTO g_fldcat1.
struct_grid_lset-edit = i_edit. "To enable editing
struct_grid_LSET-zebra = i_zebra.
struct_grid_lset-grid_title = i_gridtitle.
struct_grid_lset-ctab_fname = 'T_CELLCOLORS'.
struct_grid_lset-stylefname = 'CELLTAB'.
CALL METHOD grid1->set_ready_for_input
EXPORTING
i_ready_for_input = '1'.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
is_layout = struct_grid_lset
CHANGING
it_outtab = gt_outtab
it_fieldcatalog = it_fldcat.
ENDMETHOD.
You can even easily code your own column names if you so wish in the application program.
Before calling the method that displays the grid encode the following macro.
DEFINE col_name.
read table it_fldcat into wa_it_fldcat index &1.
wa_it_fldcat-coltext = &2.
wa_it_fldcat-outputlen = &3.
modify it_fldcat from wa_it_fldcat index &1.
END-OF-DEFINITION.
Then have a subroutine in your application code something like this
Form name_columns.
Here before displaying you can change the field catalog to
adjust your own column names.
*col_name col-nr 'your name' output length.
col_name 1 'Table name' 30.
col_name 2 'Table class' 12.
col_name 3 'Changed By' 12.
col_name 4 ' On' 12.
col_name 5 ' At' 8.
col_name 6 'Act' 3.
i_gridtitle = 'HR ESS / ITS ZHR Tables - Double click to display'.
i_zebra = 'X'.
i_edit = ' '.
endform.
Hope this clears it up a bit.
Once you get this stuff working you can re-use 99% of the code for almost any structure making the whole process of OO ALV grid applications really simple.
Yoy only need as well a standard dynpro with a custom container on it (se51).
Cheers
jimbo -
Regarding error "Field symbol is not assigned." during print preview
Hi experts,
I am getting dump while trying print preview for particular POs in ME23n transaction(ECC 6.0). Please refer the below dump error:
Runtime Errors GETWA_NOT_ASSIGNED_RANGE
Date and Time 29.09.2009 19:30:39
Short dump has not been completely stored (too big)
Short text
Field symbol is not assigned.
What happened?
Error in the ABAP Application Program
The current ABAP program "SAPLSTXC" 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
A field symbol that was not assigned was accessed
(data segment no. 32769).
The field symbol is no longer assigned because there was an attempt
makde previously in a Unicode program to set the field symbol using
ASSIGN with offset and/or length specification. Here, the memory
addressed by the offset/length specification was not within the
allowed area.
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_RANGE" " "
"SAPLSTXC" or "LSTXCFFT"
"FT_COMPOSE"
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.
I am getting this dump only for few POs.. Rest of the POs are able to print. I am not able to find notes for this issue. Is there any SAP notes available for that or Is there any configuration issue related to this?
Please provide solution for thsi as soon as possible.
Thanks and Regards
SubbuA field symbol is not assigned, but thats what the dump is telling you. Mostly this happens, when fields or function modules are stored by name, like the fieldnames in the fieldcatalog in an ALV report. It a field referenced in such a way does not exist you will get this error. Always store fieldnames and function names in capital letters and check mistyping of 1L 8B and so on.
-
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. -
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
Maybe you are looking for
-
Amazon S3 Web Service WSDL not working
I trying to create a shared reference to the new Amazon S3 web service using the following WSDL http://s3.amazonaws.com/doc/2006-03-01/AmazonS3.wsdl .. but the wizard isn't recognising any input or output parameters , is this a fault of Amazon's WSDL
-
Error RTC-5346 in registering target location in OWB Deployment manager.
Hello! Dear experts, I've got DB 10GR2 and I downloaded OWB 10.1. I've installed OWB successfully and began to look through the samples. And during my trying to register a target location (when I looked through the sample "Deploying targets") Ive go
-
I am attempting to create a GUI which takes from user Last Name, First Name, Middle Initial, etc. How can I set the JLabels to be aligned (which I already have) and text fields aligned but different sizes? Here is my code and I am trying to make the
-
Hi all. Recently got a car with an aux input (3.5mm jack) ideal for ipods and other mp3 players. Mine's an ipod 80gb classic. I've always assumed that better sound quality comes from the "dock connector" rather than the headphone output. Looked aroun
-
Hi All, I hope this is simple, but what I would like to do is to include a css file, but have the FacesServlet do it's magic on it first. Let's say I have this line right now (which in fact, I do): <link rel="stylesheet" type="text/css" href="main.cs