Skip to Content
author's profile photo Former Member
Former Member

Spliting the file

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 09:46 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 09:54 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.