To convert the row of an internal table into columns
Hi ,
I want to use the rows of a single column internal table itab1
to form another internal table itab2 with column names same as the rows of itab1 .
How is this possible?
Regards,
Harshit Rungta
Hi,
Check the link..[Convert Rows of internal table to Columns|http://docs.google.com/Doc?id=dfv2hmgs_5d6bcxqgp&hl=en]
Similar Messages
-
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 -
Wirte the content of an internal table into a text file
Hello Experts,
how can I wirte the content of an internal table into a text file and putit on my local
desktop ?
Regards
ertasHi,
You can use the FM GUI_DOWNLOAD for this purpose.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'c:\testmmv.txt'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE
SHOW_TRANSFER_STATUS = ABAP_TRUE
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = LT_STR
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
Implement suitable error handling here
ENDIF.
With regards,
Vamsi -
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 -
Moving the data from multiple internal tables into a single one
Hello everyone,
I am creating a classical report which uses the following tables.
tables : ekko, ekpo, mara, makt,lfa1.
my input parameter is
Select-options Purchase Order number
Following fields are getting used.
Doc no EKKO-EBELN
Material EKPO-MATNR
Item number EKPO-EBELP
Quantity EKPO-MENGE
Material Group MARA-MATKL
Vendor EKKO-LIFNR
Old Material code MARA-BISMT
Material Desc. MAKT-MAKTX
Vendor name LFA1-NAME1
Now i need to do the following task.
1 Select record from EKKO Using document number.
2 Select record from EKPO using EKKO record using Document no as key.
3 Find out Old Material code of each and every material from Material master.
4 Find out Material description for each and every material from MAKT.
5 Sort record on Vendor, Purchase Order number and Material.
I have defined seperate internal tables for these operation.
Once i have fetched records into these individual internal tables from the corresponding DB tables i need to move these values into a new internal tables which has all the above fields mentioned
I need to move these values into a new internal table because to display the values on the report.
Any idea for the above ? Plz help with a sample example or some relevant.
Regards,
Ranjith NambiarHi
1 Select record from EKKO Using document number.
2 Select record from EKPO using EKKO record using Document no as key.
Use inner join and retrive data into one internal table.for Ex ITAB1
3 Find out Old Material code of each and every material from Material master.
Use ITAB1 with for allentries in MARA table to get the onl materil number populate in to one table.
4 Find out Material description for each and every material from MAKT.
Get the Material desc with the same manner as above,
5 Sort record on Vendor, Purchase Order number and Material.
now sort the ITAB1 as you req.
now Loop on the ITAB1.
and read above 2 tables for old matnr and matner deac and append into another table as you want.
Hope this will help.
Regards,
Hiren Patel -
How to read the data from an internal table,when column names are known
Hi All
I have a specific requirement. I got an internal table with many fields (let it be my_tab). Some of the fieldnames (column names in internal table my_tab) are stored in separate internal table(let it be my_fields).
I need to store/read data corresponding to the fields (whose name is stored in my_fields) from my_tab.
I am able to build dynamic table (referred by field-symbol) with respect to the given field names in my_fields.
But i am unable to read the data corresponding to the fieldnames from my_tab.
Please provide me some pointer in this regard.
Regards
Swetabh ShuklaHI All
Thanks for the prompt response. I got solution for my question. Please check below thread. For quick reponse i posted my question in one more category. Thanks to all of you.
How to read internal table w.r.t. fieldnames stored in other table -
SWAP COLUMNS AND ROW IN AN INTERNAL TABLE to display in ALV
Hi ,
I want to swap all the rows in an internal table with the column of the internal table to display it horizontally in ALV grid.
e.g
1 2 3 (field names)
A P X
B Q Y
C R Z
should look like :
D A B C
E P Q R
F X Y Z
Where D , E, F in first column is already apended in new table.
Or else is there a way to rotate the ALV grid so that it can display rows as columns & columns as rows.
regardshi,
i have an internal table which is like
f1 f2 f3 f4 (column header)
A 1 2 3
B 4 5 6
C 7 8 9
the values in o/p table should be
A B C ( column header)
1 4 7
2 5 8
3 6 9
Please help!! -
Can we get the data from two internal tables in ALV.
hi friends i would like to display the data using two internal tables using alv grid.please guide me.
Hi,
ALV would be having a specific layout say :
MATNR
MAKTX
QTY
Now, if you have two internal tables, then do they have a different structure. If they have different structures, then what kind of ALV layout you expect. The ALV output should be as per the structure of 1st or 2nd internal table.
If both internal table have same layout, then populate the data from 2nd internal table into 1st internal table and pass the 1st internal table ( it will have data of both internal tables) to ALV.
Best regards,
Prashant -
How to download values in an internal table into an excel file
is there any fn module to download the values in an internal table into an excel file..
hi
the function module "GUI_DOWNLOAD" downloads the data from
an internal table into a file (can be xl, dat ,doc etc) .
Plz follow the usage below ;
Parameters : pa_pfile LIKE rlgrap-filename OBLIGATORY.
Data : lv_filename TYPE STRING.
lv_filename = pa_pfile.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = lv_filename
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = tb_download " table data to b downlaoded
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards
Pankaj -
Merging of multiple rows in an internal table as a single record
Hi All,
I have an internal table which has the following columns:
text, date, time, user.
it stores notes in the internal table.
The problem is...when I save a note with multiple lines and spaces it saves each line of the note as a row in the internal table.
Thus i get more no. of rows in the internal table compare to the no. of rows!
I need to store each notes as single row in the internal table.
Please advise how to approach this?
Helpful answers will be rewarded.
Thanks & Regards,
Anshumita.You can create a deep internal table. You can declare one Column as an internal table and store the NOTES in that Internal table for each row.
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm
you can check the example in the link
regards,
abhishek -
No. of Rows in an internal table
Dear Friends,
Please let me know which ABAP System Field shall give me the no. of rows in an internal table. If it is sy-dbcnt kindly provide an example on how to use it in a program.
Regards,
Alok.Hi Alok,
Use the Describe Statement.
Sample Program :
*TABLES ZVIJIRANK.
*DATA : BEGIN OF IT OCCURS 10.
*INCLUDE STRUCTURE zvijirank.
*DATA : END OF IT.
*data : lines1(4) type n,
knd type c,
n type i.
*select * from zvijirank into table it.
**describe table zvijirank lines lines1. -
> Describe statement is only used for Internal Tables.....
*write : / 'BEFORE DESENDING'.
*LOOP AT IT.
*WRITE : / IT-REG_NO , IT-NAME.
*ENDLOOP.
*ULINE.
*describe table it lines lines1. "-----> To find No Of lines
Write : lines1.
Thanks.
Message was edited by:
Viji -
FM to upload the Excel file to internal table
Hi
Is any FM available to upload the Excel file to internal table.
Thanks
AnbuHi
se this code
EXCEL to INTERNAL TABLE and then to APPLICATION SERVER
*& Report ZSD_EXCEL_INT_APP
REPORT ZSD_EXCEL_INT_APP.
parameter: file_nm type localfile.
types : begin of it_tab1,
f1(20),
f2(40),
f3(20),
end of it_tab1.
data : it_tab type table of ALSMEX_TABLINE with header line,
file type rlgrap-filename.
data : it_tab2 type it_tab1 occurs 1,
wa_tab2 type it_tab1,
w_message(100) TYPE c.
at selection-screen on value-request for file_nm.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = 'X'
MASK = ' '
CHANGING
file_name = file_nm
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
start-of-selection.
refresh it_tab2[].clear wa_tab2.
file = file_nm.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '10'
i_end_row = '35'
tables
intern = it_tab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 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.
loop at it_tab.
case it_tab-col.
when '002'.
wa_tab2-f1 = it_tab-value.
when '004'.
wa_tab2-f2 = it_tab-value.
when '008'.
wa_tab2-f3 = it_tab-value.
endcase.
at end of row.
append wa_tab2 to it_tab2.
clear wa_tab2.
endat.
endloop.
data : p_file TYPE rlgrap-filename value 'TEST3.txt'.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
*--- Display error messages if any.
IF sy-subrc NE 0.
MESSAGE e001(zsd_mes).
EXIT.
ELSE.
*---Data is downloaded to the application server file path
LOOP AT it_tab2 INTO wa_tab2.
TRANSFER wa_tab2 TO p_file.
ENDLOOP.
ENDIF.
*--Close the Application server file (Mandatory).
CLOSE DATASET p_file.
loop at it_tab2 into wa_tab2.
write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
endloop. -
Req : to capture the filter data in internal table from ALV
hi friends..
i have an requirement, plz guide me to solve this..
let consider in alv grid i m displaying 10 data(10 rows)
by using filter let assume now i m getting 5 rows (from the 10 rows).
i want to capture these 5 rows in an internal table..
plz giude me to resolve this..
thanks in advance
by
selvaHi
u can think to do this programatically.
1 add one button on alv tool bar say capture.
2. filetr the requiredd rows .
3. seelct all filterd rows.
4. say capture.
5.At user command write a code to get the selcted alv rows
in different internal table.
6 you can use FM get_selected_rows for this purpose. -
Why is the Rows Fixed in a Table in Smartforms?
Hi,
I am new to smartforms. This one particular Smartform has a Table defined in the Main Window. In the Data Tab of the Table under the Loop heading an internal table is used to pass information to the Table. There is no Loop defined. Only the Table is defined in the Main Window. The funny part is when the SamrtForm is run 15 rows get displayed. The program that populates the SmartForm always sends 15 rows to the SmartForm. I tried to send the actual number of rows, then nothing gets displayed in the SmartForm. It seems that some where in the SmartForm the 15 rows is doing some spooky things. How to solve this?
Thanks,
KishanKishan,
The TABLE node in SmartForms automatically loops through the table specified inthe "Data" tab. The data passed through the TABLES paramater are defined with reference to Table Types. They have no header line. So in the "Data" tab, you must also define a work area for the TABLE node to loop into.
That is why in the "Data" tab, you see in the Loop section, a INTO (or ASSIGNING) operand. You need to pass the record into a work area. When you are displaying the data, just like in a normal ABAP program, you use the work area.
Not sure what you mean by "I tried to send the actual number of rows, then nothing gets displayed in the SmartForm".
Hope this helps.
Cheers,
Pat. -
The work area (or internal table) "IT_ZLE_LAGERPLANUNG" is not flat,
***Data declaration
TYPES : BEGIN OF t_zle_lagerplanung,
SEl, "stores which row user has selected
kdauf TYPE zle_lagerplanung-kdauf,
kdpos TYPE zle_lagerplanung-kdpos,
etenr TYPE zle_lagerplanung-etenr,
papiermaschine TYPE zle_lagerplanung-papiermaschine,
runnr TYPE zle_lagerplanung-runnr,
prio TYPE zle_lagerplanung-prio,
werk TYPE zle_lagerplanung-werk,
durchmesser TYPE zle_lagerplanung-durchmesser,
breite TYPE zle_lagerplanung-breite,
anzle TYPE zle_lagerplanung-anzle,
occupied TYPE zle_lagerplanung-text30,
free TYPE zle_lagerplanung-text30,
lgpla TYPE zle_lagerplanung-lgpla,
lgtyp TYPE zle_lagerplanung-lgtyp,
art TYPE zle_lagerplanung-art,
anzhoehe TYPE zle_lagerplanung-anzle,
zindicator TYPE zle_lagerplanung-text30,
fa TYPE zle_lagerplanung-fa,
field_style TYPE lvc_t_styl, "FOR DISABLE
END OF t_zle_lagerplanung.
I am getting the data in internal table by using thiis select statement.
SELECT kdauf kdpos etenr papiermaschine runnr prio werk durchmesser breite
anzle lgpla lgtyp art anzhoehe fa
FROM zle_lagerplanung INTO CORRESPONDING FIELDS OF TABLE it_zle_lagerplanung
WHERE kdauf IN s_kdauf
" AND kdpos = p_kdpos
AND KDPOS IN s_kdpos
AND werk = p_werks.
But while updating the particular field in ztable using this statement
UPDATE zle_lagerplanung from table it_zle_lagerplanung.
it is giving syntax error
"The work area (or internal table) "IT_ZLE_LAGERPLANUNG" is not flat, or
contains reference or internal tables as components. components.
components. components. components."
Could any one help me out how to resolve this problem....
Thanks in advanceHi Shyamal,
lvc_s_styl is a structure so you will get the same error.
for your select and update statement you dont need field "field_style".
regards
rea
Maybe you are looking for
-
An corrupted EFTFile1.sparseimage has appeared on my iMac but cannot deleted
Hello guys! I need real hands-on practical help here, please. I have already asked for help in here but didn't manage to get clear step by step help. Only got confusing redirection to other posts and very technical advice which really confuses me. Fi
-
Write "Unknown error." Log in App Store from MacBook.
I cannot enter into AppStore only from MacBook, username and password is introduced correctly. Please, help me(
-
Error in deploying Webdynpro DC.
Hi All I have created a Webdynpro DC which consumes Webservice using adaptive webservices model,also it uses KM apis for km document updation.I have created a separate library DC for KM jars. The issue is when i am deploying WDJ DC then i get an Depl
-
HT1668 I have mine set to show 1000 recent messages but they are deleting after 25
I have my mail messages set to show the last 1000 messages but they are purging after the last 25 messages
-
HT3275 Airport Time Capsule - Password Retrieval
I have an Airport Time Capsule. When I went to add another computer it to be backed up, I couldn't remember the passcode I used in initially setting up the Time Capsule. How does one retrieve it?