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 Text File from selection Screen and populating table (Urgent)

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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:

1 REPLY 1

Former Member
0 Kudos

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: