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: 

without selection screen how can we featch the file.

Former Member
0 Kudos

Hi all,

without selection screen(parameter,select-options iam not using these both.) how can we featch the flat file what ever it may be (file format is xls.textor any thing) how ot do...plz it's urgent for me.

Regards,

Krishna,

4 REPLIES 4

Former Member
0 Kudos

Hello,

If u r not getting the file name from sel scr then u need to hardcode the filename with path in the report

Regards,

Vasanth

Former Member
0 Kudos

just hard code it in the program

<b>Filename = 'D:\Documents and Settings\501030562\Desktop\Test.txt'.</b>

Former Member
0 Kudos

Hi you need to hard code it and use it in your func mod, gui_upload.

data: myfile type string value 'C:\file123.TXT'.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = myfile

  • FILETYPE = 'ASC'

  • HAS_FIELD_SEPARATOR = ' '

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

tables

data_tab =

  • 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.

Hope this would be helpful for your information.

Regards,

Varun.

0 Kudos

Hi varun,

this is my sample code.here we are geting selection screen.without selection screen hoe to get file from out internal table.

plz gothrough this code and replay to me varun.

tables:pa0002.

type-pools:truxs.

*data:W_TRUXS_T_TEXT_DATA TYPE TRUXS_T_TEXT_DATA ,

  • it_p0001 type standard table of pa0001.

*

TYPES: BEGIN OF it_p0002,

pernr like pa0002-pernr,

nachn like pa0002-nachn,

vorna like pa0002-vorna,

end of it_p0002.

DATA: t_p0002 type standard table of it_p0002,

wa_p0002 type It_p0002.

DATA: it_raw TYPE truxs_t_text_data.

SELECTION-SCREEN BEGIN OF BLOCK S_BLK WITH FRAME TITLE TEXT-000.

parameters: P_EXCEL TYPE RLGRAP-FILENAME.

SELECTION-SCREEN end OF BLOCK S_BLK.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_EXCEL.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = 'P_EXCEL'

IMPORTING

FILE_NAME = P_EXCEL .

*

START-OF-SELECTION.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

  • I_FIELD_SEPERATOR =

I_LINE_HEADER = 'X'

I_TAB_RAW_DATA = it_raw

I_FILENAME = p_excel

TABLES

I_TAB_CONVERTED_DATA = t_p0002[]

EXCEPTIONS

CONVERSION_FAILED = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

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

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

ENDIF.

end-of-selection.

loop at t_p0002 into wa_p0002.

write:/ wa_p0002-pernr,

wa_p0002-nachn,

wa_p0002-vorna.

endloop.