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: 

Reading a file from unix server and save it into custom table.

Former Member
0 Kudos

Hi,

I have a custom table z_test which consits of fields date SY-DATUM, qty QUAN, desc CHAR(2). I need to read a flat file in unix server delimited by tab and store into this table.

I have designed the selection screen and also the code.Snapshot is as follows

Snapshot

-


TYPES : begin of ty_demand.

TYPES : INCLUDE STRUCTURE Z_TEST.

TYPES : end of ty_demand.

DATA : t_demand TYPE STANDARD TABLE OF ty_demand,

wa_demand TYPE ty_demand.

CALL ws_upload

:

tables

data_tab = t_demand

:

Loop at t_demand into wa_demand.

WRITE : / SY_VLINE,

(10) wa_demand-date,

(10) wa_demand-qty,

(10) wa_demand-desc.

APPEND wa_demand to t_demand.

CLEAR wa_demand.

ENDLOOP.

When printing doesnt show any values,and also its reading the contents into MANDT field of the table(which should be avoided, should i use another internal table instead of same structure of custom table. Please suggest.Any code will be welcome too. I shall reward with points.

Thanks- Shawn

3 REPLIES 3

Former Member
0 Kudos

Hi,

To read file from UNIX server we use command, READ DATASET and not WS_UPLOAD.

Here are the details for how to read file from application server -

Hope this helps.

ashish

Former Member
0 Kudos

Hi Shawn,

You should use different internal tables for reading the data and to upload the data in the DB table.

Regards,

Atish

0 Kudos

Hi,

Okay so you say i have to use open dataset,read dataset instead of ws_upload ? Can you provide some code or example codes available in SAP environment please. I definitely dont want to use a internal table with header line, so something without header line and work area. Thanks in advance