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: 

uploading data using 'GUI_UPLOAD' ....

Former Member
0 Kudos

Hi Experts,

i ve a problem i.e here am uploading a flat file but am not getting proper output,

could anyone see this peace of code.

DATA: BEGIN OF ITAB OCCURS 1,

BRANCH(1) TYPE C,

XRE_TTY(18) TYPE C,

ORIG_CURR(3) TYPE C,

COB(3) TYPE C,

TTY_TYPE(1) TYPE C,

END OF ITAB.

DATA: WA_ITAB LIKE ITAB.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\ACCUPLOAD\input'

FILETYPE = 'DAT'

HAS_FIELD_SEPARATOR = '|'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = ITAB

  • EXCEPTIONS .

IF SY-SUBRC <> 0.

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

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

ENDIF.

LOOP AT ITAB .

WRITE:/20 ITAB-BRANCH,

ITAB-XRE_TTY,

ITAB-ORIG_CURR,

ITAB-COB,

ITAB-TTY_TYPE.

ENDLOOP.

my input file is (here seperator is (pipe) | ).

S|S-FFF-P-96-0193-96|AED|FFF|P

S|S-FNM-P-96-0194-96|USD|FNM|P

S|S-EEB-P-92-0365-92|PKR|EEB|P

S|S-EEB-P-92-0365-93|PKR|EEB|P

S|S-EEB-P-92-0365-94|PKR|EEB|P

S|S-GGA-P-92-0006-96|PKR|GGA|P

but am getting output is only single char. like.

S

S

S

S

S

S

WHAT is the wrong here plz..

Thanks in advance..

sudharsan.

6 REPLIES 6

Former Member
0 Kudos

Hi Sudarshan,

Wrte the Loop statement as Lop at Itab into wa_itab.

write :wa_itab-branch,

wa_itab-xre_tty,

.......

and so on.

It will solve the problem.

In case you have any further clarifications,do let me know.

Regards,

Puneet Jhari.

0 Kudos

Hi puneet and ritika as u both of u told that is not the problem, i ve trid like that also, its giving same o/p, the problem the itab its self is getting only one char i.e S.

i think the problem is Field seperator, in my flat having pipe is the seperator,

so how to solve this..

regards,

sudharsan.

Former Member
0 Kudos

For HAS_FIELD_SEPERATOR you are passing '|".

See the documentation for this field -

Columns Separated by Tabs in Case of ASCII Upload

Description

Specifies if the fields in the file are separated by a tab. This is necessary if the structure passed contains several components. CR/LF occurs instead of a tab after the last field of a row.

Value range

'X': Fields are separated by tabs.

SPACE: Fields are not separated by tabs. In this case, the table must

contain either only one single column or all columns must be contained

in the file in their full length.

Default

SPACE

So check if you can use Tab as field separator and populate correct value to the function module parameter.

ashish

Former Member
0 Kudos

hi,

try using :

data: wa_record type itab.

loop at itab into wa_record.

write:/ sy-vline,

(10) wa_record-branch,

(20) wa_record-xre_tty,

(30) wa_record-cob.

endloop.

this might solve your problem.

Former Member
0 Kudos

GIVE SPACE IN THE HAS FIELD SEPERATOR......

I HAVE TRIED THIS AND I GOT THE OUTPUT

DATA: BEGIN OF ITAB OCCURS 1,

BRANCH(1) TYPE C,

XRE_TTY(18) TYPE C,

ORIG_CURR(3) TYPE C,

COB(3) TYPE C,

TTY_TYPE(1) TYPE C,

END OF ITAB.

DATA: WA_ITAB LIKE ITAB.

DATA: V_FILENAME TYPE STRING.

V_FILENAME = 'C:\ACCUPLOAD\input.TXT'.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = V_FILENAME

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = ' '

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

DAT_MODE = 'X'

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = ITAB.

  • EXCEPTIONS .

IF SY-SUBRC <> 0.

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

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

ENDIF.

LOOP AT ITAB .

WRITE:/20 ITAB-BRANCH,

ITAB-XRE_TTY,

ITAB-ORIG_CURR,

ITAB-COB,

ITAB-TTY_TYPE.

REWARD POINTS IF HELPFUL .......

0 Kudos

hi ramyav, thank u very much, u r right i got the solution.

Thank u verymuch.

i ve given gd rewards,

regards,

sudharsan.