HI. Problem in concatenating a field symbol
Hi,
I used the following code... for downloading the file in application server..
OPEN DATASET P_FILE FOR OUTPUT IN TEXT MODE
ENCODING DEFAULT.
IF SY-SUBRC EQ 0.
LOOP AT <FS_ITAB> ASSIGNING <FS_TAB>.
DO.
To Assign the Field Symbol
ASSIGN COMPONENT SY-INDEX OF STRUCTURE
<FS_TAB> TO <FS_LINE> .
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
To Type Cast the retrieved data.
CONCATENATE L_R_FILE <FS_LINE>INTO L_R_FILE
SEPARATED BY
CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
ENDDO.
TRANSFER L_R_FILE TO P_FILE.
CLEAR: L_R_FILE.
ENDLOOP.
CLOSE DATASET P_FILE.
IF SY-SUBRC <> 0.
Unable to close the file in application server
Message e057.
ELSE.
WRITE:/(30) V_FILE,
(30) 'Generated successfully'(M02).
ENDIF. "IF SY-SUBRC <> 0.
ENDIF. "if not rb_pres is initial.
ENDIF. " IF NOT RB_PRES IS INITIAL.
ENDIF. " if not <fs_tab> is initial.
It Gave a dump saying the conversion to standard type not possible. (like C,N,T..)..
So I changed the following part as
L_V_FILE = <FS_LINE>.
CONCATENATE L_R_FILE L_V_FILE INTO L_R_FILE
SEPARATED BY
CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
Now the Problem is when the File is downloaded.. there is an #(Space/Tab) in the first column..
Can Any one help me in soliving this issue..
Thanks In Advance..
Guhapriyan Subrahmanyam..
Hi,
Can you try the same with <b>SPACE_STR</b> instead of HORIZONTAL_TAB?
Also,
If only the tab(#) in the first column is the only problem..then, after the DO..ENDO... truncate the first # and then proceed further...
Regards,
Raj
Message was edited by: Rajasekhar Dinavahi
Similar Messages
-
Problem trying to create FIELD SYMBOLS in BADI.
Hi guys!
I'm trying to create a Field Symbol in method CHECK of BADI me_process_req_cust (well, I'm working on a Z implementation).
The problem is that I'm trying to create a FIELD SYMBOL and when I check the syntaxsis, I receive the next error:
Clase ZCL_IM_MM_PURREQ_UPDATE,Método IF_EX_ME_PROCESS_REQ_CUST~CHECK
Names may only consist of the characters "A-Z", "0-9" and "_". In
addition, they may not begin with a number.
This is the code:
FIELD-SYMBOLS: <sy-mereq> TYPE mereq3328-afnam.
Any idea????
Thanks in advance!
BetHi Silveria,
The problem lies in
FIELD-SYMBOLS: <sy-mereq> TYPE mereq3328-afnam.
instead of that it should be something like this
FIELD-SYMBOLS: <sy_mereq> TYPE mereq3328-afnam.
With your code you will be getting a syntax error saying sy-mereq is not defined,as it will be looking for the mereq in the system fields.
Regards
Abhinab Mishra -
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 -
Hello experts,
I am getting a problem while working with field symbols. I have some data field symbol in the form of structure. The field symbols have the type 'TABLE' so the data fills in runtime, so the structure also changes runtime. We need to get some fields out form them in the work area.
How can I do that? Is there any code you can give me so that I can use that.
Please help.
Thanks,
GaneshHello,
Use the Assign statement.
Try like this.
LOOP AT <FS_1> ASSIGNING <FS_2>.
ASSIGN COMPONENT 'POSIDFROM'
OF STRUCTURE <FS_2> TO <FS_5>.
LV_POSID = <FS_5>.
endloop.
Cheers,
Vasanth -
Field Symbol not writing the values while executing in background.
Hi,
In my program i am writing the values of a field symbol to list output.
write :/ <f_fs_up_excel_wa2>.
Its writing successfully when i am executing in foreground.
But when i am executing in background(Submitting the same program as a job)
its not displaying the values from field-symbol but all the other write statments are getting displayed in the spool.
Could anybody help me out in this situation and how to handle it?
Thanks,
SAM.Hmm. I think the problem is that the field-symbols is blank in background processing, rather than background process has some fault that prevents it being displayed...
On that basis - how is this field-symbol populated?
matt -
Problem in assigning field symbol to a nested internal table
Hi All,
I have searched the forum but could not find a solution to this problem. I have a requirement where I need to define an internal table within an internal table, so I have used pointer within the outer internal table(itab2) which point to the inner table. However, I am facing problem while assigning the pointer.
data: begin of struct1 occurs 0,
fld3(10) type C,
end of struct1.
data: begin of itab2 occurs 0,
fld1(10) type C,
fld2(10) type C,
p_inner like ref to struct1,
end of itab2.
field-symbols <inner_table> type any.
I want to assign "itab2->p_inner->* " to "<inner_table>".
However, the following statement is Not working:
assign itab2->p_inner->* to <inner_table>.
I want to fill the values within fields fld1, fld2 and fld3 and append it in itab2.
The final table should be like:
ITAB2:
fld1 fld2 fld3
aa bb cc
dd
ee
11 22 33
44
55
I have tried many other ways too but could not suceed, please help.
Thanks,
Vishal.Thanks Matt,
But how do I append the values within this internal table ??
When I am using the following code:
ls_wa-fld3 = 'A'.
ls_wa-t_in-fld1 = 'B'.
ls_wa-t_in-fld2 = 'C'.
ls_wa-t_in-fld1 = 'D'.
ls_wa-t_in-fld2 = 'E'.
append ls_wa to lt_tab.
Its giving an error that:
The data object "LS_WA" does not have a component called "T_IN-FLD1".
I wanted the values to be appended in the following way in lt_tab:
fld3 fld1 fld2
A B C
D E
Please help. -
Problem with slis_t_specialcol_alv Field Symbol Assignment
I have created a dynamic internal table (runtime determined number of columns) to contain data to be displayed in an ALV. Ive also made ensured that the last column of the dynamic itab is of type <b>'slis_t_specialcol_alv'</b> and named <b>CINFO</b> to contain color information for that particular row. In the code below the dynamic itab is pointed to by field symbol <dyn_table> while the work area for it would be <dyn_wa>.
Somewhere down the line I attempt to assign the CINFO component of the current row of the itab to a field symbol called <fs_cinfo> typed as slist_t_specialcol_alv (Same as CINFO).
I used the code:
ASSIGN COMPONENT 'CINFO' OF STRUCTURE <dyn_wa> TO <fs_cinfo>.
This gives me the runtime error:
<i>Type conflict in the ASSIGN statement in the program "ZHRR001_TEMMATRIX".
You attempted to assign a field to a typed field symbol,
but the field does not have the required type. </i>
I am unsure why this happens as both the component CINFO and FS <fs_cinfo> are of type slist_t_specialcol_alv.
For some odd reason though during debugging, I took a look at the <dyn_wa> structure and the component type of CINFO was displayed as C???
Here is the relevant portion of code (creation of dynamic itab and attempting to assign <fs_cinfo>)
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
<dyn_wa>.
FIELD-SYMBOLS: <fs_cinfo> TYPE slist_t_specialcol_alv.
DATA: lw_cinfo TYPE slis_specialcol_alv.
DATA: li_fldcat TYPE lvc_t_fcat,
lw_fldcat TYPE lvc_s_fcat.
*Create internal table fields (they will be called Field1, Field2, etc)
*Last column will be named 'CINFO' to contain row color information
DO l_alvcolumncount TIMES.
index = sy-index.
IF index <> l_alvcolumncount.
CLEAR lw_fldcat.
CONCATENATE 'Field' index INTO lw_fldcat-fieldname .
CONDENSE lw_fldcat-fieldname NO-GAPS.
lw_fldcat-datatype = 'STRING'.
* lw_fldcat-intlen = 5.
APPEND lw_fldcat TO li_fldcat .
ELSE.
CLEAR lw_fldcat.
lw_fldcat-fieldname = 'CINFO'.
CONDENSE lw_fldcat-fieldname NO-GAPS.
lw_fldcat-datatype = 'slis_t_specialcol_alv'.
APPEND lw_fldcat TO li_fldcat.
ENDIF.
ENDDO.
* Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = li_fldcat
IMPORTING
ep_table = new_table.
ASSIGN new_table->* TO <dyn_table>.
*Create dynamic work area and assign to FS
CREATE DATA new_line LIKE LINE OF <dyn_table>.
ASSIGN new_line->* TO <dyn_wa>.
ASSIGN COMPONENT 'CINFO' OF STRUCTURE <dyn_wa> TO <fs_cinfo>.
* Color this cell
lw_cinfo-fieldname = fieldname.
lw_cinfo-color-col = 6.
APPEND lw_cinfo TO <fs_cinfo>.
Message was edited by: Sow Yong WongHello Sow
There is a big problem in the program: you are mixing types used for FM-based ALV (SLIS_...) and ABAP-OO based ALV (LVC_...).
For ABAP-OO based row colouring you have to define your itab like this:
TYPES: ty_s_outtab.
INCLUDE TYPE kna1. " just an example
TYPES: rowcolor(4) TYPE c.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE of ty_s_outtab
WITH DEFAULT KEY.
In the layout (LVC_S_LAYO) you have to set <b>ls_layout-info_fname = 'ROWCOLOR'</b>.
ROWCOLOR has to be filled according to <b>Cxyz</b> whereas
- x = color
- y = inverse on/off
- z = intensified on/off
For documentation please refer to <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907">An Easy Reference to ALV Grid Control</a>
Regards
Uwe -
Problem with field symbols in ecc 6.0
i have the following code written in 4.6 version now i am executing the old report in 6.0 but i am facing with some unicode error.
FIELD-SYMBOLS:
<line_of_bs_table> LIKE tbl1024,
READ TABLE bs_table INDEX row_bst ASSIGNING <line_of_bs_table> .
buffer_bsbuffer_ptr(aux) = <line_of_bs_table> >col_bst.
tb1024 is standard sap structure for storing buffer contents
i have the following error in ecc 6.0
structure type '<line_of_bs_table> >+col_bst' does not start with a charecter type field in unicode programs in such cases
offset/ length declarations are not allowed.
can any one tell how can a field symbol structure is changed to charecter type.Hi elinuk,
you have already posted this thread in the ABAP general forum under problem in field symbols in ecc6.0 and I think that this forum is more related to this issue than the DMS forum. So please close this thread and investigate this issue further in the ABAP general forum.
Best regards,
Christoph -
Problem with field-symbol values not updating
H i ,
I have following piece of code :
Assigning Dynamic Table to Field Symbol
ASSIGN ist_dyn_table->* TO <gs_dyn_table>.
* Creating Structure for dynamic table
CREATE DATA gs_dyn_line LIKE LINE OF <gs_dyn_table>.
* Creating line type for the Dynamic Values
ASSIGN gs_dyn_line->* TO <gs_line>.
* Populating values in the dynamic table
LOOP AT ist_pwcl_main INTO wa_pwcl_main.
ASSIGN COMPONENT gc_fld_werks OF STRUCTURE <gs_line> TO <gs_field>.
1 IF sy-subrc EQ 0.
2 <gs_field> = wa_pwcl_main-werks.
3 ENDIF.
5 IF <gs_field> IS ASSIGNED.
6 <gs_field> = wa_pwcl_main-vbeln.
ENDIF.
7 IF <gs_field> IS ASSIGNED.
8 <gs_field> = wa_pwcl_main-posnr.
ENDIF.
IF <gs_field> IS ASSIGNED.
<gs_field> = wa_pwcl_main-quant.
ENDIF.
on debugging at line 2 <gs_filed> contains the value of werks .
but at line 6 <gs_field> contains value of vbeln as 0 and at 8 of posnr as 0 .
What can be the problem ? Other values are getting assigned properly .
Plz help ...
Regards .Hi,
Assigning Dynamic Table to Field Symbol
ASSIGN ist_dyn_table->* TO <gs_dyn_table>.
Creating Structure for dynamic table
CREATE DATA gs_dyn_line LIKE LINE OF <gs_dyn_table>.
Creating line type for the Dynamic Values
ASSIGN gs_dyn_line->* TO <gs_line>.
Populating values in the dynamic table
LOOP AT ist_pwcl_main INTO wa_pwcl_main.
ASSIGN COMPONENT gc_fld_werks OF STRUCTURE <gs_line> TO <gs_field>.
1 IF sy-subrc EQ 0.
2 <gs_field> = wa_pwcl_main-werks.
3 ENDIF.
5 IF <gs_field> IS ASSIGNED.
6 <gs_field> = wa_pwcl_main-vbeln.
ENDIF.
7 IF <gs_field> IS ASSIGNED.
8 <gs_field> = wa_pwcl_main-posnr.
ENDIF.
IF <gs_field> IS ASSIGNED.
<gs_field> = wa_pwcl_main-quant.
ENDIF.
Based on your coding above, <gs_field> has been assigned with data type 'WERKS' (i'd assume component gc_fld_werks found from structure <gs_line> is a plant typed), which is a CHAR(4) data type.
Meaning, if <gs_field> is assigned with Plant type value, e.g. <gs_field> = '1000', field symbol <gs_field> will contain 4 character only.
At line 6, if wa_pwcl_main-vbeln = '0000201000', <gs_field> is only capturing '0000' only. This is also happened to line 8.
However, it looks like that <gs_field> is getting over-write if ASSIGNED statement returns SY-SUBRC = 0.
Hope this helps.
Regards,
Patrick -
Problem with FIELD SYMBOL upgrading from 46c to ECC6.0
Hi people... i'm having big trouble making an upgrade from 4.6c to ECC6.0 with this portion of code of Z's programm.
In the line
ASSIGN (w_field) TO <fs_field>.
i don't see any assigment, so <fs_field> remains empty, when enters into firts IF conditions it is TRUE, then go into second IF condition, it is FALSE, and finally assing
<fs_field> = '/'.
, at this point i have a DUMP telling me MOVE_TO_LIT_NOTALLOWED_NODATA
I'm try any way of definition, assigment, but always i have a DUMP.
Someone can give a hand with this issue!
Thanks in advance!!!
This is the full code from the FORM with the problem.
* FORM GRABA *
* --> VALUE(P_TABLE) *
FORM graba USING value(p_table) TYPE c.
DATA:
w_field(60),
w_dd03l TYPE dd03l.
FIELD-SYMBOLS <fs_field>.
CLEAR w_flag.
CASE p_table.
WHEN 'BGR00'.
d_bgr00-group = w_batin.
d_bgr00-mandt = sy-mandt.
d_bgr00-usnam = sy-uname.
d_bgr00-xkeep = 'X'.
d_bgr00-nodata = '/'.
d_bgr00-stype = 0.
TRANSFER d_bgr00 TO w_fname.
WHEN 'BBKPF'.
LOOP AT gt_dd03l INTO w_dd03l WHERE tabname EQ p_table.
CONCATENATE
'd_'
w_dd03l-tabname
w_dd03l-fieldname
INTO w_field.
ASSIGN (w_field) TO <fs_field>.
IF <fs_field> IS INITIAL OR <fs_field> EQ '/'.
IF w_dd03l-fieldname EQ 'TBNAM'.
<fs_field> = p_table.
ELSE.
<fs_field> = '/'.
ENDIF.
ELSE.
w_flag = 'X'.
ENDIF.
ENDLOOP.
TRANSFER d_bbkpf TO w_fname.
WHEN 'BBSEG'.
LOOP AT gt_dd03l INTO w_dd03l WHERE tabname EQ p_table.
CONCATENATE
'd_'
w_dd03l-tabname
w_dd03l-fieldname
INTO w_field.
ASSIGN (w_field) TO <fs_field>.
IF <fs_field> IS INITIAL OR <fs_field> EQ '/'.
IF w_dd03l-fieldname EQ 'TBNAM'.
<fs_field> = p_table.
ELSE.
<fs_field> = '/'.
ENDIF.
ELSE.
w_flag = 'X'.
ENDIF.
ENDLOOP.
TRANSFER d_bbseg TO w_fname.
ENDCASE.
ENDFORM.
Edited by: Matt on Dec 15, 2008 5:03 PM - Made subject more informativeGentlemen:
The problem around this statement:
ASSIGN (w_field) TO <fs_field>
is explained as follows:
1. In ABAP language, there are two ways for assigning a new value to a field-symbol.
- Sentence: ASSIGN (values) TO <my_field_symbol>.
In this case, the <my_field_symbol> receives from (w_field) the data type and value content of this variable. So, we keep that a FSymbol is assigned and, at the same time, receives an initial value.
- Sentence: <my_field_symbol> = '/' or <my_field_symbol> = my_var.
In this way, we only pass the content of the variable next to = sign. But before this, the field-symbol must had been assigned (using ASSIGN statement), in another case, the compiler raises an exception.
Following the example of Federico... I think he tried to assign a field like this (please, supose the program imports the structure of a database table with a standard function, into a internal table which is looped by the work area w_field ):
- If w_field contains 'BKPF-WERKS', so sentence ASSIGN will affect the field symbol, passing to this the data type and current content of table field BKPF-WERKS.
- If w_field contains 'BKPF-.INCLUDE': *the column .INCLUDE obviously is not associated with a data type... so our statement ASSIGN... TO... never pass any data type or value to our field-symbol. So that, this field is never initialized properly, and when inmmediately you try to execute something like this: <my_field_symbol> = '/', the game (program) is over.. XD
I hope this post was helpful for anyone...
Best Regards!!
RRG
ABAPer(u) - EVOLution -
Problem with field-symbols in UNICODE conversion
Hi all.
I'm in a UNICODE conversion project and I have a problem with a program that uses field-symbols.
DATA: BEGIN OF wa_data_aux,
mandt LIKE zindices-mandt,
kschl LIKE zindices-kschl,
datab LIKE zindices-datab,
valor LIKE zindices-valor,
descripcion LIKE zindices-descripcion,
ernam LIKE zindices-ernam,
erdat LIKE zindices-erdat,
waers LIKE zindices-waers,
END OF wa_data_aux.
FIELD-SYMBOLS:
<fs2> TYPE ANY,
<fs3> LIKE wa_data_aux.
<fs2> = <fs3>.
This assignment results in a DUMP.
Can anybody help me to solve this problem?
Thanks!!TYPES: BEGIN OF wa_data_aux,
mandt TYPE mandt,
kschl TYPE kschl,
erdat TYPE d,
waers TYPE waers,
END OF wa_data_aux.
DATA: w_aux TYPE wa_data_aux.
FIELD-SYMBOLS:
<fs2> TYPE ANY,
<fs3> TYPE wa_data_aux.
w_aux-mandt = '300'.
ASSIGN w_aux TO <fs3>.
ASSIGN <fs3> TO <fs2>.
WRITE : / <fs2>.
GBY. -
Hi!
I have a problem with a field-symbol like this:
DATA: gt_coep_ext TYPE kaep_t_coep_ext.
field-symbols <gt_data> type table.
ASSIGN gt_coep_ext TO <gt_pos_data>
This field symbol is used in the FM REUSE_ALV_GRID_DISPLAY as output table. I need add two fields in this <gt_data>. Is there any way to add new fields in the <gt_data> structure.
Thanks!!Create your one Fieldcat
Global data declaration ***
TYPE-POOLS: SLIS.
<types: ... . " user definded types>
DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: G_REPID LIKE SY-REPID.
DATA: GT_OUTTAB TYPE <UD_STRUCT> OCCURS 0 WITH HEADER LINE.
<data: ... . " user specific data>
Initialization field catalog ***
INITIALIZATION.
G_REPID = SY-REPID.
PERFORM FIELDCAT_INIT USING GT_FIELDCAT[].
Data selection ***
START-OF-SELECTION.
PERFORM SELECT_DATA TABLES GT_OUTTAB.
Display list ***
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
IT_FIELDCAT = GT_FIELDCAT[]
TABLES
T_OUTTAB = GT_OUTTAB.
FORMS ***
FORM FIELDCAT_INIT USING RT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: POS TYPE I VALUE 1.
Initialize keyfield(s)
CLEAR LS_FIELDCAT.
LS_FIELDCAT-COL_POS = POS.
LS_FIELDCAT-FIELDNAME = <GT_OUTTAB_FIELD_NAME>.
LS_FIELDCAT-REF_FIELDNAME = <DDIC_REF_FIELD_NAME>.
LS_FIELDCAT-REF_TABNAME = <DDIC_REF_TABLE_NAME>.
LS_FIELDCAT-KEY = 'X'. " sets key field
APPEND LS_FIELDCAT TO RT_FIELDCAT.
Initialize normal field(s)
POS = POS + 1.
clear ls_fieldcat.
ls_fieldcat-col_pos = pos.
LS_FIELDCAT-FIELDNAME = <GT_OUTTAB_FIELD_NAME>.
LS_FIELDCAT-REF_FIELDNAME = <DDIC_REF_FIELD_NAME>.
LS_FIELDCAT-REF_TABNAME = <DDIC_REF_TABLE_NAME>.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
Initialize hidden field(s)
POS = POS + 1.
clear ls_fieldcat.
ls_fieldcat-col_pos = pos.
LS_FIELDCAT-FIELDNAME = <GT_OUTTAB_FIELD_NAME>.
LS_FIELDCAT-REF_FIELDNAME = <DDIC_REF_FIELD_NAME>.
LS_FIELDCAT-REF_TABNAME = <DDIC_REF_TABLE_NAME>.
LS_FIELDCAT-NO_OUT = 'X'. " sets hidden field
APPEND LS_FIELDCAT TO RT_FIELDCAT.
ENDFORM. " fieldcat_init
FORM SELECT_DATA TABLES RT_OUTTAB LIKE GT_OUTTAB[].
<user specific data selection>
ENDFORM. " select_data -
Problem with populating internal with field-symbol
hi all,
I have following structure of internal table .
internal Table 1(int1) : source,source_field, and other fields.
internal Table 2 (int2): x1,x2,x3,x4,x5,x6 .
Read table 1 assigning <gs_t1> with....
assign ( <gs_t1>-source_field ) to <ld_char> .
case <gs_t1>-source.
when 'int1'.
Read int1 assgining <gs_int1> .
ASSIGN COMPONENT <ld_char> OF STRUCTURE <gs_int1>
TO <fs_char>.
wa_output-x1 = <fs_char>.
simillarly,
ASSIGN COMPONENT <ld_char> OF STRUCTURE <gs_int1>
TO <fs_char>.
wa_output-x2 = <fs_char>.
The source_field of int1 contains any value either it can be x2,x3,x4 .
Now the problem is how my work wa_output should know that <fs_char> contains value of field x1 .
I mean to say how we willl determine that value to be passed is to wa_output-x1 or wa_output-x2 as <ld_char> is just a pointer we cannot determine anything .
so how should i make my workarea . It can be made as a fields-symbol but how to that .
As it is having a strucutre of like :
componenet component_type
CONTROLLER PRXCTRLTAB<-this is also a line type having value two fields
x1 char5
x2 char5
Plz help...Hi all,
i have to pass all field values after obtaining them to a workarea wa_output .
data : wa_output type xyz.
READ TABLE ist_smp_tst ASSIGNING <gs_smp_tst>
WITH KEY iden_no =
<gs_smp_tst_dtl>-iden_no
BINARY SEARCH.
ASSIGN COMPONENT <ld_char_val> OF STRUCTURE
<gs_smp_tst_lab> TO <fs_char>.
CONCATENATE 'WA_OUTPUT-' <fs_char> INTO l_field.
ASSIGN (l_field) TO <wa_field>.
<wa_field> = <fs_char>.
read table ist_temp .........
<wa_field> = <fs_char>.
I have done this but <wa_field> actually holds the current data of <fs_char>
it should be like
wa_ouput-f1 = <fs_char>..
wa_output-f2 = <fs_char>.
and the appending it to wa_output to i_output .
How we can do this using field-symbol.
Plz required help.
Regards. -
Problem FIELD-SYMBOL with HASHED TABLE
Hello gurus,
I have a problem with the following code. It is called in method MB_DOCUMENT_BEFORE_UPDATE of badi MB_DOCUMENT_BADI. I need to read the serial numbers of all items. I tried to do it with a field symbol. The information I need is stored in the hased table (SAPLMIGO)LCL_MIGO_GLOBALS=>KERNEL->PT_GOSERIAL_KERNEL. The systems returns sy-subrc = 4 after the assign. Can anyone help me? Thanks!
TYPES: BEGIN OF ty_s_goserial,
selected TYPE xfeld,
serialno TYPE gernr,
END OF ty_s_goserial,
ty_t_goserial TYPE STANDARD TABLE OF ty_s_goserial WITH
NON-UNIQUE DEFAULT KEY.
TYPES: BEGIN OF ty_s_goserial_kernel,
global_counter TYPE migo_global_counter,
t_goserial TYPE ty_t_goserial,
END OF ty_s_goserial_kernel.
types: tyt_goserial TYPE HASHED TABLE OF ty_s_goserial_kernel
WITH UNIQUE KEY global_counter.
fs_l_serialno = '(SAPLMIGO)LCL_MIGO_GLOBALS=>KERNEL->PT_GOSERIAL_KERNEL'.
FIELD-SYMBOLS: <fs_serialno> type tyt_goserial.
ASSIGN (fs_l_serialno) TO <fs_serialno>.
IF sy-subrc = 4.
WRITE: / 'Ouch...'.
ENDIF.Hi,
Try adding body operator..at the end as it is an internal table..
(SAPLMIGO)LCL_MIGO_GLOBALS=>KERNEL->PT_GOSERIAL_KERNEL[]'.
Thanks
Naren -
Problem related to field-Symbol?
HI All,
I am writting the below coding, Please tell me whether the Field Symbol will act as a table or not as I want to append a lot of data to field symbol. Please tell me is there any problem in the code.
LOOP AT lt_vepoequi_keys into ls_vepoequi_keys.
READ TABLE lt_vekp ASSIGNING <ls_vekp_str> with key
matnr = ls_vepoequi_keys-matnr.
IF sy-subrc = 0.
<ls_vekp_str>-stoff = ls_vepoequi_keys-stoff.
<ls_vekp_str>-sonum = ls_vepoequi_keys-sonum.
<ls_vekp_str>-lagkl = ls_vepoequi_keys-lagkl.
<ls_vekp_str>-lagkt = ls_vepoequi_keys-lagkt.
endif.
endloop.Hi Abhinav,
you have internal table (say it_employee) with fields name,age,senior_category.
now when you loop this internal table you will need workarea.
loop at it_employee into wa_employee.
if wa_employee-age > 60.
wa_employee-senior_category = 'YES'.
else.
wa_employee-senior_category = 'NO'.
endif.
modify it_employee from wa_employee.
endloop.
now one use of Field-symbols is : when internal table is huge and when you loop with workarea and modify internal table each time, it takes time. So if we use Field-symbols performance would increase.
loop at it_employee assigning into <fs_employee>.
if <fs_employee>-age > 60.
<fs_employee>-senior_category = 'YES'.
else.
<fs_employee>-senior_category = 'NO'.
endif.
endloop.
Now you see in the above code, i have not used modify statement because when i loop internal table, the field symbol points directly to the memory of internal table.
So during loop if i assign any value to the field symbol then it directly changes the internal table value, so there wont be any need to use modify statement.
Hope you are clear with this example....
Regards
Sajid
Maybe you are looking for
-
Issue in creating OPSS Schema with rcu.
Hi, There is an issue in creating the OPSS schema in oracle DB 11.2.0.3.0 even though the rcu (Oracle Fusion Middleware Repository Creation Utility 11g (11.1.2.1.0) completed it without any error with status of success opss schema at the end of
-
I have seen users posting new threads, which are discussed earlier and solutions is available in the forums. This just increases the volume of posts. Can we have a functionality where, before posting a new thread, a search is performed in the forums
-
i buy a ipod with video 30 gb and i install the ipod and itunes. everething it's all right the video the music, but i can't put photos in my ipod. in first place i synchronized with my images and the ipod start to copy photos but in the middle of the
-
This may be a dumb question, but... I have a custom converter with attributes. I've built the converter itself, but am not clear on how to hook it in as far as the attributes are concerned. Is there a .tld? How does one set it up? Sorry if this is a
-
Java webstart - authentication required
Hello and thank you for reading my post, I need to get the username written in the "Authentication required" dialog. System.getenv("User.name") gets the username used to login to OS. Would be grateful for any help. Best regards, S.Renani