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: 

Upload excel file from application server using open dataset

Former Member
0 Kudos

Hi,

i am working on a upload program. Here we are passing data from excel sheet. I was using GUI_UPLOAD and its not working in the background. in my yesterday thread i got the reply to use OPEN DATASET and READ DATASET. I just need to confirm that do we have any other FM to achieve this functionality.

Please give me the piece of code if you are having for DATASET operation for excel file upload.

This is quite urgent. Need a quick reply.

Thanks a lot.

SAM.

1 REPLY 1

varma_narayana
Active Contributor
0 Kudos

Hii..

This is the Program code for Application Server files.

Data has to be in a Txt file.

REPORT YRP00_20 .

DATA : IT_CARR TYPE TABLE OF SCARR,

WA_CARR TYPE SCARR.

parameters : p_dsn(30) DEFAULT 'AIRLINE.TXT'. "Give the path on App server

DATA : V_TEXT(40).

START-OF-SELECTION.

**Writing data to file

OPEN DATASET P_DSN FOR OUTPUT

IN TEXT MODE ENCODING DEFAULT.

IF SY-SUBRC NE 0.

WRITE:/ 'FILE NOT OPENED' .

EXIT.

ELSE.

SELECT * FROM SCARR INTO TABLE IT_CARR.

LOOP AT IT_CARR INTO WA_CARR.

TRANSFER WA_CARR TO P_DSN.

ENDLOOP.

CLOSE DATASET P_DSN.

ENDIF.

***reading from file

OPEN DATASET P_DSN FOR INPUT

IN TEXT MODE ENCODING DEFAULT.

IF SY-SUBRC = 0.

DO.

READ DATASET P_DSN INTO WA_CARR.

IF SY-SUBRC NE 0.

EXIT.

ENDIF.

WRITE:/ WA_CARR-CARRID,

WA_CARR-CARRNAME.

ENDDO.

CLOSE DATASET P_DSN.

ENDIF.