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

BDC File from application server

Former Member
0 Likes
968

Hi experts,

I am working on a BDC programme for uploading master data into SAP.

I have generated an ABAP programme from the transaction recording in SHDB and I have used Function GUI_UPLOAD to upload a file from the Local PC and it worked fine.

But now my file is in application server, how to load that data into my internal table and generate the BDC session?

I know that we need to use open dataset, read dataset, transfer dataset ..... but can anyone provide me the sample code for uploading file from application server.

I will appreciate your help by rewarding points.........

Thank you,

Mili.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
795

You can use this FM <b>RZL_READ_FILE_LOCAL</b>

You need to pass the Directory and the file name and the FM will pass you an Internal Table with all the file information -;)

Works almost like using GUI_UPLOAD but with the app server -:)

Greetings,

Blag.

5 REPLIES 5
Read only

Former Member
0 Likes
796

You can use this FM <b>RZL_READ_FILE_LOCAL</b>

You need to pass the Directory and the file name and the FM will pass you an Internal Table with all the file information -;)

Works almost like using GUI_UPLOAD but with the app server -:)

Greetings,

Blag.

Read only

Former Member
0 Likes
795

To read file from applciation server, you need to use :

READ DATASET <dsn> INTO <f> [LENGTH <len>].

Check this example :

http://help.sap.com/saphelp_webas620/helpdata/en/fc/eb3d42358411d1829f0000e829fbfe/content.htm

Thanks,

SKJ

Read only

ferry_lianto
Active Contributor
Read only

0 Likes
795

Hi Ferry,SKJ and Alvaro,

Thank you all for the valuable input.

I have rewarded points.........

Thank you,

Mili.

Read only

Former Member
0 Likes
795

PARAMETER P_LFILE LIKE FILENAME-FILEINTERN.

to get actual file name from logical file.

data : FILE_NAME LIKE RLGRAP-FILENAME.

CALL FUNCTION 'FILE_GET_NAME'

EXPORTING

LOGICAL_FILENAME = P_LFILE

IMPORTING

FILE_NAME = FILE_NAME

EXCEPTIONS

FILE_NOT_FOUND = 1

OTHERS = 2.

OPEN DATASET P_FILENAME FOR INPUT IN TEXT MODE.

DO.

READ DATASET P_FILENAME INTO WA_FLINE.

enddo.

this is not full code..just the important steps..