2008 Sep 15 7:27 AM
I have an excel grid which looks like the following
DI D2 D3
O1 1 1 2
O2 1 1 1
O3 2 2 2
I need to get the crosssection of the D and the O Lines to give the following output in an internal table .
O1,D1,1
O1,D2,1
O1,D3,2
O2,D1,1
O2.D2,1
and so on .
Any suggestions on how to proceed with this .Also the D and the O cloums and rows can vary in number
Thanks in advance.
I have an excel grid which looks like the following
DI D2 D3
O1 1 1 2
O2 1 1 1
O3 2 2 2
I need to get the crosssection of the D and the O Lines to give the following output in an internal table .
O1,D1,1
O1,D2,1
O1,D3,2
O2,D1,1
O2.D2,1
and so on .
Any suggestions on how to proceed with this .Also the D and the O cloums and rows can vary in number
Thanks in advance.
2008 Sep 15 7:39 AM
Hi Anjali Panday,
Your question is not clear...
However an offer might be such a thing that you prepare your data through excel and create a clear structure there.
Later is easy, you can use ALSM_EXCEL_TO_INTERNAL_TABLE function...
Or create a .txt file from your excel file and then uploading your data into itab.
Hope helps.
deniz.
2008 Sep 15 7:47 AM
2008 Sep 15 7:51 AM
hi.
wat you mean by " you dont have access to ALSM_EXCEL_TO_INTERNAL_TABLE".
its a function module and you can call that FM from ur se38 editor.
revert back if ay issues.
Regards
Naveen
2008 Sep 15 7:53 AM
Hi,
You can use then
GUI_UPLOAD function.
But first save your excel file as tab delimeted text file(.txt) file
and use this file with this function.
deniz.
2008 Sep 15 8:10 AM
as i know if you want to upload you excel file........
you have to do two things....firstly you use ALSM_EXCEL_TO_INERNAL_TABLE function module then after you use field symbol to display file content in proper manner,....if you are not using concept of field symbols,your excel file will not display in proper row and column.
2008 Sep 15 8:17 AM
>
>if you are not using concept of field symbols,your excel file will not display in proper row and column.
Completely nonsence
2008 Sep 15 8:14 AM
Do you want this..
REPORT ztest_transpose.
DATA: BEGIN OF itab OCCURS 0,
col(2),
d1 TYPE n,
d2 TYPE n,
d3 TYPE n,
END OF itab.
DATA: BEGIN OF it_final OCCURS 0,
col(2),
col2(2),
d TYPE n,
END OF it_final.
itab-col = 'O1'.
itab-d1 = 1.
itab-d2 = 1.
itab-d3 = 2.
APPEND itab.
itab-col = 'O2'.
itab-d1 = 1.
itab-d2 = 1.
itab-d3 = 1.
APPEND itab.
itab-col = 'O3'.
itab-d1 = 2.
itab-d2 = 2.
itab-d3 = 2.
APPEND itab.
SORT itab BY col.
FIELD-SYMBOLS: <fs>.
DATA: ind TYPE n,
val(10).
LOOP AT itab.
it_final-col = itab-col.
ind = 1.
DO 3 TIMES.
CONCATENATE 'ITAB-D' ind INTO val.
ASSIGN (val) TO <fs>.
it_final-d = <fs>.
it_final-col2 = val+5(2).
APPEND it_final.
WRITE:/ it_final.
ind = ind + 1.
ENDDO.
ENDLOOP.
2008 Sep 15 8:22 AM
Hi,
My suggestion would be u save the excel content as .txt file
and use the FM - GUI_upload.
This will upload the data in ur internal table.
All the best.
Regards,
Mohammadi.
2008 Sep 15 10:13 AM
Hi,
Any ways there are also a couple of alternatives which use fucntion modules 'KCD_EXCEL_OLE_TO_INT_CONVERT'
and 'ALSM_EXCEL_TO_INTERNAL_TABLE' but the method below is the simplest method to used.
And these are all SAP standard function modules so you will have all of them.
plz check this example :
TYPE-POOLS: truxs.
PARAMETERS: p_file TYPE rlgrap-filename.
TYPES: BEGIN OF t_datatab,
col1(30) TYPE c,
col2(30) TYPE c,
col3(30) TYPE c,
END OF t_datatab.
DATA: it_datatab type standard table of t_datatab,
wa_datatab type t_datatab.
DATA: it_raw TYPE truxs_t_text_data.
* At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
***********************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw " WORK TABLE
i_filename = p_file
TABLES
i_tab_converted_data = it_datatab[] "ACTUAL DATA
EXCEPTIONS
conversion_failed = 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.
***********************************************************************
* END-OF-SELECTION.
END-OF-SELECTION.
LOOP AT it_datatab INTO wa_datatab.
WRITE:/ wa_datatab-col1,
wa_datatab-col2,
wa_datatab-col3.
ENDLOOP.thanx.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |