Moving columns of an internal table to rows of an another internal table.
Hi
i have an internal table with 20 fields for single record .Now i need to move the 20 fields
(of similar length) of single record into internal table with those 20 fields as 20 records i.e i need to make rows of first internal table into columns of second internal table.
hope iam clear.
HI Deepthi,
Try with this Logic...
IF NOT ITAB[] IS INITIAL.
LOOP AT ITAB FROM 7.
ITAB2-FIELD1 = ITAB-FIELD1.
ITAB2-FIELD2 = ITAB-FIELD2.
APPEND : ITAB2.
CLEAR : ITAB2.
ENDLOOP.
DO 27 TIMES.
CASE CNT.
WHEN '1'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD6.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD6.
WHEN '2'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD7.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD7.
WHEN '3'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD8.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD8.
WHEN '4'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD9.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD9.
WHEN '5'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD10.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD10.
WHEN '6'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD11.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD11.
WHEN '7'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD12.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD12.
WHEN '8'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD13.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD13.
WHEN '9'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD14.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD14.
WHEN '10'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD15.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD15.
WHEN '11'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD16.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD16.
WHEN '12'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD17.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD17.
WHEN '13'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD18.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD18.
WHEN '14'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD19.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD19.
WHEN '15'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD20.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD20.
WHEN '16'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD21.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD21.
WHEN '17'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD22.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD22.
WHEN '18'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD23.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD23.
WHEN '19'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD24.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD24.
WHEN '20'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD25.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD25.
WHEN '21'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD26.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD26.
WHEN '22'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD27.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD27.
WHEN '23'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD28.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD28.
WHEN '24'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD29.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD29.
WHEN '25'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD30.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD30.
WHEN '26'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD31.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD31.
WHEN '27'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD32.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD32.
WHEN '28'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD33.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD33.
WHEN '29'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD34.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD34.
WHEN '30'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD35.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD35.
WHEN '31'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD36.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD36.
WHEN '32'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD37.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD37.
WHEN '33'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD38.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD38.
WHEN '34'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD39.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD39.
WHEN '35'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD40.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD40.
WHEN '36'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD41.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD41.
WHEN '37'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD42.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD42.
WHEN '38'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD43.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD43.
WHEN '39'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD44.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD44.
WHEN '40'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD45.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD45.
WHEN '41'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD46.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD46.
WHEN '42'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD47.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD47.
WHEN '43'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD48.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD48.
WHEN '44'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD49.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD49.
WHEN '45'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD50.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD50.
WHEN '46'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD51.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD51.
WHEN '47'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD52.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD52.
WHEN '48'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD53.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD53.
WHEN '49'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD54.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD54.
WHEN '50'.
READ TABLE ITAB INDEX 4.
ITAB3-FIELD1 = ITAB-FIELD55.
READ TABLE ITAB INDEX 5.
ITAB3-FIELD2 = ITAB-FIELD55.
ENDCASE.
APPEND ITAB3.
CLEAR ITAB3.
CNT = CNT + 1.
ENDDO.
ENDIF.
ENDIF.
Regards,
Santosh
Similar Messages
-
How can I use one hierarchical table as a node of another hierarchical tabl
I have a requirement where I have two hierarchical tables and one table should work as node for other table . How to achieve this??
To elaborate more the structure is like
Main Table (Company Structure)
Sub table Consolidation Groups which has got hierarchical structure
Sub table Entity which is also hierarchical.
The Entity table should act as a node for table Consolidation Groups
How can I achieve this functionality??
Thanks
Suvarnayou misunderstood me apparently. I said you can't organinze to tables so one serves as a node's value of the other. Let me show you wnat I suggested by an example.
First table has such values:
-A
|-B
|-C
and the second one is
-x
|-y
|-z
-p
|-r
|-s
I thought you wanted to confine relationships between them so fo B node be able to select only x's branch and for C - only p's branch. If it's similar to the truth then let's create another table with two fields. Field one points to table containing capital letters and field two - lower case letters. Both fields are of type lookup pointing to an hierachial tables. Now when you populate this table you'll create records like (I list two columns):
B - y
B - z
C - r
C - s
from your orinal table from now you should point to the above table. So instead of having two fields each pointing to its own table and compeling you to think how to organize two hierarchies, now you have only one field pointing to a table with all valid combinations. When you populate this table though YOU have to decide what such combinations are. It may make sense (if you have different users) to restrict access to this table on read-only level for regular users to preserve the valid combinations.
Hope it helps but if I understood your wrong give a concrete example. -
How to display internal frame on click event from another internal frame
hi me developing desktop application in netbean. i have some problem. plz reply me as soon as possible. feedback me on [email protected]
1. I want to invoke an Internal Frame by click event that is in another internal frame. how i do it. I tried my best
2. how can i call reports (ireports) from swing applicationRead the JInternalFrame API. You will find a link to the Swing tutorial on "How to Use Internal Frames" which contains a working example.
-
CONVERTING ROWS OF AN INTERNAL TABLE TO COLUMNS OF ANOTHER INTERNAL TABLE
Hi,
I hv an internal table itab as below with 3 columns.
name age place
sandeep 24 delhi
ajay 22 bangalore
abhishek 25 mumbai
internal table itab can have any number of rows.
from this internal table i want to make another internale table itab_new as
sandeep ajay abhishek
24 22 25
delhi bangalore mumbai
thanksHi,
Check this example:
data:p_temp(30) TYPE c value 'ztmp_projectreport'.
*data declaration
DATA: it_tab TYPE filetable,
gd_subrc TYPE i,
answer TYPE c.
TYPES: BEGIN OF t_abapcode,
row(72) TYPE c,
END OF t_abapcode.
DATA: it_abapcode TYPE STANDARD TABLE OF t_abapcode INITIAL SIZE 0.
data:it_prps like prps occurs 0 with header line.
data:colum(20) type c.
data:ncol type i.
data:ccol type c.
select * into corresponding fields of table
it_prps from prps where
append 'report ztmp_projectreport' to it_abapcode.
append 'data:begin of it_prps2,' to it_abapcode.
ncol = 1.
loop at it_prps.
ccol = ncol.
concatenate 'colum' ccol '(20)' into colum.
concatenate colum 'type c,' into it_abapcode.
add 1 to ncol.
endloop.
append 'data:end of it_prps2.' to it_abapcode.
'All your code here to fill the internal table and alv grid
'End of all your code
INSERT REPORT p_temp FROM it_abapcode.
SUBMIT (p_temp) AND RETURN.
DELETE REPORT p_temp.
Please provide points -
How to populate rows in the detail table of a form from another table.
please can someone help me here:
i have a master/detail page. the master data is created and then i would like to do this: when one goes to the detail page (when first created), i would like somehow to populate all the rows in the detail table from rows retrieved in another table (with conditions).
i am new to apex so if this is a stupid question i apologise in advance!Hi
Firstly, there are no stupid questions, we all start somewhere!
However, I could do with some more detail (or even better an example on apex.oracle.com). Please can you post exactly what you have so far and what you want to achieve with simple details of the tables involved.
It sound like you may need to create a custom process to populate the details. You say 'with conditions'... what conditions?
Cheers
Ben
http://www.munkyben.wordpress.com
Don't forget to mark replies helpful or correct ;) -
How do I get table heading rows to repeat if a table is broken across one or more pages? I'm sure it's something simple, but I have just about driven myself insane trying to figure it out. Help, please!
Molly,
You might be better off asking this question in the Structured FM
section of the forum as this is part is for unstructured FM.
Also, your question might easily be missed when you jump in on an
older topic such as this. Please start a new topic and also include
other relevant information such as your version of FrameMaker
(including point release, e.g. 8.0p277) and the structure of the table
elements that you're using.
Arnis Gubins
Forum host -
Transfering from one Internal Order to another Internal order
Hi
I need to transfer part of internal order from one location to another internal order to a different location (not physically, but in the system). Budget is only one
Can somebody let me know if we have this functionality in the Controlling. Each Internal Order is assigned to different CWIP.
PrasadI want to transfer the Budget and Actuals also. The actual scenario is like this:
We have a budget for 10lakhs. We purchased some materials. Please remeber this is CWIP related thru internal order. Part of the Budget is used (for 1 lakh) and purchased material against this. Part of this material purchased say 40000 is to be transfered to another location Physically, for similar activity.
As a i am transfering this material, part of my internal order is also has to be transfered to the other location, but remember the budget will be the same.
So I need to transfer actuals and budget to another location.
Prasad -
How to convert rows of internal table to columns of another internal table?
Hi,
Experts,
test_data.xls:
one two three four five
one two three four
one two three
one two
one
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = 'c:/test_data.xls'
I_BEGIN_COL = '1'
I_BEGIN_ROW = '1'
I_END_COL = '10'
I_END_ROW = '10'
TABLES
INTERN = it_tab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
output:
0001 0001 one
0001 0002 two
0001 0003 three
0001 0004 four
0001 0005 five
0002 0001 one
0002 0002 two
0002 0003 three
0002 0004 four
0003 0001 one
0003 0002 two
0003 0003 three
0004 0001 one
0004 0002 two
0005 0001 one
but i want this format:
one two three four five
one two three four
one two three
one two
one
i don't want this type of output display i want to display in ABAP report as in file format how can i achieve this post some ideas on it.
Thank U,
Shabeer ahmed.Hi,
Use this piece of code :
parameters: p_flname type rlgrap-filename.
data:
li_filecontent type standard table of alsmex_tabline ,
lwa_filecontent type alsmex_tabline ,
lv_begin_col type i value 1,
lv_begin_row type i value 1,
lv_end_col type i value 17,
lv_end_row type i value 65000,
li_fieldlist type lvc_t_fcat,
li_data type ref to data,
dy_line type ref to data.
field-symbols:<dyntable> type standard table,
<fs_data> type ref to data,
<fs_1>,
<dyn_wa>,
<dyn_field>.
*Transfer excel file contents to internal table
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = p_flname
i_begin_col = lv_begin_col
i_begin_row = lv_begin_row
i_end_col = lv_end_col
i_end_row = lv_end_row
tables
intern = li_filecontent
exceptions
inconsistent_parameters = 1
upload_ole = 2
error_message = 3
others = 4.
if sy-subrc = 0.
*Creating the list of fields in the table
perform f_create_tab_field tables li_fieldlist using 'BUKRS' 4 .
perform f_create_tab_field tables li_fieldlist using 'ZPOC_KUNNR' 10 .
perform f_create_tab_field tables li_fieldlist using 'RANL' 13.
perform f_create_tab_field tables li_fieldlist using 'ZPEDAT' 10 .
perform f_create_tab_field tables li_fieldlist using 'KWERT' 15 .
perform f_create_tab_field tables li_fieldlist using 'BONUS' 2 .
perform f_create_tab_field tables li_fieldlist using 'WAERS' 5 .
perform f_create_tab_field tables li_fieldlist using 'ZVAL' 15 .
perform f_create_tab_field tables li_fieldlist using 'ZQTY' 15 .
perform f_create_tab_field tables li_fieldlist using 'KMEIN' 3 .
assign li_data to <fs_data>.
*CREATING INTERNAL TABLE TO store data
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = li_fieldlist
importing
ep_table = <fs_data>
exceptions
generate_subpool_dir_full = 1
others = 2.
if sy-subrc = 0.
assign <fs_data>->* to <fs_1>.
assign <fs_1> to <dyntable>.
Create dynamic work area and assign to FS
create data dy_line like line of <dyntable>. " creating a line type of the table just created above
assign dy_line->* to <dyn_wa>. " creating the work area with reference to the line type
loop at li_filecontent into lwa_filecontent.
assign component lwa_filecontent-col "accessing corresponding field in the field catalog
of structure <dyn_wa> to <dyn_field>. "and assigning this field to a field symbol
if sy-subrc = 0.
<dyn_field> = lwa_filecontent-value. " filling value for this field
endif.
at end of row.
append <dyn_wa> to <dyntable>.
clear <dyn_wa>.
endat.
clear lwa_filecontent.
endloop.
i_input_file[] = <dyntable>.
endif.
elseif sy-subrc <> 0.
message s027 display like c_error with text-001.
stop.
endif.
form f_create_tab_field tables p_li_fieldlist structure lvc_s_fcat
using p_fname
p_lenght.
data:lwa_fieldlist type lvc_s_fcat.
lwa_fieldlist-fieldname = p_fname.
lwa_fieldlist-intlen = p_lenght.
append lwa_fieldlist to p_li_fieldlist.
clear lwa_fieldlist.
endform. " F_CREATE_TAB_FIELD
Regards,
Dev. -
Interchanging rows and colums of internal table
Hi all,
I have one requirement to interchange the rows and colums of 3X3 internal table.(internal table contains 3 rows and 3 columns ). In the new internal table, I have to display the rows as column values and column values as rows..
It's urgently. Kindly send me the sample code for the same.
Thanks in advance.
Ramesh.Hi ramesh,
it is not possible to create a 'transponed' internal table if the (2) fields in your table arte or different type. Thus each row of the new table would be of different type.
The quick solution for display is
field-symbols:
<any> type any.
do.
loop at itab.
assign component sy-index of structure itab to <any>.
if sy-subrc <> 0.
* not assigned means no more components
exit.
endif.
write <any>.
endloop.
if sy-subrc = 0.
* start a new line for the next field
write /.
else.
* all done
exit.
endif.
enddo.
If you really want to store the values in transposes table, you could do so by storing their references in fields of type REF TO DATA because this is good for any data.
possible usage:
types:
ty_t_reftab type standard table of ref to data with default key,
ty_t_transposed type standard table of ty_t_reftab with default key.
data:
lt_transposed type ty_t_transposed,
lv_ref type ref to data.
field-symbols:
<any> type any,
<transposed> type line of ty_t_transposed
do.
loop at itab.
at first.
append initial line to lt_transposed assigning <transposed>.
endat.
assign component sy-index of structure itab to <any>.
if sy-subrc <> 0.
* not assigned means no more components
exit.
endif.
get refernce of <any> into lv_ref.
append lv_ref to <transposed>.
endloop.
if sy-subrc <> 0.
* all done
exit.
endif.
enddo.
read table
Sorry, don't know what it's good for. If you need the values, access them like
loop at lt_transposed assigning <transposed>.
loop at <transposed> assigning <any>.
write <any>->*. "Hope that works with WRITE
endloop.
endloop.
Regards,
Clemens -
Create an internal table with the rows of another internal table.
Hi I want to know if posible to create an internal table structure with the rows of another internal table?
ex.
If in i_tab column A has this values: row 1 = first, row 2 = second, row 3 = third.
Now I want that the structure of my internal table be: first, second, thirdHi,
If you do this way then what will be the difference between the two table anyway?? First internal table has the same structure irrespective of which row you select. and you are going to store the data from each row to the rows of the second internal table. In that case, the structure of the internal table is the same as first table. and it would have same rows.
Am I missing something here? or you want to declare the internal table with each field being the structure of the first table? In this case you'd have to do a dynamic declaration of data as the first table can have any no of rows then the second table would have any no of fields in the structure.
Now if you know that your first internal table is going to have a fixed no of rows eg 3 rows then it becomes simple. Do the following then
Data: begin of second_table occurs 0,
first type <first_table type>,
second type <first_table type>,
third type <first_table type>,
end of second_table.
Regards
Prasenjit -
How to convert rows to lines in internal table?
Hi Folks,
i have an internal table with some rows and would like to convert that table into another internal table with columns.
Let me give you an example:
it1:
a
b
c
d
it1 should be converted into table it2 and should look like this:
it2:
a b c d
The problem is that the entries in table it1 are not fixed, so that means that the number of lines is different depending on the query...
Has anyone an idea?
Thanks in advance,
Ralf
Edited by: Ralf Vath on Oct 17, 2008 11:01 AMhi i have an example in the alv ....that the rows are transported into columns...
REPORT Z_TRANSPOSEALV .* Type pools declaration for ALV
TYPE-POOLS: slis.*Declarations for ALV, dynamic table and col no for transpose
DATA: l_col TYPE sy-tabix,
l_structure TYPE REF TO data,
l_dyntable TYPE REF TO data,
wa_lvc_cat TYPE lvc_s_fcat,
lt_lvc_cat TYPE lvc_t_fcat,
lt_fieldcatalogue TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_layout TYPE slis_layout_alv.*Field symbols declarations
FIELD-SYMBOLS :
<header> TYPE ANY,
<dynheader> TYPE ANY,
<dyndata> TYPE ANY,
<ls_table> TYPE ANY,
<dynamictable> TYPE STANDARD TABLE,
<it_table> TYPE STANDARD TABLE.*Input the name of the table
PARAMETERS p_table TYPE dd02l-tabname OBLIGATORY.*Initialization event
INITIALIZATION.*Start of selection event
START-OF-SELECTION.* Create internal table of dynamic type
CREATE DATA l_dyntable TYPE STANDARD TABLE OF (p_table)
WITH NON-UNIQUE DEFAULT KEY.
ASSIGN l_dyntable->* TO <it_table>.*select statement to select data from the table as input into
*our dynamic internal table.
*Here i have restricted only till 5 rows.
*You can set a variable and give no of rows to be fetched
*The variable can be set in your select statement SELECT * INTO CORRESPONDING FIELDS OF TABLE <it_table>
FROM (p_table) up to 5 rows.*Fieldcatalogue definitions
wa_lvc_cat-fieldname = 'COLUMNTEXT'.
wa_lvc_cat-ref_table = 'LVC_S_DETA'.
APPEND wa_lvc_cat TO lt_lvc_cat. wa_fieldcat-fieldname = 'COLUMNTEXT'.
wa_fieldcat-ref_tabname = 'LVC_S_DETA'.
wa_fieldcat-key = 'X'..
APPEND wa_fieldcat TO lt_fieldcat. DESCRIBE TABLE <it_table>. DO sy-tfill TIMES.
For each line, a column 'VALUEx' is created in the fieldcatalog
Build Fieldcatalog
WRITE sy-index TO wa_lvc_cat-fieldname LEFT-JUSTIFIED.
CONCATENATE 'VALUE' wa_lvc_cat-fieldname
INTO wa_lvc_cat-fieldname.
wa_lvc_cat-ref_field = 'VALUE'.
wa_lvc_cat-ref_table = 'LVC_S_DETA'.
APPEND wa_lvc_cat TO lt_lvc_cat.
Build Fieldcatalog
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = wa_lvc_cat-fieldname.
wa_fieldcat-ref_fieldname = 'VALUE'.
wa_fieldcat-ref_tabname = 'LVC_S_DETA'.
APPEND wa_fieldcat TO lt_fieldcat.
ENDDO.* Create dynamic internal table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_lvc_cat
IMPORTING
ep_table = l_dyntable. ASSIGN l_dyntable->* TO <dynamictable>.* Create structure as structure of the internal table
CREATE DATA l_structure LIKE LINE OF <dynamictable>.
ASSIGN l_structure->* TO <header>.* Create structure = structure of the internal table
CREATE DATA l_structure LIKE LINE OF <it_table>.
ASSIGN l_structure->* TO <ls_table>.* Create field catalog from our table structure
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = p_table
CHANGING
ct_fieldcat = lt_fieldcatalogue
EXCEPTIONS
inconsistent_interface = 1
program_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. DESCRIBE TABLE lt_fieldcatalogue.* Fill the internal to display <dynamictable>
DO sy-tfill TIMES.
IF sy-index = 1.
READ TABLE lt_fieldcatalogue INTO wa_fieldcat INDEX 1.
ENDIF.
For each field of it_table
ASSIGN COMPONENT 1 OF STRUCTURE <header> TO <dynheader>.
IF sy-subrc NE 0. EXIT .ENDIF.
READ TABLE lt_fieldcatalogue INTO wa_fieldcat INDEX sy-index.
Fill 1st column
<dynheader> = wa_fieldcat-seltext_m.
IF <dynheader> IS INITIAL.
<dynheader> = wa_fieldcat-fieldname.
ENDIF.*Filling the other columns
LOOP AT <it_table> INTO <ls_table>.
l_col = sy-tabix + 1.
ASSIGN COMPONENT sy-index OF STRUCTURE <ls_table> TO <dyndata>.
IF sy-subrc NE 0. EXIT .ENDIF.
ASSIGN COMPONENT l_col OF STRUCTURE <header> TO
<dynheader>.
IF sy-subrc NE 0. EXIT .ENDIF.
WRITE <dyndata> TO <dynheader> LEFT-JUSTIFIED.
ENDLOOP.
APPEND <header> TO <dynamictable>.
ENDDO.*Layout for ALV output
lt_layout-zebra = 'X'.
lt_layout-no_colhead = 'X'..
lt_layout-colwidth_optimize ='X'.
lt_layout-window_titlebar = 'ALV GRID TRANSPOSED'.*ALV Grid output for display
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = lt_layout
it_fieldcat = lt_fieldcat
TABLES
t_outtab = <dynamictable>. -
Copy a certain row of data into the next row in a same internal table ??
HI, guys.
May i know how to copy a certain row of data into the next row in a same internal table ?? Bcz I plan to update a certain colum of data in the row just now into another value..
For example:-
*at first...
ebeln1 ebelp1 xblnr1
ebeln2 ebelp2 xblnr2
ebeln3 ebelp3 xblnr3
*after that, become...
ebeln1 ebelp1 xblnr1
ebeln2 ebelp2 xblnr2
ebeln2 ebelp2 xblnr4
ebeln2 ebelp2 xblnr5
ebeln3 ebelp3 xblnr3
Thanks in advance.hi,
If you have this kind of requirement then you must be having 2 internal tables ,one existing data and 2nd from which you have to insert the records into 1st table.
so in this case,
loop at itab1.
v_index = sy-tabix.
loop at itab2 into wa where pri_key = itab1-pri_key.
v_index = v_index + 1.
insert wa into itab index v_index.
endloop.
endloop.
Using this code ,your data records similar to your 1st tables primary key records will get inserted into table. -
How can I write into a table cell (row, column are given) in a databae?
How can I write into a table cell (row, column are given) in a database using LabVIEW Database Toolkit? I am using Ms Access. Suppose I have three columns in a table, I write 1st row of 1st column, then 1st row of 3rd column. The problem I am having is after writing the 1st row 1st column, the reference goes to second row and if I write into 3rd column, it goes to 2nd row 3rd column. Any suggestion?
Solved!
Go to Solution.When you do a SQL INSERT command, you create a new row. If you want to change an existing row, you have to use the UPDATE command (i.e. UPDATE tablename SET column = value WHERE some_column=some_value). The some_column could be the unique ID of each row, a date/time, etc.
I have no idea what function to use in the toolkit to execute a SQL command since I don't use the toolkit. I also don't understand why you just don't do a single INSERT. It would be much faster. -
Repeat header's column in a table with row height that greater then 200px
== Issue
==
I have another kind of problem with Firefox
== Description
==
I develop a website and encounter some problem about web page printing. I try to repeat header's column in a table with row's height that greater than or equal to 198px, but it doesn't work. Another size that lower than 198px works fine. If somebody has seen this issue before and know a solution, please help me. Thanks in advance.
== This happened
==
Every time Firefox opened
== Firefox version
==
3.6.6
== Operating system
==
Windows XP
== User Agent
==
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6
== Plugins installed
==
*-6.0.12.1739
*RealPlayer(tm) LiveConnect-Enabled Plug-In
*PDF-XChange Viewer Netscape Gecko Plugin
*Default Plug-in
*Shockwave Flash 8.0 r22
*Adobe Shockwave for Director Netscape plug-in, version 11.0
*3.0.40624.0
*Office Live Update v1.3
*Windows Presentation Foundation (WPF) plug-in for Mozilla browsers
*Next Generation Java Plug-in 1.6.0_18 for Mozilla browsers
*Npdsplay dll
*DRM Store Netscape Plugin
*DRM Netscape Network ObjectTry posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox.
[http://forums.mozillazine.org/viewforum.php?f=25]
You'll need to register and login to be able to post in that forum. -
How to create table with rows and columns in the layout mode?
One of my friends advised me to develop my whole site on the
layout mode as its better than the standard as he says
but I couldnot make an ordinary table with rows and columns
in th layout mode
is there any one who can tell me how to?
thanx alotYour friend is obviously not a reliable source of HTML
information.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"Mr.Ghost" <[email protected]> wrote in
message
news:f060vi$npp$[email protected]..
> One of my friends advised me to develop my whole site on
the layout mode
> as its
> better than the standard as he says
> but I couldnot make an ordinary table with rows and
columns in th layout
> mode
> is there any one who can tell me how to?
> thanx alot
>
Maybe you are looking for
-
Eclipse problem selection does not contain main type
i m using eclipse3.3 and have set all the necessary paths in it but when i run a simple java program just for displaying hello world but the error comes selection does not contain main type
-
How do I edit the Distinguished Name in Signature?
I cannot find from where the DN in a signature is sourced. My job title changed and even though I update that in Adobe's settings in my Profile, nothing changes in the DN.
-
Error : A cycle was detected in the classpath of project
Hi, When I build a scheduler program, I get the below error A cycle was detected in the classpath of project: Error A cycle was detected in the classpath of project: EPD_APMDM_Dkmsted.com EPD_APMDM_Dkmsted.com Error A cycle was detected in the classp
-
i want ant to find an AirPlay receiver to connect to an old amplifier/receiver/speakers system and then push music to from iPad. Any suggestions?
-
Is it possible for my Mac to warn me when someone connects to me either via the network or my remote connection? I have to be on a Network but recently have been plagued by colleagues happily watching me with the new share screen setting in leopard o