Application Development and Automation 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: 
Read only

Problem in UPLOADING A FILE

Former Member
0 Likes
849

Hello Everybody

I want to upload a file but file structure can be dynamically change , so my problem is how to define ITAB structure according to file .

for uploading i am using Gui_upload

ASAP

Hello Everybody

I want to upload a file but file structure can be dynamically change , so my problem is how to define ITAB structure according to file .

for uploading i am using Gui_upload

ASAP

6 REPLIES 6
Read only

Former Member
0 Likes
831

Hi,

you can you a generic table, use this code:

data: ref TYPE REF TO data,

<table> TYPE table.

CREATE DATA ref TYPE STANDARD TABLE OF (table_name).

ASSIGN ref->* TO <table>.

Now the field-symbol <table> have the structure of the table that you want.

Use <table> in the FM GUI_UPLOAD.

regards,

Leo

Read only

0 Likes
831

Not working , infact it's pickuping only first field

i want completed data ( line ) of that file

Read only

Former Member
0 Likes
831

Hi,

Take the ITAB with one field of type STRING.

Begin of ITAB occurs 0,

field1 type string,

End of ITAB.

If STRING creates the problem take CHAR of maximum length.

Reward points if helpful.

Read only

Former Member
0 Likes
831

Define a table like this:


data:
i_tab type standard table of string initial size 0,  "Internal table, use this for GUI_UPLOAD
wa_tab type string.    " Work area for the table

Read only

Former Member
0 Likes
831

hi,

DATA : FILE_STR TYPE STRING.

PARAMETERS : P_FLNME LIKE RLGRAP-FILENAME. "File Name

FILE_STR = P_FLNME.

*UPLOADING FILE INTO INTERNAL TABLE

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = FILE_STR

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = ITAB

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.

try this ..all the records in the flat file to be moved to the internal table.

Thanks & regards,

Y.R.Prem Kumar

Read only

Former Member
0 Likes
831

thx everybody