Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

at user command

Former Member
0 Likes
608

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
580

but my function module is ALSM_EXCEL_TO_INTERNAL_TABLE

4 REPLIES 4
Read only

Former Member
0 Likes
580

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

Read only

former_member491305
Active Contributor
0 Likes
580

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 .

Read only

Former Member
0 Likes
581

but my function module is ALSM_EXCEL_TO_INTERNAL_TABLE

Read only

0 Likes
580

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.