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: 

Spliting the file

Former Member
0 Kudos

Hi Experts,

Iam getting one file as input i have to split the file based on the length of the fields.My input file format is

plant = char(4)

material = char(18)

ship_to = char(10)

amount = curr(11)dec(2)(KONP-kbetr)

unit = cuky(5)

qty_per = dec(5)

valid_from_date = dats(8)

valid_to_date = dats(8)

action_code = char(1)

can any one provide the code for this.

Thanks in advance

2 REPLIES 2

Former Member
0 Kudos

Hi,

you need to work with:

call function 'WS_UPLOAD'

EXPORTING

filename = pa_file

filetype = 'DAT'

TABLES

data_tab = it_record

EXCEPTIONS

conversion_error = 1

file_open_error = 2

file_read_error = 3

invalid_table_width = 4

invalid_type = 5

no_batch = 6

unknown_error = 7

gui_refuse_filetransfer = 8

others = 9.

it_record is your internal table with all fields and length.

regards

Nicole

Former Member
0 Kudos

Hi

If you mean that your file total length is 100 .

But you want data upto length 50 in one fiel/table and data from 51 to 100 in another table/file.

Use offsets to achieve this .

Foe eg :

Loop at <input file> INTO g_r_input .

workarea1 = g_r_input+0(50) .

append table1 .

workarea2 = g_r_input+51(100) .

append table2 .

CLEAR : workarea1 , workarea2 .

ENDLOOP .

If u need something else let us know .

Thanks.

Praveen