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

upload excel from presentation,application server to internaltable

Former Member
0 Likes
1,363

Hi,

I want to upload excel file from presentation server and application server to internaltable.

for Presentation server i used fm like 'ALSM_EXCEL_TO_INTERNAL_TABLE'.

How can i read the Excel data from application server to internal table.

please provide me sample code.

Regards,

Suresh.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,058

Use FM RSPO_READ_DATASET

Hope it helps,

Raj

Hi,

I want to upload excel file from presentation server and application server to internaltable.

for Presentation server i used fm like 'ALSM_EXCEL_TO_INTERNAL_TABLE'.

How can i read the Excel data from application server to internal table.

please provide me sample code.

Regards,

Suresh.

7 REPLIES 7
Read only

Former Member
0 Likes
1,059

Use FM RSPO_READ_DATASET

Hope it helps,

Raj

Read only

Former Member
0 Likes
1,058

You could use OPEN DATASET, READ DATASET for reading file from your app server.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
1,058

Hi Suresh,

Use this demo:-



DATA: BEGIN OF it_final OCCURS 0,
        matnr(10) TYPE c,
        werks(10) TYPE c,
        usage(10) TYPE c,
        data(08) TYPE c,
      END OF it_final.
 
DATA wa_final LIKE LINE OF it_final.
DATA: v_excel_string(2000) TYPE c,
      v_file LIKE v_excel_string VALUE
      'D:\TEST1.CSV',
      delimiter TYPE c VALUE ' '.
 
 
OPEN DATASET v_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
  "error message
ELSE.
  WHILE ( sy-subrc EQ 0 ).
    READ DATASET v_file INTO wa_final.
    IF NOT wa_final IS INITIAL.
      APPEND wa_final TO it_final.
    ENDIF.
    CLEAR wa_final.
  ENDWHILE.
ENDIF.
CLOSE DATASET v_file.
 
LOOP AT IT_FINAL into WA_FINAL.
  WRITE:/ WA_FINAL-MATNR, WA_FINAL-WERKS, WA_FINAL-USAGE,  WA_FINAL-DATA.
ENDLOOP.

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir

Read only

Former Member
0 Likes
1,058

Please search first in SCN. There are many threads posted for the same requirement.

Below link is one of those.

.

Regards,

Shailaja

Read only

Former Member
0 Likes
1,058

hi,

try this code

OPEN DATASET v_file FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.

WHILE sy-subrc = 0.

READ DATASET v_file INTO lt_data.

SPLIT l_data AT tab INTO: wa_data-doc_date

wa_data-doc_type

wa_data-co_code

wa_data-cost_cen

wa_data-debit_gl

wa_data-desc1

wa_data-deb_amt

wa_data-cre_gl

wa_data-desc2

wa_data-cre_amt

wa_data-curr.

IF NOT wa_data IS INITIAL.

APPEND wa_data TO it_data.

CLEAR wa_data.

ENDIF.

endwhile.

CLOSE DATASET v_file.

thanks

Read only

Former Member
0 Likes
1,058

Hi ,

The file formats in the application servers is mainly in Text and Binary modes.

Use the Open Data seta and the resepctive mode( binary/text mode) in the syntax and then using Read Data set commands you can transfer the data to the internal tables.Then You can finally use a close Data set command to close the file.

Regards,

Radhika

Read only

Former Member
0 Likes
1,058

you can't upload Xl data from applications server..........

lot of experts are telling this ,, still this q is posting on SCN?