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

Reading Text File from selection Screen and populating table (Urgent)

Hi All,

I have some requirment like i in my report i have to initial my Input feild from text file is it good to populate a internal table or range.

I have three feild in a excel file that entry can more then 500

data example

Matnr Date Day

A1 10.07.2007 12

B1 10.07.2007 10

A1 19.07.2007 15

C1 20.08.2007 30

E1 11.09.2007 12

This report for Price Protection claim.

even u can help me out with proper table plz this is urgent.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 12, 2007 at 10:22 AM

    Hi..

    <b>parameters:</b>

    p_file(50) type c.

    <b>data:</b>

    begin of itab occurs 0,

    matnr type vbak-matnr,

    date type sy-datum,

    day(2) type n,

    end of itab.

    <b>at selection-screen on value-request for p_fname.</b>

    perform get_path.

    <b>start-of-selection.</b>

    <b>CALL FUNCTION 'GUI_UPLOAD'</b>

    <b>EXPORTING

    FILENAME = p_fname

    FILETYPE = 'ASC'

    HAS_FIELD_SEPARATOR = 'X'</b>

    • HEADER_LENGTH = 0

    • READ_BY_LINE = 'X'

    • DAT_MODE = ' '

    • CODEPAGE = ' '

    • IGNORE_CERR = ABAP_TRUE

    • REPLACEMENT = '#'

    • CHECK_BOM = ' '

    • VIRUS_SCAN_PROFILE =

    • IMPORTING

    • FILELENGTH =

    • HEADER =

    <b> TABLES

    DATA_TAB = itab</b>

    • EXCEPTIONS

    • FILE_OPEN_ERROR = 1

    • FILE_READ_ERROR = 2

    • NO_BATCH = 3

    • GUI_REFUSE_FILETRANSFER = 4

    • INVALID_TYPE = 5

    • NO_AUTHORITY = 6

    • UNKNOWN_ERROR = 7

    • BAD_DATA_FORMAT = 8

    • HEADER_NOT_ALLOWED = 9

    • SEPARATOR_NOT_ALLOWED = 10

    • HEADER_TOO_LONG = 11

    • UNKNOWN_DP_ERROR = 12

    • ACCESS_DENIED = 13

    • DP_OUT_OF_MEMORY = 14

    • DISK_FULL = 15

    • DP_TIMEOUT = 16

    • OTHERS = 17

    .

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    &----


    • This Sub routine is used to get the file name

    ----


    *There are no interface parameters passed to this subroutine.

    ----


    FORM get_path .

    CALL FUNCTION 'WS_FILENAME_GET'

    EXPORTING

    DEF_FILENAME = P_FNAME

    • DEF_PATH = ' '

    • MASK = ' '

    • MODE = ' '

    • TITLE = ' '

    IMPORTING

    FILENAME = P_FNAME

    • RC =

    EXCEPTIONS

    INV_WINSYS = 1

    NO_BATCH = 2

    SELECTION_CANCEL = 3

    SELECTION_ERROR = 4

    OTHERS = 5

    .

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ENDFORM. " get_path

    data:

    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.