Application Development 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: 

Problem in transferring file(presentation server) contents to internl table

Former Member
0 Kudos

Hi Experts,

My requirement is to upload a file from presentation server and get the contents into an internal table then I need to update bespoke table based on the values of the internal table. I tried using both funtion module : WS_UPLOAD and GUI_UPLOAD but the data is not getting populated properly to the correct fields of the internal table.

Hence Could you please tell me the pre requisites which needs to be done before uploading the file.I mean the format of the file and the parameters to be passed to the funtion module.

I am also confused with the file extension( i.e of the input file name . Eg. Demo.txt ) with the Filetype ( DAT / BIN/ ASC ) option provided in the funtion modules for upload.

Thanks in advance.

Regards,

Srinivas

1 ACCEPTED SOLUTION

Former Member
0 Kudos

if you are uploading from excel sheet to internal table

from flat file

Please search forum ewith GUI_UPLOAD for further info.

Regards

Satish Boguda

7 REPLIES 7

Former Member
0 Kudos

What type of file is being uploaded? Is it an EXcel file?

Rob

Former Member
0 Kudos

if you are uploading from excel sheet to internal table

from flat file

Please search forum ewith GUI_UPLOAD for further info.

Regards

Satish Boguda

0 Kudos

Satish Boguda - the threads you mentioned are rather old. A better way to upload Excel files is to use FM ALSM_EXCEL_TO_INTERNAL_TABLE

Rob

0 Kudos

Refer to the program :FILA_HELP_UPLOAD_EXCEL_01/03 if it is excel, otherwise revert back with file format details. based on that I can provide the details or may be a sample code .

thks .

S

Former Member
0 Kudos

if it is .txt file follow below steps

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = gv_file

filetype = 'ASC'

TABLES

data_tab = gt_text_file

for this your text file should be

1234|field2| field3|.....

here field seperator is pipe symbol(|)

your internal table must be same as your text file

then use SPLIT command and append your internal table..

LOOP AT gt_text_file INTO wa_text_file.

CLEAR wa_text_table.

SPLIT wa_text_file-line AT gc_pipe INTO wa_text_table-objectid

wa_text_table-lifnr

.......

Append internal table...

endloop.

Former Member
0 Kudos

Try using this:


PARAMETERS: P_FILE  LIKE RLGRAP-FILENAME OBLIGATORY.
DATA:  T_INTERN TYPE STANDARD TABLE OF ALSMEX_TABLINE.

    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
         EXPORTING
              FILENAME                = P_FILE                 
              I_BEGIN_COL             = LC_BEGIN_COL    " Begin Column in Excel File   
              I_BEGIN_ROW             = LC_BEGIN_ROW  " Begin Row in Excel File  
              I_END_COL               = LC_END_COL     " End Column in Excel File
              I_END_ROW               = LC_END_ROW    " End Row in Excel File
         TABLES
              INTERN                  = T_INTERN
         EXCEPTIONS
              INCONSISTENT_PARAMETERS = 1
              UPLOAD_OLE              = 2
              OTHERS                  = 3.

    IF SY-SUBRC NE 0 OR T_INTERN[] IS INITIAL.
      STOP.
    ENDIF.

Cheers,

Pritam

Former Member
0 Kudos

Hi ,

My issue is resolved.I have used the funtion module : WS_UPLOAD and I have used the .Txt file which is of Tab delimited format.then its uploading the data's properly into the Internal table.

Thanks

Srinivas