‎2007 Jun 26 11:11 AM
hi experts,
I have a selection-screen which uploads an excel file, when i uploads an excel file i want to display no. of rows. That no. of rows should be displayed in the paramter field when i press a push button on the same selection screen.
1. Paramete type for excel upload.
2. Parameter type to get the no. of records in excel file (number of rows in that file).
3. one push button to display the no. of records in excel file.
‎2007 Jun 26 1:28 PM
‎2007 Jun 26 11:14 AM
Hi
Using the excel file first upload the records into an Internal table
In PF status keep a Button on Application tool bar
then at user-command
when button is pressed just count the no of lines in internal table using DESCRIBE statement and display the no of lines/records
Reward points for useful Answers
Regards
Anji
‎2007 Jun 26 11:32 AM
Hi,
Check out the following code.
DATA:v_dt(2),filename TYPE string,
i_temp TYPE truxs_t_text_data.
DATA:BEGIN OF it_eket OCCURS 0,
ebeln LIKE eket-ebeln,
ebelp LIKE eket-ebelp,
menge LIKE eket-menge,
ameng LIKE eket-ameng,
END OF it_eket.
PARAMETERS: p_path TYPE rlgrap-filename.
SELECTION-SCREEN : PUSHBUTTON /2(10) pb_but1 USER-COMMAND get.
PARAMETERS:p_no TYPE i.
INITIALIZATION.
pb_but1 = 'GET'.
AT SELECTION-SCREEN.
IF sy-ucomm = 'GET'.
filename = p_path.
IF filename IS NOT INITIAL .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = filename
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = i_temp.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
i_tab_raw_data = i_temp
i_filename = p_path
TABLES
i_tab_converted_data = it_eket
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
DESCRIBE TABLE it_eket.
p_no = sy-tfill.
ENDIF.
ENDIF.
*************Search help for the Path to download
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = sy-cprog
dynpro_number = sy-dynnr
FIELD_NAME = ' '
IMPORTING
file_name = p_path .
‎2007 Jun 26 1:28 PM
‎2007 Jun 26 2:48 PM
Hi sathu,
That is just an example.You can use any FM to upload according to your requirement.This FM "TEXT_CONVERT_XLS_TO_SAP" can also be used to upload an Excel file.I recommend this FM because it is easier than "ALSM_EXCEL_TO_INTERNAL_TABLE" FM.